// JavaScript Document
function MM_swapImgRestore() { //v3.0
  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_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_findObj(n, d) { //v4.01
  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() { //v3.0
  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];}
}

function fill(combo, name, src)
{
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4)
		{
			if (xmlhttp.status != 200)
			{
				alert("שגיאה!");
				return;
			}
			var doc = new ActiveXObject("Microsoft.XMLDOM");
			doc.async = false;
			doc.loadXML(xmlhttp.responseText);
			var nodes = doc.selectNodes("xml/rs:data/z:row");
			combo.length = 1;
			for (i=0; i < nodes.length; i++)
			{
				var opt = document.createElement("OPTION");
				opt.value = nodes[i].getAttribute("ID");
				opt.text = nodes[i].getAttribute("Name");
				combo.add(opt);
			}
			xmlhttp = null;
			doc = null;
		}
	}
	xmlhttp.open("GET", "getxml.asp?" + name + "=" + src.value, true);
//	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send();
}

function overData()
{
	var obj = window.event.srcElement;
	if (obj.tagName == "TD")
	{
		if (obj.parentElement.className.indexOf("click") < 0)
			obj.parentElement.className += " over";
	}
	else if (obj.tagName == "TH")
	{
		obj.className = "over";
	}
}

function outData()
{
	var obj = window.event.srcElement;
	if (obj.tagName == "TD")
	{
		if (obj.parentElement.className.indexOf("over") > 0)
			obj.parentElement.className = obj.parentElement.className.replace(" over", "");
	}
	else if (obj.tagName == "TH")
	{
		obj.className = "";
	}
}

function window.onscroll()
{
	obj = document.getElementById("sidebanner");
	if (!obj) return;
	obj.style.top = document.body.scrollTop;
	obj2 = document.getElementById("sidebanner2");
	if (!obj2) return;
	obj2.style.top = document.body.scrollTop;
}

function showHide(id)
{
	oDiv = document.getElementById(id);
	if (oDiv)
	{
		if (oDiv.style.display == "none")
		{
			oDiv.style.display = "block";
		}
		else
		{
			oDiv.style.display = "none";
		}
	}
}

function sortData(strURL, strSort)
{
	var obj = window.event.srcElement;
	if (obj.tagName == "TH")
	{
		var ID = obj.id;
		if (ID)
		{
			strURL += "&Sort=" + ID;
			if (strSort == ID)
			{
				strURL += " DESC"
			}
			window.location.replace(strURL);
		}
	}
}

function sendFriend(Body){
	args = "top=0, left=0, height=350, width=750, status=no, toolbar=no, menubar=no, scrollbars=yes, location=no";
	window.open("sendFriend.asp?Body=" + Body, "SendFreidnPopUp", args);
}

function showPhoto(pic) {
var w = 400;
var h = 400;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = "top=" + wint + ",left=" + winl + ",resizable=no,scrollbars=yes" + ",width="+ w + ",height="+ h;
winMovie = window.open("showPhoto.asp?Pic=" + pic , "popupPhoto", winprops)
if (parseInt(navigator.appVersion) >= 4) { winMovie.window.focus(); }
}

function showMail(url,id){			
	var obj = window.event.srcElement;
	URL = url + ".asp?MessageID="+id;
	if(document.all("MailDetails_" + id).innerHTML=="")
	{
  		document.all("MailDetails_" + id).innerHTML="<iframe  src='" + URL + "' width='100%' height='300' frameborder='0' scrolling='auto'></iframe>";
	 }
	else
	 {
		document.all("MailDetails_" + id).innerHTML="";
	 }	
}

function showBan(divName,width,height,wmode,src,bgcolor) {
	var d=document.getElementById(divName);
	d.innerHTML='<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0  WIDTH='+width+' HEIGHT='+height+'>'+wmode+'<PARAM NAME=movie VALUE="'+src+'"><PARAM NAME=quality VALUE=high><param name=bgcolor value="'+bgcolor+'"><EMBED src="'+src+'" quality=high WIDTH='+width+' HEIGHT='+height+' bgcolor="'+bgcolor+'" TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash></EMBED></OBJECT>';
}

//----------------------------- NO RIGHT CLICK -------------------------------
// (C) 2003 CodeLifter.com
// Source: CodeLifter.com
// Do not remove this header

// Set the message for the alert box
am = "!כל הזכויות שמורות לג'ובניק";

// do not edit below this line
// ===========================
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}
//the 3 lines disable mouse right click on site
//document.onmousedown = nrc;
//if (document.layers) window.captureEvents(Event.MOUSEDOWN);
//if (bNS && bV<5) window.onmousedown = nrc;
//--------------------------------------------------------------------------------------
/***********************************************
* Disable select-text script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
* Modified here to exclude form tags properly and cross browser by jscheuer1
***********************************************/

//form tags to omit:
var omitformtags=["input", "textarea", "select"]

function disableselect(e){
for (i = 0; i < omitformtags.length; i++)
if (omitformtags[i]==(e.target.tagName.toLowerCase()))
return;
return false
}

function reEnable(){
return true
}

function noSelect(){
	if (typeof document.onselectstart!="undefined"){
		document.onselectstart=new Function ("return false")
		if (document.getElementsByTagName){
		tags=document.getElementsByTagName('*')
		for (j = 0; j < tags.length; j++){
			for (i = 0; i < omitformtags.length; i++)
				if (tags[j].tagName.toLowerCase()==omitformtags[i]){
					tags[j].onselectstart=function(){
						document.onselectstart=new Function ('return true')
						}
						tags[j].onmouseup=function(){
						document.onselectstart=new Function ('return false')
					}
				}
			}
		}
	}
	else{
		document.onmousedown=disableselect
		document.onmouseup=reEnable
	}
}

//window.onload=noSelect;

//---- function check only num pressed  -------------------------------------------------
var Ver4 = parseInt(navigator.appVersion) >= 4 
var Nav4 = ((navigator.appName == "Netscape") && Ver4)
var IE4 = ((navigator.userAgent.indexOf("MSIE") != -1) && Ver4)
if (Nav4) {
	var origWidth = window.innerWidth ;
	var origHeight = window.innerHeight ;
}

function ValidNameMask(curER, e){
	var key = Nav4 ? e.which : e.keyCode;
	if((key>=65 && key<=90) ||(key>=97 && key<=122)||(key>=1188 && key<=1514)||(key==32))return true;
	//(key>=65 && key<=90) //english big
	//(key>=97 && key<=122) //english small
	//(key>=1188 && key<=1514)//hebrew
	return false;
}

function ValidPhoneMask(curER, e){
	var key = Nav4 ? e.which : e.keyCode;
	if((key>=48 && key<=57)||(key>=45 && key<=45))return true;
	return false;
}

function ValidAgeMask(curER, e){
	var key = Nav4 ? e.which : e.keyCode;
	if((key>=48 && key<=57)||(key>=46 && key<=46))return true;
	return false;
}

function ValidNumberMask(curER, e){
	var key = Nav4 ? e.which : e.keyCode;
	if(key>=48 && key<=57)return true;
	return false;
}

function ValidEmailMask(curER, e){
	var key = Nav4 ? e.which : e.keyCode;
	if((key>=95 && key<=95) ||(key>=45 && key<=46) ||(key>=64 && key<=90) ||(key>=97 && key<=122)||(key>=48 && key<=57))return true;
	//(key>=48 && key<=57) //numbers
	//(key>=65 && key<=90) //english big
	//(key>=97 && key<=122) //english small
	return false;
}
//----- This function decide if the length of item is equel or more then len------------
function ValidLength(item, len){
        return (item.length >= len);
}
//----- This function decide if the length of Phone field is equel or more then len------------
function ValidPhoneLength(item){
        //return (item.length == 7);
        //return (item.length ==6)||(item.length == 7);
        return (item.length ==9)||(item.length == 7);
}
//----- function to validate an email address -------------------------------------------
function ValidEmail(item){
        if (!ValidLength(item, 6)) return false;
        if (item.indexOf ('@', 0) == -1) return false;
        if (item.indexOf ('.', 0) == -1) return false;
       return true; 
}
//----This function check if the parameters in TellFriend window are fill true ----------
function Validate(){
		var msg = "";
		if(!ValidLength(document.UserData.FullName.value,2)){
			msg = msg + "נא להקליד שם\n";
		}
   	    if(!ValidLength(document.UserData.Phone.value,9)){
			msg = msg + "מספר הטלפון צריך להיות לפחות בין 9 ספרות\n";
   	    }
		if(!ValidEmail(document.UserData.Email.value)){
			msg = msg + "נא להקיש דואר אלקטרוני חוקי\n";
		}
		if (msg!=""){
			alert (msg);
			void(0);
			return false;
			}
		else{
			document.UserData.submit();
			}
}

//----This function check if the parameters in TellFriend window are fill true 
function Validate(){
	var msg = "";
	if(!ValidLength(document.UserData.FullName.value,2)){
		msg = msg + "נא להקליד שם\n";
	}
    if(!ValidLength(document.UserData.Phone.value,9)){
		msg = msg + "מספר הטלפון צריך להיות לפחות בין 9 ספרות\n";
    }
	if(!ValidEmail(document.UserData.Email.value)){
		msg = msg + "נא להקיש דואר אלקטרוני חוקי\n";
	}
	if (msg!=""){
		alert (msg);
		void(0);
		return false;
		}
	else{
		document.UserData.submit();
		}
}

function checkResponse()
{
var msg = "";
	if(!ValidLength(document.UserData.FullName.value,2)){
		msg = msg + "נא להקליד שם\n";
	}
    if(!ValidLength(document.UserData.Phone.value,9)){
		msg = msg + "מספר הטלפון צריך להיות לפחות בין 9 ספרות\n";
    }
	if(!ValidEmail(document.UserData.Email.value)){
		msg = msg + "נא להקיש דואר אלקטרוני חוקי\n";
	}
	if (msg!=""){
		alert (msg);
		void(0);
		return false;
		}
	else{
		document.UserData.submit();
		}
}