function rusure(what) { 
	if(confirm(what)) { 
		return true;  
	}else { 
		return false; 
	} 
}

function checkEnter(e){ //e is event object passed from function invocation
var characterCode

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
return false 
}
else{
return true 
}

}

function scrollTop(){
   window.scroll(0,0)
}

function validateNumber(field){
  var val = field.value;
  if(!/(^\d+$)|(^\d+\.\d+$)/.test(val)||val==""){
      field.value = 0;
      field.focus();
      field.select();
  }
}

function doNothing(){
    return false
}

function closeWin(){
   window.close()
}

function enter(){
  if (event.keyCode == 13) document.formiSearch.submit()
}

function disON(){
   document.getElementById("err").innerHTML = ""
   document.formi.sendi.disabled = true
}

function disOff(){
   document.formi.sendi.disabled = false
}

function delSpace(what){
  return what.replace(/ /g, "")
}

function PopWIN(str,namei){
	window.open(str,namei,'top='+(screen.height-100)/2+',left='+(screen.width-100)/2+',width=1,height=1,scrollbars=Yes,status=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no')
}

function CardImage(str){
	window.open('Site_ContentImages.asp?Image='+str,'CardImage','top='+(screen.height-400)/2+',left='+(screen.width-500)/2+',width=500,height=400,scrollbars=Yes,status=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no')
}

function ContentCard(who,what){
	window.open('Site_ViewMetapelPOP.asp?Who=' + escape(who) + '&What=' + escape(what),'CardMetapel','top='+(screen.height-500)/2+',left='+(screen.width-750)/2+',width=750,height=500,scrollbars=Yes,status=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no')
}

function ContentCard2(urLink){
	window.open(urLink,'CardMetapel','top='+(screen.height-500)/2+',left='+(screen.width-750)/2+',width=750,height=500,scrollbars=Yes,status=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no')
}

function PopWINwh(Str,Namei,w,h){
   window.open(Str,Namei,'top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',height='+h+',width='+w+',scrollbars=No,status=Yes,toolbar=No,menubar=No,location=No,resizable=No,titlebar=No')
}

function PopWINwh2(Str,Namei,w,h){
   window.open(Str,Namei,'top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',height='+h+',width='+w+',scrollbars=Yes,status=Yes,toolbar=No,menubar=No,location=No,resizable=No,titlebar=No')
}

function AdsContent(who){
	window.open('Site_AdsViewPOP.asp?ID=' + escape(who) ,'AdsContent','top='+(screen.height-500)/2+',left='+(screen.width-750)/2+',width=750,height=500,scrollbars=Yes,status=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no')
}


function key(){
	if(event.keyCode < 45 || event.keyCode > 57){event.returnValue = false;}
}
	
function key2(){
   if (event.keyCode < 45 || event.keyCode > 57){
	  event.returnValue = true;
   }else{
	  event.returnValue = false;
   }
}

function keyPhone(){
	if((event.keyCode < 45 || event.keyCode > 57) && event.keyCode!=32 && event.keyCode!=45 && event.keyCode!=44){event.returnValue = false;}
}

function key3(){
    if(event.keyCode <= 46 || event.keyCode > 57 || event.keyCode == 47){event.returnValue = false;}
}

function key3Zero(){
   if(event.keyCode <= 46 || event.keyCode==48 || event.keyCode > 57 || event.keyCode == 47){event.returnValue = false;}
}

function key4(){
   if(event.keyCode <= 45 || event.keyCode > 57 || event.keyCode == 47){event.returnValue = false;}
}

function key6(){
   if(event.keyCode <= 45 || event.keyCode > 58 || event.keyCode == 47){event.returnValue = false;}
}
 
 //Start text area limit
function taLimit() {
	var taObj=event.srcElement;
	if (taObj.value.length==taObj.maxLength*1) return false;
}

function taCount(visCnt) { 
	var taObj=event.srcElement;
	if (taObj.value.length>taObj.maxLength*1) taObj.value=taObj.value.substring(0,taObj.maxLength*1);
	if (visCnt) visCnt.innerText=taObj.maxLength-taObj.value.length;
}
//End text area limit

function search(){
   var  pkeyWordsL = document.searchi.keyWords.value.length;
   
   if(pkeyWordsL<2){
      alert("הערך לחיפוש חייב להיות לפחות 2 תווים")
	  return false
   }
}

function setSmile(who){
   if(document.FaddMessage.Cursor.value=="Subjecti"){
       if(document.FaddMessage[document.FaddMessage.Cursor.value].value.length*1+who.length*1<=document.FaddMessage[document.FaddMessage.Cursor.value].maxLength*1){
	   document.FaddMessage[document.FaddMessage.Cursor.value].value=document.FaddMessage[document.FaddMessage.Cursor.value].value+who
	   }
	   document.FaddMessage[document.FaddMessage.Cursor.value].focus()
   }else{
	   document.FaddMessage[document.FaddMessage.Cursor.value].value=document.FaddMessage[document.FaddMessage.Cursor.value].value+who
	   document.FaddMessage[document.FaddMessage.Cursor.value].focus()
   }
}

function searchProd(){
   var  pkeyWordsL = document.searchProdi.keyWords.value.length;
   
   if(pkeyWordsL<2){
      alert("הערך לחיפוש חייב להיות לפחות 2 תווים")
	  return false
   }
   
}

function setDateFormat(who){
  var pLen = who.value.length
  
  if(pLen==2||pLen==5){
    who.value = who.value + "/"
  }
}

function showHideTalkBack(who){
  if(document.getElementById("TalkVis"+who).style.display==""){
    document.getElementById("TalkVis"+who).style.display="none"
	document.getElementById("TalkInvVis"+who).style.display=""
  }else{
    document.getElementById("TalkVis"+who).style.display=""
	document.getElementById("TalkInvVis"+who).style.display="none"
  }
}

function showHideAds(who){
  if(document.getElementById(who).style.display=="none"){
    document.getElementById(who).style.display=""
  }else{
    document.getElementById(who).style.display="none"
  }
}

function getTags(subject,id,counter){
    var url="AJAXGet"+subject+"Tags.asp?sid=" + Math.random() + "&ID=" + id + "&Counter=" + counter
    xmlHttp=GetXmlHttpObjectSubject(setTags)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}


function setTags(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
			if(pstrtohandle!=""){
				document.getElementById("moreTags").innerHTML = pstrtohandle
			}
	  } 
}


function EmbAudio(idsound){
  //alert(sound)
  var fieldValue = document.getElementById("tempAudio").value
  var statusi = document.getElementById("V"+idsound).name
  if(fieldValue==""){
    document.getElementById("tempAudio").value = idsound
    document.getElementById("NSPlaySound"+idsound).Stop();
    document.getElementById("NSPlaySound"+idsound).Play();
	document.getElementById("V"+idsound).name = "stop"
	document.getElementById("V"+idsound).src = "images/btm_ramkol_off.gif"
  }else{
  
  if(idsound==fieldValue){
    document.getElementById("tempAudio").value = ""
	document.getElementById("NSPlaySound"+idsound).Stop();
	document.getElementById("V"+idsound).name = "play"
	document.getElementById("V"+idsound).src = "images/btm_ramkol_on.gif"
  }else{
		  document.getElementById("NSPlaySound"+fieldValue).Stop();
		  document.getElementById("V"+fieldValue).name = "play"
		  document.getElementById("V"+fieldValue).src = "images/btm_ramkol_on.gif"
		  document.getElementById("NSPlaySound"+idsound).Stop();
		  document.getElementById("NSPlaySound"+idsound).Play();
		  document.getElementById("V"+idsound).name = "stop"
		  document.getElementById("V"+idsound).src = "images/btm_ramkol_off.gif"
		  document.getElementById("tempAudio").value = idsound
		  }
  }
}

function getTalkBacksListView(who,id){
	var url="../data/"+who+"/TalkBacks/"+id+".txt?sid=" + Math.random()
    xmlHttp=GetXmlHttpObjectSubject(setTalkBacksListView)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}

function setTalkBacksListView(){ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	  pstrtohandle = xmlHttp.responseText
	  document.getElementById("talkBack").innerHTML = pstrtohandle
  } 
}

function getTalkBacksList(who,id){
	var url="Site_"+who+"TalkBackList.asp?sid=" + Math.random() + "&ID="+escape(id)
    xmlHttp=GetXmlHttpObjectSubject(setTalkBacksList)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}


function setTalkBacksList(){ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	  pstrtohandle = xmlHttp.responseText
	  document.getElementById("talkBack").innerHTML = pstrtohandle
  } 
}

function getTalkBackRecomanded(who,id){
     
	 document.getElementById("Reco"+id).innerHTML = "<b style=\"font-size: 11px; color: #E23088;\">המלצתך התקבלה. תודה.</b>"
	 
	 var url="Site_"+who+"TalkBackRecomended.asp?sid=" + Math.random() + "&ID="+escape(id)
     xmlHttp=GetXmlHttpObjectSubject(setTalkBackRecomanded)
     xmlHttp.open("GET", url , true)
     xmlHttp.send(null)
     return false
}

function setTalkBackRecomanded(){ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	  pstrtohandle = xmlHttp.responseText
  } 
}


function checkTalkBack(){
     var message = ""
	 var  pSubject = delSpace(document.formi.Subject.value);
	 
	 if(pSubject==""){
	   message=message+"אנא הזן נושא / כותרת."+"\n"
	 }
	 
	 if(message!=""){
     alert(message)
	 return false
	 }
	 
	 document.formi.sendi.value = "מעבד נתונים....אנא המתן"
	 document.formi.sendi.disabled = true
}


function AdsValidateDate(){
     document.formi.Datei.value = delSpace(document.formi.Datei.value)
	 pVal = document.formi.Datei.value
	 if(pVal!=""){
		 var url="AJAXAdsCheckDate.asp?sid=" + Math.random() + "&Val="+escape(pVal)
	     xmlHttp=GetXmlHttpObjectSubject(setAdsValidateDate)
	     xmlHttp.open("GET", url , true)
	     xmlHttp.send(null)
	     return false
	 }
}

function setAdsValidateDate(){ 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
        if(pstrtohandle=="OK"){
			return true
		}else{
		    alert(pstrtohandle)
			document.formi.Datei.focus()
			document.formi.Datei.select()
		}
   } 
   
   return false
}


function contact(){
    var message = ""
	var  pFname = document.formi.Fname.value;
    var  pLname = document.formi.Lname.value;
    var  pEmail = document.formi.Email.value;
    var  pPhone = document.formi.Phone.value;
    var  pprePhone = document.formi.prePhone.value;
    
	if(pFname==""||pLname==""){
	   message=message+"נא להזין שם פרטי ושם משפחה"+"\n"
	}
	
	if(pEmail==""){
	      message = message + "נא להזין כתובת דוא\"ל" + "\n"
	}else{
	    if(pEmail.indexOf(".")==-1||pEmail.indexOf("@")==-1){
	      message = message + "כתובת הדוא\"ל אינה חוקית" + "\n"
	    }
	}
	
	if(pPhone==""&&pprePhone==""){
	   message=message+"נא להזין מספר טלפון כולל קידומת"+"\n"
	}else{
	
	   if(pprePhone==""){
	      message=message+"נא להזין קידומת למספר טלפון"+"\n"
	   }
	   
	   if(pPhone==""){
	      message=message+"נא להזין מספר טלפון"+"\n"
	   }
	   
	}
	
	
	if(message!=""){
    alert(message)
	return false
  }
	
}


function GetContent(what){
  if(what!=""){
     pA = document.getElementById('A'+what)
	 
	 if(document.getElementById('DIV'+what).style.display=="none"){
	  //get content
	    document.getElementById('divID').value = what
		XMLSetContent(what)
	 }else{
	  //delete content
	    document.getElementById('DIV'+what).innerHTML = ""
		document.getElementById('DIV'+what).style.display="none"
		document.getElementById('divID').value = ""
	 }
	 
  }
}

function XMLSetContent(who){
	var url="AJAXGetSubs.asp?sid=" + Math.random() + "&ID=" + who
    xmlHttp=GetXmlHttpObjectSubject(XMLGetContent)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}

function XMLGetContent(){ 
	pFiledID = document.getElementById('divID').value
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
			if(pstrtohandle!=""){
				document.getElementById('DIV'+pFiledID).innerHTML = pstrtohandle
				document.getElementById('DIV'+pFiledID).style.display=""
			}
	  } 
}

function MetapelSearch(){
   var message = ""
   var  pType = document.Mformi.Type.value;
   var  pCategory1 = document.Mformi.Category1.value;
   //var  pArea = document.Mformi.Area.value;
   
   if(pType=="Metapl"){
      if(pCategory1==""){
	    message=message+"אנא בחר/י תחום טיפול"
	  }
   //}else{
   //   if(pArea==""){
	//     message=message+"אנא בחר/י אזור"+"\n"
	//  }
   }
   
   if(message!=""){
   alert(message)
   return false
   }
   
   document.Mformi.sendi.disabled = true
   
}


function SearchDis(what){
   if(what=="Metapl"){
      document.Mformi.Category1.disabled = false
   }else{
      document.Mformi.Category1.options[0].selected = true
	  document.Mformi.Category1.disabled = true
   }
}

function getSimptom(what){
   if(delSpace(what)!=""){
     var url="AJAXGetSimptomList.asp?sid=" + Math.random() + "&Str=" + escape(what)
     xmlHttp=GetXmlHttpObjectSubject(XMLGetSimptoms)
     xmlHttp.open("GET", url , true)
     xmlHttp.send(null)
     return false
   }else{
     document.getElementById("SimptomDiv").innerHTML = ""
	 document.getElementById("SimptomDiv").style.display = "none"
   }
}

function XMLGetSimptoms(){ 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		   
		if(pstrtohandle.indexOf("~")==-1){
		   document.getElementById("SimptomDiv").innerHTML = "תקלה זמנית,<br>אין אפשרות להמשיך בתהליך<br>אנא נסה שנית מאוחר יותר."
		   document.getElementById("SimptomDiv").style.display = ""
		}else{
		   pSplit = pstrtohandle.split("~");
		   pRes = pSplit[0]
		   pText = pSplit[1]
		   
		   if(pRes=="OK"){
		      document.getElementById("SimptomDiv").innerHTML = pText
			  document.getElementById("SimptomDiv").style.display = ""
		   }else{
		      document.getElementById("SimptomDiv").innerHTML = ""
			  document.getElementById("SimptomDiv").style.display = "none"
		   }		   
		   
		}
   } 
}

function getContentCard(who,what){
	var url="AJAXGetContentCard.asp?sid=" + Math.random() + "&Who=" + escape(who) + "&What=" + escape(what)
    xmlHttp=GetXmlHttpObjectSubject(XMLContentCard)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}

function XMLContentCard(){ 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
        if(pstrtohandle!="error"){
			scroll(0,0)
			document.getElementById("LeafCardContent").innerHTML = ""
		    document.getElementById("LeafCardContent").style.display = ""
		    document.getElementById("CardContent").innerHTML = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" height=\"100%\" align=\"center\"><tr><td align=\"center\"><table width=\"690\" height=\"690\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"#ffffff\" align=\"center\" style=\"border: 1px solid #808080;\"><tr><td class=\"innerCard\" valign=\"top\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td class=\"topCloseWin\" align=\"right\"><a href=\"javascript:;\" onclick=\"HideDivs()\"><img src=\"../Site/images/btn_CloseWin.gif\" width=\"43\" height=\"17\" alt=\"סגור חלון\" border=\"0\"></a></td></tr></table>" + pstrtohandle + "</td></tr></table></td></tr></table>"
		    document.getElementById("CardContent").style.display = ""
			document.getElementById("LeafCardContent").style.Height = document.getElementById('mainBody').scrollHeight
		}else{
		    alert("תקלה זמנית, אין אפשרות להציג כרטיס")
		}
   } 
}

function HideDivs(){
    document.getElementById("CardContent").innerHTML = ""
	document.getElementById("CardContent").style.display = "none"
	document.getElementById("LeafCardContent").innerHTML = ""
	document.getElementById("LeafCardContent").style.display = "none"
}

function forgotpassword(){
	message = ""
	pEmail = document.forgotPass.Email.value
	
	document.forgotPass.sendi.value = "אנא המתן..."
	document.forgotPass.sendi.disabled = true
	
	if(pEmail==""){
	      message = message + "נא להזין כתובת דוא\"ל" + "\n"
	}else{
	    if(pEmail.indexOf(".")==-1||pEmail.indexOf("@")==-1){
	      message = message + "כתובת הדוא\"ל אינה חוקית" + "\n"
	    }
	}
	
	if(message!=""){
	document.forgotPass.sendi.value = "שלח סיסמא"
	document.forgotPass.sendi.disabled = false
	alert(message)
	return false
	}
	
	var url="AJAXForgotPassword.asp?sid=" + Math.random() + "&Email=" + escape(pEmail)
    xmlHttp=GetXmlHttpObjectSubject(XMLForgotPassword)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
	
}

function XMLForgotPassword(){ 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
        if(pstrtohandle=="OK"){
			document.location = "Pop_Message.asp?Message=" + escape("הסיסמא נשלחה לכתובת הדוא\"ל אשר הזנת.")
		}else{
		    document.forgotPass.sendi.value = "שלח סיסמא"
			document.forgotPass.sendi.disabled = false
			alert(pstrtohandle)
		}
   } 
   
   return false
}


function forumLogin(){
    message = ""
	pNick = document.ForumLogin.Nick.value
	pPassword = document.ForumLogin.Password.value
	
	if(pNick==""||pPassword==""){
	      message = message + "אנא הזן כינוי וסיסמא" + "\n"
	}
	
	if(message!=""){
	alert(message)
	return false
	}
	
	document.ForumLogin.sendi.value = "המתן"
	document.ForumLogin.sendi.disabled = true
	
	var url="AJAXForumLogin.asp?sid=" + Math.random() + "&Nick=" + escape(pNick) + "&Password=" + escape(pPassword)
    xmlHttp=GetXmlHttpObjectSubject(XMLForumLogin)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}

function XMLForumLogin(){ 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
        if(pstrtohandle=="OK"){
			document.location.reload()
		}else{
		    document.ForumLogin.sendi.value = "כניסה"
			document.ForumLogin.sendi.disabled = false
			alert(pstrtohandle.replace(/~/g, "\n"))
		}
   } 
   
   return false
}


function forumRegis(){
	pNick = document.ForumRegis.Nick.value
	pNickL = document.ForumRegis.Nick.value.length
	pPassword = document.ForumRegis.Password.value
	pPasswordL = document.ForumRegis.Password.value.length
	pEmail = document.ForumRegis.Email.value
	pPrivatMessage = document.ForumRegis.PrivatMessage.value
	pConditions = document.ForumRegis.Conditions.checked
	pSpam = document.ForumRegis.Spam.checked

	if(delSpace(pNick)==""||pNickL<2){
	   //document.ForumRegis.Nick.value = ""
	   document.ForumRegis.Nick.focus()
	   alert("הכינוי חייב להיות לפחות 2 תווים")
	   return false
	}
	
	if(delSpace(pPassword)==""||pPasswordL<4){
	   //document.ForumRegis.Password.value = ""
	   document.ForumRegis.Password.focus()
	   alert("הסיסמא חייבל להיות לפחות 4 תווים")
	   return false
	}
	
	if(delSpace(pEmail)==""){
	   //document.ForumRegis.Email.value = ""
	   document.ForumRegis.Email.focus()
	   alert("אנא הזן דוא\"ל")
	   return false
	}else{
	    if(pEmail.indexOf(".")==-1||pEmail.indexOf("@")==-1){
	      alert("כתובת הדוא\"ל אינה חוקית")
		  return false
	    }
	}
	
	if(pConditions==false){
	   alert("אנא סמן כי קראת את תנאי השימוש בפורמים")
	   return false
	}
	
	if(pSpam==true){
	   pSpam = "-1"
	}else{
	   pSpam = "0"
	}
	
	document.ForumRegis.sendi.value = "אנא המתן.."
	document.ForumRegis.sendi.disabled = true
	
	var url="AJAXForumDetails.asp?sid=" + Math.random() + "&Nick=" + escape(pNick) + "&Password=" + escape(pPassword) + "&Email=" + escape(pEmail) + "&PrivatMessage=" + escape(pPrivatMessage) + "&Spam=" + pSpam
    xmlHttp=GetXmlHttpObjectSubject(XMLForumDetails)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}

function XMLForumDetails(){ 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		pSplit = pstrtohandle.split("~");
		pLoc = pSplit[0]
		pText = pSplit[1]
		
		if(pText=="OK"){
			if(pLoc==""){
			   document.location.reload()
			}else{
			   document.location = pLoc
			}
		}else{
		    document.ForumRegis.sendi.value = "הרשמה"
			document.ForumRegis.sendi.disabled = false
			alert(pText.replace(/@/g, "\n"))
		}
   } 
   
   return false
}



function forumRegisMod(){
	pNick = document.ForumRegis.Nick.value
	pNickL = document.ForumRegis.Nick.value.length
	pPassword = document.ForumRegis.Password.value
	pPasswordL = document.ForumRegis.Password.value.length
	pEmail = document.ForumRegis.Email.value
	pPrivatMessage = document.ForumRegis.PrivatMessage.value
	pRedi = document.ForumRegis.Redi.value
	pSpam = document.ForumRegis.Spam.checked
	

	if(delSpace(pNick)==""||pNickL<2){
	   //document.ForumRegis.Nick.value = ""
	   document.ForumRegis.Nick.focus()
	   alert("הכינוי חייב להיות לפחות 2 תווים")
	   return false
	}
	
	if(delSpace(pPassword)==""||pPasswordL<4){
	   //document.ForumRegis.Password.value = ""
	   document.ForumRegis.Password.focus()
	   alert("הסיסמא חייבל להיות לפחות 4 תווים")
	   return false
	}
	
	if(delSpace(pEmail)==""){
	   //document.ForumRegis.Email.value = ""
	   document.ForumRegis.Email.focus()
	   alert("אנא הזן דוא\"ל")
	   return false
	}else{
	    if(pEmail.indexOf(".")==-1||pEmail.indexOf("@")==-1){
	      alert("כתובת הדוא\"ל אינה חוקית")
		  return false
	    }
	}
	
	if(pSpam==true){
	   pSpam = "-1"
	}else{
	   pSpam = "0"
	}
	
	document.ForumRegis.sendi.value = "אנא המתן.."
	document.ForumRegis.sendi.disabled = true
	
	var url="AJAXForumDetails.asp?sid=" + Math.random() + "&Nick=" + escape(pNick) + "&Password=" + escape(pPassword) + "&Email=" + escape(pEmail) + "&PrivatMessage=" + escape(pPrivatMessage) + "&Redi=" + pRedi + "&Spam=" + pSpam
    xmlHttp=GetXmlHttpObjectSubject(XMLForumDetailsMod)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}


function XMLForumDetailsMod(){ 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		pSplit = pstrtohandle.split("~");
		pLoc = pSplit[0]
		pText = pSplit[1]
		
		if(pText=="OK"){
			if(pLoc==""){
			   document.location.reload()
			}else{
			   document.location = pLoc
			}
		}else{
		    document.ForumRegis.sendi.value = "עדכון"
			document.ForumRegis.sendi.disabled = false
			alert(pText.replace(/@/g, "\n"))
		}
   } 
   
   return false
}



function ForumMessage(){
  fileUp = "0"
  strAppVersion = navigator.appVersion;
  var pSubjecti = document.FaddMessage.Subjecti.value
  var pFilei  = document.FaddMessage.Filei.value.toLowerCase()
  var pFileiDesc = document.FaddMessage.FileiDesc.value
  var pBuffer  = document.FaddMessage.Buf.value
  pSubjectiCheck = pSubjecti.replace(/ /g, "")
  pFileiDescCheck = pFileiDesc.replace(/ /g, "")
  
  
  if(pSubjectiCheck==""){
     document.FaddMessage.Subjecti.value = ""
	 alert("נושא ההודעה אינו יכול להיות ריק")
	 return false
  }
  
  if(pFilei!=""){
     if(pFilei.indexOf(".doc")==-1&&pFilei.indexOf(".pdf")==-1&&pFilei.indexOf(".gif")==-1&&pFilei.indexOf(".jpg")==-1){
	    alert("רק קבצים מסוג PDF או DOC או GIF או JPG או TIF ניתנים להוספה")
		return false
	 }else{
	    if(pFileiDescCheck==""){
		   alert("תיאור הקובץ אינו יכול להיות ריק")
		   return false
		}else{
		   fileUp = "-1"
		}
	 }
  }

  
  if(fileUp=="-1"){  
	  if(strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4){
	      winstyle = "dialogWidth=375px; dialogHeight:130px; center:yes";
	      window.showModelessDialog(pBuffer+'&b=IE',null,winstyle);
	  }else{
			window.open(pBuffer+'&b=NN','','width=370,height=115', true);
			}
  }
  
  document.FaddMessage.sendi.value = "מעבד נתונים...אנא המתן."
  document.FaddMessage.sendi.disabled = true
  
}

function deleteMessage(topi,who){
  if (confirm("?האם אתה בטוח שברצונך למחוק הודעה זו\n     שים לב, כל הנגררות של הודעה זו ימחקו\n                    !!!אין אפשרות לשחזר פעולה זו")){
      var url="AJAXForumDelete.asp?sid=" + Math.random() + "&Topic=" + escape(topi) + "&ID=" + escape(who)
      xmlHttp=GetXmlHttpObjectSubject(XMLDeleteMessage)
      xmlHttp.open("GET", url , true)
      xmlHttp.send(null)
      return false
  }else{
      return false
  }
}


function XMLDeleteMessage(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		//document.getElementById("err").innerHTML = pstrtohandle
		document.location.reload()
	  } 
}


function viewForumContent(topic,id,page,searchKey){
   document.getElementById("tempFID").value = id
   
   if(document.getElementById("TR"+id).style.display=="none"){
      document.getElementById("Content"+id).innerHTML = "<img src=\"Images/Loading.gif\" width=\"16\" height=\"16\" border=\"0\" align=\"middle\"> טוען נתונים...אנא המתן"
      document.getElementById("TR"+id).style.display = ""
	  
	  var url="AJAXForumGetMessage.asp?sid=" + Math.random() + "&Topic=" + escape(topic) + "&ID=" + escape(id) + "&page=" + escape(page) + "&key=" + escape(searchKey)
      xmlHttp=GetXmlHttpObjectSubject(XMLGetMessage)
      xmlHttp.open("GET", url , true)
      xmlHttp.send(null)
	  
   }else{
      document.getElementById("Content"+id).innerHTML = ""
      document.getElementById("TR"+id).style.display = "none"
	  return false
   }
}


function XMLGetMessage(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		document.getElementById("Content"+document.getElementById("tempFID").value).innerHTML = pstrtohandle
	  } 
}


function searchForum(){
  var Keyw = document.formiSearch.KeyWord.value;
  var KeyUser = document.formiSearch.KeyUser.value;

  pKeywCheck = Keyw.replace(/ /g, "")
  pKeywCheckL = Keyw.replace(/ /g, "").length
  
  pKeyUserCheck = KeyUser.replace(/ /g, "")
  pKeyUserCheckL = KeyUser.replace(/ /g, "").length
  
  if((pKeywCheck==""||pKeywCheckL<2)&&(pKeyUserCheck==""||pKeyUserCheckL<2)){
	 
	 if(pKeywCheck==""||pKeywCheckL==0){
	    document.formiSearch.KeyWord.value = ""
	 }
	 
	 if(pKeyUserCheck==""||pKeyUserCheckL==0){
	    document.formiSearch.KeyUser.value = ""
	 }
	 
	 alert("אנא הזן ערך לחיפוש בשדה התוכן ו/או בשדה הכינוי\n                         הערכים חייבים להיות לפחות 2 תווים")
	 return false
  }
  
}

function ContactUs(){
   document.formi.Phone.value = delSpace(document.formi.Phone.value)
   document.formi.Cell.value = delSpace(document.formi.Cell.value)
   document.formi.Email.value = delSpace(document.formi.Email.value)
   
   pNamei = document.formi.Namei.value.length
   pPhone = document.formi.Phone.value
   pCell = document.formi.Cell.value
   pPhoneL = document.formi.Phone.value.length
   pCellL = document.formi.Cell.value.length
   pEmail = document.formi.Email.value
   
   
   if(pNamei<2){
      document.formi.Namei.focus()
	  alert("יש להזין שם")
	  return false
   }
   
   if(pPhone==""&&pCell==""){
      document.formi.Cell.focus()
	  alert("יש להזין מספר טלפון או מספר נייד")
	  return false
   }else{
	   if(pPhone!=""&&pPhoneL<9){
	      document.formi.Phone.focus()
		  alert("מספר הטלפון חייב להיות כולל קידומת")
		  return false
	   }
	   
	   if(pCell!=""&&pCellL<10){
	      document.formi.Cell.focus()
		  alert("מספר הנייד חייב להיות כולל קידומת")
		  return false
	   }
   }
   
   if(pEmail==""){
	     document.formi.Email.focus()
		 alert("יש להזין כתובת דוא\"ל")
		 return false
	}else{
	    if(pEmail.indexOf(".")==-1||pEmail.indexOf("@")==-1){
	      document.formi.Email.focus()
		  alert("כתובת הדוא\"ל אינה חוקית")
		  return false
	    }
	}
	
	
   document.formi.sendi.value = "שולח טופס....אנא המתן"
   document.formi.sendi.disabled=true
   document.formi.action = "Site_ContactUsExec.asp"
}


function AddvCheck(){
   countiCat = 0
   pCategories1 = document.regis.Categories1.value
   pmonthi = document.regis.monthi.value*1
   pyeari = document.regis.yeari.value*1
   pMetapel = document.regis.Metapel.checked
   pSpa = document.regis.Spa.checked
   pZimer = document.regis.Zimer.checked
   pCollege = document.regis.College.checked
   pStore = document.regis.Store.checked
   pBName = delSpace(document.regis.BName.value)
   pBContact = delSpace(document.regis.BContact.value)
   pBKey = delSpace(document.regis.BKey.value)
   pBPhone = delSpace(document.regis.BPhone.value)
   pBCity = delSpace(document.regis.BCity.value)
   pBAddress = delSpace(document.regis.BAddress.value)
   pBEmail = delSpace(document.regis.BEmail.value)
   
   pCCNum = delSpace(document.regis.CCNum.value)
   pCCNumL = pCCNum.length
   pempMonth = document.regis.empMonth.value*1
   pempYear = document.regis.empYear.value*1
   pCCIdent = delSpace(document.regis.CCIdent.value)
   
   pSecureCode = delSpace(document.regis.SecureCode.value)
   
   if(pMetapel==false&&pSpa==false&&pZimer==false&&pCollege==false&&pStore==false){
      alert("אנא בחר סוג עסק")
      return false
   }
   
   if(pBName==""){
      document.regis.BName.value=""
	  document.regis.BName.focus()
      alert("יש להזין שם / שם עסק")
      return false
   }
   
   if(pBContact==""){
      document.regis.BContact.value=""
	  document.regis.BContact.focus()
      alert("יש להזין איש קשר")
      return false
   }
   
   if(pBKey==""){
      document.regis.BKey.value=""
	  document.regis.BKey.focus()
      alert("יש להזין משפט מפתח")
      return false
   }
   
   if(pBPhone==""){
      document.regis.BPhone.value=""
	  document.regis.BPhone.focus()
      alert("יש להזין מספר טלפון")
      return false
   }
   
   if(pBCity==""){
	  document.regis.BCity.focus()
      alert("יש לבחור אזור מגורים")
      return false
   }
   
   if(pBAddress==""){
      document.regis.BAddress.value=""
	  document.regis.BAddress.focus()
      alert("יש להזין כתובת")
      return false
   }
   
   if(pBEmail==""){
	     document.regis.BEmail.value=""
		 document.regis.BEmail.focus()
		 alert("יש להזין כתובת דוא\"ל")
		 return false
	}else{
	    if(pBEmail.indexOf(".")==-1||pBEmail.indexOf("@")==-1){
	      document.regis.BEmail.focus()
		  alert("כתובת הדוא\"ל אינה חוקית")
		  return false
	    }
	}
	
    for (i=0;i<=pCategories1;i++){
       if(document.regis.BCategory.options[i].selected==true){
	     countiCat = countiCat + 1
	   }
    }
	
	if(pMetapel==true){
		if(countiCat==0){
		   document.regis.BCategory.focus()
		   alert("אנא בחר לפחות תחום טיפול אחד")
		   return false
		}else{
		   if(countiCat>5){
		      document.regis.BCategory.focus()
		      alert("ניתן לבחור עד 5 תחומי טיפול")
		      return false
		   }
		}
	}
	
	if(document.regis.PirsumType[0].checked==false&&document.regis.PirsumType[1].checked==false){
   	    alert("יש לבחור את סוג הפרסום")
        return false
    }
	
	if(pCCNum==""){
	  document.regis.CCNum.focus()
      alert("יש להזין מספר כרטיס אשראי")
      return false
   }else{
   	  if(pCCNumL<8){
	  	document.regis.CCNum.focus()
        alert("יש להזין מספר כרטיס אשראי חוקי")
        return false
	  }
   }
   
   if(pempMonth==""||pempYear==""){
   	   alert("יש לבדוק תוקף כרטיס אשראי")
	   return false
   }else{
   		if(pempYear==pyeari&&pempMonth<pmonthi){
			alert("יש לבדוק תוקף כרטיס אשראי")
	   		return false
		}
   }
	
	if(ValidateID(pCCIdent)!="1"){
	   document.regis.CCIdent.focus()
       alert("יש לבדוק את מספר תעודת הזהות")
	   return false
    }else{
   	   if(pCCIdent*1==0){
	  	 document.regis.CCIdent.focus()
      	 alert("יש לבדוק את מספר תעודת הזהות")
	  	 return false
	   }
    }	
	
	if(pSecureCode==""){
	  document.regis.SecureCode.focus()
      alert("אנא הזן קוד גישה")
      return false
   }else{
      var url="SecureCodeAjax.asp?sid=" + Math.random() + "&SecureCode=" + escape(pSecureCode) + "&Phone=" + escape(pBPhone) + "&Email=" + escape(pBEmail)
	  xmlHttp=GetXmlHttpObjectSubject(XMLSecureCode)
	  xmlHttp.open("GET", url , true)
	  xmlHttp.send(null)
	  return false
   }
}

function XMLSecureCode(){
   var message = ""
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		
		if(pstrtohandle.indexOf("~")==-1){
		   alert("ישנן שגיאות זמניות - לא ניתן להוסיף רשומה")
           return false
		}else{
		   pSplit = pstrtohandle.split("~")
		   pType = pSplit[0]
		   pText = pSplit[1]
		   
		   if(pType=="ok"){
		      document.regis.BCategory.disabled = false
			  document.regis.sendi.value = "אנא המתן...."
			  document.regis.sendi.disabled=true
			  document.regis.action = "Site_AdvertiseExec.asp"
			  document.regis.submit()
		   }else{
		      document.getElementById("secImage").src="dump.asp?dump=" + Math.random()
			  document.regis.SecureCode.value=""
			  document.regis.SecureCode.focus()
			  alert(pText)
			  return false
		   }
		   
		}
		
   }
}



function AddvPayCheck(){
   pmonthi = document.regis.monthi.value*1
   pyeari = document.regis.yeari.value*1
   pCCNum = delSpace(document.regis.CCNum.value)
   pCCNumL = pCCNum.length
   pempMonth = document.regis.empMonth.value*1
   pempYear = document.regis.empYear.value*1
   pCCIdent = delSpace(document.regis.CCIdent.value)
   
   
   if(document.regis.PirsumType[0].checked==false&&document.regis.PirsumType[1].checked==false){
   	    alert("יש לבחור את סוג הפרסום")
        return false
   }
  
	if(pCCNum==""){
	  document.regis.CCNum.focus()
      alert("יש להזין מספר כרטיס אשראי")
      return false
   }else{
   	  if(pCCNumL<8){
	  	document.regis.CCNum.focus()
        alert("יש להזין מספר כרטיס אשראי חוקי")
        return false
	  }
   }
   
   if(pempMonth==""||pempYear==""){
   	   alert("יש לבדוק תוקף כרטיס אשראי")
	   return false
   }else{
   		if(pempYear==pyeari&&pempMonth<pmonthi){
			alert("יש לבדוק תוקף כרטיס אשראי")
	   		return false
		}
   }
	
	if(ValidateID(pCCIdent)!="1"){
	   document.regis.CCIdent.focus()
       alert("יש לבדוק את מספר תעודת הזהות")
	   return false
    }else{
   	   if(pCCIdent*1==0){
	  	 document.regis.CCIdent.focus()
      	 alert("יש לבדוק את מספר תעודת הזהות")
	  	 return false
	   }
    }	
	
	document.regis.sendi.value = "אנא המתן...."
    document.regis.sendi.disabled=true
    document.regis.action = "Site_AdvertisePayExec.asp"
    document.regis.submit()
	
}






function disCat(who){
   pCategories1 = document.regis.Categories1.value
   
   if(who.checked==true){
      document.regis.BCategory.disabled = false
   }else{
      for (i=0;i<=pCategories1;i++){
         document.regis.BCategory.options[i].selected=false
      }	  
	  document.regis.BCategory.disabled = true
   }
}

function adsCheck(){
   pDatei = delSpace(document.formi.Datei.value)
   pTitlei = delSpace(document.formi.Titlei.value)
   
   if(pDatei==""){
	  document.formi.Datei.value=""
	  document.formi.Datei.focus()
      alert("יש להזין תאריך אירוע")
      return false
   }
   
   if(pTitlei==""){
      document.formi.Titlei.value=""
	  document.formi.Titlei.focus()
      alert("יש להזין כותרת")
      return false
   }
   
   document.formi.action = "Site_AdsAddExec.asp"
   document.formi.sendi.value = "מעבד נתונים...אנא המתן.."
   document.formi.sendi.disabled = true
   
}

function GetCalendarDate(datei){
    var url="CalendarHP_Ajax.asp?sid=" + Math.random() + "&Datei=" + escape(datei)
	xmlHttp=GetXmlHttpObjectSubject(XMLCalendarDate)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	return false
}

function XMLCalendarDate(){
   var message = ""
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		document.getElementById("CalBox").innerHTML = pstrtohandle
   }
}

function ads1(){
   setTimeout("ads2()",5000)
}

function ads2(){
   pID = document.getElementById("ID").value
   
   var url="XML_AdsActivate.asp?sid=" + Math.random() + "&ID=" + escape(pID)
   xmlHttp=GetXmlHttpObjectSubject(XMLads2)
   xmlHttp.open("GET", url , true)
   xmlHttp.send(null)
   return false
}

function XMLads2(){
   var message = ""
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		if(pstrtohandle=="OK"){
		   document.location = "Site_AdsGetEvents.asp?Date="+document.getElementById("Datei").value
		}else{
		   setTimeout("ads2()",5000)
		}
   }
}

function ViewMetapelList(loopi){
    for (i=0;i<=loopi;i++){
       document.getElementById("MetapelTR_"+i).style.display = ""
	   document.getElementById("MetapelTRLine_"+i).style.display = ""
    }
	
	document.getElementById("MoreMetpels").style.display = "none"
}


function setStoreClick(item,customer,type){
    var url="/Store/XML_SetClick.asp?sid=" + Math.random() + "&item=" + escape(item) + "&customer=" + escape(customer) + "&type=" + escape(type)
    xmlHttp=GetXmlHttpObjectSubject(XMLStoreClicks)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}

function XMLStoreClicks(){
   var message = ""
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
   }
}


function setProducts(){
    if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
			  winW = window.innerWidth;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			  winW = document.body.offsetWidth;
		 }
    }
		
	if(winW!=""&&winW!="undefined"){
	   if(winW*1>=1024){
	      document.getElementById("Products1").style.display = ""
	      document.getElementById("Products2").style.display = ""
		  setTimeout("getHomePageProducts()",2000)
	   }else{
	      document.getElementById("Products1").style.display = "none"
	      document.getElementById("Products2").style.display = "none"
	   }
	}else{
	   document.getElementById("Products1").style.display = "none"
	   document.getElementById("Products2").style.display = "none"
	}
}


function getHomePageProducts(){
    var url="Store_HomePageProducts.asp?sid=" + Math.random()
    xmlHttp=GetXmlHttpObjectSubject(XMLHomePageProducts)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
}

function XMLHomePageProducts(){
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		
		if(pstrtohandle.indexOf("~")!=-1){
		   pSplit = pstrtohandle.split("~");
		   pDiv1 = pSplit[0]
		   pDiv2 = pSplit[1]
		   document.getElementById("Products1").innerHTML = pDiv1
		   document.getElementById("Products2").innerHTML = pDiv2
		}
    }
}


function ValidateID(str){ 
   //INPUT VALIDATION
   var R_ELEGAL_INPUT = -1;
   var R_NOT_VALID = -2;
   var R_VALID = 1; 

   // Just in case -> convert to string
   var IDnum = String(str);

   // Validate correct input
   if ((IDnum.length > 9) || (IDnum.length < 5))
      return R_ELEGAL_INPUT; 
   if (isNaN(IDnum))
      return R_ELEGAL_INPUT;

   // The number is too short - add leading 0000
   if (IDnum.length < 9)
   {
      while(IDnum.length < 9)
      {
         IDnum = '0' + IDnum;         
      }
   }

   // CHECK THE ID NUMBER
   var mone = 0, incNum;
   for (var i=0; i < 9; i++)
   {
      incNum = Number(IDnum.charAt(i));
      incNum *= (i%2)+1;
      if (incNum > 9)
         incNum -= 9;
      mone += incNum;
   }
   if (mone%10 == 0)
      return R_VALID;
   else
      return R_NOT_VALID;
}

function GetXmlHttpObjectSubject(handler){ 
var objXmlHttp=null

if (navigator.userAgent.indexOf("MSIE")>=0){ 
	var strName="Msxml2.XMLHTTP"
	if (navigator.appVersion.indexOf("MSIE 5.5")>=0){
		strName="Microsoft.XMLHTTP"
	} 
        try{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 
			return objXmlHttp
		} 
catch(e){ 
	alert("Error. Scripting for ActiveX might be disabled") 
	return 
	} 
} 

objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp

}

