// JavaScript Document
function switchTo(id) {
	var newitem = document.getElementById(id);
	var registerForm = document.getElementById("registerForm");
	var mainImage = document.getElementById("mainImage");
	var locationMap = document.getElementById("locationMap");
	if (id = "locationMap") {
		registerForm.style.height=0;
		registerForm.style.display="nonce";
		mainImage.style.height=0;
		mainImage.style.display="nonce";
		newitem.style.height=400;
		newitem.style.display="block";
	} else if (id = "registerForm") {
		locationMap.style.height=0;
		locationMap.style.display="nonce";
		mainImage.style.height=0;
		mainImage.style.display="nonce";
	} else if (id = "mainImage") {
		registerForm.style.height=0;
		registerForm.style.display="nonce";
		locationMap.style.height=0;
		locationMap.style.display="nonce";		
	}
}
        function displayMap() {
			dhtmlwindow.open('locationMapWindow', 'div', 'locationMap', 'Lara Bohinc Store location', 'width=515px,height=580px,resize=0,scrolling=0,center=1');
		}	

	    function displayMapAjax() {
			dhtmlwindow.open('locationMapWindow', 'ajax', 'mapAjax.html', 'Lara Bohinc Store location', 'width=515px,height=580px,resize=0,scrolling=0,center=1');
		}
		function displayShop() {
			dhtmlwindow.open('shopWindow', 'ajax', 'shopDisplay.html', 'Lara Bohinc Store', 'width=988px,height=460px,resize=0,scrolling=0,center=1');
		}
		function displayRegisterForm() {
			dhtmlwindow.open('registerFormWindow', 'div', 'registerForm', 'Register here for exclusive offers and Lara Bohinc newsletter', 'width=440px,height=430px,resize=0,scrolling=0,center=1');
		}	
		
		 function displaySaleInvite() {
			dhtmlwindow.open('saleInviteWindow', 'div', 'saleInvite', 'Lara Bohinc Sale', 'width=799px,height=395px,resize=0,scrolling=0,center=1');
		}
function displayView(view) { 
	var featuredProductImage = document.getElementById("featuredProductImage");
	var currentProduct = featuredProductImage.name;
	featuredProductImage.src = "images/" + currentProduct+"-"+view+".jpg";
	
	var hsImageLink = document.getElementById("hsImageLink");
	hsImageLink.href="images/" + currentProduct+"-"+view+"_lg.jpg";
	//window.document.links["hsImageLink"].href = "images/" + imageurl;
}
function changeProduct(productNumber) { 
	var featuredProductImage = document.getElementById("featuredProductImage");
	featuredProductImage.name = "product-"+productNumber;
	displayView('1');
}
function clientValidate() {
	document.getElementById("validation_firstname").style.display="none";
	document.getElementById("validation_lastname").style.display="none";
	document.getElementById("validation_email").style.display="none";
	//document.getElementById("validation_address1").style.display="none";
	//document.getElementById("validation_postcode").style.display="none";
	document.getElementById("validation_country").style.display="none";
	
	var newsmailer_F = document.getElementById("newsmailer_F");
	var newsmailer_L = document.getElementById("newsmailer_L");
	var newsmailer_E = document.getElementById("newsmailer_E");
	//var newsmailer_c2 = document.getElementById("newsmailer_c2");
	//var newsmailer_c6 = document.getElementById("newsmailer_c6");
	var newsmailer_c5 = document.getElementById("newsmailer_c5");
	
	var errorfound=0;
	if (newsmailer_F.value == "") {
		errorfound=1;
		document.getElementById("validation_firstname").style.display="block";
	}
	if (newsmailer_L.value == "") {
		errorfound=1;
		document.getElementById("validation_lastname").style.display="block";
	}
	if (newsmailer_E.value == "") {
		errorfound=1;
		document.getElementById("validation_email").style.display="block";
	}
	/*
	if (newsmailer_c2.value == "") {
		errorfound=1;
		document.getElementById("validation_address1").style.display="block";
	}
	if (newsmailer_c6.value == "") {
		errorfound=1;
		document.getElementById("validation_postcode").style.display="block";
	}
	*/
	if (newsmailer_c5.value == "") {
		errorfound=1;
		document.getElementById("validation_country").style.display="block";
	}
		
	if (errorfound ==1) {
		return false;	
	} else {
		return true;	
	}
	
}

function getViewHeight() {



 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
 
 return viewportheight
}
function updateObjectHeight(id, height) {
	document.getElementById(id).style.height = height+"px";
}