function ShowID(who){
	pLastVal = document.getElementById("LastID").value
	
	if(pLastVal!="") HideID(pLastVal)
	
	document.getElementById(who).style.display = ""
	
	document.getElementById("LastID").value = who
}

function HideID(who){
	document.getElementById(who).style.display = "none"
	document.getElementById("LastID").value = ""
}




function regisHeb(){
	pRedi = document.Registration.Redi.value
	pFname = document.Registration.Fname.value
	pLname = document.Registration.Lname.value
	pStreet = document.Registration.Street.value
	pNumber = document.Registration.Number.value
	pCity = document.Registration.City.value
	pZip = document.Registration.Zip.value
	pPhone = document.Registration.Phone.value
	pEmail = document.Registration.Email.value
	preEmail = document.Registration.reEmail.value
	
	if(delSpace(pFname)==""){
	   alert("יש להזין שם פרטי")
	   document.Registration.Fname.focus()
	   document.Registration.Fname.select()
	   return false
	}
	
	if(delSpace(pLname)==""){
	   alert("יש להזין שם משפחה")
	   document.Registration.Lname.focus()
	   document.Registration.Lname.select()
	   return false
	}
	
	if(delSpace(pStreet)==""){
	   alert("יש להזין רחוב")
	   document.Registration.Street.focus()
	   document.Registration.Street.select()
	   return false
	}
	
	if(delSpace(pNumber)==""){
	   alert("יש להזין מספר בית")
	   document.Registration.Number.focus()
	   document.Registration.Number.select()
	   return false
	}
	
	if(delSpace(pCity)==""){
	   alert("יש להזין עיר מגורים")
	   document.Registration.City.focus()
	   document.Registration.City.select()
	   return false
	}
	
	if(delSpace(pPhone)==""){
	   alert("יש להזין טלפון או טלפון סלולרי")
	   document.Registration.Phone.focus()
	   document.Registration.Phone.select()
	   return false
	}
	
	
	if(delSpace(pEmail)!=""){
	    if(pEmail.indexOf("@")==-1&&pEmail.indexOf(".")==-1){
		   alert("כתובת הדוא\"ל אשר הזנת אינה חוקית")
		   document.Registration.Email.focus()
		   document.Registration.Email.select()
		   return false
		}
	}
	
    if(delSpace(preEmail)!=delSpace(pEmail)){
	   alert("אימות הדוא\"ל אשר הזנת אינו תואם לדוא\"ל")
	   document.Registration.reEmail.focus()
	   document.Registration.reEmail.select()
	   return false
    }

	var url=pRedi+"?sid=" + Math.random() + "&Fname=" + escape(pFname) + "&Lname=" + escape(pLname) + "&Street=" + escape(pStreet) + "&Number=" + escape(pNumber) + "&City=" + escape(pCity) + "&Zip=" + escape(pZip) + "&Phone=" + escape(pPhone) + "&Email=" + escape(pEmail)
    xmlHttp=GetXmlHttpObjectSubject(XMLregis)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
	
	
}



function regisEng(){
	pRedi = document.Registration.Redi.value
	pFname = document.Registration.Fname.value
	pLname = document.Registration.Lname.value
	pStreet = document.Registration.Street.value
	pNumber = document.Registration.Number.value
	pCity = document.Registration.City.value
	pZip = document.Registration.Zip.value
	pPhone = document.Registration.Phone.value
	pEmail = document.Registration.Email.value
	preEmail = document.Registration.reEmail.value
	
	if(delSpace(pFname)==""){
	   alert("Please enter your first name")
	   document.Registration.Fname.focus()
	   document.Registration.Fname.select()
	   return false
	}
	
	if(delSpace(pLname)==""){
	   alert("Please enter your last name")
	   document.Registration.Lname.focus()
	   document.Registration.Lname.select()
	   return false
	}
	
	if(delSpace(pStreet)==""){
	   alert("Please enter street name")
	   document.Registration.Street.focus()
	   document.Registration.Street.select()
	   return false
	}
	
	if(delSpace(pNumber)==""){
	   alert("Please enter home number")
	   document.Registration.Number.focus()
	   document.Registration.Number.select()
	   return false
	}
	
	if(delSpace(pCity)==""){
	   alert("Please enter your city")
	   document.Registration.City.focus()
	   document.Registration.City.select()
	   return false
	}
	
	if(delSpace(pPhone)==""){
	   alert("Please enter your phone / cell phone number")
	   document.Registration.Phone.focus()
	   document.Registration.Phone.select()
	   return false
	}
	
	if(delSpace(pEmail)!=""){
	    if(pEmail.indexOf("@")==-1&&pEmail.indexOf(".")==-1){
		   alert("Your email address is invalid")
		   document.Registration.Email.focus()
		   document.Registration.Email.select()
		   return false
		}
	}
	
    if(delSpace(preEmail)!=delSpace(pEmail)){
	   alert("Your email verification is invalid")
	   document.Registration.reEmail.focus()
	   document.Registration.reEmail.select()
	   return false
    }
	
	
	var url=pRedi+"?sid=" + Math.random() + "&Fname=" + escape(pFname) + "&Lname=" + escape(pLname) + "&Street=" + escape(pStreet) + "&Number=" + escape(pNumber) + "&City=" + escape(pCity) + "&Zip=" + escape(pZip) + "&Phone=" + escape(pPhone) + "&Email=" + escape(pEmail)
    xmlHttp=GetXmlHttpObjectSubject(XMLregis)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false
	
	
}


function XMLregis(){ 
	var message = ""
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		pstrtohandle = xmlHttp.responseText
		//alert(pstrtohandle)
		
		document.Registration.Fname.value = ""
		document.Registration.Lname.value = ""
		document.Registration.Street.value = ""
		document.Registration.Number.value = ""
		document.Registration.City.value = ""
		document.Registration.Zip.value = ""
		document.Registration.Phone.value = ""
	    document.Registration.Email.value = ""
	    document.Registration.reEmail.value = ""
		
		window.location = "RegSuccess.asp"
	} 
}















function delSpace(what){
  return what.replace(/ /g, "")
}

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

}
