<!--

var mCategoryIndex=0,ageIndex=0,zoneIndex=0, catIndex=0;
var mCatName='Categories',zoneName='',ageName='',wordName='',catName='';
var ageLetch=0 //prvent age when parents activity is chosen
var catId=0;
var tm, currentTopMenu;
var kidsleisure_menu_left = 610; 	kidsleisure_menu_top = 175;
var kidsactivities_menu_left = 500; kidsactivities_menu_top = 175;
var aboutTooty_menu_left = 510; aboutTooty_menu_top = 175;
var log_e,buble_e,buttons_e;


stdbrowser=(document.getElementById)? true: false;


function starttimeout(flag){	
setTimeout("popDown("+flag+")", 200);
}


function init(){
	
	pageOnload = true; //located in imgload.js

	engineDefaults();

	setHeights(); 

	
}


function setHeights(){

	 var tbl = document.getElementById("eng_bus_view");
	 
	 var ob = new Obj_rectangle(tbl);
	 
	 var k = (ob.ObjHeight); 
	 
	 if (k<670){
	 
	 tbl.style.height = alertSize() - 200 + "px";
	 
	 }
	 	 

}


function engineDefaults(){
	
	loadCatMenu(0);
	mCategoryIndex=0;
	engine('categoryM','Category');
	parentCheck();
	
}


function gCenter()
{
	var linksCoordinate = 0;
	
		if (document.getElementById) 
		{
			if (document.all) {
			var winWidth = document.body.clientWidth; //     
			}
			else {
			var winWidth=window.innerWidth
			}
		}
			var linksCoordinate = (winWidth > 770 ? (eval(winWidth - 762)) / 2 : 10)
			
	return linksCoordinate;
}



function coordinate(leftPos, topPos)
{
		if (document.getElementById)
		{

		log_e = document.getElementById("logo_e");
		log_e.style.left = gCenter() + 20 + "px";
		log_e.style.top = 45 + "px";
		log_e.style.visibility="visible";
		
		buble_e = document.getElementById("buble_e");
		buble_e.style.left = gCenter() + 320 + "px";
		buble_e.style.top = -0 + "px";
		buble_e.style.visibility="visible";
		
		buttons_e = document.getElementById("buttons_e");
		buttons_e.style.left = gCenter() + 450 + "px";
		buttons_e.style.top = 123 + "px";
		buttons_e.style.visibility="visible";
		
		
		if (page=="indexe"){
			
			var emb = gCenter() + 90;
			
			
			engineCords = new Obj_rectangle(document.getElementById("engine_e_td"));
			embLeft = engineCords.ObjLeft + 90;
			embTop =  engineCords.ObjTop;
			
			//document.getElementById("menuBack").style.left = gCenter();
			//document.getElementById("subMenu"+mainQ).style.left = gCenter();
			//document.getElementById("engineMenus").style.left= gCenter()+169 + "px"
			
			document.getElementById("ageLable").style.left= embLeft + 25 + "px"	
			document.getElementById("engineBack").style.left= embLeft  + "px"	
			document.getElementById("engineMenus").style.left= embLeft + 25 + "px"
			document.getElementById("ageLable").style.visibility="visible"
			
			document.getElementById("engineMenus").style.top=embTop + 32 + "px";
			document.getElementById("engineBack").style.top=embTop + "px";
			document.getElementById("ageLable").style.top=embTop + 13 + "px";
			
			document.getElementById("engineMenus").style.visibility="visible"
			document.getElementById("engineBack").style.visibility="visible"
			//document.getElementById("ageLable").style.visibility="visible"
	
	/*
			if  (document.getElementById("searchWord1").style.display=='block' && document.getElementById("searchWord1").style.visibility=='visible')
				 document.getElementById("searchWord1").focus();
			*/
		}
		
		else{//not an index page
			if (false){	
				
				var nMode = 0;
				var mMode = 10;
				
				if (sMode=='menu'){mMode=10} else {mMode=8};
				
				if (page=='tooty'){
						nMode = -8;
						mMode -= 8;
						
					}
				
					var miniEngineReference = new Obj_rectangle(document.getElementById("miniEngineReference"))
					
					document.getElementById("miniEngine").style.left 		= miniEngineReference.ObjLeft + 2 +"px";
					document.getElementById("miniEngineMenus").style.left   = miniEngineReference.ObjLeft + 8 +"px";	
					document.getElementById("categoryMtable").style.width="110px";
					document.getElementById("agetable").style.width="41px";
					document.getElementById("miniEngineTablesPOS").style.width= 0 + "px";

					document.getElementById("miniEngineMenus").style.visibility="visible";
					document.getElementById("miniEngine").style.visibility="visible";

					
					/*
					document.getElementById("miniEngine").style.left= gCenter()-miniEngineLeft+8 + nMode + "px";
					document.getElementById("miniEngine").style.visibility="visible";
					document.getElementById("miniEngineMenus").style.left= gCenter()-miniEngineLeft+mMode + "px";
					document.getElementById("miniEngineMenus").style.visibility="visible";
					
					
					
					*/
					/*
					document.getElementById("miniReturnToHomePage").style.left= gCenter()-miniEngineLeft+8 + "px"
					document.getElementById("miniReturnToHomePage").style.visibility="visible"
					*/

				}
			}

		}

}


function nextPage(t,page,pageURL){

var url = page + "?pageCurrent="+t+"&" + pageURL;

location.href=url;
//alert(url);	
}





function reloadM(q){
eval("loadMenu"+q+".window.location.reload();")
}



function checkEngine(){



if (page=="indexe"){

					
					
					var wString
				
					wString=document.form1.searchWord1.value;
					
					if (wString==null) wString="";
					
					if (InStr(wString,'"')>0) {
												alert("!תו אסור")
												return false;
												}
					//alert(wString);return;
					//alert(mCategoryIndex+" "+ageIndex+" "+zoneIndex+" "+document.form1.searchWord1.value)
					
					

					if (mCategoryIndex==0 && ageIndex==0 && zoneIndex==0 && wString=="")
						{
							alert("Please choose category, age, region or keyword")
							return false;
						}
					else
					{
						return true;
					}
				}
else{
	return true;
	}
	
}
	

function formAction(){

	if (checkEngine()){
	
		//alert(mCategoryIndex)
	    
		if (page=="indexe"){
			wString=document.getElementById("searchWord1").value;
			//document.getElementById("counter").src="count.asp?param1=engine&param2="+engineNum+"&param3="+wString;
			if (ageName=='5 +') {ageName="5."};
			
			if (mCategoryIndex!=4){
			    location.href="catView_eng.asp?mCatId="+mCategoryIndex+"&ageId="+ageIndex+"&zoneId="+zoneIndex+"&mCatName="+mCatName+"&zoneName="+zoneName+"&ageName="+ageName+"&word="+wString+"&sMode=engine&catName="+catName+"&catIndex="+catIndex;
			}
			else{
				location.href="addsView_eng.asp?mCatId="+mCategoryIndex+"&ageId="+ageIndex+"&zoneId="+zoneIndex+"&mCatName="+mCatName+"&zoneName="+zoneName+"&ageName="+ageName+"&word="+wString+"&sMode=engine&catName="+catName+"&catIndex="+catIndex;
				}
		}
		
		else{
				//alert(catId);
				if (ageName=='5 +') {ageName="5."};
				if (engineNum==4) {document.getElementById("counter").src="count.asp?param1=engine&param2="+engineNum} // only if filter 
					
				if (mCategoryIndex!=4){
				location.href="catView_eng.asp?mCatId="+mCategoryIndex+"&ageId="+ageIndex+"&zoneId="+zoneIndex+"&catId="+catId+"&mCatName="+mCatName+"&sMode=engine"+"&zoneName="+zoneName+"&ageName="+ageName+"&catName="+catName+"&catIndex="+catIndex;
				}
				else{
				location.href="addsView_eng.asp?mCatId="+mCategoryIndex+"&ageId="+ageIndex+"&zoneId="+zoneIndex+"&catId="+catId+"&mCatName="+mCatName+"&sMode=engine"+"&zoneName="+zoneName+"&ageName="+ageName+"&catName="+catName+"&catIndex="+catIndex;
				}
			
			}
	}

}


/* q == menu index 
   mCategoryIndex - main category
*/

var mainQengine;
function engineMenuOpen(q){

	if(mainQengine==q) {
	   closeEngineMenues();
	   mainQengine = 0;
	   return;
	}
	
	var id,offsetLeft=0,offsetTop=0;

    if (q==4 && mCategoryIndex==0) return;
	if (q==2 && mCategoryIndex==2) return;
	
	mainQengine=q;

	//engineCategoryMenu_offsetLeft - is calculated in dynamicStyle_eng_inc.asp
	//engineCategoryMenu_offsetTop	- is calculated in dynamicStyle_eng_inc.asp
	//engineZoneMenu_offsetLeft 	- is calculated in dynamicStyle_eng_inc.asp

	if (page=="indexe"){
		
		if (q==1) {id = "categoryM";offsetLeft=0;offsetTop=2;}
		if (q==4) {id = "category";offsetLeft=engineCategoryMenu_offsetLeft;offsetTop=engineCategoryMenu_offsetTop;}
		if (q==2) {id = "age";offsetLeft=0;offsetTop=2;}
		if (q==3) {id = "zone";offsetLeft=engineZoneMenu_offsetLeft;offsetTop=2;}
	
	}
	else{
		
		if (q==1) {id = "miniCategoryM";offsetLeft=0;offsetTop=2;}
		if (q==4) {id = "category";offsetLeft=0;offsetTop=2;}
		if (q==2) {id = "miniAge";offsetLeft=0;offsetTop=2;}
		if (q==3) {id = "miniZone";offsetLeft=0;offsetTop=2;}
	}

		
		var ref = new Obj_rectangle(document.getElementById(id))
		var mnu=document.getElementById("engineMenu"+q);
		
		closeEngineMenues();
		
		mnu.style.top  = ref.ObjBottom + offsetTop + "px";
		mnu.style.left = ref.ObjLeft + offsetLeft + "px";
		mnu.style.visibility="visible";

}



function closeEngineMenues(){
	
	for (t=1;t<=4;t++){
		var obj1 = document.getElementById("engineMenu"+t);
		if (obj1) obj1.style.visibility="hidden";
		}			

}


function engineMenuClose(){
mnu=document.getElementById("engineMenu"+mainQengine).style
mnu.visibility="hidden"
}


// small engine category width
function setCategoryWidth(){

	//document.getElementById("menuInner").style.width="116px";
	//document.getElementById("bottom-round-menu").style.width="116px";
	document.getElementById("EmenuBackTD").style.width="109px";
	document.getElementById("categoryBackTable").style.width="109px";
}


function engine(id,val){

if (id=='categoryM' || id=='miniCategoryM') {
		mCatName=val
		//page=='index' || page=='tooty_engine' || page=='catView.asp'
		if(true) if (document.getElementById("category")) document.getElementById("category").innerHTML='All activities'
		};
		
if (id=='zone' || id=='miniZone') {zoneName=val};
if (id=='age' || id=='miniAge') {ageName=val; if (val=='5.') {val='5 +'}};
if (id=='category' || id=='miniCategory') {catName=val};

if (page!='index') {setCategoryWidth();}

val = val.replace("-",":");

if (document.getElementById(id)) document.getElementById(id).innerHTML=val;

for (t=0;t<=engineMenuTop;t++){
	 if (document.getElementById("engineMenu"+t)){
	 	 document.getElementById("engineMenu"+t).style.visibility="hidden";
		 }
	 }	

}



function parentCheck(){
	if (mCategoryIndex==2){
		document.getElementById(ageParam).style.color="#bbbbbb"
		document.getElementById(ageParam).innerHTML="גיל";
	ageIndex=0;
	ageLetch=1
	}
	else
	{
		if(document.getElementById(ageParam))   document.getElementById(ageParam).style.color="#000000"
		if(document.getElementById('category')) document.getElementById('category').style.color="#000000"
		ageLetch=0
    }

}


function Scrolling(Type,num)
{
	var mn
	clearTimeout(v);
	if (Type == "DOWN")
	{
		Scroll = 3;
	}
	else
	{
		Scroll = -3;
	}
	//alert("loadMenu"+num)
	mn=eval("loadMenu"+num)
	with (mn)
	{
		scrollBy(0, Scroll);
	}
	v = setTimeout("Scrolling('"+Type+"',"+num+")", 50);
}





function InStr(strSearch, charSearchFor)
{
	for (i=0; i < Len(strSearch); i++)
	{
	    if (charSearchFor == Mid(strSearch, i, 1))
	    {
			return i;
	    }
	}
	return -1;
}


function Mid(str, start, len)
{
		if (start < 0 || len < 0) return "";
		var iEnd, iLen = String(str).length;
		if (start + len > iLen)
				iEnd = iLen;
		else
				iEnd = start + len;
		return String(str).substring(start,iEnd);
}

function Len(str)
{  return String(str).length;  }



function loadCatMenu(ki){
	categoryFrame.location.href="getMenu.asp?mCatId="+ki+"&lang=eng";
	}



function couponInit(){
	

	
	var sp = document.getElementsByTagName("span");
	var addObj;
	var cpnObj,ob,tbl;
	
	for (var t=0; t<sp.length; t++ )
	{
		 if (sp[t].id){ 
		 if (sp[t].id.split("_")[0]=="coupon"){
			 
			 //addObj = new Obj_rectangle(document.getElementById("tb"+sp[t].id.split("_")[1]));
			 cpnObj = document.getElementById("coupon_"+sp[t].id.split("_")[1]);
			 
			 tbl = document.getElementById("stripTable_"+sp[t].id.split("_")[1]);
			 ob = new Obj_rectangle(tbl);
			 
			 cpnObj.style.left = ob.ObjLeft -15 + "px";
			 cpnObj.style.top = ob.ObjTop -15  + "px";
			 //alert();
			 //cpnObj.style.left = addObj.ObjLeft - 665;
			 //cpnObj.style.top = addObj.ObjTop - 13;
			 cpnObj.style.visibility="visible";
			 
			 }
		 }
		 
	}
}


function Obj_rectangle(Obj)
{
	if (! Obj){return;};

	this.ObjLeft = findOffset(Obj, "offsetLeft");
	this.ObjWidth = Obj.offsetWidth;
	this.ObjRight = this.ObjLeft + this.ObjWidth;
	this.ObjTop = findOffset(Obj, "offsetTop");
	this.ObjHeight = Obj.offsetHeight;
	this.ObjBottom = this.ObjTop + this.ObjHeight;

	function findOffset(Obj, offset)
	{
		var NumValue = 0;
		
		var startOffsetDom = Obj;

		while (startOffsetDom.offsetParent)
		{
			NumValue = NumValue + startOffsetDom[offset];
			startOffsetDom = startOffsetDom.offsetParent;
		}
		return NumValue;
	}
}


//****************************************************************************************
			

	function openMenu(menu){
	
	//if (!pageOnload) return;
	closeM(currentTopMenu)
	
	window.clearTimeout(tm);
	//if (mainQ>0 && mainQ!=q){closeM(mainQ);}
	//mainQ=q;
	
	//alert(menu)
	
	mnu=document.getElementById(menu);
	bak=document.getElementById("menuBack");
	
	document.getElementById(menu + "_img").src = "images/" + menu + "-over.gif";
	
	mnuButton = new Obj_rectangle(document.getElementById(menu + "_img"));

	mnu.style.left = mnuButton.ObjLeft - 20 + "px";				
	mnu.style.top  =  mnuButton.ObjBottom + 5 +  "px";
	mnu.style.visibility="visible";

	bak.style.top	= mnuButton.ObjBottom + 5 + "px";
	bak.style.left 	= mnuButton.ObjLeft -20 +  "px";
	bak.style.visibility="visible";
	
	currentTopMenu = menu;
	
	}
	
	
	function closeMenu(menu){

		window.clearTimeout(tm)
		tm=window.setTimeout("closeM('"+menu+"')",800)
	}
	
	
	function closeM(menu){
		
		if (document.getElementById(menu)){
		
			window.clearTimeout(tm);
			mnu=document.getElementById(menu);
			bak=document.getElementById("menuBack");
			mnu.style.visibility="hidden";
			bak.style.visibility="hidden";
			
			document.getElementById(menu+"_img").src = "images/"+menu+".gif";
		}
	}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  return myHeight;
}


function changeImages() {
	if (!pageOnload) return;
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function roundPositionSmallPic(){

	var rightRound,leftRound;

	if (ieBrowser==1){
		rightRound = 0
		leftRound = -8
	}
	else{
		rightRound = 8
		leftRound = 0
	}

	
	var imgId;
	
	var images = document.getElementById("addsContainer").getElementsByTagName("IMG");
	
	for (var t=0; t<images.length; t++){
			
		  imgId = images[t].id;	
			
		  if (imgId.indexOf("IMG_")>-1){
		  	   
			   var ref = new Obj_rectangle(images[t]);
			   
			   var id = imgId.split('_')[1]; 
			   
			   document.getElementById("topLeft_" + id).style.left = ref.ObjLeft - leftRound + "px";
			   document.getElementById("topLeft_" + id).style.top  = ref.ObjTop + "px";
			   document.getElementById("topLeft_" + id).style.display = "block";
			   
			   document.getElementById("topRight_" + id).style.left = ref.ObjRight - rightRound + "px";
			   document.getElementById("topRight_" + id).style.top  = ref.ObjTop + "px";
			   document.getElementById("topRight_" + id).style.display = "block";
			   
			   document.getElementById("bottomRight_" + id).style.left = ref.ObjRight -rightRound -1 + "px";
			   document.getElementById("bottomRight_" + id).style.top  = ref.ObjBottom -8 + "px";
			   document.getElementById("bottomRight_" + id).style.display = "block";
			   
			   document.getElementById("bottomLeft_" + id).style.left = ref.ObjLeft - leftRound + "px";
			   document.getElementById("bottomLeft_" + id).style.top  = ref.ObjBottom -8 + "px";
			   document.getElementById("bottomLeft_" + id).style.display = "block";
			   
		  }	
	}
	
}


function roundPositionBigPic(){

	var rightRound,leftRound;

	if (ffBrowser==1 || ieBrowser==1){
		rightRound = 16
		leftRound = 1
	}
	else{
		rightRound = 15
		leftRound = 0
	}

	
	var images = document.getElementById("imgContainer").getElementsByTagName("IMG");
	
	for (var t=0; t<images.length; t++){
			
		  if (images[t].id.indexOf("img")>-1){
		  	   var id = images[t].id.split('_')[1]; 
			   var ref = new Obj_rectangle(document.getElementById(images[t].id));
			   
			   document.getElementById("topLeft_" + id).style.left = ref.ObjLeft - leftRound + "px";
			   document.getElementById("topLeft_" + id).style.top  = ref.ObjTop + "px";
			   document.getElementById("topLeft_" + id).style.display = "block";
			   
			   document.getElementById("topRight_" + id).style.left = ref.ObjRight - rightRound + "px";
			   document.getElementById("topRight_" + id).style.top  = ref.ObjTop + "px";
			   document.getElementById("topRight_" + id).style.display = "block";
			   
			   document.getElementById("bottomRight_" + id).style.left = ref.ObjRight -rightRound + "px";
			   document.getElementById("bottomRight_" + id).style.top  = ref.ObjBottom -15 + "px";
			   document.getElementById("bottomRight_" + id).style.display = "block";
			   
			   document.getElementById("bottomLeft_" + id).style.left = ref.ObjLeft - leftRound + "px";
			   document.getElementById("bottomLeft_" + id).style.top  = ref.ObjBottom -15 + "px";
			   document.getElementById("bottomLeft_" + id).style.display = "block";
			   
		  }	
	}
	
}


// -->