if (document.images)
   {
	image1 = new Image();
	image1.src = "/images/bg.jpg";
	
	image2 = new Image();
	image2.src = "/images/logo-me-map.jpg";
	
	image3 = new Image();
	image3.src = "/images/arab-tours-of-london.jpg";
}

function CaricaFoto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+40;
  altez=foto1.height+40;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}



// ------------ VALIDATE CONTACT FORM ---------//


function validateContact(){

	var strName			=	document.contact.cname.value;
	var strPhone		=	document.contact.tel.value;
	var strEmail		=	document.contact.email.value;

  	var valid = true;

	if(strName==''){
		alert('Please enter your name');
		document.contact.cname.focus();
		valid = false;
		return false;
	}
	if(strPhone==''){
		alert('Please enter your telephone contact number');
		document.contact.tel.focus();
		valid = false;
		return false;
	}

	if(!strPhone==''){
		var validChars = "1234567890() "
		for(var Idx=0; Idx<strPhone.length; Idx++) 
		{ 
			var Char = strPhone.charAt(Idx); 
			var Match = false; 
	
			for(var Idx1=0; Idx1<validChars.length; Idx1++) 
			{ 
				if(Char == validChars.charAt (Idx1)) 
					Match = true; 
			} 
			if (!Match) {
				alert("Please enter a valid phone number (only digits, brackets and spaces are allowed)");
				document.contact.tel.focus(); 
				valid = false;
				return false; 
				}
		} 
	}

 	var strEmail = document.contact.email.value;
  	invalidChars = " /:,;'`^"
  	if (strEmail=="") valid = false;  
  	if (!valid) { 
		alert("Please enter your email address"); 
		document.contact.email.focus(); 
		valid = false;
		return false;
	}
  	for (i=0;i<invalidChars.length; i++){
    		badChar=invalidChars.charAt(i)
    		if (strEmail.indexOf(badChar,0)>-1) valid = false;  
  	}
  	atPos = strEmail.indexOf("@",1)
  	if (atPos == -1) valid = false;  
  	if (strEmail.indexOf("@",atPos+1) != -1) valid = false;  
  	periodPos = strEmail.indexOf(".",atPos)
  	if (periodPos == -1) valid = false;  
  	if (periodPos+3 > strEmail.length) valid = false;  
  	if (!valid) { 
		alert("Please enter a valid email address"); document.contact.email.focus(); 
		valid = false;
		return false;
	}

  	if (valid) return true;
	else return false;
}


// ------------ VALIDATE TOUR BOOKING FORM ---------//


function validateTourBooking(){

	var strName			=	document.tourbooking.cname.value;
	var strPhone		=	document.tourbooking.tel.value;
	var strEmail		=	document.tourbooking.email.value;
	var strDepDate		=	document.tourbooking.depdate.value;

  	var valid = true;

	if(strName==''){
		alert('Please enter your name');
		document.tourbooking.cname.focus();
		valid = false;
		return false;
	}
	if(strPhone==''){
		alert('Please enter your telephone contact number');
		document.tourbooking.tel.focus();
		valid = false;
		return false;
	}

	if(!strPhone==''){
		var validChars = "1234567890() "
		for(var Idx=0; Idx<strPhone.length; Idx++) 
		{ 
			var Char = strPhone.charAt(Idx); 
			var Match = false; 
	
			for(var Idx1=0; Idx1<validChars.length; Idx1++) 
			{ 
				if(Char == validChars.charAt (Idx1)) 
					Match = true; 
			} 
			if (!Match) {
				alert("Please enter a valid phone number (only digits, brackets and spaces are allowed)");
				document.tourbooking.tel.focus(); 
				valid = false;
				return false; 
				}
		} 
	}

 	var strEmail = document.tourbooking.email.value;
  	invalidChars = " /:,;'`^"
  	if (strEmail=="") valid = false;  
  	if (!valid) { 
		alert("Please enter your email address"); 
		document.tourbooking.email.focus(); 
		valid = false;
		return false;
	}
  	for (i=0;i<invalidChars.length; i++){
    		badChar=invalidChars.charAt(i)
    		if (strEmail.indexOf(badChar,0)>-1) valid = false;  
  	}
  	atPos = strEmail.indexOf("@",1)
  	if (atPos == -1) valid = false;  
  	if (strEmail.indexOf("@",atPos+1) != -1) valid = false;  
  	periodPos = strEmail.indexOf(".",atPos)
  	if (periodPos == -1) valid = false;  
  	if (periodPos+3 > strEmail.length) valid = false;  
  	if (!valid) { 
		alert("Please enter a valid email address"); document.tourbooking.email.focus(); 
		valid = false;
		return false;
	}

	if(strDepDate==''){
		alert('Please select your preferred departure date');
		document.tourbooking.depdate.focus();
		valid = false;
		return false;
	}

  	if (valid) return true;
	else return false;
}



// ------------ VALIDATE FLIGHT BOOKING FORM ---------//


function validateFlightBooking(){

	var strName			=	document.flightbooking.cname.value;
	var strPhone		=	document.flightbooking.tel.value;
	var strEmail		=	document.flightbooking.email.value;
	var strDepDate		=	document.flightbooking.depdate.value;

  	var valid = true;

	if(strName==''){
		alert('Please enter your name');
		document.flightbooking.cname.focus();
		valid = false;
		return false;
	}
	if(strPhone==''){
		alert('Please enter your telephone contact number');
		document.flightbooking.tel.focus();
		valid = false;
		return false;
	}

	if(!strPhone==''){
		var validChars = "1234567890() "
		for(var Idx=0; Idx<strPhone.length; Idx++) 
		{ 
			var Char = strPhone.charAt(Idx); 
			var Match = false; 
	
			for(var Idx1=0; Idx1<validChars.length; Idx1++) 
			{ 
				if(Char == validChars.charAt (Idx1)) 
					Match = true; 
			} 
			if (!Match) {
				alert("Please enter a valid phone number (only digits, brackets and spaces are allowed)");
				document.flightbooking.tel.focus(); 
				valid = false;
				return false; 
				}
		} 
	}

 	var strEmail = document.flightbooking.email.value;
  	invalidChars = " /:,;'`^"
  	if (strEmail=="") valid = false;  
  	if (!valid) { 
		alert("Please enter your email address"); 
		document.flightbooking.email.focus(); 
		valid = false;
		return false;
	}
  	for (i=0;i<invalidChars.length; i++){
    		badChar=invalidChars.charAt(i)
    		if (strEmail.indexOf(badChar,0)>-1) valid = false;  
  	}
  	atPos = strEmail.indexOf("@",1)
  	if (atPos == -1) valid = false;  
  	if (strEmail.indexOf("@",atPos+1) != -1) valid = false;  
  	periodPos = strEmail.indexOf(".",atPos)
  	if (periodPos == -1) valid = false;  
  	if (periodPos+3 > strEmail.length) valid = false;  
  	if (!valid) { 
		alert("Please enter a valid email address"); document.flightbooking.email.focus(); 
		valid = false;
		return false;
	}

	if(strDepDate==''){
		alert('Please select your preferred departure date');
		document.flightbooking.depdate.focus();
		valid = false;
		return false;
	}

  	if (valid) return true;
	else return false;
}

