
/*function emailck(objToCheck, mes_valid_email) {
				spedia_re= /[^A-Za-z0-9_.@\-]/g;
				var array1 = objToCheck.value.match(spedia_re);									
				
				if ( ( array1 == null && (objToCheck.value.indexOf("@") == -1 || objToCheck.value.indexOf(".") == -1))){
		      	alert(mes_valid_email);
      			objToCheck.focus();
		        return false;
			   }
			   return true;
			   
			}*/

function emailck(field, alert_str)
{
	var str = field.value;
	//alert(str);
	if (window.RegExp) {
		var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
		var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
		var reg1 = new RegExp(reg1str);
		var reg2 = new RegExp(reg2str);
		if (!reg1.test(str) && reg2.test(str)) {
			return true;
		}
		if(alert_str.length>0)
			alert(alert_str);
		field.select();
		return false;
	} else {
		if(str.indexOf("@") >= 0)
		{
			return true;
		}
		if(alert_str.length>0)
			alert(alert_str);
		field.select();
		return false;
	}
}

function isDate(dtStr, mes1, mes2, mes3){
				var myRegex = new RegExp("^([0-2][0-9]|[3][0-1])\/([0][0-9]|[1][0-2])\/[0-9]{4}$");
				var myRegex2 = new RegExp("^([0-2][0-9]|[3][0-1])\.([0][0-9]|[1][0-2])\.[0-9]{4}$");
				if ( (dtStr.match(myRegex)) || (dtStr.match(myRegex2)) )
					{//valid date format, check for valid date dd/mm/yyyy
					var theDay = Math.round(dtStr.substr(0,2));
					var theMonth = Math.round(dtStr.substr(3,2));
					var theYear = Math.round(dtStr.substr(6,4));
					
					if (theYear< 2005) {
						alert (mes1);
						return false;
						}
					else if ((theYear%4 == 0) && (theDay > 29) && (theMonth == 2)) {
						alert (mes2);
						return false;
						}
					else if ((theYear%4 != 0) && (theDay > 28) && (theMonth == 2)) {
						alert (mes2);
						return false;
						}
					else if ((theDay > 30) && ((theMonth == 0) || (theMonth == 4) || (theMonth == 6) || (theMonth == 9) || (theMonth == 11) )) {
						alert (mes2);
						return false;
						}
					else {
						return true;
						}
					}
				else
					{
					alert (mes3);
					return false;
					}
				
			
			}	

function dateisNotPossible(day,month,year, mes5) {

	var datePoss = new Date().valueOf();
	var dateReal = new Date();
	dateReal.setMonth(Number(month) - 1);
	dateReal.setYear(parseInt(year));
	dateReal.setDate(Number(day));

	if (dateReal.valueOf() < datePoss) {
		alert(mes5+day+"-"+month+"-"+year);
		return false;
	}
	return true;
}


function checkmyDates(day1,day2,month1,month2,year1,year2, mes4) {
			
		if (parseFloat(year1) > parseFloat(year2)) 
		{
			alert(mes4);
			return false;
		}
		if (parseFloat(year1) == parseFloat(year2)) 
		{
			if (parseFloat(month1) > parseFloat(month2)) 
			{
				alert(mes4);
 				return false;
			}
			if (parseFloat(month1) == parseFloat(month2)) 
			{
				if (parseFloat(day1) > parseFloat(day2)) 
				{
					alert(mes4);
					return false;
				}
			}
		}
	return true;
	}		


function valid(err1, err2, err3, err4, err5, mes1, mes2, mes3, mes4, mes5, mes_valid_email, date_format) {

if (document.calctransfer.dest1.value==0) { 
	alert(err1);
	document.calctransfer.dest1.focus();return false;
	}
var date1String = document.calctransfer.transferdate1.value;
var day1    = date1String.substr(0,2);
var month1  = date1String.substr(3,2);
var year1   = date1String.substr(6,4);

document.calctransfer.checktwo2.value==1;
	
if ((date1String==date_format) || (date1String=='')) 
			{
			alert(err2);
			document.calctransfer.transferdate1.value='';
			document.calctransfer.transferdate1.focus();
			return false;
			}
			
if (isDate(date1String, mes1, mes2, mes3)==false) { document.calctransfer.transferdate1.focus(); return false; }
			
if (dateisNotPossible(day1,month1,year1, mes5)==false) { document.calctransfer.transferdate1.focus(); return false; }			
			
if (document.calctransfer.checktwo[1].checked) 
  {
	document.calctransfer.checktwo2.value==2;
	if (document.calctransfer.depart2.value==0) {
		alert(err3);
		document.calctransfer.depart2.focus();return false;
	}
	
	if (document.calctransfer.dest2.value==0) { 
		alert(err1);
		document.calctransfer.dest2.focus();return false;
		
	}	
	
	if ((document.calctransfer.transferdate2.value==date_format) || (document.calctransfer.transferdate2.value=='')) 
			{
			alert(err4);
			document.calctransfer.transferdate2.value='';
			document.calctransfer.transferdate2.focus();
			return false;
			}	
	
	if (isDate(document.calctransfer.transferdate2.value, mes1, mes2, mes3)==false) {
			document.calctransfer.transferdate2.focus(); return false;
			}
	
	var date2String = document.calctransfer.transferdate2.value;
	var day2    = date2String.substr(0,2);
	var month2  = date2String.substr(3,2);
	var year2   = date2String.substr(6,4);
	if (!checkmyDates(day1,day2,month1,month2,year1,year2, mes4)) {document.calctransfer.transferdate2.focus(); return false;}
  }
  
  if (document.calctransfer.email.value=='') {
		alert(err5);
		document.calctransfer.email.focus();return false;
  }
  
  if (!emailck(document.calctransfer.email, mes_valid_email)) 
  {
		return false;
  }

			
	document.calctransfer.dest1display.value = document.calctransfer.dest1.options[document.calctransfer.dest1.selectedIndex].text;
	document.calctransfer.depart1display.value = document.calctransfer.depart1.options[document.calctransfer.depart1.selectedIndex].text;
	
	document.calctransfer.dest2display.value = document.calctransfer.dest2.options[document.calctransfer.dest2.selectedIndex].text;
	document.calctransfer.depart2display.value = document.calctransfer.depart2.options[document.calctransfer.depart2.selectedIndex].text;
	
   
return true;

}


function calcpret(myairport, mes1, mes2, mes3){
	//check my airport
	//var myairport = "Alicante Airport";
	
	var pricecalc = 0; //final price
	var mychecktwo = 0;
	if (document.calctransfer.checktwo[0].checked) { mychecktwo = 1; document.calctransfer.checktwo2.value=1; } //one way
	if (document.calctransfer.checktwo[1].checked) { mychecktwo = 2; document.calctransfer.checktwo2.value=2; } //two ways
	var pers = document.calctransfer.persnum.value;
	var addr1 = document.calctransfer.depart1.value; //id
	var addr2 = document.calctransfer.dest1.value; //id 
	var addr3 = document.calctransfer.depart2.value; //id
	var addr4 = document.calctransfer.dest2.value; //id
	/*var addr1txt = document.calctransfer.depart1.options[document.calctransfer.depart1.selectedIndex].text;
	var addr2txt = document.calctransfer.dest1.options[document.calctransfer.dest1.selectedIndex].text;
	var addr3txt = document.calctransfer.depart2.options[document.calctransfer.depart2.selectedIndex].text;
	var addr4txt = document.calctransfer.dest2.options[document.calctransfer.dest2.selectedIndex].text;*/

	var addr1txt = document.calctransfer.depart1.value;
	var addr2txt = document.calctransfer.dest1.value;
	var addr3txt = document.calctransfer.depart2.value;
	var addr4txt = document.calctransfer.dest2.value;
	
	if ((addr1txt!=myairport) && (addr2==0)) {return false;}
	if (addr2==0) {document.calctransfer.result.value = 0; alert(mes1); document.calctransfer.dest1.selectedIndex=0; document.calctransfer.dest1.focus(); return false;}
	if (addr1txt==addr2txt) {document.calctransfer.result.value = 0; document.calctransfer.dest1.selectedIndex=0; alert(mes2); return false;}
	if ((addr1txt!=myairport) && (addr2txt!=myairport)) {document.calctransfer.result.value = 0; alert(mes3); return false;}
	
	if (mychecktwo == 2) {
			if ((addr3txt!=myairport) && (addr4==0)) {return false;}
			if (addr4==0) {document.calctransfer.result.value = 0; alert(mes1); document.calctransfer.dest2.selectedIndex=0; document.calctransfer.dest2.focus(); return false;}
			if (addr3txt==addr4txt) {document.calctransfer.result.value = 0; document.calctransfer.dest2.selectedIndex=0; alert(mes2); return false;}
			if ((addr3txt!=myairport) && (addr4txt!=myairport)) {document.calctransfer.result.value = 0; alert(mes3); return false;}
			}


			if (pers<=pax1)
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax1) && (pers<=pax2))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax2) && (pers<=pax3))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax3) && (pers<=pax4))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax4) && (pers<=pax5))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr3]); } //Lagos to Faro airport / ex
							}
				}

			if ((pers>pax5) && (pers<=pax6))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr3]); } //Lagos to Faro airport / ex
							}
				}

		
	document.calctransfer.result.value = pricecalc;
}

function return_btn(myairport, mes1, mes2, mes3) {
if (document.calctransfer.checktwo[1].checked) { //two ways
	document.calctransfer.dest2.selectedIndex=document.calctransfer.depart1.selectedIndex+1;
    document.calctransfer.depart2.selectedIndex=document.calctransfer.dest1.selectedIndex; calcpret(myairport, mes1, mes2, mes3);
	}
	else
	{
	document.calctransfer.depart2.selectedIndex=0;document.calctransfer.dest2.selectedIndex=0;
	calcpret(myairport, mes1, mes2, mes3);
	}
}

function return_change(myairport, mes, mes1, mes2, mes3) {

if (document.calctransfer.checktwo[1].checked==false) 
	{ 	alert(mes); 
		document.calctransfer.depart2.selectedIndex=0;
		document.calctransfer.dest2.selectedIndex=0;
	}
calcpret(myairport, mes1, mes2, mes3);
}


//===========for admin section===========================================================

function set_select(field, val)
{
	var i;
	for (i=0;i<field.options.length;i++)
		if (field.options[i].value == val) 
		{
			field.selectedIndex = i;
			return true;
		}
	return false;
}


function calcpret_admin(myairport, selected_location, location_type){
	//check my airport

	
	//var myairport = "Alicante Airport";
	//alert("sel_admin = "+selected_location);
	var pricecalc = 0; //final price
	var mychecktwo = 0;

	//daca e 0, pretul este afisat in TOTAL PRICE
	//daca e 1, pretul e trecut in confirmarea bookingului
	document.calctransfer.price_in_confirmation.value = 0;

	if (document.calctransfer.checktwo[0].checked) { mychecktwo = 1; document.calctransfer.checktwo2.value=1; } //one way
	if (document.calctransfer.checktwo[1].checked) { mychecktwo = 2; document.calctransfer.checktwo2.value=2; } //two ways
	var pers = document.calctransfer.persnum.value;
	var addr1 = document.calctransfer.depart1.value; //id
	var addr2 = document.calctransfer.dest1.value; //id 
	var addr3 = document.calctransfer.depart2.value; //id
	var addr4 = document.calctransfer.dest2.value; //id
	/*var addr1txt = document.calctransfer.depart1.options[document.calctransfer.depart1.selectedIndex].text;
	var addr2txt = document.calctransfer.dest1.options[document.calctransfer.dest1.selectedIndex].text;
	var addr3txt = document.calctransfer.depart2.options[document.calctransfer.depart2.selectedIndex].text;
	var addr4txt = document.calctransfer.dest2.options[document.calctransfer.dest2.selectedIndex].text;*/

	var addr1txt = document.calctransfer.depart1.value;
	var addr2txt = document.calctransfer.dest1.value;
	var addr3txt = document.calctransfer.depart2.value;
	var addr4txt = document.calctransfer.dest2.value;
	
	if ((addr1txt!=myairport) && (addr2==0)) {return false;}
	if (addr2==0) {document.calctransfer.result.value = 0; alert('Select first a "Transfer to" location.'); document.calctransfer.dest1.selectedIndex=0; document.calctransfer.dest1.focus(); return false;}
	if (addr1txt==addr2txt) 
	{
		document.calctransfer.result.value = 0;
		if(location_type == 'depart1')
		{
			set_select(document.calctransfer.depart1, selected_location);
			
		}

		if(location_type == 'dest1')
		{
			set_select(document.calctransfer.dest1, selected_location);

		}
		alert('You can not select the departure location to be the same as destination.'); 
		return false;
	}

	if ((addr1txt!=myairport) && (addr2txt!=myairport)) 
	{
		document.calctransfer.result.value = 0; 
		document.calctransfer.price_in_confirmation.value = 1; 
		//alert('The price for this location will be specified into the confirmation of the transfer booking.'); 
		return false;
	}
	
	if (mychecktwo == 2) 
	{
			if ((addr3txt!=myairport) && (addr4==0)) {return false;}
			if (addr3txt==addr4txt) 
			{
				document.calctransfer.result.value = 0; 
				if(location_type == 'depart2')
				{
					set_select(document.calctransfer.depart2, myairport);
					
				}

				if(location_type == 'dest2')
				{
					set_select(document.calctransfer.dest2, myairport);
				}
				alert('You can not select the departure location to be the same as destination.'); 
				return false;
			}
			if ((addr3txt!=myairport) && (addr4txt!=myairport)) 
			{
				document.calctransfer.result.value = 0; 
				document.calctransfer.price_in_confirmation.value = 1; 
				//alert('The price for this location will be specified into the confirmation of the transfer booking.'); 
				return false;
			}
	}

	if (pers<=pax1)
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc1[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax1) && (pers<=pax2))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc2[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax2) && (pers<=pax3))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc3[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax3) && (pers<=pax4))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc4[addr3]); } //Lagos to Faro airport / ex
							}
				}
				
			if ((pers>pax4) && (pers<=pax5))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc5[addr3]); } //Lagos to Faro airport / ex
							}
				}

			if ((pers>pax5) && (pers<=pax6))
				{  if ((addr2!=0) && (addr1txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr2]); } //faro airport to Alvor / ex
				   if ((addr1!=0) && (addr2txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr1]); } //Lagos to Faro airport / ex
				   if (mychecktwo == 2) {
							if ((addr4!=0) && (addr3txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr4]); } //faro airport to Alvor / ex
							if ((addr3!=0) && (addr4txt==myairport)) { pricecalc = parseFloat(pricecalc) + parseFloat(myloc6[addr3]); } //Lagos to Faro airport / ex
							}
				}
		
	document.calctransfer.result.value = pricecalc;
	return true;
}

function get_price_persons(myairport)
{
	var mes1 = "Select a `Transfer to` location.";
	var mes2 = "You can not select the departure location to be the same as destination.";
	var mes3 = "The price for this location will be specified into the confirmation of the transfer booking.";
	calcpret(myairport, mes1, mes2, mes3);
}

function return_btn_admin(myairport) 
{
	var mes1 = "Select a `Transfer to` location.";
	var mes2 = "You can not select the departure location to be the same as destination.";
	var mes3 = "The price for this location will be specified into the confirmation of the transfer booking.";
	//var mes3 = "";
	if (document.calctransfer.checktwo[1].checked) 
	{ 
		//two ways
		document.calctransfer.dest2.selectedIndex=document.calctransfer.depart1.selectedIndex;
		document.calctransfer.depart2.selectedIndex=document.calctransfer.dest1.selectedIndex; 

		if(document.calctransfer.depart2.selectedIndex == 0)
		{
			selected_city = document.calctransfer.dest2.options[document.calctransfer.dest2.selectedIndex].text;
			document.getElementById('div_exact_address3').style.display='none';
			document.getElementById('div_exact_address4').style.display='block';
			document.getElementById('span_dest2').innerHTML = selected_city;

		}
		if(document.calctransfer.dest2.selectedIndex == 0) 
		{
			selected_city = document.calctransfer.depart2.options[document.calctransfer.depart2.selectedIndex].text;
			document.getElementById('div_exact_address3').style.display='block';
			document.getElementById('div_exact_address4').style.display='none';
			document.getElementById('span_departure2').innerHTML = selected_city;

		}
		calcpret(myairport, mes1, mes2, mes3);
	}
	else
	{
		calcpret(myairport, mes1, mes2, mes3);
	}
}


function show_exact_address(airport, selected_location)
{
		selected_city = document.calctransfer.depart1.options[document.calctransfer.depart1.selectedIndex].text;
		ret = calcpret_admin(airport, selected_location, 'depart1');
		if(ret == true || document.calctransfer.price_in_confirmation.value == 1)
		{
			if(selected_city == airport)
			{
				//don't display exact address
				document.getElementById('div_exact_address1').style.display='none';
				
			}
			else
			{
				//display exact address	
				document.getElementById('div_exact_address1').style.display='block';
				document.getElementById('span_departure1').innerHTML = selected_city;
			}
		}

}

function show_exact_address_2(airport, selected_location)
{
		selected_city = document.calctransfer.dest1.options[document.calctransfer.dest1.selectedIndex].text;
		ret = calcpret_admin(airport, selected_location, 'dest1');
		if(ret == true || document.calctransfer.price_in_confirmation.value == 1)
		{
		
			if(selected_city == airport)
			{
				//don't display exact address
				document.getElementById('div_exact_address2').style.display='none';
				
			}
			else
			{
				//display exact address	
				document.getElementById('div_exact_address2').style.display='block';
				document.getElementById('span_dest1').innerHTML = selected_city;
			}
		}

}

//======for the return way======================================
function show_exact_address_3(airport, selected_location)
{
		selected_city = document.calctransfer.depart2.options[document.calctransfer.depart2.selectedIndex].text;
		ret = calcpret_admin(airport, selected_location, 'depart2');

		if(ret == true || document.calctransfer.price_in_confirmation.value == 1)
		{
			if(selected_city == airport)
			{
				//don't display exact address
				document.getElementById('div_exact_address3').style.display='none';
				
			}
			else
			{
				//display exact address	
				document.getElementById('div_exact_address3').style.display='block';
				document.getElementById('span_departure2').innerHTML = selected_city;
			}
		}

}

function show_exact_address_4(airport, selected_location)
{
		selected_city = document.calctransfer.dest2.options[document.calctransfer.dest2.selectedIndex].text;
		ret = calcpret_admin(airport, selected_location, 'dest2');

		if(ret == true || document.calctransfer.price_in_confirmation.value == 1)
		{
		
			if(selected_city == airport)
			{
				//don't display exact address
				document.getElementById('div_exact_address4').style.display='none';
				
			}
			else
			{

				//display exact address	
				document.getElementById('div_exact_address4').style.display='block';
				document.getElementById('span_dest2').innerHTML = selected_city;
			}
		}

}

//============function for date validation in admin=============================================================

function valid_date_admin() 
{
	err1 = "Select a `Transfer to` location.";
	err2 = "Select a pick up date please.";
	err3 = "Select a `Return from` location.";
	err4 = "Select a return date date please.";
	err5 = "Please complete the Email field.";

	mes1 = "The year has to be greater than 2004.";
	mes2 = "This is not a valid date (dd/mm/yyyy)";
	mes3 = "The date is not in correct dd/mm/yyyy format";
	mes4 = "Pick up date is later than Return date.Please correct.";
	mes5 = "Earliest possible date of service is 1 day from now. You specified the date:";

	mes_valid_email = "Please enter a valid email address.";
	date_format = "dd/mm/yyyy";

	var date1String = document.calctransfer.transferdate1.value;
	var day1    = date1String.substr(0,2);
	var month1  = date1String.substr(3,2);
	var year1   = date1String.substr(6,4);

	document.calctransfer.checktwo2.value==1;
		
	if ((date1String==date_format) || (date1String=='')) 
	{
		alert(err2);
		document.calctransfer.transferdate1.value='';
		document.calctransfer.transferdate1.focus();
		return false;
	}
				
	if (isDate(date1String, mes1, mes2, mes3)==false) { document.calctransfer.transferdate1.focus(); return false; }
				
	//if (dateisNotPossible(day1,month1,year1, mes5)==false) { document.calctransfer.transferdate1.focus(); return false; }			
				
	if (document.calctransfer.checktwo[1].checked) 
	{
		document.calctransfer.checktwo2.value==2;
		if ((document.calctransfer.transferdate2.value==date_format) || (document.calctransfer.transferdate2.value=='')) 
		{
			alert(err4);
			document.calctransfer.transferdate2.value='';
			document.calctransfer.transferdate2.focus();
			return false;
		}	
		
		if (isDate(document.calctransfer.transferdate2.value, mes1, mes2, mes3)==false) 
		{
			document.calctransfer.transferdate2.focus(); 
			return false;
		}
		
		var date2String = document.calctransfer.transferdate2.value;
		var day2    = date2String.substr(0,2);
		var month2  = date2String.substr(3,2);
		var year2   = date2String.substr(6,4);
		if (!checkmyDates(day1,day2,month1,month2,year1,year2, mes4)) {document.calctransfer.transferdate2.focus(); return false;}
	}

	document.calctransfer.dest1display.value = document.calctransfer.dest1.options[document.calctransfer.dest1.selectedIndex].text;
	document.calctransfer.depart1display.value = document.calctransfer.depart1.options[document.calctransfer.depart1.selectedIndex].text;
	
	document.calctransfer.dest2display.value = document.calctransfer.dest2.options[document.calctransfer.dest2.selectedIndex].text;
	document.calctransfer.depart2display.value = document.calctransfer.depart2.options[document.calctransfer.depart2.selectedIndex].text;

	document.calctransfer.submit();  
	return true;

}