var undoValue;
function viewpic(picname){
var jwnd
	jwnd=window.open("","pic","resizible=0,status=0,fullscreen=0,width=200,height=150");
jwnd.location.href="viewpic.asp?pic='"+picname+"'";

}


function valfield(exp) {
	var srcEL,re,x; 
	srcEL = (valfield.arguments.length>1) ? valfield.arguments[1] : window.event.srcElement;
	x = exp;
	// macro definition
	re = /<empty>/gi; x = x.replace(re,"(<f>.value!=='')");
	re = /<numeric>/gi; x = x.replace(re,"(!(isNaN(<f>.value)))");
	re = /<quantity>/gi; x = x.replace(re,"(!((isNaN(<f>.value)) || (Math.round(<f>.value)!=<f>.value) || (<f>.value<=0)))");
	re = /<date>/gi; x = x.replace(re,"(isDate(<f>.value))");
	
	// replace the field property
	re = /<f>/gi;	x = x.replace(re,"srcEL");
	if (!(eval(x))) {
		alert("ערך לא תקין");
		srcEL.value=undoValue
		return false;
	}
	return true;
}
																												
function setUndoValue() {
	var v;
	v = (setUndoValue.arguments.length>0) ? setUndoValue.arguments[1] : window.event.srcElement.value;
	undoValue=v;
}

function isDate(dt) {
	var s,d;
	s = /(-|\.|[ ])/gi; dt = dt.replace(s,'/');
	d = dt.split("/");
	if (d.length!=3) return false;
	if ((d[0]<1) || (d[0]>31) || (d[1]<1) || (d[1]>12) || ((d[2].length % 2)==1)  || (d[2].length>4)) return false;
	if (d[2].length==2) d[2] = ((d[2]>30) ? '19' : '20') + d[2];
	var  ok = new Boolean ;
	ok = (((d[1]==1) || (d[1]==3) ||  (d[1]==5) || (d[1]==7) || (d[1]==8) || (d[1]==10) || (d[1]==12)) && (d[0]<=31));
	ok = ok || (((d[1]==4) || (d[1]==6) || (d[1]==9) || (d[1]==11)) && (d[0]<=30));
	ok = ok || ((d[1]==2) && (d[0]<=(((d[2] % 4)==0) ? 29 : 28)));
	return ok;
}


function checkLogin()
{
var login,pass
login = document.login.name.value
pass = document.login.Pass.value
if (login.length < 4)
	{
	alert("אנא הקלד את שם משתמש");
	}
	else if (pass.length < 4)
	{
	alert("אנא הקלד סיסמא");
	}
	else
	{
	document.login.submit()
	}
}

function sub_form(){
	var email


email = document.frm.Email.value

if (email.indexOf('@')<1 || email.indexOf('.',email.indexOf('@'))-email.indexOf('@')<2 || email.length-1==email.lastIndexOf('.') || email.length > 40)
	{
	alert(".כתובת דואר אלקטרוני שגויה");
	}
	
	else
	{
	document.frm.submit()
	}
}

window.onload = function() {
var a = document.getElementsByTagName("A");
	for(var i = 0; i < a.length; i++) {
		a[i].hideFocus = "true";
	}
}

function show(o) {
	//o.style.backgroundColor="#CCCCCC";
	//o.style.color="#191970";
	o.nextSibling.style.visibility = "visible";
}
function show1(o) {
	o.style.backgroundColor="#191970";
	o.style.color="#0084c2";
	for(i = 0; i < o.all.length; i++){
   if(o.all(i).tagName=="A"){
		o.all(i).style.color="#0084c2";
   }
}

}
function show2(o) {
	o.style.backgroundColor="#191970";
	o.style.color="#0084c2";
	for(i = 0; i < o.all.length; i++){
   if(o.all(i).tagName=="A"){
		o.all(i).style.color="#0084c2";
   }
}

}
function hide1(o,n) {
	n.style.backgroundColor="";
	n.style.color="#0E3D74";
	if(!o.contains(event.toElement) && o.previousSibling.stay != true) {
		o.style.visibility = "hidden";
	}
}
function hide3(o,n) {
	n.style.backgroundColor="";
	n.style.color="#191970";
	if(!o.contains(event.toElement) && o.previousSibling.stay != true) {
		o.style.visibility = "hidden";
	}
}
function hide2(n) {
	n.style.backgroundColor="";
	n.style.color="#000000";
	for(i = 0; i < n.all.length; i++){
   if(n.all(i).tagName=="A"){
		n.all(i).style.color="#000000";
	}
   }
}
function hide21(n) {
	n.style.backgroundColor="#CCCCCC";
	n.style.color="#000000";
	for(i = 0; i < n.all.length; i++){
   if(n.all(i).tagName=="A"){
		n.all(i).style.color="#000000";
	}
   }
}
function hide(o) {
	if(!o.contains(event.toElement) && o.previousSibling.stay != true) {
		o.style.visibility = "hidden";
	}
}
function toggleStay(o) {
	o.stay = !o.stay;
	if(o.stay == true) {
		//o.firstChild.innerHTML = 5;
	} else {
		//o.firstChild.innerHTML = 6;
	}
}

function selectgo(o){
	window.location.href="equipment.asp?eid="+o.value;

}
function selectgo22(o){
	window.location.href="equipment1.asp?eid="+o.value;

}
function selectgo11(o){
	window.location.href="equipmenteng.asp?eid="+o.value;

}
function selectgo2(o,b){
	window.location.href="sitepage.asp?pid="+o.value+"&eid="+b;

}
function selectgo2_en(o,b){
	window.location.href="sitepage_en.asp?pid="+o.value+"&eid="+b;

}
function selectgo2_ru(o,b){
	window.location.href="sitepage_ru.asp?pid="+o.value+"&eid="+b;

}
function selectgo23(o,b){
	window.location.href="sitepage1.asp?pid="+o.value+"&eid="+b;

}
function selectgo1(o,b){
	window.location.href="sitepageng.asp?pid="+o.value+"&eid="+b;

}
function checkform(){
var fname,phone,isphone
fname=document.frm.name1.value;
phone=document.frm.phone.value;
isphone=/^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/;
	if (fname.length < 2 || fname.length > 25)
	{
	alert(".אנא הקלד את שמך");
	}
	else if (!isphone.test(phone) || phone.length < 9 || phone.length >12)
	{
	alert(".מספר טלפון שגוי");
	}
	
	else
	{
	document.frm.submit()
	}
}
function opwin1(st){
window.open("viewpic.asp?pic="+st,"opwin","directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=0,toolbar=0");

}
function image_open(image_loc)
{
  HTML = "<html><head><link rel='stylesheet' type='text/css' href='ie.css' >";
  HTML = HTML + "<script language=javascript>"
  HTML = HTML + "function ch_img(){"
  HTML = HTML + "	if(document.load_image.width>screen.width-1){window.resizeTo(700,550);document.load_image.width=690;document.load_image.height=500;}"
  HTML = HTML + "else{window.resizeTo(document.load_image.width+100,document.load_image.height+150)}}"
  
  HTML = HTML + "</script>"
  HTML = HTML + "</head><body onBlur='top.close()'>";
  HTML = HTML + "<hr size=1 noshade><div align=center>";
  HTML = HTML + "<img src='"+ image_loc +"' border=0 name=load_image onLoad='ch_img()'><hr size=1 noshade><FORM id=form1 name=form1><INPUT TYPE='button' VALUE='סגור חלון' " + "onClick='window.close()' id='button'1 name='button'1 class='kaftor'>";
  HTML = HTML + "</FORM></div></body></html>";
  popupImage = window.open('','_blank','toolbar=no,scrollbars=no');
  popupImage.document.open();
  popupImage.document.write(HTML);
  popupImage.document.close();
  image_loc= image_loc.src;
}

function checkprod(){
	var Melem,Apl,model,man,cat1
	Melem=document.frm1.Melem.value;
	Apl=document.frm1.Apl.value;
	model=document.frm1.model.value;
	man=document.frm1.man.value;
	cat1=document.frm1.cat1.value;
	if (Melem.length<2){
		alert("Please fill Measured Element");
	}
	else if(cat1=="0"){
		alert("Please choose category");
		document.frm1.cat1.focus();
	}
	else if(Apl.length<2){
		alert("Please fill Application");
	}
	else if(model.length<2){
		alert("Please enter model");
	}
	else if(man.length<2){
		alert("Please enter Manufacturer");
	}
	else{
		document.frm1.submit();
	}

}

function checkfor(){
var flag;
flag=0;
for(var i=0;i<document.frm1.elements.length;i++){
	if (document.frm1.elements[i].id.substr(0,4)=='fore')
		{
			if(document.frm1.elements[i].value==0){
				alert("בחר מזג האוויר");
				flag=1;
				document.frm1.elements[i].focus();
				return false;
			}
		}
	else if(document.frm1.elements[i].id.substr(0,4)=='temp'){
		if(document.frm1.elements[i].length==0){
			alert("הכנס טמפרטורה");
			flag=1;
			document.frm1.elements[i].focus();
			return false;
		}
	}
  }
if (flag==0){
document.frm1.submit();
}
}
function checkheat(){
var flag;
flag=0;
for(var i=0;i<document.frm1.elements.length;i++){
	if (document.frm1.elements[i].id.substr(0,4)=='fore')
		{
			if(document.frm1.elements[i].value==0){
				alert("בחר מזג האוויר");
				flag=1;
				document.frm1.elements[i].focus();
				return false;
			}
		}
  }
if (flag==0){
document.frm1.submit();
}
}


				function ShowTitle(sTitle,DivID)
				{
					if(sTitle!=null)
					{
                                                                      	if(sTitle.length>0)
						{
							var v_Div = document.getElementById("divLogo" + DivID);
							v_Div.title=sTitle;
							flagOnDiv=DivID;
							
						}
					}
				}
			

				function HideTitle(DivID)
				{
					var v_Div = document.getElementById("divTitle" + DivID);
					v_Div.style.visibility="hidden";
					flagOnDiv="";					
				}	
			
				function SetLogo(sForSplit,DivID)
				{	
                                                         //   alert(sForSplit);
			   	if(sForSplit!=null)
					{
						var v_Div = document.getElementById("divLogo" + DivID);
						
						var arrForSplit = sForSplit.split("||");                                                                              
						var cleanTitle = "";
						var v_url = '';
						if (arrForSplit.length = 3)
						{
							if(v_Div.filters) v_Div.filters[0].apply();
							cleanTitle = arrForSplit[0].replace("\'","\\'")                                                                                                  							
							if (arrForSplit[2].length>0)
							{
								v_url='<a href="' + arrForSplit[2] + '"'
								
								if(arrForSplit[2].indexOf('http')>=0)
								{
									v_url =v_url+' target="_blank" ';
								}
								v_url =v_url+'><img src="http://www.meteo-tech.co.il/logo_small/' + arrForSplit[1] + '"  border="0" align="center" onmouseover="ShowTitle(\'' + cleanTitle + '\',' + DivID + ');" onmouseout="HideTitle(' + DivID + ');" /></a>';                                                                                                               
								v_Div.innerHTML = v_url;
							}
							else
							{
								v_Div.innerHTML='<img src="http://www.meteo-tech.co.il/logo_small/' + arrForSplit[1] + '"  border="0"  align="center" onmouseover="ShowTitle(\'' + cleanTitle + '\',' + DivID + ');" onmouseout="HideTitle(' + DivID + ');"/>';
							}
							if(v_Div.filters) v_Div.filters[0].play();
						}
						
					}
				}
				
				function ReplaceLogo(DivID)
				{
					
                                                                   // alert(eval("arrLogo" + DivID + ".length"));
					if ((!(flagOnDiv==DivID))&&(eval("arrLogo" + DivID + ".length")>1))
						{
							var iRndLogo=eval("Math.floor(Math.random()*arrLogo" + DivID + ".length)");
							while (iRndLogo==eval("iRndLogo" + DivID))
							{
								iRndLogo=eval("Math.floor(Math.random()*arrLogo" + DivID + ".length)");
							}
							eval("iRndLogo" + DivID + "=iRndLogo");
							eval("SetLogo(arrLogo" + DivID + "[iRndLogo" + DivID + "]," + DivID + ")");
						}
						//iTempTime=(Math.floor(Math.random()*10)+3)*1000;
						iTempTime=2000;
						setTimeout("ReplaceLogo(" + DivID + ")",iTempTime);
					}