function changeRateTab(obj){
	if(obj.id == "box_btn_z" && obj.className == "box_btn_link_unslct"){
		document.getElementById("box_btn_a").className = "box_btn_link_unslct";
		document.getElementById("box_btn_c").className = "box_btn_link_unslct";
		obj.className = "box_btn_link_slct";
		document.getElementById("zip_cntr").style.display = "";
		document.getElementById("airport_cntr").style.display = "none";
		document.getElementById("city_cntr").style.display = "none";

	}else if(obj.id == "box_btn_a" && obj.className == "box_btn_link_unslct"){
		document.getElementById("box_btn_z").className = "box_btn_link_unslct";
		document.getElementById("box_btn_c").className = "box_btn_link_unslct";
		obj.className = "box_btn_link_slct";
		document.getElementById("zip_cntr").style.display = "none";
		document.getElementById("airport_cntr").style.display = "";
		document.getElementById("city_cntr").style.display = "none";
		
	}else if(obj.id == "box_btn_c" && obj.className == "box_btn_link_unslct"){
		document.getElementById("box_btn_z").className = "box_btn_link_unslct";
		document.getElementById("box_btn_a").className = "box_btn_link_unslct";
		obj.className = "box_btn_link_slct";
		document.getElementById("zip_cntr").style.display = "none";
		document.getElementById("airport_cntr").style.display = "none";
		document.getElementById("city_cntr").style.display = "";		
	}
}

function getZipRate(){
	if((document.getElementById("pickup_zip").value == "") || (document.getElementById("destination_zip").value == "")){
		alert("Please enter a valid Zip Code within the United States");
		return false;
	}

	if(isNaN(document.getElementById("pickup_zip").value) || isNaN(document.getElementById("destination_zip").value)){
		alert("Please enter a valid Zip Code within the United States");
		return false;
	}
	pickup = document.getElementById("pickup_zip").value;
	dest = document.getElementById("destination_zip").value;	
	url = "includes/ajax/zip_code_rate.php?pzip="+pickup+"&dzip="+dest;
	new ajaxRequest(url,'zip_price_cntr',"Please wait while we find your rate...");	
	//return false;
}

function getAPrate(){
	if(document.getElementById("airport").value == ""){
		alert("Please select an airport.");
		return false;
	}

	if((isNaN(document.getElementById("ap_zip").value)) || (document.getElementById("ap_zip").value == "")){
		alert("Please enter a valid Zip Code within the United States");
		return false;
	}
	zip = document.getElementById("ap_zip").value;
	airport = document.getElementById("airport").value;	
	url = "includes/ajax/airport_rate.php?zip="+zip+"&ap="+airport;
	new ajaxRequest(url,'ap_price_cntr',"Please wait while we find your rate...");	
	//return false;
}

function getCityRate(){
	if(document.getElementById("city_name").value == ""){
		alert("Please enter a name.");
		return false;
	}

	city = document.getElementById("city_name").value;
	url = "includes/ajax/city_rate.php?city="+city;
	new ajaxRequest(url,'city_price_cntr',"Please wait while we find your rate...");	
	//return false;
}


function loadLogin(){
	if(document.getElementById("verified").innerHTML == "Approved"){
		url = "includes/ajax/page_header_right_top.php";
		ajaxRequest(url,'page_header_right_top',"loading...");

		url2 = "includes/ajax/reserve_now_cntr.php";
		makerequest(url2,'reserve_now_cntr');

		document.getElementById("box_btn_rn").innerHTML = "Welcome";
		
	}
}
function encodeMyHtml(id) {
	encodedHtml = escape(id);
	encodedHtml = encodedHtml.replace(/\//g,"%2F");
	encodedHtml = encodedHtml.replace(/\?/g,"%3F");
	encodedHtml = encodedHtml.replace(/=/g,"%3D");
	encodedHtml = encodedHtml.replace(/&/g,"%26");
	encodedHtml = encodedHtml.replace(/@/g,"%40");
	return encodedHtml;
} 
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					
	}
	
