function UpdateClock() {
 tDate = new Date();
 month = tDate.getMonth()+1;
 minutes = tDate.getMinutes();
 if (minutes < 10) minutes = "0" + minutes;
 seconds = tDate.getSeconds();
 if (seconds < 10) seconds = "0" + seconds;
 document.getElementById('clock').innerHTML =
 tDate.getDate() + "/" + month + "/" + tDate.getFullYear() + "&nbsp;&nbsp;"
 + tDate.getHours() + ":" + minutes + ":" + seconds;
 x = setTimeout("UpdateClock()", 1000);
}

var tickerC=0;
var tickerB,tickerL;
var running=true;
function tickerScroll() {
	var cO,cT;
	if (document.getElementById("ticker")) {
		cO=document.getElementById("ticker").childNodes[tickerC].offsetTop;
		cT=tickerB.scrollTop;
		if (cT>=cO) {
			if (tickerC==0) tickerB.scrollTop=0;
			return;
		}
		if ((cT+3)>cO) tickerB.scrollTop=cO;
    else tickerB.scrollTop=tickerB.scrollTop+4;
		setTimeout(tickerScroll,100);
	}
}

function showZap(id) {
 zobj = document.getElementById('showZap'+id);
 from = zobj.value;
 document.frames['_new'].location.href='update.php?showZap='+from+'&id='+id;
 newShowZap = (from=='1') ? '0' : '1';
 zobj.src = "showZap"+newShowZap+".png";
 zobj.value = newShowZap;
}

function tickerManage() {
 if (running){
  tickerC++;
  if (tickerC>=tickerL) tickerC=0;
	tickerScroll();
 }
 setTimeout(tickerManage,5000);
}


function searchprod(thispage,what){

if (thispage!='search')

 {location='sales_h.php?thisdoc='+thispage+'&key='+what;}

 else {location='search_h.php?key='+what;}

}



function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location.href='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}



function printer(){

txt=document.URL;

str=txt.split("?");

str1=escape(str[1])+"";

if ((str1!='undefined')){document.location.href=txt + '&p=1';} else {document.location.href=txt + '?p=1';}

}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("כתובת מייל שגויה")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("כתובת מייל שגויה")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("כתובת מייל שגויה")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("כתובת מייל שגויה")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("כתובת מייל שגויה")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("כתובת מייל שגויה")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("כתובת מייל שגויה")
		    return false
		 }

 		 return true
}

function isInteger(s) {
 return (s.toString().search(/^-?[0-9]+$/) == 0);
}