// JavaScript Document
// for checking valid email;
var check = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; 

// validate numeric
var numeric  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;

// validate date
var date = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;

// validate integer
var integer  = /(^-?\d\d*$)/;
/**************************************************************************/
var seat_no = 0;
var user_name = 0;
// checking seat no if exists in the db or not
function seat(str)
{
	new Ajax.Updater(
				'txtHint1', 
				'ajax/call_steps.php', 
				{
					method: 'get', 
					parameters: "q="+str+"&act=seat",
					onComplete: showResponseSeat
				});
}

function showResponseSeat(originalRequest)
{
	var res = originalRequest.responseText;
	
	if ( res == 1)
	{
		seat_no = 2;
		$('txtHint1').innerHTML = "";
	}
	if ( res == 2)
	{
		seat_no = 0;	
		$('txtHint1').innerHTML = "The seat is already reserved !";
		document.getElementById("seat_no").value = "";
		document.getElementById("seat_no").focus();
	}
		
}


		//Validate Email
function validateEmail(str)
{
	if(document.getElementById("email").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "#55B3FE";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";	
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Please enter Email!";
		document.getElementById("email").focus();	
	}
   else if(!check.test(document.getElementById("email").value))
    {
		document.getElementById("l_email").style.backgroundColor = "#55B3FE";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";	
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Please enter Valid Email!";
		document.getElementById("email").focus();	
    }
	else
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";	
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="";

		document.getElementById("txtemail").innerHTML="Validating.."

	new Ajax.Updater(
				'txtemail', 
				'ajax/call_steps.php', 
				{
					method: 'get', 
					parameters: "q="+str+"&act=Email",
					onComplete: showResponseEmail
				});
	
	}
}


function showResponseEmail(originalRequest)
{
	var res = originalRequest.responseText;
	if ( res == 1)
	{
		Email = 2;
		$('txtemail').innerHTML = "";
	}
	if ( res == 2)
	{
		Email = 0;	
		$('txtemail').innerHTML = "Email Already Exist!";
		document.getElementById("email").value = "";
		document.getElementById("email").focus();
	}
		
}




// validateing email address for correct email formate
// checking if it exists in the db
function validate(str)
{
	if(document.getElementById("username").value =="" )
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "#55B3FE";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";	
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Please enter username!";
		document.getElementById("username").focus();	
	}
	else
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";	
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="";

		document.getElementById("txtHint").innerHTML="Validating.."
	
	new Ajax.Updater(
				'txtHint', 
				'ajax/call_steps.php', 
				{
					method: 'get', 
					parameters: "q="+str+"&act=username",
					onComplete: showResponse
				});
	
	}
}


function showResponse(originalRequest)
{
	var res = originalRequest.responseText;
	
	if ( res == 1)
	{
		user_name = 2;
		$('txtHint').innerHTML = "";
	}
	if ( res == 2)
	{
		user_name = 0;	
		$('txtHint').innerHTML = "Username Already Exist!";
		document.getElementById("username").value = "";
		document.getElementById("username").focus();
	}
		
}

// mobile no validation
function step3()
{
	//document.getElementById("ph1").value =="" || (!integer.test(document.getElementById("ph1").value))
	if(document.getElementById("ph1").value =="" || (!integer.test(document.getElementById("ph1").value)))
	{
		document.getElementById("l_mobile").style.backgroundColor = "#55B3FE";
		document.getElementById("err").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("ph1").focus();
		return false
	}
	else if(document.getElementById("ph2").value =="" || (!integer.test(document.getElementById("ph2").value)))
	{
		document.getElementById("l_mobile").style.backgroundColor = "#55B3FE";
		document.getElementById("err").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("ph2").focus();
		return false
	}
   else if(document.getElementById("ph3").value =="" || (!integer.test(document.getElementById("ph3").value)))
	{
		document.getElementById("l_mobile").style.backgroundColor = "#55B3FE";
		document.getElementById("err").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("ph3").focus();
		return false
	}
	else
	{
		document.getElementById("l_mobile").style.backgroundColor = "";
		document.getElementById("err").innerHTML="";
		document.form_step3.submit();
		return true;
	}
   
  
}



// pincode validation
function step4()
{
	if(document.getElementById("pincode").value =="" || (!integer.test(document.getElementById("pincode").value)))
	{
		document.getElementById("l_pincode").style.backgroundColor = "#55B3FE";
		document.getElementById("err").innerHTML="Pincode is empty or invalid value";
		document.getElementById("pincode").focus();
		return false
	}
	else
	{
		document.getElementById("l_pincode").style.backgroundColor = "";
		document.getElementById("err").innerHTML="";
		return true;
	}
}

function steps2()
 {
	cardname = document.getElementById("cardname").value;
	csv = document.getElementById("csv").value;
	cardno = document.getElementById("cardno").value;
	exp_month = document.getElementById("exp_month").value;
	exp_year = document.getElementById("exp_year").value;
	alert(cardno)
	if(checkCreditCard(cardno,cardname) == false)
	 {
		 alert("NOT OK")
	 }
	else
	 {
		alert("OKK")	 
	 }	 
 }



// validating values of step 1
function steps()
{
	
	
	if(document.getElementById("first_name").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "#55B3FE";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter first name!";
		document.getElementById("first_name").focus();
		return false;
	}
	else if(document.getElementById("last_name").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "#55B3FE";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";	
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter last name!";
		document.getElementById("last_name").focus();
		return false;
	}
	else if(document.getElementById("username").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "#55B3FE";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";	
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter username!";
		document.getElementById("username").focus();
		return false;
	}
	else if(document.getElementById("password").value =="" || document.getElementById("password").value.length < 6)
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "#55B3FE";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";	
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Password must be 6 characters or longer !";
		document.getElementById("password").focus();
		return false;
	}
	else if(document.getElementById("rpassword").value =="" || document.getElementById("rpassword").value.length < 6)
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "#55B3FE";
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Password must be 6 characters or longer!";
		document.getElementById("rpassword").focus();
		return false;
	}
	 else if(document.getElementById("password").value != document.getElementById("rpassword").value)
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "#55B3FE";	
		document.getElementById("l_rpassword").style.backgroundColor = "#55B3FE";
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";	
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Password Mis Match !";
		document.getElementById("password").focus();
		return false;
	}
	else if( document.getElementById("email").value =="" )
	{
		document.getElementById("l_email").style.backgroundColor = "#55B3FE";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_last_name").style.backgroundColor = "";	
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter email!";
		document.getElementById("email").focus();
		return false;
	}
	else if(!check.test(document.getElementById("email").value))
    {
		document.getElementById("l_email").style.backgroundColor = "#55B3FE";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_last_name").style.backgroundColor = "";	
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter Valid email!";
		document.getElementById("email").focus();
    }
	
	
	<!--//////////////////////////////////////////////-->
	else if(document.getElementById("ph1").value =="" || (!integer.test(document.getElementById("ph1").value)))
	{
		document.getElementById("p_no").style.backgroundColor = "#55B3FE";
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("ph1").focus();
		return false
	}
	else if(document.getElementById("ph2").value =="" || (!integer.test(document.getElementById("ph2").value)))
	{
		document.getElementById("p_no").style.backgroundColor = "#55B3FE";
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("ph2").focus();
		return false
	}
   else if(document.getElementById("ph3").value =="" || (!integer.test(document.getElementById("ph3").value)))
	{
		document.getElementById("p_no").style.backgroundColor = "#55B3FE";
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("ph3").focus();
		return false
	}
	else if(document.getElementById("c1").value =="" || (!integer.test(document.getElementById("c1").value)))
	{
		document.getElementById("c_no").style.backgroundColor = "#55B3FE";
		document.getElementById("p_no").style.backgroundColor = "";
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("c1").focus();
		return false
	}
	else if(document.getElementById("c2").value =="" || (!integer.test(document.getElementById("c2").value)))
	{
		document.getElementById("c_no").style.backgroundColor = "#55B3FE";
		document.getElementById("p_no").style.backgroundColor = "";
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("c2").focus();
		return false
	}
   else if(document.getElementById("c3").value =="" || (!integer.test(document.getElementById("c3").value)))
	{
		document.getElementById("c_no").style.backgroundColor = "#55B3FE";
		document.getElementById("p_no").style.backgroundColor = "";
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("add").style.backgroundColor = "";	
		document.getElementById("city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";	
		document.getElementById("error").innerHTML="Mobile number is empty or invalid value";
		document.getElementById("c3").focus();
		return false
	}
	else if(document.getElementById("add").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "#55B3FE";	
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";	
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter your Billing Address!";
		document.getElementById("add").focus();
		return false;
	}
	else if(document.getElementById("city").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";	
		document.getElementById("l_city").style.backgroundColor = "#55B3FE";	
		document.getElementById("state").style.backgroundColor = "";			
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";	
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter your City!";
		document.getElementById("city").focus();
		return false;
	}
	else if(document.getElementById("state").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";	
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "#55B3FE";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter your State!";
		document.getElementById("state").focus();
		return false;
	}
	else if(document.getElementById("zcode").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";	
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "#55B3FE";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";	
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please enter your Zip Code!";
		document.getElementById("zcode").focus();
		return false;
	}
	else if(document.getElementById("school").value =="0")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "#55B3FE";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please Select School!";
		document.getElementById("school").focus();
		return false;
	}
	
	else if(document.getElementById("sid").value =="0")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "#55B3FE";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please Select your Stadium!";
		document.getElementById("sid").focus();
		return false;
	}
	else if(document.getElementById("section").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "#55B3FE";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";		
		document.getElementById("error").innerHTML="Please Select your Section!";
		document.getElementById("section").focus();
		return false;
	}
	else if(document.getElementById("rows").value =="")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "#55B3FE";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_sengine").style.backgroundColor = "";
		document.getElementById("error").innerHTML="Please Select your Row!";
		document.getElementById("rows").focus();
		return false;
	}
	else if(document.getElementById("seat_no").value =="" )
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";	
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";	
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("l_sengine").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "#55B3FE";		
		document.getElementById("error").innerHTML="Please enter your Seat Number!";
		document.getElementById("seat_no").focus();
		return false;
	}
	else if(document.getElementById("sengine").value =="0")
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";	
		document.getElementById("l_sengine").style.backgroundColor = "#55B3FE";
		document.getElementById("error").innerHTML="Please select value !";
		document.getElementById("sengine").focus();
		return false;
	}	
	
	else if(document.getElementById("term").checked == false)
	{
		document.getElementById("l_email").style.backgroundColor = "";
		document.getElementById("l_password").style.backgroundColor = "";	
		document.getElementById("l_rpassword").style.backgroundColor = "";	
		document.getElementById("l_first_name").style.backgroundColor = "";	
		document.getElementById("l_last_name").style.backgroundColor = "";
		document.getElementById("l_Username").style.backgroundColor = "";
		document.getElementById("p_no").style.backgroundColor = "";	
		document.getElementById("c_no").style.backgroundColor = "";	
		document.getElementById("addr").style.backgroundColor = "";	
		document.getElementById("l_city").style.backgroundColor = "";	
		document.getElementById("l_state").style.backgroundColor = "";	
		document.getElementById("z_code").style.backgroundColor = "";
		document.getElementById("sch_id").style.backgroundColor = "";		
		document.getElementById("p_id").style.backgroundColor = "";
		document.getElementById("s_id").style.backgroundColor = "";
		document.getElementById("l_section").style.backgroundColor = "";
		document.getElementById("l_rows").style.backgroundColor = "";
		document.getElementById("s_no").style.backgroundColor = "";		
		document.getElementById("l_term").style.backgroundColor = "#55B3FE";	
		document.getElementById("l_sengine").style.backgroundColor = "";
		document.getElementById("error").innerHTML="Please accept Term & Condition!";
		document.getElementById("term").focus();
		return false;
	}
	else
	 {
		
		document.step1.submit();
		return true;
	 }
	
}

function call_otherCHK()
{
	if(document.getElementById("sengine").value == "6")
		{
			var oDiv = document.getElementById('l_others');
    		oDiv.style.display='block';
		}
		else
		{
			var oDiv = document.getElementById('l_others');
    		oDiv.style.display='none';
		}
		
}

function call_stadium(id)
 {
   //show function for proces
	if(id != 0)
	 {
		var pars= "id="+id+"&sId="+Math.random();
		var myajax=new Ajax.Request('ajax/getstadiun.php',{method: 'get', parameters: pars, onComplete: showstadium});
	 }
	else
	 {
		 $('p_id').hide();
		 $('s_id').hide();
		//$('cmb_stadium').innerHTML = res[1];
	 	document.getElementById("price").value = ""; 
	 }
    return false;
  
 }

function showstadium(originalRequest)
  {

   var res = originalRequest.responseText
  
   var res = res.split("?|?");
   if( res!=1 )
    {
	 $('s_id').show();
	 $('p_id').show();
	 $('cmb_stadium').innerHTML = res[1];
	 document.getElementById("price").innerHTML = res[0];
	}
    else
	 {
		$('s_id').show();
		$('cmb_stadium').innerHTML = "Error While loading stadium dropdown!";
	 }
  }


// AUTO TAB

var isNN = (navigator.appName.indexOf("Netscape")!=-1);
	function autoTab(input,len, e) {
		var keyCode = (isNN) ? e.which : e.keyCode; 
		var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
			if(input.value.length >= len && !containsElement(filter,keyCode)) {
			input.value = input.value.slice(0, len);
			input.form[(getIndex(input)+1) % input.form.length].focus();
		}
	
		function containsElement(arr, ele) {
			var found = false, index = 0;
				while(!found && index < arr.length)
				if(arr[index] == ele)
					found = true;
				else
				index++;
					return found;
		}
	
		function getIndex(input) {
			var index = -1, i = 0, found = false;
				while (i < input.form.length && index == -1)
				if (input.form[i] == input)index = i;
				else i++;
					return index;
		}
	
	return true;
	}
