var detectPaymentPageNext = false;
var detectFrequentPageNext = false;
function showLoad(show,id){
	//alert(id);
	if(show){
		document.getElementById(id).style.display="inline";
	}else{
		document.getElementById(id).style.display="none";
	}
};

function _utf8_encode(string) {
	string = string.replace(/\r\n/g,"\n");
	var utftext = "";

	for (var n = 0; n < string.length; n++) {

		var c = string.charCodeAt(n);

		if (c < 128) {
			utftext += String.fromCharCode(c);
		}
		else if((c > 127) && (c < 2048)) {
			utftext += String.fromCharCode((c >> 6) | 192);
			utftext += String.fromCharCode((c & 63) | 128);
		}
		else {
			utftext += String.fromCharCode((c >> 12) | 224);
			utftext += String.fromCharCode(((c >> 6) & 63) | 128);
			utftext += String.fromCharCode((c & 63) | 128);
		}

	}

	return utftext;
}

function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}



var http = createRequestObject();
function sndReq(action) {
	//MM_showHideLayersDeleteRideProfile('popdelete','','hide');
    http.open('get', action);
    http.onreadystatechange = handleResponse;
	 http.send(null);
  
}
function handleResponse() {
    if(http.readyState == 4){
		document.getElementById('account_payment_profile').innerHTML = http.responseText;
    }
	
}
function rider_cc(flag,ProfileNo) {
	//var city1=city;
	var val = 'ajax/account_payment_profile_mainbody.php?sid=' + Math.random() + '&flag='+flag+'&ProfileNo=' +ProfileNo; 
	if(flag=='Del')
	{
		showLoad(true,'loadingDeletePayment');
	}
	sndReq(val);
	return false;
}



var http1 = createRequestObject();
function sndReq1(action) {
	//MM_showHideLayersDeleteFrequentRide('popdelete','','hide');
    http1.open('get', action);
    http1.onreadystatechange = handleResponse1;
	 http1.send(null);
	
   
}
function handleResponse1() {
    if(http1.readyState == 4){
		document.getElementById('frequent_rides').innerHTML = http1.responseText;
		jQuery("#ToLabel").qtip({
		 content: {
		   text:'Checking this box will tell the vendor that you prefer a green vehicle, if available. Green vehicles include hybrids, high MPG vehicles, low CO2 emission vehicles or electric vehicles.<p>NOTE: Due to high demand for these vehicles, there is no guarantee a vendor can provide a green vehicle on the day of the ride.</p>'
		  },
		  show: 'mouseover',
		  hide: 'mouseout',
		  position: {
			corner: {
			 target: 'upperRight',
			  tooltip: 'bottomLeft'
					}
		   },
		   style: { 
			border: {
			 width: 2,
			  radius: 5
			},
			padding: 10, 
			textAlign: 'left',
			name: 'cream',
			tip: true
		   }
		});
		
		jQuery("#pu_address1").autocomplete(
			"ajax/airport_popupajax.php",
			{
				minChars:3,
				matchSubset:false,
				cacheLength:10,
				width:300,
				loadingClass:'ajax_input_loading',
				formatItem:formatItem,
				onItemSelect:selectItemPickup,
				autoFill:false,
				selectFirst:true
			}
		);
		jQuery("#do_address1").autocomplete(
			"ajax/airport_popupajax.php",
			{
				minChars:3,
				cacheLength:10,
				matchSubset:false,
				width:300,
				loadingClass:'ajax_input_loading',
				formatItem:formatItem,
				onItemSelect:selectItemDrop,
				autoFill:true,
				selectFirst:true
			}
		);
		
    }
	
}
function frequent_rides(flag,FrequentRideNo,from) {
	var val = 'ajax/account_frequent_rides_mainbody.php?sid=' + Math.random()+'&flag='+flag+'&FrequentRideNo='+FrequentRideNo+'&from='+from;
	if(flag=='Del')
	{
		showLoad(true,'loadingDeleteFrqRide');
	}
	sndReq1(val);
	return false;
}



var http2 = createRequestObject();
	function sndReq2(action) {
		 //-------- Crad Exp date chk ----------------
		 if(detectPaymentPageNext==true && document.getElementById('NameOnCard').value=='' && document.getElementById('cc_number').value=='')
		{
			//alert('aaaa');

			document.location.href=document.getElementById('paymentNextPath').value;
			  return true;
		}
		else
		{
	
	  var dtObj=new Date();
	  var cr_yr=20+document.getElementById('ccexp_year').value;
	  if(document.getElementById('ccexp_month').value < dtObj.getMonth()+1 && cr_yr <= dtObj.getFullYear())
	  {
				document.getElementById('if_exp').innerHTML ='Card Expired';
				eval("document.getElementById('if_exp').style.color = 'red'");
				eval("document.getElementById('if_exp').style.fontSize = '10px'");
				return false;
	  }
//-----------------------------------------------------------------------------------
	if(document.getElementById('ussebilllingaddress').checked==true)
	{
		var ussebilllingaddress='1';
		
	}
	else
	{
		var ussebilllingaddress='0';
		
		 if(document.getElementById('address_1').value=='' || document.getElementById('address_1').value=='Address Required' || document.getElementById('city').value=='' || document.getElementById('city').value=='City Required' || document.getElementById('zipcode').value=='' || document.getElementById('zipcode').value=='ZipCode Required'  || document.getElementById('country').value=='' || document.getElementById('country').value=='Country Required' || document.getElementById('cc_number').value=='' || document.getElementById('cc_number').value=='Card No Required' || document.getElementById('cc_ccv2').value=='' || document.getElementById('cc_ccv2').value=='CVV No Required' || document.getElementById('NameOnCard').value=='' || document.getElementById('NameOnCard').value=='Name Required')
		  {
		  
			if(document.getElementById('address_1').value=='')
			{
			document.getElementById('address_1').style.borderColor='red';   
			eval("document.getElementById('address_1').value = 'Address Required'");
			eval("document.getElementById('address_1').style.color = 'red'");
			
			}
			
			if(document.getElementById('city').value=='')
			{
			document.getElementById('city').style.borderColor='red';   
			eval("document.getElementById('city').value = 'City Required'");
			eval("document.getElementById('city').style.color = 'red'");
			
			}
			if(document.getElementById('zipcode').value=='')
			{
			document.getElementById('zipcode').style.borderColor='red';   
			eval("document.getElementById('zipcode').value = 'ZipCode Required'");
			eval("document.getElementById('zipcode').style.color = 'red'");
			
			}
			if(document.getElementById('country').value=='')
			{
			document.getElementById('country').style.borderColor='red';   
			eval("document.getElementById('country').value = 'Country Required'");
			eval("document.getElementById('country').style.color = 'red'");
			
			}
			
			if(document.getElementById('NameOnCard').value=='')
			{
			document.getElementById('NameOnCard').style.borderColor='red';   
			eval("document.getElementById('NameOnCard').value = 'Name Required'");
			eval("document.getElementById('NameOnCard').style.color = 'red'");
			eval("document.getElementById('NameOnCard').style.fontSize = '10px'");
			}
			if(document.getElementById('cc_number').value=='')
			{
			document.getElementById('cc_number').style.borderColor='red';   
			eval("document.getElementById('cc_number').value = 'Card No Required'");
			eval("document.getElementById('cc_number').style.color = 'red'");
			eval("document.getElementById('cc_number').style.fontSize = '10px'");
			}
			
			if(document.getElementById('cc_ccv2').value=='')
			{
			document.getElementById('cc_ccv2').style.borderColor='red';   
			eval("document.getElementById('cc_ccv2').value = 'CVV No Required'");
			eval("document.getElementById('cc_ccv2').style.color = 'red'");
			eval("document.getElementById('cc_ccv2').style.fontSize = '10px'");
			}
		
			return false;
		  }
	}
	
	 if(document.getElementById('cc_number').value=='' || document.getElementById('cc_number').value=='Card No Required' || document.getElementById('cc_ccv2').value=='' || document.getElementById('cc_ccv2').value=='CVV No Required' || document.getElementById('NameOnCard').value=='' || document.getElementById('NameOnCard').value=='Name Required')
		  {
		  	
			if(document.getElementById('NameOnCard').value=='')
			{
			document.getElementById('NameOnCard').style.borderColor='red';   
			eval("document.getElementById('NameOnCard').value = 'Name Required'");
			eval("document.getElementById('NameOnCard').style.color = 'red'");
			eval("document.getElementById('NameOnCard').style.fontSize = '10px'");
			}
			if(document.getElementById('cc_number').value=='')
			{
			document.getElementById('cc_number').style.borderColor='red';   
			eval("document.getElementById('cc_number').value = 'Card No Required'");
			eval("document.getElementById('cc_number').style.color = 'red'");
			eval("document.getElementById('cc_number').style.fontSize = '10px'");
			}
			
			if(document.getElementById('cc_ccv2').value=='')
			{
			document.getElementById('cc_ccv2').style.borderColor='red';   
			eval("document.getElementById('cc_ccv2').value = 'CVV No Required'");
			eval("document.getElementById('cc_ccv2').style.color = 'red'");
			eval("document.getElementById('cc_ccv2').style.fontSize = '10px'");
			}
			return false;
		  }
		 
		  //------------ Credit Card Validation ---------------------
		  
		  cardType=document.getElementById('cc_type').value;
		  cardNumber= document.getElementById('cc_number').value;
		  document.getElementById('CardValid').innerHTML ='';
		  if(cardNumber.length>16)
		  {
			  	document.getElementById('CardValid').innerHTML ='Credit Card number should not be more than 16 digits';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				return false;
		  }
		  else
		  {
			switch(cardType)
			{
				case "MAST":
				if(cardNumber.length!=16 || cardNumber.substr(0,2) <51 || cardNumber.substr(0,2)>55 )
				{
				document.getElementById('CardValid').innerHTML ='Invalid master card number';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				return false;
				}
				break;
				case "VISA":
				if(cardNumber.substr(0,1) !=4)
				{ 
				document.getElementById('CardValid').innerHTML ='Invalid Visa number';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				return false;
				}
				else if(cardNumber.length!=16 && cardNumber.length!=13)
				{
				document.getElementById('CardValid').innerHTML ='Invalid Visa number';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				return false;
				}
				break;
				case "AMEX":
				if(cardNumber.length !=15)
				{
				document.getElementById('CardValid').innerHTML ='Invalid Amex number';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				return false;
				}
				else if(cardNumber.substr(0,2)!=37 && cardNumber.substr(0,2)!=34)
				{
				document.getElementById('CardValid').innerHTML ='Invalid Amex number';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				
				return false;
				}
				break;
				case "DISC":
				if(cardNumber.substr(0,4) !='6011')
				{ 
				document.getElementById('CardValid').innerHTML ='Invalid Discover number';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				return false;
				}
				break;
				default:
				document.getElementById('CardValid').innerHTML ='Card type unceptable';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
			}
		  }
		//---------------- MOD 10 CHECK ---------------------
			var no_digit = cardNumber.length;
			var oddoeven = no_digit & 1;
			var sum = 0;
			for (var count = 0; count < no_digit; count++) {
			var digit = parseInt(cardNumber.charAt(count));
			if (!((count & 1) ^ oddoeven)) {
			digit *= 2;
			if (digit > 9)
			digit -= 9;
			}
			sum += digit;
			}
			if (sum % 10 != 0)
			{
				document.getElementById('CardValid').innerHTML ='Invalid card number';
				eval("document.getElementById('CardValid').style.color = 'red'");
				eval("document.getElementById('CardValid').style.fontSize = '10px'");
				return false;
			}

		//--------------------------------------------  
		
	if(document.getElementById('payprofile_default').checked==true)
	{
		var payprofile_default='1';
	}
	else
	{
		var payprofile_default='0';
	}
}	
	showLoad(true,'loadingPayPro');
    http2.open('post', action);
	http2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    http2.onreadystatechange = handleResponse2;
	http2.send('Add='+document.payment_profile.Add.value+'&flag='+document.payment_profile.flag.value+'&ProfileNo='+document.payment_profile.ProfileNo.value+'&cc_type='+document.payment_profile.cc_type.value+'&ccexp_month='+document.payment_profile.ccexp_month.value+'&ccexp_year='+document.payment_profile.ccexp_year.value+'&cc_number='+document.payment_profile.cc_number.value+'&cc_ccv2='+document.payment_profile.cc_ccv2.value+'&ussebilllingaddress='+ussebilllingaddress+'&address_1='+document.payment_profile.address_1.value+'&city='+document.payment_profile.city.value+'&address_2='+document.payment_profile.address_2.value+'&state='+document.payment_profile.state.value+'&zipcode='+document.payment_profile.zipcode.value+'&country='+document.payment_profile.country.value+'&payprofile_name='+document.payment_profile.payprofile_name.value+'&payprofile_default='+payprofile_default+'&NameOnCard='+document.payment_profile.NameOnCard.value);
   
}
function handleResponse2() {
    if(http2.readyState == 4){
		document.getElementById('account_payment_profile').innerHTML = http2.responseText;
		if(detectPaymentPageNext==true)
		{
			document.location.href=document.getElementById('paymentNextPath').value;
		}
		detectPaymentPageNext=false;
    }
}
function rider_cc_upd(flag) {
	var val = 'ajax/account_payment_profile_mainbody.php?sid=' + Math.random();
	if(flag=='next')
	{
	  detectPaymentPageNext=true;
	}
	sndReq2(val);
	return false;
}



var http3 = createRequestObject();
function sndReq3(action,next_val) {
	if(next_val=='next')
	{
		  detectFrequentPageNext=true;
	}
	//alert(detectFrequentPageNext);
	if(detectFrequentPageNext==true && document.getElementById('pu_address1').value=='' && document.getElementById('payprofile_name').value=='')
	{
		document.location.href=document.getElementById('linkFrequent').value;
		return true;
	}
	else
	{
	if(document.getElementById('greenride').checked==true)
	{
		var greenride='1';
	}
	else
	{
		var greenride='0';
	}
	
	for (var i=0; i < document.frequent_rides_frm.ride_type.length; i++)
	   {
	   if (document.frequent_rides_frm.ride_type[i].checked)
		  {
		  var ride_type = document.frequent_rides_frm.ride_type[i].value;
		  }
	   }
	   
	var prof_nm= document.getElementById('chkProfile').innerHTML ;
	prof_nm=prof_nm.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
	if(document.getElementById('cell').value!='' || document.getElementById('cell').value=='Phone No must Be 10 Digits.')
	  {
		var cellNoValidation= _doPhoneRequired('cell','','Cell No. must Be 10 Digits.','blank');
	  }
	if(document.getElementById('pu_address1').value=='' || document.getElementById('pu_address1').value=='Address Required' || document.getElementById('pu_address1_city').value=='' || document.getElementById('pu_address1_city').value=='City Required' || document.getElementById('pu_address1_zip').value=='' || document.getElementById('pu_address1_zip').value=='ZipCode Required' ||                          document.getElementById('do_address1').value=='' || document.getElementById('do_address1').value=='Address Required' || document.getElementById('do_address1_city').value=='' || document.getElementById('do_address1_city').value=='City Required' || document.getElementById('do_address1_zip').value=='' || document.getElementById('do_address1_zip').value=='ZipCode Required' || document.getElementById('do_country').value=='' || document.getElementById('do_country').value=='Country Required' || document.getElementById('pu_country').value=='' || document.getElementById('pu_country').value=='Country Required' || document.getElementById('payprofile_name').value=='' || document.getElementById('payprofile_name').value=='Profile Name Required' || prof_nm !='' || document.getElementById('cc_number').value=='' || document.getElementById('cc_number').value=='Must be greater than 0' || cellNoValidation==false)
	  {
		
		if(document.getElementById('pu_address1').value=='')
		{
		document.getElementById('pu_address1').style.borderColor='red';   
		eval("document.getElementById('pu_address1').value = 'Address Required'");
		eval("document.getElementById('pu_address1').style.color = 'red'");
		
		}
		
		if(document.getElementById('pu_address1_city').value=='')
		{
		document.getElementById('pu_address1_city').style.borderColor='red';   
		eval("document.getElementById('pu_address1_city').value = 'City Required'");
		eval("document.getElementById('pu_address1_city').style.color = 'red'");
		
		}
		if(document.getElementById('pu_address1_zip').value=='')
		{
		document.getElementById('pu_address1_zip').style.borderColor='red';   
		eval("document.getElementById('pu_address1_zip').value = 'ZipCode Required'");
		eval("document.getElementById('pu_address1_zip').style.color = 'red'");
		
		}
		if(document.getElementById('do_address1').value=='')
		{
		document.getElementById('do_address1').style.borderColor='red';   
		eval("document.getElementById('do_address1').value = 'Address Required'");
		eval("document.getElementById('do_address1').style.color = 'red'");
		
		}
		if(document.getElementById('do_address1_city').value=='')
		{
		document.getElementById('do_address1_city').style.borderColor='red';   
		eval("document.getElementById('do_address1_city').value = 'City Required'");
		eval("document.getElementById('do_address1_city').style.color = 'red'");
		
		}
		if(document.getElementById('do_address1_zip').value=='')
		{
		document.getElementById('do_address1_zip').style.borderColor='red';   
		eval("document.getElementById('do_address1_zip').value = 'ZipCode Required'");
		eval("document.getElementById('do_address1_zip').style.color = 'red'");
		
		}
		if(document.getElementById('do_country').value=='')
		{
		document.getElementById('do_country').style.borderColor='red';   
		eval("document.getElementById('do_country').value = 'Country Required'");
		eval("document.getElementById('do_country').style.color = 'red'");
		
		}
		if(document.getElementById('pu_country').value=='')
		{
		document.getElementById('pu_country').style.borderColor='red';   
		eval("document.getElementById('pu_country').value = 'Country Required'");
		eval("document.getElementById('pu_country').style.color = 'red'");
		
		}
		if(document.getElementById('payprofile_name').value=='')
		{
		document.getElementById('payprofile_name').style.borderColor='red';   
		eval("document.getElementById('payprofile_name').value = 'Profile Name Required'");
		eval("document.getElementById('payprofile_name').style.color = 'red'");
		
		}
		if(document.getElementById('cc_number').value=='')
		{
		document.getElementById('cc_number').style.borderColor='red';   
		eval("document.getElementById('cc_number').value = 'Must be greater than 0'");
		eval("document.getElementById('cc_number').style.color = 'red'");
		
		}
		
		return false;
	  }
	}
	  showLoad(true,'loadingFreqRide');
    http3.open('post', action);
	http3.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    http3.onreadystatechange = handleResponse3;
    http3.send('Add='+document.frequent_rides_frm.Add.value+'&flag='+document.frequent_rides_frm.flag.value+'&FrequentRideNo='+document.frequent_rides_frm.FrequentRideNo.value+'&from='+document.frequent_rides_frm.from.value+'&ride_type='+ride_type+'&greenride='+greenride+'&occn='+document.frequent_rides_frm.occn.value+'&cc_number='+document.frequent_rides_frm.cc_number.value+'&vehicle_type='+document.frequent_rides_frm.vehicle_type.value+'&use_puaddress='+document.frequent_rides_frm.use_puaddress.value+'&do_address1='+document.frequent_rides_frm.do_address1.value+'&do_address2='+document.frequent_rides_frm.do_address2.value+'&do_city='+document.frequent_rides_frm.do_city.value+'&do_state='+document.frequent_rides_frm.do_state.value+'&do_zipcode='+document.frequent_rides_frm.do_zipcode.value+'&do_country='+document.frequent_rides_frm.do_country.value+'&email='+document.frequent_rides_frm.email.value+'&pu_address1='+document.frequent_rides_frm.pu_address1.value+'&pu_address2='+document.frequent_rides_frm.pu_address2.value+'&pu_city='+document.frequent_rides_frm.pu_city.value+'&pu_state='+document.frequent_rides_frm.pu_state.value+'&pu_zipcode='+document.frequent_rides_frm.pu_zipcode.value+'&pu_country='+document.frequent_rides_frm.pu_country.value+'&cell='+document.frequent_rides_frm.cell.value+'&payprofile_name='+document.frequent_rides_frm.payprofile_name.value+'&PickUpAirportCode='+document.frequent_rides_frm.PickUpAirportCode.value+'&DropOffAirportCode='+document.frequent_rides_frm.DropOffAirportCode.value+'&next_val='+next_val);
}
function handleResponse3() {
	if(http3.readyState == 4){
		document.getElementById('frequent_rides').innerHTML = http3.responseText;
		if(detectFrequentPageNext==true)
		{
			document.location.href=document.getElementById('linkFrequent').value;
		}
		
		jQuery("#ToLabel").qtip({
		 content: {
		   text:'Checking this box will tell the vendor that you prefer a green vehicle, if available. Green vehicles include hybrids, high MPG vehicles, low CO2 emission vehicles or electric vehicles.<p>NOTE: Due to high demand for these vehicles, there is no guarantee a vendor can provide a green vehicle on the day of the ride.</p>'
		  },
		  show: 'mouseover',
		  hide: 'mouseout',
		  position: {
			corner: {
			 target: 'upperRight',
			  tooltip: 'bottomLeft'
					}
		   },
		   style: { 
			border: {
			 width: 2,
			  radius: 5
			},
			padding: 10, 
			textAlign: 'left',
			name: 'cream',
			tip: true
		   }
		});
		
		jQuery("#pu_address1").autocomplete(
			"ajax/airport_popupajax.php",
			{
				minChars:3,
				matchSubset:false,
				cacheLength:10,
				width:300,
				loadingClass:'ajax_input_loading',
				formatItem:formatItem,
				onItemSelect:selectItemPickup,
				autoFill:false
			}
		);
		jQuery("#do_address1").autocomplete(
			"ajax/airport_popupajax.php",
			{
				minChars:3,
				cacheLength:10,
				matchSubset:false,
				width:300,
				loadingClass:'ajax_input_loading',
				formatItem:formatItem,
				onItemSelect:selectItemDrop,
				autoFill:true
			}
		);
	
    }
}
function frequent_rides_upd(next) {
	//alert(next);
	var next=next;
	var val = 'ajax/account_frequent_rides_mainbody.php?sid=' + Math.random(); 
	if(next=='next')
	{
		//alert('aaaa');
	  var detectFrequentPageNext=true;
	}
	sndReq3(val,next);
	return false;
}



var http4 = createRequestObject();
function sndReq4(action) {
    http4.open('get', action);
    http4.onreadystatechange = handleResponse4;
    http4.send(null);
}
function handleResponse4() {
    if(http4.readyState == 4){
		document.getElementById('ride_summary').innerHTML = http4.responseText;
    }
}
function ride_summary(status) {
	var val = 'ajax/ride_summary_mainbody.php?sid=' + Math.random()+'&status='+status; 
	sndReq4(val);
	return false;
}





var http5 = createRequestObject();
function sndReq5(action) {
	MM_showHideLayersDeleteRide('popdelete','','hide');
	MM_showHideLayersDeleteAcc('popbenefit','','hide');
    http5.open('get', action);
    http5.onreadystatechange = handleResponse5;
    http5.send(null);
}
var flagsortBy='No';
function handleResponse5() {
    if(http5.readyState == 4){
		document.getElementById('ride_summary_left').innerHTML = http5.responseText;
		//alert(flagsortBy);
		if(flagsortBy=='YES')
			window.location.href='../index.php';
    }
}
function ride_summary_vender(status,TxnNo,VendorNo,sortBy) {
	if(sortBy=='DEL' || sortBy=='Cancel')
		flagsortBy='YES';
	var val = 'ajax/ride_summary_mainbody_left.php?sid=' + Math.random()+'&status='+status+'&TxnNo='+TxnNo+'&VendorNo='+VendorNo+'&sortBy='+sortBy; 
	sndReq5(val);
	return false;
}




var http6 = createRequestObject();
function sndReq6(action) {
	//MM_showHideLayersDeleteRide('popdelete','','hide');
    http6.open('get', action);
    http6.onreadystatechange = handleResponse6;
    http6.send(null);
}
function handleResponse6() {
    if(http6.readyState == 4){
		document.getElementById('ride_summary_right').innerHTML = http6.responseText;
		
    }
}
var flagTxnNo=0;
function ride_summary_sort(status,TxnNo,VendorNo,sortBy,dammyFlag) {
	if(flagTxnNo!=TxnNo || dammyFlag==1)
	{
		flagTxnNo=TxnNo;
		var val = 'ajax/ride_summary_mainbody_right.php?sid=' + Math.random()+'&status='+status+'&TxnNo='+TxnNo+'&sortBy='+sortBy+'&VendorNo='+VendorNo;
		//showLoad(true,'loadingDeleteRide');
		sndReq6(val);
	}
	if(TxnNo=='')
	{
		var val = 'ajax/ride_summary_mainbody_right.php?sid=' + Math.random()+'&status='+status+'&TxnNo='+TxnNo+'&sortBy='+sortBy+'&VendorNo='+VendorNo;
		//showLoad(true,'loadingDeleteRide');
		sndReq6(val);	
	}
	return false;
}




var http7 = createRequestObject();
function sndReq7(action) {
    http7.open('get', action);
    http7.onreadystatechange = handleResponse7;
	 http7.send(null);
}
function handleResponse7() {
    if(http7.readyState == 4){
		document.getElementById('ride_checkout').innerHTML = http7.responseText;
		jQuery("#ToLabel").qtip({
		 content: {
		   text:'For your convenience, RideBid.com allows you to tip your driver prior to your ride.  This not only saves you from the hassle of cash or secondary credit transactions at the time of the ride, but also shows the vendor in advance how much you appreciate their service!'
		  },
		  show: 'mouseover',
		  hide: 'mouseout',
		  position: {
			corner: {
			 target: 'upperRight',
			  tooltip: 'bottomLeft'
					}
		   },
		   style: {
			border: {
			 width: 2,
			  radius: 5
			},
			padding: 10,
			textAlign: 'left',
			name: 'cream',
			tip: true
		   }
		});
    }
	
}
function rider_checkout(TxnNo,VendorNo,BidAmount,BidNo,prepaid_gratuity,ProfileNo,credit_code,preservedCcno,cc_number,cc_type,ccexp_month,ccexp_year,cc_ccv2,ussebilllingaddress,save_profile,address_1,state,zipcode,address_2,country,city,total_display) {
	var val = 'ajax/ride_checkout_mainbody.php?sid=' + Math.random()+'&TxnNo='+TxnNo+'&VendorNo='+VendorNo+'&BidAmount='+BidAmount+'&BidNo='+BidNo+'&ProfileNo='+ProfileNo+'&prepaid_gratuity='+prepaid_gratuity+'&credit_code='+credit_code+'&preservedCcno='+preservedCcno+'&cc_number='+cc_number+'&cc_type='+cc_type+'&ccexp_month='+ccexp_month+'&ccexp_year='+ccexp_year+'&cc_ccv2='+cc_ccv2+'&ussebilllingaddress='+ussebilllingaddress+'&save_profile='+save_profile+'&address_1='+address_1+'&state='+state+'&zipcode='+zipcode+'&address_2='+address_2+'&country='+country+'&city='+city+'&total_display='+total_display;
	sndReq7(val);
	return false;
}



var http71 = createRequestObject();
function sndReq71(action) {
    http71.open('get', action);
    http71.onreadystatechange = handleResponse71;
	 http71.send(null);
}
function handleResponse71() {
    if(http71.readyState == 4){
		document.getElementById('ride_checkout').innerHTML = http71.responseText;
		jQuery("#ToLabel").qtip({
		 content: {
		   text:'For your convenience, RideBid.com allows you to tip your driver prior to your ride.  This not only saves you from the hassle of cash or secondary credit transactions at the time of the ride, but also shows the vendor in advance how much you appreciate their service!'
		  },
		  show: 'mouseover',
		  hide: 'mouseout',
		  position: {
			corner: {
			 target: 'upperRight',
			  tooltip: 'bottomLeft'
					}
		   },
		   style: {
			border: {
			 width: 2,
			  radius: 5
			},
			padding: 10,
			textAlign: 'left',
			name: 'cream',
			tip: true
		   }
		});
    }
	
}
function rider_coupon(TxnNo,VendorNo,BidAmount,BidNo,ProfileNo,credit_code,load_id) {
	var address_1=document.getElementById('address_1').value;
	address_1=escape(this._utf8_encode(address_1));
	var address_2=document.getElementById('address_2').value;
	address_2=escape(this._utf8_encode(address_2));
	
	var val = 'ajax/ride_checkout_mainbody.php?sid=' + Math.random()+'&TxnNo='+TxnNo+'&VendorNo='+VendorNo+'&BidAmount='+BidAmount+'&BidNo='+BidNo+'&ProfileNo='+ProfileNo+'&coupon_code='+document.chkout.coupon_code.value+'&prepaid_gratuity='+document.chkout.prepaid_gratuity.value+'&cc_type='+document.getElementById('cc_type').value+'&ccexp_month='+document.getElementById('ccexp_month').value+'&ccexp_year='+document.getElementById('ccexp_year').value+'&cc_number='+document.getElementById('cc_number').value+'&cc_ccv2='+document.getElementById('cc_ccv2').value+'&address_1='+address_1+'&state='+document.getElementById('state').value+'&zipcode='+document.getElementById('zipcode').value+'&address_2='+address_2+'&country='+document.getElementById('country').value+'&city='+document.getElementById('city').value+'&noPaymentProfileSelected=1&credit_code='+credit_code;
	//alert(val);
	showLoad(true,load_id);
	document.getElementById('pay_now').disabled='disabled';
	//document.getElementById('prepaid_gratuity').disabled='disabled';
	sndReq71(val);
	return false;
}





var http72 = createRequestObject();
function sndReq72(action) {
    http72.open('get', action);
    http72.onreadystatechange = handleResponse72;
	 http72.send(null);
}
function handleResponse72() {
    if(http72.readyState == 4){
		document.getElementById('ride_checkout').innerHTML = http72.responseText;
		jQuery("#ToLabel").qtip({
		 content: {
		   text:'For your convenience, RideBid.com allows you to tip your driver prior to your ride.  This not only saves you from the hassle of cash or secondary credit transactions at the time of the ride, but also shows the vendor in advance how much you appreciate their service!'
		  },
		  show: 'mouseover',
		  hide: 'mouseout',
		  position: {
			corner: {
			 target: 'upperRight',
			  tooltip: 'bottomLeft'
					}
		   },
		   style: {
			border: {
			 width: 2,
			  radius: 5
			},
			padding: 10,
			textAlign: 'left',
			name: 'cream',
			tip: true
		   }
		});
    }
	
}

function rider_credit(TxnNo,VendorNo,BidAmount,BidNo,ProfileNo) {
	
	if(document.chkout.credit_code.value=='')
	{
		document.getElementById('credit_code').style.borderColor='red';   
		//eval("document.getElementById('credit_code').value = 'Must be greater than 0'");
		eval("document.getElementById('credit_code').style.color = 'red'");
		eval("document.getElementById('credit_code').style.fontSize = '10px'");
		return false;
	}
	var address_1=document.getElementById('address_1').value;
	address_1=escape(this._utf8_encode(address_1));
	var address_2=document.getElementById('address_2').value;
	address_2=escape(this._utf8_encode(address_2));
	//address_2=address_2.substr(1);
	
	var val = 'ajax/ride_checkout_mainbody.php?sid=' + Math.random()+'&TxnNo='+TxnNo+'&VendorNo='+VendorNo+'&BidAmount='+BidAmount+'&BidNo='+BidNo+'&ProfileNo='+ProfileNo+'&cc_type='+document.getElementById('cc_type').value+'&ccexp_month='+document.getElementById('ccexp_month').value+'&ccexp_year='+document.getElementById('ccexp_year').value+'&cc_number='+document.getElementById('cc_number').value+'&cc_ccv2='+document.getElementById('cc_ccv2').value+'&address_1='+address_1+'&state='+document.getElementById('state').value+'&zipcode='+document.getElementById('zipcode').value+'&address_2='+address_2+'&country='+document.getElementById('country').value+'&city='+document.getElementById('city').value+'&noPaymentProfileSelected=1&credit_code='+document.chkout.credit_code.value+'&prepaid_gratuity='+document.chkout.prepaid_gratuity.value;
	//alert(val);
	showLoad(true,'loadingCredit');
	sndReq72(val);
	return false;
}





var http8 = createRequestObject();
function sndReq8(action) {
    http8.open('get', action);
    http8.onreadystatechange = handleResponse8;
	 http8.send(null);
}
function handleResponse8() {
    if(http8.readyState == 4){
		document.getElementById('airport_code').innerHTML = http8.responseText;
    }
	
}
function airport_code(val) {
	var val = 'ajax/airport_popup.php?sid=' + Math.random()+'&val='+val;
	sndReq8(val);
	return false;
}



var http9 = createRequestObject();
function sndReq9(action) {
    http9.open('get', action);
    http9.onreadystatechange = handleResponse9;
	 http9.send(null);
}
function handleResponse9() {
    if(http9.readyState == 4){
		document.getElementById('airport_code_drop').innerHTML = http9.responseText;
    }
	
}
function airport_code_drop(val) {
	var val = 'ajax/airport_popup_drop.php?sid=' + Math.random()+'&val='+val;
	sndReq9(val);
	return false;
}




var http10 = createRequestObject();
function sndReq10(action) {
    http10.open('get', action);
    http10.onreadystatechange = handleResponse10;
	 http10.send(null);
}
function handleResponse10() {
    if(http10.readyState == 4){
		document.getElementById('chkUser').innerHTML = http10.responseText;
    }
	
}
function chk_user(val) {
	var val = 'ajax/chk_user_name.php?sid=' + Math.random()+'&val='+val;
	//alert(val);
	sndReq10(val);
	return false;
}



var http11 = createRequestObject();
function sndReq11(action) {
    http11.open('get', action);
    http11.onreadystatechange = handleResponse11;
	 http11.send(null);
}
function handleResponse11() {
    if(http11.readyState == 4){
		document.getElementById('account_history').innerHTML = http11.responseText;
    }
	
}
function account_history(sortBy,ord,search_from,search_to) {
	var val = 'ajax/account_ride_history_mainbody.php?sid=' + Math.random()+'&sortBy='+sortBy+'&ord='+ord+'&search_from='+search_from+'&search_to='+search_to;
	sndReq11(val);
	return false;
}



var http12 = createRequestObject();
function sndReq12(action) {
    http12.open('get', action);
    http12.onreadystatechange = handleResponse12;
	 http12.send(null);
}
function handleResponse12() {
    if(http12.readyState == 4){
		document.getElementById('account_history').innerHTML = http12.responseText;
    }
	
}
function account_history_bydate() {
	var val = 'ajax/account_ride_history_mainbody.php?sid=' + Math.random()+'&search_from='+document.getElementById('search_from').value+'&search_to='+document.getElementById('search_to').value+'&search=search';
	showLoad(true,'loadingHistory');
	sndReq12(val);
	return false;
}




var http13 = createRequestObject();
function sndReq13(action) {
    http13.open('get', action);
    http13.onreadystatechange = handleResponse13;
	 http13.send(null);
}
function handleResponse13() {
    if(http13.readyState == 4){
		document.getElementById('submit_review').innerHTML = http13.responseText;
    }
	
}
function account_review(TxnNo,VendorNo) {
	//showLoad(true,'loadingSubmitReview');
	var val = 'ajax/account_submit_review_mainbody.php?sid=' + Math.random()+'&TxnNo='+TxnNo+'&VendorNo='+VendorNo;
	//showLoad(true,'loadingSubmitReview');
	sndReq13(val);
	return false;
}



var http14 = createRequestObject();
function sndReq14(action) {
    http14.open('get', action);
    http14.onreadystatechange = handleResponse14;
	 http14.send(null);
}
function handleResponse14() {
    if(http14.readyState == 4){
		document.getElementById('chkProfile').innerHTML = http14.responseText;
    }
	
}
function chk_profile(val) {
	var val = 'ajax/chk_profile_name.php?sid=' + Math.random()+'&val='+val;
	sndReq14(val);
	return false;
}




var http15 = createRequestObject();
function sndReq15(action) {
    http15.open('get', action);
    http15.onreadystatechange = handleResponse15;
	 http15.send(null);
}
function handleResponse15() {
    if(http15.readyState == 4){
		document.getElementById('supported_pickup_zip').innerHTML = http15.responseText;
    }
	
}
function SupportedPickupZip(pickup_zip) {
	var val = 'ajax/chk_pickup_zip.php?sid=' + Math.random()+'&pickup_zip='+pickup_zip;
	sndReq15(val);
	return false;
}



var http16 = createRequestObject();
function sndReq16(action) {
    http16.open('get', action);
    http16.onreadystatechange = handleResponse16;
	 http16.send(null);
}
function handleResponse16() {
    if(http16.readyState == 4){
		document.getElementById('supported_drop_zip').innerHTML = http16.responseText;
    }
	
}
function SupportedDropZip(drop_zip) {
	var val = 'ajax/chk_drop_zip.php?sid=' + Math.random()+'&drop_zip='+drop_zip;
	sndReq16(val);
	return false;
}




var http17 = createRequestObject();
function sndReq17(action) {
    http17.open('get', action);
    http17.onreadystatechange = handleResponse17;
	 http17.send(null);
}
function handleResponse17() {
    if(http17.readyState == 4){
		document.getElementById('DisplayConfPass').innerHTML = http17.responseText;
    }
	
}
function conf_pass(pass,conf_pass) {
	var val = 'ajax/conf_pass.php?sid=' + Math.random()+'&pass='+pass+'&conf_pass='+conf_pass;
	sndReq17(val);
	return false;
}



var http18 = createRequestObject();
function sndReq18(action) {
    http18.open('get', action);
    http18.onreadystatechange = handleResponse18;
	 http18.send(null);
}
function handleResponse18() {
    if(http18.readyState == 4){
		document.getElementById('chkEmail').innerHTML = http18.responseText;
    }
	
}
function chk_Email(val,CustomerNo) {
	var val = 'ajax/chk_user_email.php?sid=' + Math.random()+'&val='+val+'&CustomerNo='+CustomerNo;
	sndReq18(val);
	return false;
}




var http19 = createRequestObject();
function sndReq19(action) {
    http19.open('get', action);
    http19.onreadystatechange = handleResponse19;
	 http19.send(null);
}
function handleResponse19() {
    if(http19.readyState == 4){
		document.getElementById('autoaccept_amount_upd').innerHTML = http19.responseText;
    }
	
}
function AutoAmount() {
	if(document.getElementById('autoaccept_bid').checked==true)
	{
			var autoacceptcheck=1;
	}
	else{
			var autoacceptcheck=0;
	}
	
	var AutoAcceptAmount=document.getElementById('autoaccept_amount').value;
	var val = 'ajax/update_autoaccept.php?sid=' + Math.random()+'&autoacceptcheck='+autoacceptcheck+'&AutoAcceptAmount='+AutoAcceptAmount;
	sndReq19(val);
	return false;
}



var http20 = createRequestObject();
function sndReq20(action) {
    http20.open('get', action);
    http20.onreadystatechange = handleResponse20;
	 http20.send(null);
}
function handleResponse20() {
    if(http20.readyState == 4){
		document.getElementById('chkAnnoEmail').innerHTML = http20.responseText;
    }
	
}
function chk_Anno_Email() {
	var val = 'ajax/chk_anno_email.php?sid=' + Math.random()+'&val='+document.getElementById('cont_email').value;
	sndReq20(val);
	return false;
}



var http21 = createRequestObject();
function sndReq21(action) {
    http21.open('get', action);
    http21.onreadystatechange = handleResponse21;
	 http21.send(null);
}
function handleResponse21() {
    if(http21.readyState == 4){
		document.getElementById('chkCurPass').innerHTML = http21.responseText;
    }
	
}
function chk_curpass(val) {
	var val = 'ajax/chk_cur_pass.php?sid=' + Math.random()+'&val='+val;
	//alert(val);
	sndReq21(val);
	return false;
}




function openWindow(url) {
  window.open(url,'popupWindow','resizable=no,scrollbars=yes,toolbar=no,status=no,height=650,width=720');
}
function expandOrClose(arrow_id, list_num, list_name)  {
	var a = document.getElementById(arrow_id);
	if(a.name=='d') { 
		a.src='arrowRight.gif';
		a.name='r';
		hideSearchTypes(list_num,list_name);
	}
	else {
		a.src='arrowDown.gif';
		a.name='d';
		showSearchTypes(list_num,list_name);
	}
	return false;
}
function hideSearchTypes (i,j) { 
	var theDiv = document.getElementById(j).getElementsByTagName('li');
	for(var d = 1; d < theDiv.length; d++) {
		var theID = 'res-'+i+'-'+d;
		Effect.DropOut(theID);
	}
}	
function showSearchTypes (i,j) { 
	var theDiv = document.getElementById(j).getElementsByTagName('li');
	for(var d = 1; d < theDiv.length; d++) {
		var theID = 'res-'+i+'-'+d;
		
		Effect.Appear(theID);
	}
}

/*VendorReviewDisplay*/
var http00000 = createRequestObject();
function sndReq00000(action) {
    http00000.open('get', action);
    http00000.onreadystatechange = handleResponse00000;
	http00000.send(null);
  
}
function handleResponse00000() {
    if(http00000.readyState == 4){
		document.getElementById('ajaxVendorReviewSummaryBody').innerHTML = http00000.responseText;
    }
	
}
function vendorReviewDisplay(VendorNo,TxnNo,orderBy,orderType) {
	var val = 'ajax/review_summary_mainbody.php?sid=' + Math.random() + '&DisplayVendor=DisplayVendor&VendorNo='+VendorNo+'&TxnNo='+TxnNo+'&orderBy='+orderBy+'&orderType='+orderType; 
	sndReq00000(val);
	return false;
}

function gratuityCal(gratuity)
{
	if(gratuity=='')
	{
		var gartAmt=0;
	}
	else
	{
		var gartAmt=gratuity;
	}
	var totalAmount=document.getElementById('totalAmt').value;
	totalAmount=parseFloat(totalAmount);
	//alert(totalAmount);
	var prepaidGratuity=document.getElementById('prepaid_gratuity').value;
	prepaidGratuity=parseFloat(prepaidGratuity-gartAmt);
	//alert(prepaidGratuity);
	//alert(prepaidGratuity+totalAmount);
	var totalCharge=parseFloat(prepaidGratuity+totalAmount);
	totalCharge=totalCharge.toFixed(2);
	document.getElementById('totalCharge').innerHTML=totalCharge;
	document.getElementById('totalChargeGen').style.display='none';
	document.getElementById('totalCharge').style.display='';
}

/*==================*/

