﻿
function Pop(isPop)
{
	var html = "";
//html += "<link href=\"StyleSheet.css\" rel=\"stylesheet\" type=\"text\/css\" \/>";
//html += "<script type=\"text\/javascript\" src=\"Jscript.js\"><\/script>";
//html += "<script type=\"text\/javascript\" src=\"Calendar\/calendarDateInput.js\"><\/script>";
html += "<div align='left' >";
html += "<table cellspacing=\"0\" cellpadding=\"0\">";
html += "<tr valign=\"bottom\">";
html += "<td>";
html += "<table width=\"360px\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"font-family:arial\" >";
html += "<tr>";
html += "<td width=\"4\" height=\"10\"  nowrap=\"nowrap\" class=\"TabSpacer\">&nbsp;</td>";
html += "<td id=\"liA\" onclick=\"ShowHide('A'); return false;\" width=\"90px\" class=\"TabSelected\" nowrap=\"nowrap\" align=\"center\" valign=\"middle\" >";
html += "<span onclick=\"ShowHide('A'); return false;\" style=\"padding: 0 0 0 0\" align=\"center\" nowrap=\"nowrap\">Step One</span>";
html += "</td>";
html += "<td  width=\"4\" height=\"10\"  nowrap=\"nowrap\" class=\"TabSpacer\">&nbsp;</td>";
html += "<td id=\"liB\" onclick=\"ShowHide('B'); return false;\" class=\"TabNotSelected\" nowrap=\"nowrap\" align=\"center\" valign=\"middle\" >";
html += "<span onclick=\"ShowHide('B'); return false;\" style=\"padding: 0 0 0 0\" nowrap=\"nowrap\">Step Two</span>";
html += "</td>";
html += "<td  width=\"4\" height=\"10\"  nowrap=\"nowrap\" class=\"TabSpacer\">&nbsp;</td>";
html += "<td id=\"liC\" onclick=\"ShowHide('C'); return false;\" class=\"TabNotSelected\" nowrap=\"nowrap\" align=\"center\" valign=\"middle\" >";
html += "<span onclick=\"ShowHide('C'); return false;\" style=\"padding: 0 0 0 0\" nowrap=\"nowrap\">Your Quote</span>";
html += "</td>";
html += "<td  width=\"10%\" height=\"10\"  nowrap=\"nowrap\" class=\"TabSpacer\">&nbsp;</td>";
html += "</tr>";
html += "</table>";
html += "<\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td style=\"border-right: solid 1px #777777; border-left: solid 1px #777777; border-bottom: solid 1px #777777; padding-top:10px\" >";
html += "<div id=\"divA\">";
html += "<table cellpadding=\"2px\" width=\"360px\" height=\"216px\">";
html += "<tr><td colspan=\"2\" align=\"center\" style=\"font-size:14px; font-weight:bold; color:#9E0A0B\">Get Free Limo Quote</td></tr>";
html += "<tr>";
html += "<td colspan=\"2\" style=\"padding-left:10px\">";
html += "<select id=\"ddlType\" onkeyup=\"ddlType_changed()\" onchange=\"ddlType_changed()\" >";
html += "<option value=\"A\">Trip to the Airport<\/option>";
html += "<option value=\"B\">Pickup From the Airport<\/option>";
html += "<option value=\"C\">Point to Point<\/option>";
html += "<\/select>";
html += "<\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td style=\"padding-left:10px\"><b>Origin<b\/><\/td>";
html += "<td style=\"padding-left:10px\"><b>Destination<\/b><\/td>";
html += "<\/tr>";
html += "<tr style=\"padding:0 0 0 0;\">";
html += "<td width=\"180px\">";
html += "<table cellpadding=\"0px\">";
html += "<tr>";
html += "<td><span id=\"spnFromState\">State<\/span><br \/><select id=\"ddlFromState\" style=\"width:158px\" onchange=\"ddlState_Change(this)\" onkeyup=\"ddlState_Change(this)\" ><\/select><\/td>";
html += "<\/tr>";
html += "<tr valign=\"top\">";
html += "<td style=\"padding-top:0px\">";
html += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"height:30px\">";
html += "<tr valign=\"top\">";
html += "<td id=\"tdFromCity\"><span id=\"spnFromCity\">City<\/span><br \/>";
html += "<input id=\"tbFromCity\" type=\"text\" style=\"width:152px\" onkeyup=\"document.getElementById('spnFromCity').style.color = '#000000'\" \/>";
html += "<\/td>";
html += "<td id=\"tdFromAP\"><span id=\"spnFromAP\">Airport<\/span><br \/>";
html += "<select id=\"ddlFromAP\" style=\"width:158px\" onkeyup=\"document.getElementById('spnFromAP').style.color = '#000000'\" onchange=\"document.getElementById('spnFromAP').style.color = '#000000'\" ><\/select><\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/td>";
html += "<td width=\"180px\">";
html += "<table cellpadding=\"0px\">";
html += "<tr>";
html += "<td><span id=\"spnToState\">State<\/span><br \/><select id=\"ddlToState\" style=\"width:158px\" onchange=\"ddlState_Change(this)\" onkeyup=\"ddlState_Change(this)\" ><\/select><\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td style=\"padding-top:0px\">";
html += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"height:30px\">";
html += "<tr>";
html += "<td id=\"tdToCity\"><span id=\"spnToCity\">City<\/span><br \/>";
html += "<input id=\"tbToCity\" type=\"text\" style=\"width:152px\" onkeyup=\"document.getElementById('spnToCity').style.color = '#000000'\"\/>";
html += "<\/td>";
html += "<td id=\"tdToAP\"><span id=\"spnToAP\">Airport<\/span><br \/>";
html += "<select id=\"ddlToAP\" style=\"width:158px\" onkeyup=\"document.getElementById('spnToAP').style.color = '#000000'\" onchange=\"document.getElementById('spnToAP').style.color = '#000000'\"><\/select><\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/td>";
html += "<\/tr>";
html += "<tr valign=\"bottom\">";
html += "<td style=\"padding-left:10px\">";
html += "<table>";
html += "<tr>";
html += "<td><span id=\"spnDate\">Date<\/span><br \/>";
html += "<input id=\"tbDate\" style=\"width:50px\" value=\"mm/dd/yy\" onfocus=\"if (this.value == 'mm/dd/yy') this.value = '';\" onblur=\"if (this.value == '') this.value = 'mm/dd/yy';\" onkeyup=\"document.getElementById('spnDate').style.color = '#000000'\"\/> ";
html += "</td>";
html += "<td>Time<br \/>";
html += "<select id=\"ddlHr\" >";
html += "<option value=\"01\"> 1 AM<\/option>";
html += "<option value=\"02\"> 2 AM<\/option>";
html += "<option value=\"03\"> 3 AM<\/option>";
html += "<option value=\"04\"> 4 AM<\/option>";
html += "<option value=\"05\"> 5 AM<\/option>";
html += "<option value=\"06\"> 6 AM<\/option>";
html += "<option value=\"07\"> 7 AM<\/option>";
html += "<option value=\"08\"> 8 AM<\/option>";
html += "<option value=\"09\"> 9 AM<\/option>";
html += "<option value=\"10\">10 AM<\/option>";
html += "<option value=\"11\">11 AM<\/option>";
html += "<option value=\"12\" selected>12 PM<\/option>";
html += "<option value=\"13\"> 1 PM<\/option>";
html += "<option value=\"14\"> 2 PM<\/option>";
html += "<option value=\"15\"> 3 PM<\/option>";
html += "<option value=\"16\"> 4 PM<\/option>";
html += "<option value=\"17\"> 5 PM<\/option>";
html += "<option value=\"18\"> 6 PM<\/option>";
html += "<option value=\"19\"> 7 PM<\/option>";
html += "<option value=\"20\"> 8 PM<\/option>";
html += "<option value=\"21\"> 9 PM<\/option>";
html += "<option value=\"22\">10 PM<\/option>";
html += "<option value=\"23\">11 PM<\/option>";
html += "<option value=\"00\">12 AM<\/option>";
html += "</select>";
html += "</td>";
html += "<td><br />";
html += "<select id=\"ddlMin\" >";
html += "<option value=\"00\">00<\/option>";
html += "<option value=\"15\">15<\/option>";
html += "<option value=\"30\">30<\/option>";
html += "<option value=\"45\">45<\/option>";
html += "</select>";
html += "</td>";
html += "<td style=\"width:40%\"><\/td>";
html += "</tr>";
html += "</table>";
html += "</td>";
html += "<td align=\"center\">";
html += "<input type=\"button\" value=\"Last Step ->\" style=\"width:100px;\" onclick=\"ShowHide('B')\" \/>";
html += "<\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td><\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/div>";
html += "<div id=\"divB\">";
html += "<table width=\"360px\" >";
html += "<tr>";
html += "<td>";
html += "<table width=\"100%\">";

html += "<tr>";
html += "<td>Type&nbsp;&nbsp;";
html += "<select id=\"ddlVType\" onchange=\"ddlVType_Change(this)\" onkeyup=\"ddlVType_Change(this)\">";
html += "<option value=\"LX\">Luxuary Sedan<\/option>";
html += "<option value=\"ME\">Mercedes Sedan<\/option>";
html += "<option value=\"SL\">Stretch Limousine<\/option>";
html += "<option value=\"SUV\">SUV<\/option>";
html += "<option value=\"SUVSL\">Stretch SUV<\/option>";
html += "<option value=\"Van\">Passenger Van<\/option>";
html += "<option value=\"Bus\">Bus<\/option>";
html += "<\/select>";
html += "<\/td>";
html += "<td style=\"padding-left:10px\">Pass&nbsp;&nbsp;";
html += "<select id=\"ddlPass\" style=\"width:40px\">";
html += "<option value=\"1\">1<\/option>";
html += "<option value=\"2\">2<\/option>";
html += "<option value=\"3\">3<\/option>";
html += "<option value=\"4\">4<\/option>";
html += "<\/select>";
html += "<\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td>";
html += "<table height=\"66px\">";
html += "<tr>";
html += "<td id=\"trTypeLX\">";
html += " <table style=\"border:dashed 1px #cccccc; \" width=\"335px\" height=\"64px\">";
html += "  <tr>";
html += "   <td style=\"width:110px\"><img src=\"\/Images\/LX.jpg\" \/><\/td>";
html += "   <td style=\"70%\"></td>";
html += "   <td style=\"width:100px; background-color:#ffffbb; padding:5px\">Lincoln Town Car <br />Cadilac<\/td>";
html += "  <\/tr>";
html += " <\/table>";
html += "<\/td>";
html += "<td id=\"trTypeME\" style=\"display:none\">";
html += " <table style=\"border:dashed 1px #cccccc;\" width=\"335px\" height=\"64px\">";
html += "  <tr>";
html += "   <td style=\"width:110px\"><img src=\"\/Images\/ME.jpg\" \/><\/td>";
html += "   <td style=\"70%\"></td>";
html += "   <td style=\"width:100px; background-color:#ffffbb; padding:5px\">Mecedes S class <br />BMW 7 Series<\/td>";
html += "  <\/tr>";
html += " <\/table>";
html += "<\/td>";
html += "<td id=\"trTypeSL\" style=\"display:none\">";
html += " <table style=\"border:dashed 1px #cccccc;\" width=\"335px\" height=\"64px\">";
html += "  <tr>";
html += "   <td style=\"width:110px\"><img src=\"\/Images\/SL.jpg\" \/><\/td>";
html += "   <td style=\"70%\"></td>";
html += "   <td style=\"width:100px; background-color:#ffffbb; padding:5px\">Lincoln Town Car Stretch Limousine<\/td>";
html += "  <\/tr>";
html += " <\/table>";
html += "<\/td>";
html += "<td id=\"trTypeSUV\" style=\"display:none\">";
html += " <table style=\"border:dashed 1px #cccccc;\" width=\"335px\" height=\"64px\">";
html += "  <tr>";
html += "   <td style=\"width:110px\" height=\"62px\"><img src=\"\/Images\/SUV.gif\" \/><\/td>";
html += "   <td style=\"70%\"></td>";
html += "   <td style=\"width:100px; background-color:#ffffbb; padding:5px\">Chevy Suberban<br />Lincoln Navigator<\/td>";
html += "  <\/tr>";
html += " <\/table>";
html += "<\/td>";
html += "<td id=\"trTypeSUVSL\" style=\"display:none\">";
html += " <table style=\"border:dashed 1px #cccccc;\" width=\"335px\" height=\"64px\">";
html += "  <tr>";
html += "   <td style=\"width:110px\"><img src=\"\/Images\/SUVSL.jpg\" \/><\/td>";
html += "   <td style=\"70%\"></td>";
html += "   <td style=\"width:100px; background-color:#ffffbb; padding:5px\">SUV Stretch Limousine<\/td>";
html += "  <\/tr>";
html += " <\/table>";
html += "<\/td>";
html += "<td id=\"trTypeVan\" style=\"display:none\">";
html += " <table style=\"border:dashed 1px #cccccc;\" width=\"335px\" height=\"64px\">";
html += "  <tr>";
html += "   <td style=\"width:110px\"><img src=\"\/Images\/Van.jpg\" \/><\/td>";
html += "   <td style=\"70%\"></td>";
html += "   <td style=\"width:100px; background-color:#ffffbb; padding:5px\">Luxury 14 Passenger Van<\/td>";
html += "  <\/tr>";
html += " <\/table>";
html += "<\/td>";
html += "<td id=\"trTypeBus\" style=\"display:none\">";
html += " <table style=\"border:dashed 1px #cccccc;\" width=\"335px\" height=\"64px\">";
html += "  <tr>";
html += "   <td style=\"width:110px\"><img src=\"\/Images\/Bus.jpg\" \/><\/td>";
html += "   <td style=\"70%\"></td>";
html += "   <td style=\"width:100px; background-color:#ffffbb; padding:5px\">Luxury Coach Mini Bus<\/td>";
html += "  <\/tr>";
html += " <\/table>";
html += "<\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td>";
html += "<table>";
html += "<tr>";
html += "<td colspan=\"2\"><span id=\"spnName\">Name *<\/span><br \/><input id=\"tbName\" style=\"width:335px\" onkeyup=\"document.getElementById('spnName').style.color = '#000000'\"\/><\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td><span id=\"spnEmail\">Email *<\/span><br \/><input id=\"tbEmail\" style=\"width:160px\" onkeyup=\"document.getElementById('spnEmail').style.color = '#000000'\"\/><\/td>";
html += "<td><span id=\"spnTel\">Telephone (optional)<\/span><br \/><input id=\"tbTel\" style=\"width:160px\" onkeyup=\"document.getElementById('spnTel').style.color = '#000000'\"\/><\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<td><\/td>";
html += "<td align=\"center\"><input type=\"button\" value=\"Receive Your Quote ->\" onclick=\"ShowHide('C')\" style=\"width:140px\" \/><\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/td>";
html += "<\/tr>";
html += "<tr>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/div>";
html += "<div id=\"divC\">";
html += "<table width=\"360px\" height=\"216px\">";
html += "<tr valign=\"middle\">";
html += "<td align=\"center\"><div><b>Thank You for your request</b><br /><br /> Shortly you will receive your quote.</div><\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/div>";

html += "<\/td>";
html += "<\/tr>";
html += "<\/table>";
html += "<\/div>";
html += "<script type=\"text\/javascript\">";
html += "ddlType_changed();";
html += "InitState();";
html += "ShowHide('A');";
html += "var sent = false;";
html += "<\/script>";   	

//html = 'asd';
	
	//alert(html);

if (isPop == '1')
    jQuery.facebox(html);
    else
    document.write(html);
}
function ShowHide(id) 
{
    if (sent == true) return;
	switch (id) {
		case ('A'):
			document.getElementById('divA').style.display = 'block';
			document.getElementById('liA').className = "TabSelected";
			document.getElementById('divB').style.display = 'none';
			document.getElementById('liB').className = "TabNotSelected";
			document.getElementById('divC').style.display = 'none';
			document.getElementById('liC').className = "TabNotSelected";
			break;
		case ('B'):
			if (!Validate('B')) break;
			document.getElementById('divA').style.display = 'none';
			document.getElementById('liA').className = "TabNotSelected";
			document.getElementById('divB').style.display = 'block';
			document.getElementById('liB').className = "TabSelected";
			document.getElementById('divC').style.display = 'none';
			document.getElementById('liC').className = "TabNotSelected";
			break;
		case ('C'):
			if (!Validate('C')) break;
			document.getElementById('divA').style.display = 'none';
			document.getElementById('liA').className = "TabNotSelected";
			document.getElementById('divB').style.display = 'none';
			document.getElementById('liB').className = "TabNotSelected";
			document.getElementById('divC').style.display = 'block'; 
			document.getElementById('liC').className = "TabSelected";
			SendInfo();
			break;
	}
}
function ddlType_changed() 
{
	var ddlValue = document.getElementById('ddlType').value;
	switch (ddlValue) 
	{
		case ('A'):
			//document.getElementById('tbFromCity').style.display = 'block';
			document.getElementById('tdFromCity').style.display = 'block';
			//document.getElementById('ddlFromAP').style.display = 'none';
			document.getElementById('tdFromAP').style.display = 'none';
			//document.getElementById('tbToCity').style.display = 'none';
			document.getElementById('tdToCity').style.display = 'none';
			//document.getElementById('ddlToAP').style.display = 'block';	
			document.getElementById('tdToAP').style.display = 'block';	
			ddlState_Change(document.getElementById('ddlToState'));		
			break;
		case ('B'):
			//document.getElementById('tbFromCity').style.display = 'none';
			document.getElementById('tdFromCity').style.display = 'none';
			//document.getElementById('ddlFromAP').style.display = 'block';
			document.getElementById('tdFromAP').style.display = 'block';
			//document.getElementById('tbToCity').style.display = 'block';
			document.getElementById('tdToCity').style.display = 'block';
			//document.getElementById('ddlToAP').style.display = 'none';					
			document.getElementById('tdToAP').style.display = 'none';					
			ddlState_Change(document.getElementById('ddlFromState'));
			break;
		case ('C'):
			//document.getElementById('tbFromCity').style.display = 'block';
			document.getElementById('tdFromCity').style.display = 'block';
			//document.getElementById('ddlFromAP').style.display = 'none';
			document.getElementById('tdFromAP').style.display = 'none';
			//document.getElementById('tbToCity').style.display = 'block';
			document.getElementById('tdToCity').style.display = 'block';
			//document.getElementById('ddlToAP').style.display = 'none';					
			document.getElementById('tdToAP').style.display = 'none';					
			break;
	}
}
function Validate(nextStep)
{
	var isValid = true;
	if (nextStep == 'B')
	{
		switch (document.getElementById('ddlType').value)
		{
			case('A'):
				if(document.getElementById('ddlFromState').value == '') { document.getElementById('spnFromState').style.color = 'red'; isValid = false;}
				if(document.getElementById('tbFromCity').value == '')  { document.getElementById('spnFromCity').style.color = 'red'; isValid = false;}
				if(document.getElementById('ddlToState').value == '')  { document.getElementById('spnToState').style.color = 'red'; isValid = false;}
				if(document.getElementById('ddlToAP').value == '')  { document.getElementById('spnToAP').style.color = 'red'; isValid = false;}
				break;
			case('B'):
				if(document.getElementById('ddlFromState').value == '') { document.getElementById('spnFromState').style.color = 'red'; isValid = false;}
				if(document.getElementById('ddlFromAP').value == '') { document.getElementById('spnFromAP').style.color = 'red'; isValid = false;}
				if(document.getElementById('ddlToState').value == '') { document.getElementById('spnToState').style.color = 'red'; isValid = false;}
				if(document.getElementById('tbToCity').value == '') { document.getElementById('spnToCity').style.color = 'red'; isValid = false;}
				break;
			case('C'):
				if(document.getElementById('ddlFromState').value == '') { document.getElementById('spnFromState').style.color = 'red'; isValid = false;}
				if(document.getElementById('tbFromCity').value == '') { document.getElementById('spnFromCity').style.color = 'red'; isValid = false;}
				if(document.getElementById('ddlToState').value == '') { document.getElementById('spnToState').style.color = 'red'; isValid = false;}
				if(document.getElementById('tbToCity').value == '') { document.getElementById('spnToCity').style.color = 'red'; isValid = false;}			
				break;
		}
		if(document.getElementById('ddlHr').value == '-1') isValid = false;
		if(document.getElementById('ddlMin').value == '-1') isValid = false;
		if (!ValidateDate(document.getElementById('tbDate').value))
		{
			document.getElementById('spnDate').style.color = 'red'; 
			isValid = false;
		}
	}
	if (nextStep == 'C')
	{
		if(document.getElementById('tbName').value == '')  { document.getElementById('spnName').style.color = 'red'; isValid = false;}
		if(!ValidateEmail(document.getElementById('tbEmail').value))  { document.getElementById('spnEmail').style.color = 'red'; isValid = false;}
		//if(document.getElementById('tbTel').value == '')  { document.getElementById('spnTel').style.color = 'red'; isValid = false;}
	}	
	return isValid;
	
}
function ValidateDate(strDate) 
{
  var re = new RegExp('(([1-9])|(0[1-9])|(1[0-2]))[- /.]([1-9]|0[1-9]|[12][0-9]|3[01])[- /.]((20[0-9][0-9])|([0-9][0-9]))$');
  if (strDate.match(re)) {
    return true;
  } else {
    return false;
  }
}
function ValidateEmail(strEmail) 
{
  var re = new RegExp('^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$');
  if (strEmail.match(re)) {
    return true;
  } else {
    return false;
  }
}
function InitState() 
{
	document.getElementById('ddlFromState').options.length = 0;
	document.getElementById('ddlToState').options.length = 0;
	var anOptionA = new Option('Loading...','');
	var anOptionB = new Option('Loading...','');
	document.getElementById('ddlFromState').options.add(anOptionA); 
	document.getElementById('ddlFromState').options.add(anOptionB); 
	SendAjaxGetStateList();
}
var AjaxCallType = '';
function SendAjaxGetStateList()
{
	AjaxCallType = 'stateList';
	var d = new Date();  
    var _idn = d.getTime(); 
	SendAjaxCall('/otherpages/Query2.aspx?type=stateList&d=' + _idn, ''); 
}

function ddlState_Change(ddl)
{
	if (ddl.id == 'ddlFromState')
	{
		document.getElementById('spnFromState').style.color = '#000000';
		document.getElementById('spnFromAP').style.color = '#000000';
		document.getElementById('spnToAP').style.color = '#000000';
		document.getElementById('ddlToState').value = ddl.value;
		ddlState_Change(document.getElementById('ddlToState'));
		if (document.getElementById('tdFromAP').style.display == 'block')
		{
			document.getElementById('ddlFromAP').disabled = true;
			document.getElementById('ddlFromAP').options.length = 0;
			if (document.getElementById('ddlFromState').value != '')
			{
				var anOption = new Option('Loading...','');
				document.getElementById('ddlFromAP').options.add(anOption); 
				AjaxCallType = 'fromCityList';
				SendAjaxCall('/otherpages/Query2.aspx?type=cityList', '&statecode=' + ddl.value);
			}
		}
	}
	else
	{
		if (document.getElementById('tdToAP').style.display == 'block')
		{	
			document.getElementById('spnToState').style.color = '#000000';
			document.getElementById('spnToAP').style.color = '#000000';
			document.getElementById('ddlToAP').disabled = true;
			document.getElementById('ddlToAP').options.length = 0;
			if (document.getElementById('ddlToState').value != '')
			{
				var anOption = new Option('Loading...','');
				document.getElementById('ddlToAP').options.add(anOption); 		
				AjaxCallType = 'toCityList';
				SendAjaxCall('/otherpages/Query2.aspx?type=cityList', '&statecode=' + ddl.value);
			}
		}			
	}
	//var d = new Date();  
	//var e = d.getTime(); 
	 
}
function ddlVType_Change(ddl)
{
	document.getElementById('trTypeLX').style.display = 'none';
	document.getElementById('trTypeME').style.display = 'none';
	document.getElementById('trTypeSL').style.display = 'none';
	document.getElementById('trTypeSUV').style.display = 'none';
	document.getElementById('trTypeSUVSL').style.display = 'none';
	document.getElementById('trTypeVan').style.display = 'none';
	document.getElementById('trTypeBus').style.display = 'none';
	document.getElementById('trType' + ddl.value).style.display = 'block';
	var maxPass = 4;
	switch(ddl.value)
	{
	    case('LX'):
	        maxPass = 4;
	        break;
	    case('ME'):
	        maxPass = 3;
	        break;	        
	    case('SL'):
	        maxPass = 12;
	        break;
	    case('SUV'):
	        maxPass = 7;
	        break;
	    case('SUVSL'):
	        maxPass = 18;
	        break;
	    case('Van'):
	        maxPass = 14;
	        break;
	    case('Bus'):
	        maxPass = 54;
	        break;
	}
	document.getElementById('ddlPass').options.length = 0;
	for (i = 1 ; i < maxPass + 1; i++)
	{
		var anOption = new Option(i,i);
		document.getElementById('ddlPass').options.add(anOption); 	
	}
}

function ProcessJSON(str, type)
{
	//alert(str);
	str = str.replace("\n","").replace("\r","");
	str = str.replace("<html>","").replace("<head>","").replace("<title>","").replace("</title>","").replace("</head>","").replace("</html>","");
	var resultObj = eval("(" + str + ")");	
	switch(type)
	{
		case('stateList'):
			document.getElementById('ddlFromState').options.length = 0;
			document.getElementById('ddlToState').options.length = 0;
			for(var i=0; i<resultObj.TABLE[0].ROW.length; i++) 
			{	
			    if (!((resultObj.TABLE[0].ROW[i].COL[0].DATA == 'IA') || (resultObj.TABLE[0].ROW[i].COL[0].DATA == 'DE')))
			    {
				    var anOptionA = new Option(resultObj.TABLE[0].ROW[i].COL[1].DATA, resultObj.TABLE[0].ROW[i].COL[0].DATA);
				    var anOptionB = new Option(resultObj.TABLE[0].ROW[i].COL[1].DATA, resultObj.TABLE[0].ROW[i].COL[0].DATA);
				    document.getElementById('ddlFromState').options.add(anOptionA);
				    document.getElementById('ddlToState').options.add(anOptionB);
				}
			}
			break;
		case('fromCityList'):
			document.getElementById('ddlFromAP').options.length = 0;
			for(var i=0; i<resultObj.TABLE[0].ROW.length; i++) 
			{	
				var anOptionA = new Option(resultObj.TABLE[0].ROW[i].COL[2].DATA + ' - ' + resultObj.TABLE[0].ROW[i].COL[1].DATA.replace("Airport",""), resultObj.TABLE[0].ROW[i].COL[2].DATA);
				document.getElementById('ddlFromAP').options.add(anOptionA);
			}
			document.getElementById('ddlFromAP').disabled = false;
			break;		
		case('toCityList'):
			document.getElementById('ddlToAP').options.length = 0;
			for(var i=0; i<resultObj.TABLE[0].ROW.length; i++) 
			{	
				var anOptionA = new Option(resultObj.TABLE[0].ROW[i].COL[2].DATA + ' - ' + resultObj.TABLE[0].ROW[i].COL[1].DATA.replace("Airport",""), resultObj.TABLE[0].ROW[i].COL[2].DATA);
				document.getElementById('ddlToAP').options.add(anOptionA);
			}
			document.getElementById('ddlToAP').disabled = false;
			break;					
	}
}
function SendInfo()
{
    if (sent == true) return;
	var type = escape(document.getElementById('ddlType').value);
	switch(type)
	{
	    case('A'):
	        type = 'To Airport';
	        break;
	    case('B'):
	        type = 'From Airport';
	        break;
	    case('C'):
	        type = 'Point to Point';
	        break;	        	        
	}
	var fromState = escape(document.getElementById('ddlFromState').value);
	var fromCity = escape(document.getElementById('tbFromCity').value);
	var fromAP = escape(document.getElementById('ddlFromAP').value);
	var toState = escape(document.getElementById('ddlToState').value);
	var toCity = escape(document.getElementById('tbToCity').value);
	var toAP = escape(document.getElementById('ddlToAP').value);
	var time = escape(document.getElementById('ddlHr').value + ':' + document.getElementById('ddlMin').value);
	var date = escape(document.getElementById('tbDate').value);
	var vType = escape(document.getElementById('ddlVType').value);
	var pass = escape(document.getElementById('ddlPass').value);
	var name = escape(document.getElementById('tbName').value);
	var email  = escape(document.getElementById('tbEmail').value);
	var tel = escape(document.getElementById('tbTel').value);
	var sessionid = '';
	(new Image).src="/OtherPages/Recieve.aspx?Type=" + type + "&FromState=" + fromState + "&FromCity=" + fromCity + "&FromAP=" + fromAP + "&ToState=" + toState + "&ToCity=" + toCity + "&ToAP=" + toAP + "&Time=" + time + "&Date=" + date + "&VType=" + vType + "&Pass=" +  pass + "&Name=" + name + "&Email=" + email + "&Tel=" + tel + "&Session=" + sessionid;
    sent = true;	
}
//********************************  START AJAX FUNCTIONS ************************


var ie4=document.all
var ns6=document.getElementById&&!document.all

var objCall;
var xmlDoc = null;
moz=document.getElementById&&!document.all;
function displayAjaxCallResult(str)
{
	ProcessJSON(str, AjaxCallType);
}

var http_request = false;

function SendAjaxCall(url, parameters) 
{
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
     http_request = new XMLHttpRequest();
     if (http_request.overrideMimeType) {
        http_request.overrideMimeType('text/xml');
     }
  } else if (window.ActiveXObject) { // IE
     try {
        http_request = new ActiveXObject('Msxml2.XMLHTTP');
     } catch (e) {
        try {
           http_request = new ActiveXObject('Microsoft.XMLHTTP');
        } catch (e) {}
     }
  }
  if (!http_request) {
     alert('Cannot create XMLHTTP instance');
     return false;
  }
  http_request.onreadystatechange = onreturnFromSendAjaxCall;
  http_request.open('GET', url + parameters, true);
  http_request.send(null);
}

function onreturnFromSendAjaxCall() 
{
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
            str = http_request.responseText;
            displayAjaxCallResult(str);
        } 
    }
}

//********************************  END AJAX FUNCTIONS ************************
