var manualPictures = new Array();
function NextImageSlide(pictureName, imageFiles)
{
	// Ensure picture list primed.
	if (manualPictures[pictureName] == null) {
		manualPictures[pictureName] = imageFiles;
	} else {
		imageFiles = manualPictures[pictureName];
	}
	var imageSeparator = imageFiles.indexOf(";");
	var nextImage = imageFiles.substring(0,imageSeparator);
	if (document.all)
	{
		document.getElementById(pictureName).style.filter=
			"blendTrans(duration=2)";
		document.getElementById(pictureName).filters.blendTrans.Apply();
	}
	document.getElementById(pictureName).src = nextImage;
	if (document.all)
	{
		document.getElementById(pictureName).filters.blendTrans.Play();
	}
	manualPictures[pictureName] = 
		imageFiles.substring(imageSeparator+1,imageFiles.length)
		+ ';' + nextImage;
}

function getValue(ComboBoxID)
{
	var objComboBox = dojo.widget.byId(ComboBoxID);
	return objComboBox.comboBoxSelectionValue.value;
}

function getSTR(ComboBoxID)
{
	var objComboBox = dojo.widget.byId(ComboBoxID);
	return objComboBox.textInputNode.value;
}

function CreateBookmarkLink(title) { 
	if (window.sidebar) { 
		// Mozilla Firefox Bookmark		
		alert(" CTRL+D להוספת הדף למועדפים  לחץ ");
 
	} else if( window.external ) { 
		// IE Favorite		
		window.external.AddFavorite(location.href, title); 
	}	
	else if(window.opera && window.print) { 
	// Opera Hotlist		
	return true; } 
}

// help PopUp script

function launchEditor(url) {
	window.open(url, "", 'width=420,height=480,top=100,left=80,directories=no,status=no,scrollbars=no,resize=no,menubar=no');
}

// Begin - onEnter click, create a ButtonClick   
var isIE;
if (navigator.appName == "Microsoft Internet Explorer"){isIE = true;}

function CallisEnter()
{ 
	//Capture Netscape events 
	if(!isIE)
	{
		document.captureEvents (Event.KEYDOWN);
	}
	document.onkeydown = isEnter
}

function isEnter(evt)
{
	var theButtonPressed;
	if (isIE)
	{
		theButtonPressed = window.event.keyCode;
	}
	else
	{
		theButtonPressed = evt.which;
	}
	if (theButtonPressed == 13)
	{
		if(isIE)
		{
			with(event)
			{
				cancelBubble = true;
				returnValue = false;
			}
		}
		
		//document.getElementById("btnRegister").click();
        login_form();
	}
}

function remove_reply_form (td_id) {
	var td = document.getElementById(td_id);
	td.innerHTML = "";
}

function show_reply_form (td_id, reply_to_id) {
	var td = document.getElementById(td_id);
	var reply_form = "<form method='post' action='/Section/46001.asp?op=my_messages'>";
	reply_form = reply_form + "<textarea name='msg_txt' style='width: 450px; height: 100px;'></textarea>";
	reply_form = reply_form + "<input type='hidden' name='reply_to_id' value='" + reply_to_id + "'/><br>";
	reply_form = reply_form + "<input type='submit' value='שלח' class='inputShort70' style='margin: 0 0 0 10px;' />";
	reply_form = reply_form + "<a onclick='remove_reply_form("+td_id+")' class='hand'>בטל</a>";
	reply_form = reply_form + "</form>";
	td.innerHTML = reply_form;
}

function login_form() {
	if (document.loginForm.username.value == "" || document.loginForm.password.value == "") {
		alert("אנא מלאו שם משתמש וסיסמא");
	} else {
		document.loginForm.submit()	
	}
}	

function OpenPopUp(URL, ImageType)
{
	URL = URL.substring(0, URL.indexOf(".")) + "." + ImageType;
	URL = "/big_pic.asp?pat=" + URL

	if (document.all)
		var xMax = screen.width, yMax = screen.height;
	else
		if (document.layers)
			var xMax = window.outerWidth, yMax = window.outerHeight;
		else
			var xMax = 520, yMax=590;
	var xOffset = (xMax - 520)/2, yOffset = (yMax - 590)/2;
	win = window.open(URL, 'PopUp', 'width=520, height=590, screenX='+xOffset+', screenY='+yOffset+', top='+yOffset+', left='+xOffset+'');
}

// for recipe and article talkbacks...
function ShowTBForm(component_id, is_logged, talker_name, component_type) {
	var explain_text = component_type == 'Review' ? "<span class='errors'>שים לב: אתה כותב תגובה לתגובה על המתכון ולא למתכון עצמו.</span><br>אם ברצונך להגיב למתכון עצמו אנא הוסף תגובה דרך הקישור המודגש והממוסגר בהמשך הדף. " : "" ;
	var tb_form = is_logged == "true" ? explain_text + "<span id='opform'><form method='post' name='opinion" + component_id + "' action='?op=addTalkback'><input type='hidden' name='component_id' value=''><input type='hidden' name='user_id' value='" + talker_name + "'><table width='420' border=0 style='font-size:11px;'><tr align='right'><!--<td><label for='name'>שם</label></td><td><input readonly maxlength='20' size='10' id='name' value='" + talker_name + "' name='talkbackname' /></td>--><td class='DredTitle11N'><label for='text'>הוסף תגובה: </label></td><td><input type='text' maxlength='<%=$limitT%>' size='40' id='text' name='talkbacktext' /></td><td><input class='inputShort70' type='submit' name='' value=' שלח ' onclick='alert(\"פעולה זו עשויה לקחת עד דקה. אנא העזרו בסבלנות. תודה\")'></td> </tr></table></form></span>" : "רק חברי קהילה רשאים לכתוב תגובות. באפשרותך (בצד שמאל למעלה) להרשם לאתר או להכנס לחשבונך אם אתה כבר חבר רשום" ;
	var chosen_component_div = document.getElementById("form_" + component_id);
	chosen_component_div.innerHTML = tb_form;
	var form = eval("document.opinion" + component_id);
	if (form) { form.component_id.value = component_id; }
}



