/*
	refCookie=Request.Cookies("referrer")
	if len(refCookie)=0 then
		refCookie="not found"
	else
		refCookie=replace(refCookie,"stored_","")
	end if
*/	
	
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"=stored_"+value+expires+"; path=/";
	}
	
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	
	
	var allCookies=document.cookie;
	var pos=allCookies.indexOf("referrer=stored_");
	if(pos==-1){
		createCookie("referrer",escape(document.referrer),1000)
	}
	
	
	
	
	function procForm(){
		
		var dateLocal=new Date();
		
		document.JoinForm.localYea.value=dateLocal.getFullYear()+"";
		document.JoinForm.localMon.value=dateLocal.getMonth()+"";
		document.JoinForm.localDay.value=dateLocal.getDate()+"";
		document.JoinForm.localHou.value=dateLocal.getHours()+"";
		document.JoinForm.localMin.value=dateLocal.getMinutes()+"";
		document.JoinForm.localSec.value=dateLocal.getSeconds()+"";
		
		var refCookie = readCookie('referrer');
		if (refCookie) {
			refCookie=refCookie.replace(/stored_/,"");
			document.JoinForm.Referer.value=unescape(refCookie);
		}
		else{
			document.JoinForm.Referer.value="not found";
		}
		
		
	}
	
	
	function countryCheck(){
		
		var index=document.JoinForm.Country.selectedIndex;
		var countryName=document.JoinForm.Country[index].value;
		
		if(countryName!="Choose"){
			if(countryName==7 || countryName==25 || countryName==54 ||
				countryName==58 || countryName==75 || countryName==77 ||
				countryName==79|| countryName==112 || countryName==113 ||
				countryName==125 || countryName==129 || countryName==130 ||
				countryName==143 || countryName==145 || countryName==151 ||
				countryName==165 || countryName==166){
				
				//	submit down as it is with level one passed to indicate that the next level down from the country	
				//	has been selected. Also pass country through
				
				document.JoinForm.countryLevel.value=1;
				document.JoinForm.method="Post";
				document.JoinForm.action="jewish-dating.asp";
				document.JoinForm.submit();
			}
			else{
				if(document.JoinForm.countryLevel.value!=0){
					document.JoinForm.countryLevel.value=0;
					document.JoinForm.method="Post";
					document.JoinForm.action="jewish-dating.asp";
					document.JoinForm.submit();
				}
			}
		}
	}
	
	function getSublocations(){
		if(document.JoinForm.locations[document.JoinForm.locations.selectedIndex].value!="Choose"){
			document.JoinForm.countryLevel.value=2;
			document.JoinForm.method="Post";
			document.JoinForm.action="jewish-dating.asp";
			document.JoinForm.submit();
		}
	}
	function usernameCheck(x){
		if(x){
			if(document.JoinForm.Username.value=="Choose a username")document.JoinForm.Username.value="";
		}
		else{
			if(document.JoinForm.Username.value=="")document.JoinForm.Username.value="Choose a username";
		}
	}
	function emailCheck(x){
		if(x){
			if(document.JoinForm.email.value=="Your email address")document.JoinForm.email.value="";
		}
		else{
			if(document.JoinForm.email.value=="")document.JoinForm.email.value="Your email address";
		}
	}
	

