var priceCount=0;
var priceHTML;
var MOVE_THIS_ITEM_TO_ARCH_H = "האם להעביר פריט זה ל";
			
function Price()
{
				
	priceCount++;	
	priceHTML	=	
					//-- the price type amount
					"<div style='float:left;display: block;padding-left:31px;'>" +
					"<SELECT name='price" + priceCount + "_amount' style='width: 35px;padding-right: 5px;'>" +
						"<OPTION value='0'>0</OPTION>" + 
						"<OPTION value='1'>1</OPTION>" + 
						"<OPTION value='2'>2</OPTION>" +
						"<OPTION value='3'>3</OPTION>" +
						"<OPTION value='4'>4</OPTION>" +
						"<OPTION value='5'>5</OPTION>" +
					"</select>" +
					"</div>" +
				
					"<div class='priceTitle'>"+
					"סוג "+
					"</div>"+
								
					"<div style='float:right;width:37%;text-align:right;'>"+
					"<textarea id='type"+priceCount+"' name='type"+priceCount+"' dir='rtl'></textarea>"+
					"</div>"+
								
					"<div style='float:right;width:80px;'>"+
					"<input id='price"+priceCount+"' name='price"+priceCount+"' style='width: 85px;'>"+
					"</div>"+
								
					"<div style='float:right;width:100%' align=center>"+
					"<a href='javascript:void(0)' onclick='deletePrice("+priceCount+")'>הסר</a>"+
					"</div>"
								
	roomPrice.innerHTML = roomPrice.innerHTML + priceHTML; 	 
	document.frmActive.pricesCount.value = priceCount;
}
			
			
function deletePrice(id)
{
	var priceString = new String(roomPrice.innerHTML);
				
	var findId = priceString.indexOf("type"+id,1)
	var divStart = priceString.lastIndexOf("<DIV",findId)
	divStart = priceString.lastIndexOf("<DIV",divStart-1)
					
	findId = priceString.indexOf("price"+id,divStart)
	var divEnd = priceString.indexOf("</DIV>",findId)
		divEnd = priceString.indexOf("</DIV>",divEnd+1)
				
	var firstBlock = priceString.slice(0,divStart)
	var secondBlock = priceString.slice(divEnd+6,priceString.length)
				
	roomPrice.innerHTML = firstBlock + secondBlock
			
	if (eval("document.all.price" + id + "_amount"))
	eval("document.all.price" + id + "_amount.style.display='none'");
}
			
			
////////////// handles the checkbox value - archive_handler(checkbox object,string:"אתר"||"ארכיון")
function archive_handler(check_obj,status_name)
	{
		if(confirm(MOVE_THIS_ITEM_TO_ARCH_H + status_name))	
		{
			check_obj.checked=true;
		}
		else
		{
			check_obj.checked=false;
		}
	}
//////////////////////////////////////////////////////////////////////////////////////////////////	


function SndRequest(Id,num,mutag)
{
	var oXMLHTTP;
	var sXMLResponse;
	oXMLHTTP = new ActiveXObject ("Microsoft.XMLHTTP"); 	
	//oXMLHTTP.open ("POST","Responsepage.asp?SelCase=" + SelCase + "&Key=" + sKey + "&Condition=" + sCondition + "&ObjectName=" + sObjectName + "&OrderBy=" + sOrderBy + "&ChooseOption=" + iChooseOption +"&freetext=" +freetext, false);
	oXMLHTTP.open ("GET","Responsepage.asp?SelCase=" + Id + "&num=" + num + "&mutag=" + mutag,false);
	oXMLHTTP.send();
	sXMLResponse = oXMLHTTP.responseText;
	return sXMLResponse;
}

function SndRequestMakat(Id)
{
	
	var oXMLHTTP;
	var sXMLResponse;
	oXMLHTTP = new ActiveXObject ("Microsoft.XMLHTTP"); 	
	//oXMLHTTP.open ("POST","Responsepage.asp?SelCase=" + SelCase + "&Key=" + sKey + "&Condition=" + sCondition + "&ObjectName=" + sObjectName + "&OrderBy=" + sOrderBy + "&ChooseOption=" + iChooseOption +"&freetext=" +freetext, false);
	oXMLHTTP.open ("GET","Responsepage.asp?Makat=" + Id,false);
	oXMLHTTP.send();
	sXMLResponse = oXMLHTTP.responseText;
	return sXMLResponse;
}



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function spawnWindow(desktopURL,windowName,width,height,scroll) 
{
	window.open(desktopURL, windowName, "toolbars=no,top=250,left=350,scrollbars="+scroll+",width="+width+",height="+height );
}

function formValidation(formName,idsToValid)
{//alert(formName+" "+idsToValid)
	var fieldValue;
	var idsArray = idsToValid.split(",")
	for(var ii=0;ii<idsArray.length;ii++)
	{
		fieldValue = document.getElementById(idsArray[ii]).value;
		//alert(fieldValue)
		//return false;
		if(fieldValue=="")
		{
			alert('מלא שדה ' + eval("text"+ idsArray[ii] +".innerText"))
			return false;
		}
	}
	
}

function sendUrl()
{
	var link = "friend.asp?link=" + document.location.href;
	spawnWindow(link,'rec',250,360,'no');
}

//search results functions start:
var itemBG;
function HiThis(item)
{
	//alert(item);
	var itemTR = eval("document.all." + item);
	var itemIMG = eval("document.all." + item + "_image");
	itemBG = itemTR.style.backgroundColor;
	itemTR.style.backgroundColor = "#FF9020";
	itemIMG.src = "images/but_details_over.gif"
			
}
		
function LowThis(item)
{
	//alert(item);
	var itemTR = eval("document.all." + item);
	var itemIMG = eval("document.all." + item + "_image");
	itemTR.style.backgroundColor = itemBG;
	itemIMG.src = "images/but_details.gif"
}
function show_natour_iframe(xlink, xnewwindow)
{
	if (xlink != '' && (!xnewwindow) )
	{	
		//alert(xnewwindow);
		var table_hp_image_capsules = document.all.hp_image_capsules
		var table_hp_image_capsules_title = document.all.hp_image_capsules_title
		var table_hp_news_capsules = document.all.hp_news_capsules
		var table_hp_news_capsules_title = document.all.hp_news_capsules_title
		var natour_iframe_wrapper = document.all.natour_iframe_wrapper
		var natour_iframe = document.all.natour_iframe
	
		//_ hide image and news capsules 
		if (table_hp_image_capsules)
			table_hp_image_capsules.style.display = 'none';
		//if (table_hp_image_capsules_title)
		//	table_hp_image_capsules_title.style.display = 'none';

		if (table_hp_news_capsules)
			table_hp_news_capsules.style.display = 'none';
		
		
		
		if (table_hp_news_capsules_title)
			table_hp_news_capsules_title.style.display = 'none';
		//_ hide image and news capsules 
		
		if (natour_iframe_wrapper)
			natour_iframe_wrapper.style.display = 'block';
	
		if (natour_iframe)
		{
			natour_iframe.src = xlink;
			natour_iframe.style.width = 542;
		}
	}
	else
	{
		//spawnWindow(xlink,"menu_link",400,400,1) 
		if (screen.width == 1024)
		{
			window.open(xlink, "menu_link", "menubar=1, top=80, left=120, scrollbars=1, resizable=1, width=645, height=550");
		}
		else
		{
			window.open(xlink, "menu_link", "menubar=1, top=80, left=0, scrollbars=1, resizable=1, width=645, height=410");
		}
	}
}
function initDoc()
{
	//_ show the left menu
	// MFXiSM_L(); 
	
	//_ show the right menu
	// MFXiSM();
	
	//_ run the header image slide show
	runSlideShow();
}
function nevigate(param,pageName)
{
	//if (pageName == "Fattal Hotel Chain")
	//	document.all.fatal_pic.style.display = "block";
	//else
	//	document.all.fatal_pic.style.display = "none";
	//document.all["page_name"].innerHTML = pageName;
	
	// logout
	if(param==-1)
		document.all["iframe1"].src = 'log_out.asp';
	else
		document.all["iframe1"].src = 'login_form.asp?src='+param;	
	//alert(page_title);
}
//search results functions end:

function HideStrip()
{
	//alert("hide");
	//location.href="strip_closed.asp";
	//parent.document.all.StripDiv.style.bottom = "-56px";
	document.all.StripDiv.style.display = "none";
}

function ShowStrip()
{
	//alert("show");
	//location.href="strip.asp";
	//parent.document.all.StripDiv.style.bottom = "0px";
}

function ChangeFrameset()
{
	parent.document.body.rows='*,19';
}

function ReturnFrameset()
{
	parent.document.body.rows='*,75';
}

function ShowLogin()
{
	
	document.all.TDfront.style.display = "none";
	document.all.TDinside.style.display = "none";
	document.all.TDlogin.style.display = "block";
	document.all.StripLeft.innerHTML = "<img SRC=images/strip_login_left.gif>";
	document.all.StripRight.innerHTML = "<img SRC=images/strip_login_right.gif>";
}

function AfterLogin()
{
	document.all.TDfront.style.display = "none";
	document.all.TDlogin.style.display = "none";
	document.all.TDinside.style.display = "block";
	document.all.StripLeft.innerHTML = "<img SRC=images/strip_front_left.gif>";
	document.all.StripRight.innerHTML = "<img SRC=images/strip_front_right.gif>";
}



function checkRez()
{
	var correctwidth=800
	var correctheight=600
	if (screen.width<=correctwidth||screen.height<=correctheight)
	{
	//alert ('800X600');
	StartTop=243;					// Menu offset x coordinate
	StartLeft=-8;					// Menu offset y coordinate
	}
	else
	if (screen.width>correctwidth||screen.height>correctheight)
	{
	//alert ('more');
	StartTop=247;					// Menu offset x coordinate
	StartLeft=-120;					// Menu offset y coordinate
	}
}



//-->}


