function usercheck()
{ 
var drop= new Array();
var v=document.getElementById("user_name").value;
//var listboxobj=document.getElementById("avl_counties");
if(v=="") {
	document.getElementById("user").innerHTML="Please enter a username.";
	document.getElementById("desired_url").value="";
	document.getElementById("user_name").focus();
	document.getElementById("submit").disabled=true;
}
else {
var window_url="usercheck.php?n="+v;
//alert(window_url);
	var http = null; 
	var res;
	if(window.XMLHttpRequest)  http = new XMLHttpRequest(); 
	else 
	   if (window.ActiveXObject)  http = new ActiveXObject("Microsoft.XMLHTTP"); 
		  http.onreadystatechange = function()
		  { 
			if(http.readyState == 4)
			{
			   if(http.status == 200)
			   {
				 if (http.responseText!="")
				 {
					res=http.responseText;
					if (res.indexOf("Failed")==-1)
					{
						if(res=="error")
						{
						document.getElementById("user").innerHTML="User name already in use, try another name";
						document.getElementById("desired_url").value="";
						document.getElementById("user_name").focus();
						document.getElementById("submit").disabled=true;
						}
						else
						{
							document.getElementById("user").innerHTML="Username Accepted";
							document.getElementById("desired_url").value=v;
							document.getElementById("submit").disabled=false;
						}
					
					}
					else
					{
						alert("Unable to Attach");
					}								
				  }
				  else
	    		   {
					alert("No response");
					}
				}
				else alert("Error code " + http.status);
			 
			}
		}
		http.open("GET",window_url,true); 
		http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		http.send(null);
	}
}
function chpwd()
{
if(document.getElementById("user_name").value=='')
{
alert("Please select a username");
document.getElementById("user_name").focus();
return false;
}
if(document.getElementById("password").value=='')
{
alert("Please enter password");
document.getElementById("password").focus();
return false;
}
if(document.getElementById("cpassword").value=='')
{
alert("Please retype your password");
document.getElementById("cpassword").focus();
return false;
}
if(document.getElementById("password").value!=document.getElementById("cpassword").value)
{
alert("Password should match with Re-type password");
document.getElementById("cpassword").focus();
return false;
}
if(document.getElementById("password").value.length<6 || document.getElementById("password").value.length>12)
{
alert("password length should be minimum 6 and maximum 12");
document.getElementById("password").focus();
return false;
}
if(document.getElementById("name").value=='')
{
alert("Please fill in your full name");
document.getElementById("name").focus();
return false;
}
if(document.getElementById("address1").value=='')
{
alert("Please fill in your address");
document.getElementById("address1").focus();
return false;
}
if(document.getElementById("city").value=='')
{
alert("Please fill in the city you come from");
document.getElementById("city").focus();
return false;
}
if(document.getElementById("state").value=='')
{
alert("Please fill in the state");
document.getElementById("state").focus();
return false;
}
if(document.getElementById("zip_code").value=='')
{
alert("Please fill in the Zip Code");
document.getElementById("zip_code").focus();
return false;
}
if(document.getElementById("phone").value=='')
{
alert("Please enter your phone number");
document.getElementById("phone").focus();
return false;
}
if(document.getElementById("email1").value=='')
{
alert("Please fill in your email address");
document.getElementById("email1").focus();
return false;
}
if(document.getElementById("genre").value=='0')
{
alert("Please select the music genre");
document.getElementById("genre").focus();
return false;
}
if(!document.getElementById("termscheck").checked)
{
alert("You must accept OCMUSIC FEST Terms &amp; Conditions for registering");
document.getElementById("termscheck").focus();
return false;
}
}
var testresults
function checkemail(email){
var str=document.getElementById(email).value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str)) testresults=true
else{
	alert("Please input a valid email address!")
	testresults=false
	document.getElementById(email).focus()
	}
return (testresults)
}

