	
	function memberslogin(){
	document.entry.ENTER.value="ENTER";
	document.entry.submit();
	}

	function onEnter( evt, frm ) {
		var keyCode = null;
		if( evt.which ) {			//for Netscape,Firefox,Opera
			keyCode = evt.which;
		} else if( evt.keyCode ) {	//for IE
			keyCode = evt.keyCode;
		}
		
		if( 13 == keyCode ) {
			frm.ENTER.value="ENTER";
			frm.submit();
		return false;
		}
		return true;
	}
	
	function TermsCond(){
		mypopup=window.open('online-dating/rules.asp','popup','toolbar=no,location=no,directories=no,status=no,' + 
		'menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,top=0,left=0,width=420,height=440');
	}

	
	
	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";
		}
	}

	var xmlHttp;
	function CountryListOnChange() 
	{
		var countryList = document.JoinForm.Country;
		var countryName = countryList.options[countryList.selectedIndex].value;
		var locations="";

		//if(document.all["locations"] != null)
		if(document.JoinForm.locations != null)		
			locations=document.JoinForm.locations[document.JoinForm.locations.selectedIndex].value;		
		else
			locations="Choose";


		if(countryName!=165){
			if(countryName!=75){
				document.getElementById("locid").innerHTML=""
			}
			document.getElementById("sublocid").innerHTML=""		
		}else{
				document.getElementById("locid").innerHTML="";	
				createSelect("locid");
				document.getElementById("sublocid").innerHTML=""						
				createSelect("sublocid");				
		}

		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;
				}
				else{
					if(document.JoinForm.countryLevel.value!=0){
						document.JoinForm.countryLevel.value=0;
				}
			}
		}
	    CreateXmlHttp();
    	if(xmlHttp)
    	{	
        	xmlHttp.onreadystatechange = HandleResponse;
        	if(locations!="" || locations.length!=0){
        		xmlHttp.open("GET", "displayLocation.asp?countryName="+ encodeURIComponent(countryName)+"&countryLevel="+encodeURIComponent(document.JoinForm.countryLevel.value)+"&locations="+locations,  true);
        	}else{
				xmlHttp.open("GET", "displayLocation.asp?countryName="+ encodeURIComponent(countryName)+"&countryLevel="+encodeURIComponent(document.JoinForm.countryLevel.value)+"&locations=Choose",  true);        			
			}	
        	xmlHttp.send(null);           
    	}
	}

//Browser Support Code	
	function CreateXmlHttp()
	{
		if(window.XMLHttpRequest){ 
			xmlHttp = new XMLHttpRequest(); 
		} 
		else if (window.ActiveXObject){ 
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
			if (!xmlHttp){ 
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
			}	
		} 
		return xmlHttp; 			
	}

	function HandleResponse()
	{
		if(xmlHttp.readyState == 4)
		{
        		if(xmlHttp.status == 200)
        		{
					document.getElementById("locid").innerHTML=xmlHttp.responseText;
        		}
        		else
        		{
            			alert("There was a problem retrieving data from the server. "+xmlHttp.statusText );
        		}
    		}
	}
	function HandleResponse_Sub()
	{
		if(xmlHttp.readyState == 4)
		{
        		if(xmlHttp.status == 200)
        		{
					document.getElementById("sublocid").innerHTML=xmlHttp.responseText;
        		}
        		else
        		{
            			alert("There was a problem retrieving data from the server. "+xmlHttp.statusText );
        		}
    		}
	}
	function getSublocations1(){
			var countryList = document.JoinForm.Country;
			var countryName = countryList.options[countryList.selectedIndex].value;	
			var locations;
			if(document.JoinForm.locations[document.JoinForm.locations.selectedIndex].value!="Choose"){
				locations=document.JoinForm.locations[document.JoinForm.locations.selectedIndex].value;
				document.JoinForm.locations_new.value=locations;
				document.JoinForm.countryLevel.value=2;
	    		CreateXmlHttp();
   				if(xmlHttp)
   				{	
       				xmlHttp.onreadystatechange = HandleResponse_Sub;
   					xmlHttp.open("GET", "displaySubLocation.asp?countryName="+ encodeURIComponent(countryName)+"&countryLevel="+encodeURIComponent(document.JoinForm.countryLevel.value)+"&locations="+locations,  true);
       				xmlHttp.send(null);           
   				}		
			}else{
					locations=document.JoinForm.locations[document.JoinForm.locations.selectedIndex].value;
					document.JoinForm.locations_new.value=locations;
					document.getElementById("sublocid").innerHTML=""			
					if(countryName=="165")
						createSelect("sublocid");				
			}
	}
	
	function createSelect(divId){
		var locDiv=document.getElementById(divId);
		var mySelect=document.createElement("select");
		var theOption=document.createElement("OPTION");
		var theText=document.createTextNode("Choose");
		theOption.appendChild(theText);
		theOption.setAttribute("value","Choose");
		mySelect.appendChild(theOption);
		locDiv.appendChild(mySelect); 	
	/*	if(divId=="sublocid"){
			locDiv.appendChild(document.createElement('br'));
			locDiv.appendChild(document.createElement('br'));		
		}
	*/	
	}	


	function getCountryListOnChange(){
		
		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="online-dating-friendship.asp?tstp=<%=tstp%>&dwstat=<%=dwstat%>";
				document.JoinForm.submit();
			}
			else{
				if(document.JoinForm.countryLevel.value!=0){
					document.JoinForm.countryLevel.value=0;
					document.JoinForm.method="Post";
					document.JoinForm.action="online-dating-friendship.asp?tstp=<%=tstp%>&dwstat=<%=dwstat%>";
					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="online-dating-friendship.asp?tstp=<%=tstp%>&dwstat=<%=dwstat%>";
			document.JoinForm.submit();
		}
	}	