function verifyEmail(obj){
	email = document.getElementById('customers_email').value;
	check = obj.value;
	
	if(email != check){
		document.getElementById('emailVerifyCntr').innerHTML = "no Match!";
	}else{
		url = "includes/ajax/verify_email.php?email=" + check;
		makerequest(url,'emailVerifyCntr');			
	}
}

function verifyLogin(obj){
	check = obj.value;
	
	url = "includes/ajax/verify_login.php?login=" + check;
	makerequest(url,'loginVerifyCntr');			
}

function verifyPassword(obj){
	password = document.getElementById('customers_password').value;
	pass = obj.value;
	
	if(password != pass){
		document.getElementById('passwordVerifyCntr').style.color = "#FF0000";		
		document.getElementById('passwordVerifyCntr').innerHTML = "no Match!";
	}else{
		document.getElementById('passwordVerifyCntr').style.color = "#009900";		
		document.getElementById('passwordVerifyCntr').innerHTML = "Match!";
	}
}

function clearField(id){
		document.getElementById(id).value = "";
		field = document.getElementById(id);
		field.parentNode.getElementsByTagName('span')[0].innerHTML = "";
}

function submitForm(){
	if(validateForm() != false){
		document.reg_form.submit();
	}
}

function validateForm(){

	var fname=document.getElementById('customers_fname');
	if ((fname.value==null)||(fname.value=="")){
		fname.parentNode.style.border = "2px solid #FF0000";
		alert("Please fill out all required fields!");	
		return false;
	}else{
		fname.parentNode.style.border = "";
	}
	var lname=document.getElementById('customers_lname');
	if ((lname.value==null)||(lname.value=="")){
		lname.parentNode.style.border = "2px solid #FF0000";
		alert("Please fill out all required fields!");	
		return false;
	}else{
		lname.parentNode.style.border = "";
	}	
	var cEmail=document.getElementById('customers_email');
	if ((cEmail.value==null)||(cEmail.value=="")){
		cEmail.parentNode.style.border = "2px solid #FF0000";
		alert("Please fill out all required fields!");	
		return false;
	}else{
		if(echeck(cEmail.value)==false){
			cEmail.parentNode.style.border = "2px solid #FF0000";
			return false;
		}else{
			cEmail.parentNode.style.border = "";
		}
	}	
	var cEmail2=document.getElementById('customers_email2');
	if ((cEmail2.value==null)||(cEmail2.value=="")){
		cEmail2.parentNode.style.border = "2px solid #FF0000";
		alert("Please fill out all required fields!");	
		return false;
	}else{
		cEmail2.parentNode.style.border = "";
	}	
	var login=document.getElementById('login');
	if ((login.value==null)||(login.value=="")){
		login.parentNode.style.border = "2px solid #FF0000";
		alert("Please fill out all required fields!");	
		return false;
	}else{
		login.parentNode.style.border = "";
	}	
	var password=document.getElementById('customers_password');
	if ((password.value==null)||(password.value=="")){
		password.parentNode.style.border = "2px solid #FF0000";
		alert("Please fill out all required fields!");	
		return false;
	}else{
		password.parentNode.style.border = "";
	}		
	
	//check email
	email = document.getElementById('emailVerifyCntr').firstChild.innerHTML;
	emailCntr = document.getElementById('emailVerifyCntr');
	if(email != "Match!"){
		emailCntr.parentNode.style.border = "2px solid #FF0000";
		alert("eMail must match to continue!");	
		return false;
	}else{
		emailCntr.parentNode.style.border = "";	
	}
	
	//check email
	uname = document.getElementById('loginVerifyCntr').firstChild.innerHTML;
	unameCntr = document.getElementById('loginVerifyCntr');
	if(uname != "Valid!"){
		unameCntr.parentNode.style.border = "2px solid #FF0000";
		alert("Login must be atleast 6 characters long!");	
		return false;
	}else{
		unameCntr.parentNode.style.border = "";	
	}	

//check email
	agreeCntr = document.getElementById('termsCntr');
	if(document.getElementById('agree').checked == true){
		agreeCntr.style.border = "";	
	}else{
		agreeCntr.style.border = "2px solid #FF0000";
		alert("You must agree to the terms of use to continue!");	
		return false;
	}		
}


	
	function changeNewsletter(){
		if(document.getElementById('customers_newsletter').checked == true){
			document.getElementById('customers_newsletter').value = "1";
		}else{
			document.getElementById('customers_newsletter').value = "0";
		}
	}
