function foc(){
	enable_form_values();
	clear_form_values();
	clear_span();
	document.NewUser_SignupForm.submit.disabled=true;
	document.NewUser_SignupForm.txt_email_id.focus();
}

function clear_span(){
	document.getElementById("span_email_id").innerHTML="";
	document.getElementById("span_password").innerHTML="";
	document.getElementById("span_confirm_password").innerHTML="";
	document.getElementById("span_terms_conditions").innerHTML="";
	document.getElementById("span_validation").innerHTML="";
}

function clear_form_values(){
	document.NewUser_SignupForm.txt_email_id.value="";
	document.NewUser_SignupForm.txt_password.value="";
	document.NewUser_SignupForm.txt_confirm_password.value="";
	document.NewUser_SignupForm.chk_terms_conditions.checked=false;
}

function enable_form_values(){
	document.NewUser_SignupForm.txt_email_id.disabled=false;
	document.NewUser_SignupForm.txt_password.disabled=false;
	document.NewUser_SignupForm.txt_confirm_password.disabled=false;
	document.NewUser_SignupForm.chk_terms_conditions.disabled=false;
	document.NewUser_SignupForm.validate.disabled=false;
}

function disable_form_values(){
	document.NewUser_SignupForm.txt_email_id.disabled=true;
	document.NewUser_SignupForm.txt_password.disabled=true;
	document.NewUser_SignupForm.txt_confirm_password.disabled=true;
	document.NewUser_SignupForm.chk_terms_conditions.disabled=true;
	document.NewUser_SignupForm.validate.disabled=true;
}

function copy_form_values(){
	document.NewUser_SignupForm.hid_email_id.value = document.NewUser_SignupForm.txt_email_id.value;
	document.NewUser_SignupForm.hid_password.value = document.NewUser_SignupForm.txt_password.value;
}

function check_form(){
	var email_id 			= document.NewUser_SignupForm.txt_email_id;	
	var password 			= document.NewUser_SignupForm.txt_password;
	var confirm_password 	= document.NewUser_SignupForm.txt_confirm_password;
	var terms_conditions	= document.NewUser_SignupForm.chk_terms_conditions;

	if(check_Null(email_id)==true){
		clear_span();
		document.getElementById("span_email_id").innerHTML="Enter your email id";
		email_id.focus();
		return false;
	}else if(check_Invalid_Email(email_id.value)==true){
		clear_span();
		document.getElementById("span_email_id").innerHTML="Enter a valid email id";
		email_id.focus();
		return false;
	}else if(check_Null(password)==true){
		clear_span();
		document.getElementById("span_password").innerHTML="Enter your password";
		password.focus();
		return false;
	}if(check_Null(confirm_password)==true){
		clear_span();
		document.getElementById("span_confirm_password").innerHTML="Please confirm your password";
		confirm_password.focus();
		return false;
	}else if(password.value!=confirm_password.value){
		clear_span();
		document.getElementById("span_confirm_password").innerHTML="Both the passwords do not match";
		confirm_password.focus();
		return false;
	}else if(terms_conditions.checked==false){
		clear_span();
		document.getElementById("span_terms_conditions").innerHTML="You must agree to the terms and condition to proceed";
		return false;
	}else{
		clear_span();
		document.getElementById("span_validation").innerHTML="Form has been validated. Please Submit";
		document.NewUser_SignupForm.submit.disabled=false;
		copy_form_values();
		disable_form_values();
	}
}
