function _gel(a){return document.getElementById(a)}
function trim(s){return s.replace(/^\s+/,'').replace(/\s+$/,'');}
function get_random(){var ranNum= Math.round(Math.random()*98929);return ranNum;}
function ColorInput(Obj,CellColor){Obj.style.backgroundColor=CellColor}
function isEmail(string){if(string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return true; else return false;}

function showsub(i){
	var myid=_gel(i)
	if(myid){
		var t = 0;
		if(myid.style.display == "none"){
		  myid.style.display = "";
		  t = 0;
		}else{
		  myid.style.display = "none";
		  t = 1;
		} 
	}
}

function x(iid,p){
	var d=_gel(iid)
	var imn = d.src
	if(p==0){
		imn = imn.replace('a.gif','b.gif')
	}else{
		imn = imn.replace('b.gif','a.gif')
	}
	d.src=imn
}

function x1(iid,p){
	var d=_gel(iid)
	var imn = d.src
	if(p==0){
		imn = imn.replace('c.gif','b.gif')
	}else{
		imn = imn.replace('b.gif','c.gif')
	}
	d.src=imn
}

function vfeedback(f){
var t = trim(f.elements['full_name'].value)
	if (t.length < 2) {
		alert('יש להזין שם מלא');
		ColorInput(f.elements['full_name'],'#FF9E2B')
	    document.formy.full_name.focus();
		return false
	}ColorInput(f.elements['full_name'],'#ffffff')
	
	var t = trim(f.elements['email'].value)
	if (t.length < 10) {
		alert('יש להזין כתובת מייל');
		ColorInput(f.elements['email'],'#FF9E2B')
	    document.formy.email.focus();
		return false
	}ColorInput(f.elements['email'],'#ffffff')
	
	if(!isEmail(t)){
		alert('יש להזין כתובת מייל תקינה');
		ColorInput(f.elements['email'],'#FF9E2B')
	    document.formy.email.focus();
		return false	
	}ColorInput(f.elements['email'],'#ffffff')
	return true
}

function vcontact(f){
	var t = trim(f.elements['full_name'].value)
	if (t.length < 2) {
		alert('יש להזין שם מלא');
		ColorInput(f.elements['full_name'],'#FF9E2B')
	    document.formy.full_name.focus();
		return false
	}ColorInput(f.elements['full_name'],'#ffffff')
	
	t = trim(f.elements['email'].value)
	if(!isEmail(t)){
		alert('יש להזין כתובת מייל תקינה');
		ColorInput(f.elements['email'],'#FF9E2B')
	    document.formy.email.focus();
		return false	
	}ColorInput(f.elements['email'],'#ffffff')	
	return true
}

function vhpnws(f){
	var t = trim(f.elements['reg'].value)
	if(!isEmail(t)){
		alert('יש להזין כתובת מייל תקינה');
		ColorInput(f.elements['reg'],'#FF9E2B')
	    document.fmx.reg.focus();
		return false	
	}ColorInput(f.elements['reg'],'#ffffff')	
	return true
}


function s2f(){
	var ur = document.location.href
	if (ur){
		ur = encodeURIComponent(document.location.href)
		nw('stf.asp?ur='+ ur, 'ps2f', 280, 350) 
	}
}
function s2p(){
	self.print()
}

function s2fr(){}

function nw(pg, wn, w, h) {
  var wl = (screen.width - w) / 2;
  var wt = (screen.height - h) / 2;
  wparms = 'top='+wt+',left='+wl+',height='+h+',width='+w+',status=0,scrollbars=0,resizable=1'
  win = window.open(pg,wn, wparms)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function pox(nm){
	nw('showp.asp?n='+ nm, 'popx', 460, 400) 
}
function vs(f){
	var t = trim(f.elements['q'].value)
	if (t.length < 2) {
		alert('יש להזין לפחות 2 תווים לחיפוש');
		ColorInput(f.elements['q'],'#FF9E2B')
	    document.frz.q.focus();
		return false
	}ColorInput(f.elements['q'],'#ffffff')
	return true
}

function IsNumeric(sText){
	if(!sText.length) return false
	var ValidChars="0123456789";
	var IsNumber=true;
	var Char;
	for (i=0;i<sText.length && IsNumber==true;i++){ 
		Char=sText.charAt(i); 
		if (ValidChars.indexOf(Char)==-1){
			IsNumber=false;
		}
	}
	return IsNumber;
}

function SetSearcVals(selectCtrl,inx){
	// alert(inx)
	selectCtrl.options[inx].selected = true;
}
function SetSearcValsByVal(selectCtrl,val){
//alert(selectCtrl.options[3].value)
	var i = selectCtrl.options.length;
	for (i; i > 0; i--) {
		if (selectCtrl.options[i-1].value==val){
			selectCtrl.options[i-1].selected = true 
			break;
		}
	}
}

function enableBlink(){
	var aryBlinkingElements = document.getElementsByTagName("BLINK")
	for(i=0;i<aryBlinkingElements.length;i++){
	objElement = aryBlinkingElements[i];
	if(objElement.style.visibility == "hidden"){
		objElement.style.visibility = "visible" ;
	}else{
		objElement.style.visibility = "hidden" ;
	}
   }
   setTimeout('enableBlink()', 1000);
}
function toggle(e){
	if(e.style.display=="none"){
		e.style.display="";
	}else{
		e.style.display="none";
	}
}