function bodyonloadValue(form)
{
	//alert("Check");
var val1=form.citymasterid.options[form.citymasterid.options.selectedIndex].value; 
var val2=form.citymasterid1.options[form.citymasterid1.options.selectedIndex].value; 

var val3=document.getElementById('traveldate').value; 
self.location='busavailable.php?citymasterid=' + val1 + '& citymasterid1=' + val2+ '& traveldate=' + val3;
}
function getthis1(form) 
{ 
	//alert("hi");
	var val3=form.citymasterid.options[form.citymasterid.options.selectedIndex].value;
	//alert(val3);
	engine=ajaxFunction(); 
	cityurl='query.php?citymasterid=' + val3; 
	//alert(cityurl)
	engine.onreadystatechange=stateChanged
	engine.open("GET",cityurl,true)
	engine.send(null)
}
function stateChanged() 
{ //function started
	
	if(engine.readyState==4 || engine.readyState=="complete") 
	{ //starting the if to find the state is ready or not
		if (window.ActiveXObject)
		{ //starting for IE
			
			var xmlresult=new ActiveXObject("Microsoft.XMLDOM");
			xmlresult.loadXML(engine.responseText);
			var gg=xmlresult.getElementsByTagName("name").length; //finding the length of the cities
			for (var i=0; i<gg; i++) //starting the for loop for feeding the data in option
			{
				document.getElementById('citymasterid1').options[i+1]=new Option(xmlresult.getElementsByTagName("name")[i].text,xmlresult.getElementsByTagName("code")[i].text,false,false);	//adding the options in second option (combo box)
			} //ending for loop
		} //end of if condition for IE
		else if(window.XMLHttpRequest)
		{ //starting loop for non ie
			var data=null;
			data=engine.responseText; 	// data from ajax Response
			var parser=new DOMParser(); // getting DOMParser Object for XML+Mozilla
			var xmlresult=parser.parseFromString(engine.responseText,"text/xml"); //converting xml to text format
			var rr=xmlresult.getElementsByTagName("name").length; //finding the length of tags in the file
			for(i=0,j=1;i<xmlresult.childNodes[0].childNodes.length;i=i+2,j++) 
			{ //starting the for loop for feeding the data
				document.getElementById('citymasterid1').options[j]=new Option(xmlresult.documentElement.childNodes[i].childNodes[0].nodeValue,xmlresult.documentElement.childNodes[i+1].childNodes[0].nodeValue,false,false);	// option having Name of the city and code
			} // end of for loop
		} //end of else_if loop
	} // ending the if to find the state is ready or not
} //function ended

/// took this code from www.w3schools.com 
///it starts the ajax engine 
function ajaxFunction() 
{ 
	//starting the Ajax function
	var xmlHttp; 
	//xmlHttp = false;
	if (window.XMLHttpRequest) 
	{
		//alert("firefox");
		xmlHttp = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) 
	{
		//alert("ie");
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		//alert('Cannot create XMLHTTP instance');
		return false;
	}
	return xmlHttp; 
}

/////////////////////////////////////////////////////////////////////////////////////////////
function reload3(form)
{

//var val=form.stateid.options[form.stateid.options.selectedIndex].value; 
//var val2=form.districtid.options[form.districtid.options.selectedIndex].value; 
//var val3=form.citymasterid.options[form.citymasterid.options.selectedIndex].value; 
//self.location='reservationsearch.php?stateid=' + val + '& districtid=' + val2 + '& citymasterid=' + val3;

//var val=form.stateid.options[form.stateid.options.selectedIndex].value; 
//var val2=form.districtid.options[form.districtid.options.selectedIndex].value; 
var val13=form.citymasterid.options[form.citymasterid.options.selectedIndex].value; 
self.location='reservationsearch.php?citymasterid=' + val13;
}

function reload4(form)
{
var val=form.stateid.options[form.stateid.options.selectedIndex].value; 
var val2=form.districtid.options[form.districtid.options.selectedIndex].value; 
var val3=form.citymasterid.options[form.citymasterid.options.selectedIndex].value; 
var val4=form.stateid1.options[form.stateid1.options.selectedIndex].value; 
self.location='reservationsearch.php?stateid=' + val + '& districtid=' + val2 + '& citymasterid=' + val3 + '& stateid1=' + val4;
}


function reload5(form)
{
var val=form.stateid.options[form.stateid.options.selectedIndex].value; 
var val2=form.districtid.options[form.districtid.options.selectedIndex].value; 
var val3=form.citymasterid.options[form.citymasterid.options.selectedIndex].value; 
var val4=form.stateid1.options[form.stateid1.options.selectedIndex].value; 
var val5=form.districtid1.options[form.districtid1.options.selectedIndex].value; 
self.location='reservationsearch.php?stateid=' + val + '& districtid=' + val2 + '& citymasterid=' + val3+ '& stateid1=' + val4 + '& districtid1=' + val5;
}


function reload6(form)
{
var val=form.stateid.options[form.stateid.options.selectedIndex].value; 
var val2=form.districtid.options[form.districtid.options.selectedIndex].value; 
var val3=form.citymasterid.options[form.citymasterid.options.selectedIndex].value; 
var val4=form.stateid1.options[form.stateid1.options.selectedIndex].value; 
var val5=form.districtid1.options[form.districtid1.options.selectedIndex].value; 
var val6=form.citymasterid1.options[form.citymasterid1.options.selectedIndex].value; 
self.location='reservationsearch.php?stateid=' + val + '& districtid=' + val2 + '& citymasterid=' + val3+ '& stateid1=' + val4 + '& districtid1=' + val5 + ' & citymasterid1='+ val6;
}  

function city(){
	var cityid=document.getElementById('cityid');
	var cityid1=document.getElementById('cityid1');
//	var destination=document.getElementById('destination');
	//alert(cityid.value);
	if((cityid.value==cityid1.value)&&(cityid.value!='')&&(cityid1.value!='')){
		alert("source city and destination city should not be same");
		cityid1.value="";
		cityid1.focus();
		return false;
		
		
	}
	if(cityid.value==''){
		alert("Please choose the source");
		cityid.focus();
		return false;
		
		
	}
	if(cityid1.value==''){
		alert("Please choose the Destination");
		cityid1.focus();
		return false;
				
	}
//	destination.value=cityid1.value;
	return true;
	
}


var xmlHttp;
var next_row=0;
var row_base=0;
var button;
function showBusavailable(str,str1,str2,str3)
{ 
	var q=document.getElementById('citymasterid').value;
	//alert(q);
	if (q == "" || q == null) 
	{
		alert("Please Choose Source")
		document.getElementById('citymasterid').focus();
		return false;
	}
	var q1=document.getElementById('citymasterid1').value;
	//alert(q1);
	if (q1 == "" || q1 == null)
	{
		alert("Please Choose Destination")
		document.getElementById('citymasterid1').focus();
		return false;
	}
	var q2=document.getElementById('traveldate').value;
	//alert(q2);
	if (q2 == "" || q2 == null)
	{
		alert("Please Enter Date")
		document.getElementById('traveldate').focus();
		return false;
	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		 alert ("Browser does not support HTTP Request");
	 	return;
	}
	var url="busavl.php";
	url=url+"?citymasterid="+q+"&& citymasterid1="+q1+"&& traveldate="+q2;
	//alert(url);
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=statebusChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function statebusChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		//alert(xmlHttp.responseText);
		document.getElementById('bussearchid').style.display="none";
	 	document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	} 
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
	 	xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		 //Internet Explorer
	 	try
	  	{
	  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  	}
	 	catch (e)
	  	{
	  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
	}
	return xmlHttp;
}
//////////////////////////////////////////////////////////
function showSeatselect(str3)
{ 
	var q=document.getElementById('citymasterid').value;
	//alert(q);
	var q1=document.getElementById('citymasterid1').value;
	//alert(q1);
	var q2=document.getElementById('traveldate').value;
	//alert(q2);
	busalloid=str3;
	//alert(busalloid);
	//var q3=document.getElementById("busallocationid"+busalloid).value;
	//alert(q3);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	var url="seatselection.php";
	url=url+"?citymasterid="+q+"&& citymasterid1="+q1+"&& traveldate="+q2+"&& busallocationid="+busalloid;
	//+"&& busname="+q4+"&& traveldate="+q5+"&& seatstyle="+q6+"&& routedate="+q7+"&& routetime="+q8+"&& rate="+q9
	//alert(url);
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateSeatChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
////////////////////////////////////////////////////////
function stateSeatChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		//alert(xmlHttp.responseText);
		 document.getElementById('busseathidden').style.display="none";
		  document.getElementById('bussearchcol').style.display="none";
		 document.getElementById("txtSeat").innerHTML=xmlHttp.responseText;
	 } 
}

///////////////////////////////////////
function reservation_checkboxcount()
{
	var len = document.frmbusallocation.elements.length;
    //alert(len);
   	var check = false;
	var count=0;
	var temp="";
	for (var i=0; i<len-20; i++)
	{
		count = document.frmbusallocation.txtSeatno[i].value;
		//count = document.getElementById.txtSeatno[i].value;
		temp=temp+count+',';		
	}
	//alert(temp);
	document.getElementById('seatnoarray').value = temp;

}


/*
var NewCount = 0;
function reservation_changecolor(obj, length)
{
	var count = obj.checked;
	
	if(NewCount<5)
	{
		if(count==true)
		{
			NewCount = NewCount + 1
			//alert(NewCount);
			//document.getElementById('seatcolorid'+length).style.background =  "url(images/blue.gif)"
			document.getElementById('seatcolorid'+length).className =  "seatcolorblue";
			 //obj.value="2";	
		}
		else
		{
			//document.getElementById('seatcolorid'+length).style.background =  "url(images/green.gif)";
			document.getElementById('seatcolorid'+length).className =  "seatcolorgreen";
		}
	}
	else
	{
		alert('You are selecting more No of seats for Agents');
		obj.checked=false;
		return false;
	}
} // end function
*/
var NewCount = 0;
function reservation_changecolor(obj, length)
{
	var count = obj.checked;
	if(count==true)
	{
		//document.getElementById('seatcolorid'+length).style.background =  "url(images/blue.gif)"
		document.getElementById('seatcolorid'+length).className =  "seatcolorblue";
		NewCount = NewCount + 1;
		if (NewCount > 5)
		{
			   alert('You can select five tickets only');
			   //eval('document.seatselection.' + length + '.checked = false');
			   obj.checked = false;
			   NewCount = NewCount - 1;
			   document.getElementById('seatcolorid'+length).className =  "seatcolorgreen";
			   return false;
		}
	 //obj.value="2";	
	}
	else
	{
		NewCount = NewCount - 1;
		//document.getElementById('seatcolorid'+length).style.background =  "url(images/green.gif)";
		document.getElementById('seatcolorid'+length).className =  "seatcolorgreen";
	}

} // end function

function reservation_changecolor_agent(obj, length)
{
	//alert("ssswss");
	var count = obj.checked;
	if(count==true)
	{
		document.getElementById('seatcolorid'+length).className =  "seatcolorblue";
		NewCount = NewCount + 1;
		//alert(NewCount);
		var rate=document.getElementById('bus_rate').value;
		//alert(rate);
		var totalrate=rate*NewCount;
		//alert(totalrate);
		var balance=document.getElementById('current_balance').value;
		//alert(balance);
			if(balance < totalrate)
			{
				alert("Your balance is too low..Topup your balance.!..");
				NewCount = NewCount - 1;
				obj.checked = false;
				document.getElementById('seatcolorid'+length).className =  "seatcolorgreen";
				return false;
			}
			
		if (NewCount > 5)
		{
			   alert('You can select five tickets only');
			   //eval('document.seatselection.' + length + '.checked = false');
			   obj.checked = false;
			   NewCount = NewCount - 1;
			   document.getElementById('seatcolorid'+length).className =  "seatcolorgreen";
			   return false;
		}
	 //obj.value="2";	
	}
	else
	{
		NewCount = NewCount - 1;
		//document.getElementById('seatcolorid'+length).style.background =  "url(images/green.gif)";
		document.getElementById('seatcolorid'+length).className =  "seatcolorgreen";
	}

} // end function

function isSeatcheck(obj, length)
{
	var len = document.bussearch.elements.length;
	var check = false;
	var count=0;
	var NewCount = 0;
	for (var i=0; i<len; i++)
	{
		if (document.bussearch.elements[i].id == 'txtSeatno')
		{
			count = count+1;
		}
	}
//	alert("count :"+count);
	if (count == 1)
	{
		if(document.bussearch.txtSeatno.checked == true)
		{
			check = true;
		}	
	}
	else
	{
		for (var i=0; i<count; i++)
		{
			if(document.bussearch.txtSeatno[i].checked == true)
			{
				//document.getElementById('seatcolorid'+i).className =  "seatcolorblue";
				NewCount = NewCount + 1;
				if (NewCount > 5)
				{
				   alert('You can select five tickets only')
				   alert(document.bussearch.txtSeatno[i].value);
				   //eval('document.bussearch.' + length + '.checked = false');
				   document.bussearch.txtSeatno[i].checked = false;
				   document.getElementById('seatcolorid').className =  "seatcolorgreen";
				   return false;
				}
				
			}
		}
	}

}

function reservation_seatValidate()
{
	if(NewCount==0)
	{
		alert("Please Select any one Seat");
	}
}


//////////////////////////////////////////////////////////
function showCheckedSeat(str3)
{ 
	var q=document.getElementById('source').value;
	//alert(q);
	var q1=document.getElementById('destination').value;
	//alert(q1);
	var q2=document.getElementById('txtSeatno[]').value;
	alert(q2);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	var url="passengerinfo.php";
	url=url+"?source="+q+"&& destination="+q1+"&& txtSeatno="+q2;
	//alert(url);
	//+"&& busname="+q4+"&& traveldate="+q5+"&& seatstyle="+q6+"&& routedate="+q7+"&& routetime="+q8+"&& rate="+q9
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChecked;
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null);
}

////////////////////////////////////////////////////////
function stateChecked() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		 //alert(xmlHttp.responseText);
		 document.getElementById('busseathidden').style.display="none";
		 document.getElementById("txtSeat").innerHTML=xmlHttp.responseText;
	 } 
}

function onloadDisplay()
{
	document.getElementById('creditcarddiv').style.display="none";
	document.getElementById('debitcarddiv').style.display="none";
	document.getElementById('moblepaydiv').style.display="none";
	document.getElementById('internetdiv').style.display="none";
	document.getElementById('cashcarddiv').style.display="none";
	document.getElementById('mobilechkdiv').style.display="none";
	document.getElementById('homedlvdiv').style.display="none";
}

function onclickAllPayForm(pay)
{
	//alert(pay);
	if(pay=="creditcard")
	{
		document.getElementById('creditcarddiv').style.display="block";
		document.getElementById('debitcarddiv').style.display="none";
		document.getElementById('moblepaydiv').style.display="none";
		document.getElementById('internetdiv').style.display="none";
		document.getElementById('cashcarddiv').style.display="none";
		document.getElementById('mobilechkdiv').style.display="none";
		document.getElementById('homedlvdiv').style.display="none";
	}
	if(pay=="debitcard")
	{
		document.getElementById('creditcarddiv').style.display="none";
		document.getElementById('debitcarddiv').style.display="block";
		document.getElementById('moblepaydiv').style.display="none";
		document.getElementById('internetdiv').style.display="none";
		document.getElementById('cashcarddiv').style.display="none";
		document.getElementById('mobilechkdiv').style.display="none";
		document.getElementById('homedlvdiv').style.display="none";
	}
	if(pay=="moblepay")
	{
		document.getElementById('creditcarddiv').style.display="none";
		document.getElementById('debitcarddiv').style.display="none";
		document.getElementById('moblepaydiv').style.display="block";
		document.getElementById('internetdiv').style.display="none";
		document.getElementById('cashcarddiv').style.display="none";
		document.getElementById('mobilechkdiv').style.display="none";
		document.getElementById('homedlvdiv').style.display="none";
	}
	if(pay=="internet")
	{
		document.getElementById('creditcarddiv').style.display="none";
		document.getElementById('debitcarddiv').style.display="none";
		document.getElementById('moblepaydiv').style.display="none";
		document.getElementById('internetdiv').style.display="block";
		document.getElementById('cashcarddiv').style.display="none";
		document.getElementById('mobilechkdiv').style.display="none";
		document.getElementById('homedlvdiv').style.display="none";
	}
	if(pay=="cashcard")
	{
		document.getElementById('creditcarddiv').style.display="none";
		document.getElementById('debitcarddiv').style.display="none";
		document.getElementById('moblepaydiv').style.display="none";
		document.getElementById('internetdiv').style.display="none";
		document.getElementById('cashcarddiv').style.display="block";
		document.getElementById('mobilechkdiv').style.display="none";
		document.getElementById('homedlvdiv').style.display="none";
	}
	if(pay=="mobilechk")
	{
		document.getElementById('creditcarddiv').style.display="none";
		document.getElementById('debitcarddiv').style.display="none";
		document.getElementById('moblepaydiv').style.display="none";
		document.getElementById('internetdiv').style.display="none";
		document.getElementById('cashcarddiv').style.display="none";
		document.getElementById('mobilechkdiv').style.display="block";
		document.getElementById('homedlvdiv').style.display="none";
	}
	if(pay=="homedlv")
	{
		document.getElementById('creditcarddiv').style.display="none";
		document.getElementById('debitcarddiv').style.display="none";
		document.getElementById('moblepaydiv').style.display="none";
		document.getElementById('internetdiv').style.display="none";
		document.getElementById('cashcarddiv').style.display="none";
		document.getElementById('mobilechkdiv').style.display="none";
		document.getElementById('homedlvdiv').style.display="block";
	}
}

function KeepCount(str) {
	//alert(str);
	var NewCount = 0
		for(var i=1;i<=5;i++)
		{
			//if ((document.getElementById('seats'+i).options[document.getElementById('seats'+i).options.selectedIndex].value)!=0)
			//{
				NewCount = NewCount + 1
				alert(NewCount);
			//}
		}
		if (str==NewCount)
		{
		alert('You can Select Five Tickets Only');
		return false;
		}

	return true;
}

function seatSelectValidate()
{
	var boardingplace= document.getElementById('boardingplace').value;
	/*if(isEmpty(boardingplace, "Please Select Any one Boarding Place")){
		return true;
	}
		return false;
}*/
	if(boardingplace=='select')
	{
		alert("Please Select Any one Boarding Place");
		document.getElementById('boardingplace').focus();
		return false;
	}
	if(NewCount==0)
	{
		alert("Please Select any one Seat");
		return false;
	}
	return true;
}

function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus();
		return false;
	}
	return true;
}

function validateBussearch(){
	// Make quick references to our fields
	
	var citymasterid = document.getElementById('citymasterid');
	var citymasterid1 = document.getElementById('citymasterid1');
	var traveldate = document.getElementById('traveldate');
	
	if(isEmpty(citymasterid, "Select Source City Name")){
	if(isEmpty(citymasterid1, "Select Destination City Name")){
	if(isEmpty(traveldate, "Select Travel Date")){
		return true;
	}
	}
	}
	return false;
}

function validateSearchavailable(){
	// Make quick references to our fields
	
	var citymasterid = document.getElementById('citymasterid');
	var citymasterid1 = document.getElementById('citymasterid1');
	var traveldate = document.getElementById('traveldate');
	
	if(isEmpty(citymasterid, "Select Source City Name")){
	if(isEmpty(citymasterid1, "Select Destination City Name")){
	if(isEmpty(traveldate, "Select Travel Date")){
		return true;
	}
	}
	}
	return false;
}
//Validation For Email
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

 		 return true					
	}
//Validation For Email

function passengerValid()
{
	//alert("hi");
	var len = document.bussearch.elements.length;
	//alert(len);
	var check = false;

	for (var i=1; i<len; i++)
	{
		if (document.bussearch.elements[i].id == 'passenger_name')
		{

			if(document.bussearch.elements[i].value.length == 0){
			   alert("Enter Passenger Name");
			   document.bussearch.elements[i].focus();
			   return false;		   		 
			}			
		
			if(document.bussearch.elements[i].value.length > 50)
	    	{
	     	 	alert('Too Long');
	      		document.bussearch.elements[i].select();
	      		return false;
	    	}
			if(document.bussearch.elements[i].value.length<3)
		 	{
	      		alert('Name should be minimum 3 chars');
	      		document.bussearch.elements[i].select();
	      		return false;
	    	}
			
		}
		if (document.bussearch.elements[i].id == 'passenger_age')
		{

			if(document.bussearch.elements[i].value.length == 0){
			   alert("Please Enter Passenger Age");
			   document.bussearch.elements[i].focus();
			   return false;
			}
			if(document.bussearch.elements[i].value.length>2)
		 	{
	      		alert('Maximum length is 2');
	      		document.bussearch.elements[i].select();
	      		return false;
	    	}
			var inputval=document.bussearch.elements[i].value;
	    	var inputstr=inputval.toString();
    	
	    	for(var j=0; j<inputstr.length; j+=1)
	    	{
	       		var onechar=inputstr.charAt(j);
	       		 
	       		if(onechar < "0" || onechar > "9")
	       		{
	        		alert("Please Enter Number only");
	        		document.bussearch.elements[i].select();
	        		return false;
	       		}
	       	    if(parseInt(inputval)==0)	
	       		{
		      		alert('Please Enter valid numbers');
	          		document.bussearch.elements[i].select();
	          		return false;
	       		}
	     	}			
		}
		
		if (document.bussearch.elements[i].id == 'passenger_phone')
		{
			if(document.bussearch.elements[12].value.length == 0){
			   alert("Please Enter Passenger Phone No");
			   document.bussearch.elements[12].focus();
			   return false;
			}
			if(document.bussearch.elements[12].value.length>15)
		 	{
	      		alert('Maximum length is 15');
	      		document.bussearch.elements[12].select();
	      		return false;
	    	}
			var inputval=document.bussearch.elements[12].value;
	    	var inputstr=inputval.toString();
    	
	    	for(var j=0; j<inputstr.length; j+=1)
	    	{
	       		var onechar=inputstr.charAt(j);
	       		if(parseInt(inputval)==0)	
	       		{
		      		alert('Please Enter valid numbers');
	          		document.bussearch.elements[12].select();
	          		return false;
	       		}
	     	}			
		}
		
		/*if (document.bussearch.elements[i].id == 'passenger_email')
		{
		if(document.bussearch.elements[i].value.length == 0){
			   alert("Please Enter Passenger Email");
			   document.bussearch.elements[i].focus();
			   return false;
			}
			
		if (echeck(document.bussearch.elements[i].value)==false){
			document.bussearch.elements[i].focus();
			//emailID.focus()
			return false;
		}
		}*/
		var emailID=document.getElementById('passenger_email').value;
		if(emailID=='')
		{
			alert("Please Enter your Email ID");
			document.getElementById('passenger_email').focus();
			return false;
		}
		
			if (echeck(document.getElementById('passenger_email').value)==false){
				document.getElementById('passenger_email').select();
				return false;
			}
		
		if (document.bussearch.elements[i].id == 'passenger_sex')
		{
			if(document.bussearch.elements[i].value.length == 0){
			   alert("Please Select Passenger Gender");
			   document.bussearch.elements[i].focus();
			   return false;
			}
		}
	}
	var idcardtype= document.getElementById('idcardtype').value;
	if(idcardtype=='')
	{
		alert("Please Select ID Card Type");
		document.getElementById('idcardtype').focus();
		return false;
	}
	var idcardnumber= document.getElementById('idcardnumber').value;
	if(idcardnumber=='')
	{
		alert("Please Enter ID Card Number");
		document.getElementById('idcardnumber').focus();
		return false;
	}
	var idcardauthoriity= document.getElementById('idcardauthoriity').value;
	if(idcardauthoriity=='')
	{
		alert("Please Enter ID Card Authority");
		document.getElementById('idcardauthoriity').focus();
		return false;
	}
	if (document.bussearch.terms.checked == false)

	{
		alert("Please accept Term and condition");
		return false;
	}
	alert("Please furnish Original ID proof while boarding");
}



function validateOnlyNumber()
		{
		
					if(event.keyCode < 45 || event.keyCode > 57)
					{
						 event.returnValue = false;
					}
					else if(event.which < 45 || event.which > 57) 
					{
						return false;
					}
				
		
		}
		
		
function printTicket()
{
	if(document.all) {
		document.all.divButtons.style.visibility = 'hidden';
		document.getElementById('printticketdiv').style.display="none";
		//factory.ExecWB(6,6)
		window.print();
		document.all.divButtons.style.visibility = 'visible';

	} else {
		document.getElementById('divButtons').style.visibility = 'hidden';
		document.getElementById('printticketdiv').style.display="none";
		//factory.ExecWB(6,6)
		window.print();
		document.getElementById('divButtons').style.visibility = 'visible';
	}
}