var lastSearchPannel;
function atOnMouseOverLight(o)
{o.style.backgroundColor = ''; o.style.cursor = 'hand';}

function atOnMouseOutLight(o)
{o.style.backgroundColor = '';}

function atOnMouseOverDark(o)
{o.style.backgroundColor=''; o.style.cursor='hand';}

function atOnMouseOutDark(o)
{o.style.backgroundColor='';}

function MyOpenWindow(sFileName,wwidth,wheight,winname,sScrollbars,iTop)
{
        // open window
                var topvalue = 0;

                if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5)
                        sScrollbars="yes";
                else
                        sScrollbars = "no";
                if(winname == "")
                        winname = "defaultwindowname";
                 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
                 if(iTop == "" || arguments.length < 6)
                        topvalue = yy;
                 else
                        topvalue = iTop;
         options ='location=no, toolbar=no, status=no, left='+xx+',top='+topvalue+', menubar=no, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);
}

function Send(sFileName) {
        // open window
                ww = screen.width;
         hh = screen.height;
         wwidth = 300;
         wheight = 300;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
         options ='location=no, toolbar=no, status=no, left='+xx+', top='+yy+', menubar=no,height='+wheight+', width='+wwidth+', scrollbars = no';
         file =sFileName;
         window.open(file,'picview2',options);

        }

function Add_To_Favorite()
{
        if (window.external)
        {
                external.AddFavorite("http://www.tzofit.co.il", "צופית - האתר המעודכן ביותר בישראל")
        }
        else
        {
                alert(".דפדפן שלך לא תומך באופציה זו");
        }
}
function Set_Homepage()
{
        if(navigator.appVersion.charAt(navigator.appVersion.indexOf("MSIE") + 5) >= 5 && navigator.platform.indexOf("Win16") == -1 && navigator.platform.indexOf("Mac") == -1){
                if (window.external)
                        homepage.style.behavior='url(#default#homepage)';
                        homepage.setHomePage("http://www.tzofit.co.il");
        }
}

function weather(sFileName) {
        // open window
         ww = screen.width;
         hh = screen.height;
         wwidth = 790;
         wheight = 504;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
         options ='location=no, toolbar=no, status=no, left='+xx+', top=40, menubar=no,height='+wheight+', width='+wwidth+', scrollbars = yes';
         file =sFileName;
         window.open(file,'weather',options);
        }

function OpenWindow(sFileName,wwidth,wheight,winname,sScrollbars,iTop) {
        // open window
                var topvalue = 0;

                if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5)
                        sScrollbars="yes";
                else
                        sScrollbars = "no";
                if(winname == "")
                        winname = "defaultwindowname";

                 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
                 if(iTop == "" || arguments.length < 6)
                        topvalue = yy;
                 else
                        topvalue = iTop;
         options ='resizable=yes,location=yes, toolbar=yes, status=yes, left='+xx+', top='+topvalue+', menubar=no, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);
        }

function OpenWin(sFileName) {
        // open window
		ww = screen.width;
        hh = screen.height;
		wwidth = ww-8;
		 wheight = hh-80;
		 top_ = 0;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
         options ='location=no, toolbar=no, status=yes, left=0, top=0, menubar=no, height='+wheight+', width='+wwidth+', scrollbars = no';
         if(sFileName.indexOf("tour")<1){
             file ='/tour/'+sFileName;
             }else{
             file =sFileName;
             }
         
         window.open(file,'picview',options);		
        }	
    
function toggleSearchTr(divId){
var myDiv=document.getElementById(divId);
if(lastSearchPannel){
var openPannel=document.getElementById(lastSearchPannel);
}
var centerSpacerDiv=document.getElementById('centerSpacer');
var centerSpacerDiv1=document.getElementById('centerSpacer1');
if(centerSpacerDiv){
	(myDiv.style.display=='none')?centerSpacerDiv.style.height='70px':centerSpacerDiv.style.height='15px';
	(myDiv.style.display=='none')?centerSpacerDiv1.style.height='70px':centerSpacerDiv1.style.height='15px';
}
if(openPannel && openPannel!=myDiv){
		//closeDiv(lastSearchPannel,100,0)
		openPannel.style.display='none';
		}
	(myDiv.style.display=='none')?myDiv.style.display='inline':myDiv.style.display='none';	
	
	lastSearchPannel=divId;
}


function check_word()
{
	var str = document.quick_search.keyword.value;
	if( str.length < 2){
		alert("אנא הכנס מילה בת יותר מ - 2 אותיות");
		document.quick_search.keyword.focus();
	}else{
		document.quick_search.submit();
	}
}
/*Israel Meteorological Service*/
function ims_weather()
{
        window.open("http://www.ims.gov.il/tachazit.htm","big","channelmode=no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=no,width=630,height=500,top=30,left=100'")
}
/*******************************************/	
function change(box,types)
{	
var t;
var j;	
  box.options.length = 1;		
  for (t = 0; t < types.length; t++)
	if (types[t].selected)
	{
		if(types[t].value != 0)
		for (j = 0; j < arr_subcat[types[t].value].length; j++)	
				box.options[box.options.length]=new Option(arr_subcat[types[t].value][j].text,arr_subcat[types[t].value][j].value);	
				//box.options[box.options.length] = arr_subcat[types[t].value][j];
	}
}

function hamlatzofitlink(area_id,cat_id,ts_char){
if (ts_char.indexOf('%2C')<1){
ts_char+=','+ts_char;
}
location.href='/tour/search_map.php?cat_id='+cat_id+'&area_id='+area_id+'&city_id=0&ts_char='+ts_char;
}

function showmap(mapName){
//prompt('',mapName);
mapName = mapName.replace(/^\s*|\s*$/g,"");

switch (mapName){
case 'ramat_golan.jpg':mapVal=1;break
case 'galil_ilyon.jpg':mapVal=2;break
case 'galil_maaravi.jpg':mapVal=3;break
case 'kineret.jpg':mapVal=4;break
case 'karmel.jpg':mapVal=5;break
case 'jerusalem_yhuda.jpg':mapVal=6;break
case 'bikah.jpg':mapVal=7;break
case 'telaviv_centr.jpg':mapVal=8;break
case 'negev.jpg':mapVal=9;break
case 'eylat_arava.jpg':mapVal=10;break
default:mapVal=10;
}
var m=OWin("/tour/frames_map.php?view_one=&ts_id=&area_id="+mapVal+"&cat_id=15");
//location.href="/tour/frames_map.php?view_one=&ts_id=&area_id="+mapVal+"&cat_id=15";
}

/*******************************************/
function OpenFrame(sFileName,w,h) {
        // open window
		
		ww = screen.width;
        hh = screen.height;
		wwidth = ww-8;
		 wheight = hh-80;
		 top_ = 0;
         options ='location=no, toolbar=no, status=no, left=0, top=0, menubar=no, height='+wheight+', width='+wwidth+', scrollbars = no';
         file =sFileName;
         window.open(file,'openframe',options);				 		 
        }
	
/*****************************************
function OpenWin(sFileName,w,h) {
        // open window
		
		ww = screen.width;
         hh = screen.height;
         wwidth = w;
         wheight = h;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
         alert(wheight);
         options ='location=no, toolbar=no, status=no, left='+xx+', top=42, menubar=no, height='+wheight+', width='+wwidth+', scrollbars = yes';
         file =sFileName;
         window.open(file,'picview',options);				 		 
        }	
******************************************/	
function OpenFullScreen(sFileName) {
        // open window
		ww = screen.width;
        hh = screen.height;
		wwidth = ww-8;
		 wheight = hh-80;
		 top_ = 0;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
         options ='location=no, toolbar=no, status=no, left=0, top=0, menubar=no, height='+wheight+', width='+wwidth+', scrollbars = no';
         file =sFileName;
         window.open(file,'picview',options);		
        }	

/*******************************************/	

function toggleTr(TrId)
{
        var myTr=document.getElementById("tr_"+TrId);
      //  (myTr.style.display == 'none')? myTr.style.display = 'block': myTr.style.display = 'none';
		if (myTr.style.display == 'none'){ myTr.style.display = 'block';
		url="stat_update_click.php?dealer_id="+TrId;
		xmlhttpGet(url);
		} else {myTr.style.display = 'none';}
}

function xmlhttpGet(strURL, objName) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {	// end of processing
     		
		// if you want do something with what you get from the url:
       		// self.xmlHttpReq.responseText
        }
    }
    self.xmlHttpReq.send(strURL);
}

