function download_voucher(){
	poppedwindow = window.open("images/promo/tesco_voucher.pdf","PoppedWindow","toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=500");
	return true;
}
function tesco_popup(){
	poppedwindow2 = window.open("http://www.tesco-france.com","PoppedWindow2","toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=500");
	return false;
}

/////////////////////////////////////////////////////////////////////////////////////////////
//Image Pre-loading
/////////////////////////////////////////////////////////////////////////////////////////////

var myimages=new Array();
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image();
myimages[i].src=preloadimages.arguments[i];
}
}

preloadimages("images/home.gif",
			  "images/home_ov.gif",
			  "images/home_tab.gif",
			  "images/terms.gif",
			  "images/terms_ov.gif",
			  "images/terms_tab.gif",
			  "images/dest.gif",
			  "images/dest_ov.gif",
			  "images/dest_tab.gif",
			  "images/guide.gif",
			  "images/guide_ov.gif",
			  "images/guide_tab.gif",
			  "images/contact.gif",
			  "images/contact_ov.gif",
			  "images/contact_tab.gif",
  			  "images/more_info.gif",
   			  "images/more_info_trans.gif",
  			  "images/more_info_ov.gif",
  			  "images/more_info_trans_ov.gif",
			  "images/tops.jpg",
			  "images/phone_sml.gif",
			  "images/button.gif",
			  "images/GREENhome.gif",
			  "images/GREENhome_ov.gif",
			  "images/GREENhome_tab.gif",
			  "images/GREENterms.gif",
			  "images/GREENterms_ov.gif",
			  "images/GREENterms_tab.gif",
			  "images/GREENdest.gif",
			  "images/GREENdest_ov.gif",
			  "images/GREENdest_tab.gif",
			  "images/GREENguide.gif",
			  "images/GREENguide_ov.gif",
			  "images/GREENguide_tab.gif",
			  "images/GREENcontact.gif",
			  "images/GREENcontact_ov.gif",
			  "images/GREENcontact_tab.gif",
  			  "images/GREENmore_info.gif",
   			  "images/GREENmore_info_trans.gif",
  			  "images/GREENmore_info_ov.gif",
  			  "images/GREENmore_info_trans_ov.gif",
			  "images/GREENtops.jpg");
/////////////////////////////////////////////////////////////////////////////////////////////
//Javascript Pop-up window
/////////////////////////////////////////////////////////////////////////////////////////////
function popup(w,h,trgt)
{
	var wHeight, wWidth, vertPos, horzPos;
	if (document.all)
		{	
		wHeight = screen.Height;
		wWidth = screen.Width;
		}
	else 
		{
		wHeight = window.innerHeight;
		wWidth = window.innerWidth;
		}
		
	horzPos = ((wWidth/2) - (w/2));
	vertPos = ((wHeight/2) - (h/2));
	
	poppedwindow = window.open("" + trgt + "","PoppedWindow","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + w + ",height=" + h + "");
	poppedwindow.moveTo(horzPos, vertPos);
	if (window.focus) {poppedwindow.focus();}
	wHeight = 0;
	wWidth = 0;
	vertPos = 0;
	horzPos = 0;
}

function popup2(w,h,trgt) 
{
	var wHeight, wWidth, vertPos, horzPos;
	if (document.all)
		{	
		wHeight = screen.Height;
		wWidth = screen.Width;
		}
	else 
		{
		wHeight = window.innerHeight;
		wWidth = window.innerWidth;
		}
		
	horzPos = ((wWidth/2) - (w/2));
	vertPos = ((wHeight/2) - (h/2));
	
	poppedwindow = window.open("" + trgt + "","PoppedWindow","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + w + ",height=" + h + "");
	poppedwindow.moveTo(horzPos, vertPos);
	if (window.focus) {poppedwindow.focus();}
	wHeight = 0;
	wWidth = 0;
	vertPos = 0;
	horzPos = 0;
}

/////////////////////////////////////////////////////////////////////////////////////////////
//Validate Contact Us
/////////////////////////////////////////////////////////////////////////////////////////////

function validate_contact_us(){
var oh = 0;
var oj = 0;
document.getElementById("name_fail").innerHTML = "";
document.getElementById("tel_fail").innerHTML = "";
document.getElementById("email_fail").innerHTML = "";
document.getElementById("enquiry_fail").innerHTML = "";
if (document.getElementById("frm_name").value == ""){document.getElementById("name_fail").innerHTML = document.getElementById("name_fail").innerHTML + "A Name Must Be Entered<br>"; oh = 1;}
if (document.getElementById("frm_email").value == ""){document.getElementById("email_fail").innerHTML = document.getElementById("email_fail").innerHTML + "An Email Address Must Be Entered<br>"; oh = 1; oj = 1;}
if (oj == 0){
	if (emailcheck(document.getElementById('frm_email').value) == false){document.getElementById("email_fail").innerHTML = document.getElementById("email_fail").innerHTML + "Email Address invalid<br>"; oh = 1;}
}
if (document.getElementById("frm_enquiry").value == ""){document.getElementById("enquiry_fail").innerHTML = document.getElementById("enquiry_fail").innerHTML + "An Enquiry Must Be Entered<br>"; oh = 1;}
if (oh == 1){return false;}
document.getElementById("posted").value = "1";
document.getElementById("frm_contact").submit();
return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////
//Email Validation
/////////////////////////////////////////////////////////////////////////////////////////////
function emailcheck(str){
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length -1;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr - 3){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr - 1){
		return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	 if (str.indexOf(" ")!=-1){
		return false
	 }
	 return true			
}
/////////////////////////////////////////////////////////////////////////////////////////////
//Clear Email Textbox onFocus
/////////////////////////////////////////////////////////////////////////////////////////////
function clear_email(){
	if(document.getElementById("txtEmail").value == "Email Address"){
		document.getElementById("txtEmail").value = ""
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////
//Validate Subscription to Newsletter
/////////////////////////////////////////////////////////////////////////////////////////////
function popper(){
	if(document.getElementById("txtEmail").value == "Email Address" || document.getElementById("txtEmail").value == ""){
		alert("THERE HAS BEEN AN ERROR...\n"+
		"---------------------------------------------------------------------------\n\n"+
		"Please Enter an Email Address.\n\n"+
		"---------------------------------------------------------------------------");
	return false;
	}
	if(emailcheck(document.getElementById("txtEmail").value) == false){
		alert("THERE HAS BEEN AN ERROR...\n"+
		"---------------------------------------------------------------------------\n\n"+
		"Email Address Invalid.\n\n"+
		"---------------------------------------------------------------------------");
		return false;
	}
	popup(770, 580, "about:blank");
	setTimeout('document.getElemebtById("frm_newsletter").submit();',500)
}
function validate_email(){
	return true;
}
