
function CheckOneEmail($adr){
	return (!(strpos($adr,"@",strpos($adr,"@")+1) > -1));
}

function openWindow(theURL,winName,features){ 
	window.open(theURL,winName,features);
}

function shot(shot){
	if (shot!='') shot=window.open(shot);
	window.defaultStatus="";
}


function MM_jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_swapImgRestore(){
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d){
	var p,i,x;
	if (!d) d=document;
	if ((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if (!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for (i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if (!x && d.getElementById) x=d.getElementById(n);
	return x;
}

function MM_swapImage(){
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for (i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x;
			if (!x.oSrc) x.oSrc=x.src;
			x.src=a[i+2];
		}
}

//window.onload = init;
//function init() {
	if (window.Event) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = getXY;
//}

function getXY(e){
	mousex = (window.Event) ? e.pageX : event.clientX;
	mousey = (window.Event) ? e.pageY : event.clientY;
	// Use x and y to do what ever you want
}

function showThumb(objThumber,title,url,img){
	// there is a problem with Mozile\Firefox regarding the position of the info ballon
	objThumber.style.top = mousey - 135 + document.body.scrollTop;
	objThumber.style.left = mousex - 15 + document.body.scrollLeft;
	//alert(document.body.scrollLeft);
	//objThumber.innerHTML = "<br><span style='font-size:15;'><b>" + title + "</b></span><br><img src='images/spacer.gif' width=1 height=4><br><img src='thumbs/" + img + "' width=176 height=100 style='border:solid 1px #808080;'><br><img src='images/spacer.gif' width=1 height=4><br><span style='font-size:11;'>" + url + "</span>";
	objThumber.innerHTML = "<img src='images/spacer.gif' width='1' height='4'><br><span style='font-size:11;'><b>" + title + "</b></span><br><img src='images/spacer.gif' width='1' height='3'><br><img src='thumbs/" + img + "' width='130' height='80' style='border:solid 1px #808080;'>";
//	if ((dd.elements.topad) && (dd.elements.topad.y+60>=parseInt(objThumber.style.top))){
//		dd.elements.topad.hide();
//		document.getElementById("remoteBanner").style.visibility = "hidden";
//	}

	objThumber.style.zIndex = 65001;
	objThumber.style.display = "block";
//	var IfrRef = document.getElementById('DivShim');
//	IfrRef.style.width = objThumber.offsetWidth;
//	IfrRef.style.height = objThumber.offsetHeight;
//	IfrRef.style.top = objThumber.style.top;
//	IfrRef.style.left = objThumber.style.left;
//	IfrRef.style.zIndex = objThumber.style.zIndex - 1;
//	IfrRef.style.display = "block";
}

function hideThumb(objThumber){
//	if (dd.elements.topad){
//		dd.elements.topad.show();
//		document.getElementById("remoteBanner").style.visibility = "visible";
//	}
	if (!objThumber) objThumber = document.getElementById("thumber");
	objThumber.style.display = "none";
//	document.getElementById('DivShim').style.display = "none";
}

function ShowMenu(){
	//
}

function changeAdDisp(num){
	//
}

function changeText(name, msg){
	document.getElementById("name").innerHTML=name;
	document.getElementById("description").innerHTML=msg;
}

function changeDisplay(num){
	var divId;
	var coll = document.all.tags("DIV");
	//alert(coll);
	for (i=0; i<coll.length; i++) {
		divId = coll[i].id;
		if (divId.indexOf("option") != -1) {
			if (i != num)
				document.getElementById(divId).style.display = "none";
			else
				document.getElementById(divId).style.display = "block";
		}
	}
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_dn){
        if (!img.MM_up) img.MM_up = img.src;
        img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
        nbArr[nbArr.length] = img;
	  }
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

var forms_DIGITS = "0123456789 -";

function IsEmail(sText) {
	var at="@";
	var dot=".";
	var lat=sText.indexOf(at);
	var lstr=sText.length-1;
	var ldot=sText.indexOf(dot);
	if (sText=="" || sText==null){ return false; }
	if (sText.indexOf(at)==-1 || sText.indexOf(at)==0 || sText.indexOf(at)==lstr){ return false; }
	if (sText.indexOf(dot)==-1 || sText.indexOf(dot)==0 || sText.indexOf(dot)==lstr){ return false; }
	if (sText.indexOf(at,(lat+1))!=-1){ return false; }
	if (sText.substring(lat-1,lat)==dot || sText.substring(lat+1,lat+2)==dot){ return false; }
	if (sText.indexOf(dot,(lat+2))==-1){ return false; }
	if (sText.indexOf(" ")!=-1){ return false; }
 	return true;			
}
		
function IsURL(sText) {
	/*
	if (sText.indexOf("http://") == -1 && sText.indexOf("https://") == -1) { return false; }
	else if (sText == "http://" || sText == "https://") { return false; }
	else if (sText.indexOf("http://") > 0 || sText.indexOf("https://") > 0) { return false; }
	sText = sText.substring(7, sText.length);
	if (sText.indexOf(".") == -1) { return false; }
	else if (sText.indexOf(".") == 0) { return false; }
	else if (sText.charAt(sText.length - 1) == ".") { return false; }
	if (sText.indexOf("/") != -1) {
		sText = sText.substring(0, sText.indexOf("/"));
		if (sText.charAt(sText.length - 1) == ".") { return false; }
	}	
	if (sText.indexOf(":") != -1) {
		if (sText.indexOf(":") == (sText.length - 1)) { return false; }
		else if (sText.charAt(sText.indexOf(":") + 1) == ".") {	return false; }
		sText = sText.substring(0, sText.indexOf(":"));
		if (sText.charAt(sText.length - 1) == ".") { return false;}
	}
	*/
	if (sText=='') return false;
	else return true;
}
		
function IsNumeric(sText){
	var ValidChars = forms_DIGITS;
	var ret = true;
	if (sText.length==0) return (false);
	for (i = 0 ; i < (sText.length) && (ret==true) ; i++){ 
		if (ValidChars.indexOf(sText.charAt(i)) == -1){
			ret = false;
		}
	}
	return (ret);
}

function doSendAdvertizeForm(){
	if (document.frmContact.fullname.value!=""){
		if (document.frmContact.phone.value!=""){		  		
			if (!IsNumeric(document.frmContact.phone.value) || document.frmContact.phone.value.length!=7){
				alert("מספר הטלפון צריך להכיל 7 ספרות");
				document.frmContact.phone.select();
				return;		
			}	
		}
		if (IsEmail(document.frmContact.email.value)){
			if (document.frmContact.companysite.value!=""){
				if (!IsURL(document.frmContact.companysite.value)){
					alert("כתובת האתר אינה תקינה");
					document.frmContact.companysite.select();
					return;		
				}						
			}
			if (document.frmContact.content.value!=""){
				if (document.frmContact.rndchk.value.length==5){
					document.frmContact.act.value = "dosend";
					document.frmContact.submit();
				}else{
					alert("יש להזין את קוד האבטחה (בן 5 ספרות)");
					document.frmContact.rndchk.focus();
				}
			}else{
				alert("יש להזין תוכן");
				document.frmContact.content.select();
			}
		}else{
			alert("יש להזין כתובת אימייל נכונה");
			document.frmContact.email.select();
		}
	}else{
		alert("יש להזין שם מלא");
		document.frmContact.fullname.select();
	}
}

function doSendJoinForm(){
	if (document.frmContact.fullname.value!=""){
		if (document.frmContact.email.value!="" && IsEmail(document.frmContact.email.value)){
			if (document.frmContact.sitetitle.value!="" && IsURL(document.frmContact.sitetitle.value)) {			
				if (document.frmContact.phone.value!=""){		  		
					if (!IsNumeric(document.frmContact.phone.value) || document.frmContact.phone.value.length!=7){
						alert("מספר הטלפון צריך להכיל 7 ספרות");
						document.frmContact.phone.select();
						return;		
					}	
				}				
				if (document.frmContact.rndchk.value.length==5){
					document.frmContact.act.value = "dosend";
					document.frmContact.submit();
				}else{
					alert("יש להזין את קוד האבטחה (בן 5 ספרות)");
					document.frmContact.rndchk.focus();
				}
			}else{
				alert("כתובת האתר אינה תקינה");
				document.frmContact.sitetitle.select();
			}
		}else{
			alert("יש להזין כתובת אימייל נכונה");
			document.frmContact.email.select();
		}
	}else{
		alert("יש להזין שם מלא");
		document.frmContact.fullname.select();
	}
}

function addFlashObject(width, height, filename) {
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'>");
	document.write("<param name='movie' value='"+filename+"'>");
	document.write("<param name='quality' value='high'>");
	document.write("<param name='LOOP' value='true'>");
	document.write("<param name='menu' value='false'>");
	document.write("<embed src='"+filename+"' width='"+width+"' height='"+height+"' loop='false' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed></object>");
}