




function colorVal(v,t,com,comm) {	

	
			if(com.value.length<1){

				comm.innerHTML = comm.innerHTML.replace('#424260','#ff0000'); 
				return t=1;

			}
			else
			{	
				comm.innerHTML = comm.innerHTML.replace('#ff0000','#424260'); 


				if(t==0) {
					t=t; 
				}
				else {
					t=1; 
				}
				return t;
			}

	
	
}

function checkVal(formname){
		
	var t=0;
	

//if (navigator.appName == "Microsoft Internet Explorer") { 
	t=colorVal("first_name",t,document.forms[formname].first_name, document.getElementById("first_name_m"));
	t=colorVal("last_name",t,document.forms[formname].last_name, document.getElementById("last_name_m"));
	t=colorVal("birthdate",t,document.forms[formname].birthdate, document.getElementById("birthdate_m"));
	t=colorVal("city",t,document.forms[formname].city, document.getElementById("city_m"));	
	t=colorVal("address",t,document.forms[formname].address, document.getElementById("address_m"));
	t=colorVal("zip",t,document.forms[formname].zip, document.getElementById("zip_m"));	
	t=colorVal("email",t,document.forms[formname].email, document.getElementById("email_m"));	
	t=colorVal("mobile",t,document.forms[formname].mobile, document.getElementById("mobile_m"));	
//}


	if(t==0){ 	
		document.forms[formname].Submt.value = 1;
		document.forms[formname].submit();
	}
	else {
		document.getElementById("msg").innerHTML = "<font color=red>"+document.getElementById("msg").innerHTML+"</font>";
	}
	
	return;

}

function checkRegVal(formname){
		
	var t=0;
 
	
	t=colorVal("user_code",t,document.forms[formname].user_code, document.getElementById("user_code_m"));
	t=colorVal("mobile",t,document.forms[formname].mobile, document.getElementById("mobile_m"));
	t=colorVal("email",t,document.forms[formname].email, document.getElementById("email_m"));
	t=colorVal("zip",t,document.forms[formname].zip, document.getElementById("zip_m"));	
	t=colorVal("address",t,document.forms[formname].address, document.getElementById("address_m"));
	t=colorVal("city",t,document.forms[formname].city, document.getElementById("city_m"));
	t=colorVal("birthdate",t,document.forms[formname].birthdate, document.getElementById("birthdate_m"));
	t=colorVal("last_name",t,document.forms[formname].last_name, document.getElementById("last_name_m"));
	t=colorVal("first_name",t,document.forms[formname].first_name, document.getElementById("first_name_m"));

	var str = "?user_code="+document.forms[formname].user_code.value+"&mobile="+document.forms[formname].mobile.value;
	    str += "&email="+document.forms[formname].email.value+"&zip="+document.forms[formname].zip.value;
	    str += "&address="+document.forms[formname].address.value+"&city="+document.forms[formname].city.value;
	    str += "&birthdate="+document.forms[formname].birthdate.value+"&last_name="+document.forms[formname].last_name.value+"&first_name="+document.forms[formname].first_name.value;




	if (str.length==0)
  	{
		document.getElementById("msgx").innerHTML="";
		return;
  	}

	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
  	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
			
			if(xmlhttp.responseText=="") {
				if(t==0){
					document.forms[formname].Submt.value = 1;
					document.forms[formname].submit();
				}
				else {
					document.getElementById("msg").innerHTML = "<font color=red>"+document.getElementById("msg").innerHTML+"</font>";
				}
	
				return;
			}
			else {
    				document.getElementById("msgx").innerHTML=xmlhttp.responseText;
			}
    		}
  	}

	xmlhttp.open("GET","gethint.php"+str,true);
	xmlhttp.send();



}








function checkValMissing(formname){
		
	var t=0;
 
//if (navigator.appName == "Microsoft Internet Explorer") { 

	t=colorVal("ticket_number",t,document.forms[formname].ticket_number, document.getElementById("ticket_number_m"));	
	t=colorVal("flight_number",t,document.forms[formname].flight_number, document.getElementById("flight_number_m"));
	t=colorVal("flight_date",t,document.forms[formname].flight_date, document.getElementById("flight_date_m"));	
	t=colorVal("comment",t,document.forms[formname].comment, document.getElementById("comment_m"));	
	

//}

	if(t==0){
		document.forms[formname].Submt.value = 1;
		document.forms[formname].submit();
	}
	else {
		document.getElementById("msg").innerHTML = "<font color=red>"+document.getElementById("msg").innerHTML+"</font>";
	}
	
	return;

}





