function addBookmark() {
url = window.location.href;
title = "KennedyImages.co.uk photo";
if (window.external) {
window.external.AddFavorite(url,title);
} else {
alert("Press CTRL + D to bookmark this page");
}
return false;
}



   function showOptions() {
	document.getElementById("magazine").style.display = "block";
	}

   function hideOptions() {
	document.getElementById("magazine").style.display = "none";
	}

	function totaliser() {
	
	
	if (document.getElementsByName('paypal')[0] != null){


	
	//total =(document.paypal.prints.value * 6) + (document.paypal.enlarge.value * 7.50) + (document.paypal.enlarge2.value * 9.50) 
	
	total = (document.paypal.enlarge.value * 8.50) + (document.paypal.enlarge2.value * 9.50) + (document.paypal.enlarge3.value * 14.50) 
	
	if (  document.paypal.mag && document.paypal.mag.checked == true ) {
	showOptions();
	total = total + 12.95
	} else if  (  document.paypal.mag && document.paypal.mag.checked == false ) {
	hideOptions();
	}
	
	if (document.paypal.digital.checked == true) {
	total = total + 7.50
	}
	//items1 = document.paypal.prints.value
	items2 = document.paypal.enlarge.value
	items3 = document.paypal.enlarge2.value
	items4 = document.paypal.enlarge3.value
	if ( document.paypal.mag ) {
	ridername = document.paypal.ridername.value
	headline = document.paypal.headline.value
	}
	//items3 = document.paypal.digital.value
	
	
	document.paypal.item_number.value = ""
	
	//if (items1 != "0") {
	//document.paypal.item_number.value = "7x5 Prints: " + items1 + " @ &pound;6.00. "
	//}
	
	if (items2 != "0") {
	document.paypal.item_number.value += "A5 Prints: " + items2 + " @ &pound;8.50. "
	}
	
	if (items3 != "0") {
	document.paypal.item_number.value += "A4 Prints: " + items3 + " @ &pound;9.50. "
	}
	
	if (items4 != "0") {
	document.paypal.item_number.value += "A3 Prints: " + items4 + " @ &pound;14.50. "
	}
	
	if (document.paypal.digital.checked == true) {
	document.paypal.item_number.value += "Digital copy @ &pound;7.50."
	}
	
	if (  document.paypal.mag && document.paypal.mag.checked == true ) {
	document.paypal.item_number.value += "Magazine copy @ &pound;12.95.  Rider name: " + ridername + ", headline: " + headline + "."
	}
	
	document.purchase.nom.value = document.paypal.item_name.value
	document.purchase.num.value = document.paypal.item_number.value
	
	
	total=Math.round(total*100)/100
	
	
	document.paypal.totalp.value =  "£" + total
	document.paypal.amount.value =  total
	document.purchase.tot.value =  total
		}
	}
	
	
	
	function totaliser2(fieldname, fieldvalue) {
	
	if (document.getElementsByName('paypal')[0] != null){

	var a = "";
	var opts = 0;
	f = document.forms["paypal"];
	totallength = f.elements.length;
	
	

	itemvalue = 0;
	itemname= "";
	for (m=0; m < totallength; m++) {
	//alert (f.elements[m].name.substr(0,3));
	if (f.elements[m].name.substr(0,3) == "opt") {
	fieldname = f.elements[m].name;
	eval("itemvalue += document.paypal." + fieldname + ".value * document.paypal.value" + fieldname + ".value");
	eval("itemname += document.paypal." + fieldname + ".value");
	itemname = itemname + " x ";
	eval("itemname += document.paypal.name" + fieldname + ".value");
	itemname = itemname + ", ";
	opts = opts + 1;
	}
	}
	
	//alert(opts + ", " + itemvalue + ", " + itemname);

	
	total = itemvalue;
	document.paypal.item_number.value = itemname;
	
	//eval("itemvalue = document.paypal." + fieldname + "value.value");
	//alert(fieldname + ", " + itemvalue + ", " + document.paypal.elements.length);
	
	
	

	document.purchase.nom.value = 'Product order';
	document.purchase.num.value = document.paypal.item_number.value;

	
	total=Math.round(total*100)/100;
	
	
	document.paypal.totalp.value =  "£" + total;
	document.paypal.amount.value =  total;
	document.purchase.tot.value =  total;

	
		}
	}
	
	
	
	
	
	
	
	
	
		
	function checkForm() {
	
	if ( document.purchase.fname.value == "Enter your first name" || document.purchase.fname.value == "" ) {
	alert("Please enter your first name")
	document.purchase.fname.style.border = "2px solid red"
	document.purchase.fname.style.backgroundColor = "#FEE"
	document.purchase.fname.style.fontWeight = "Bold"
	document.purchase.fname.focus()
	return false;
	} else {
	document.purchase.fname.style.border = "1px solid #999"
	document.purchase.fname.style.backgroundColor = "#FFF"
	document.purchase.fname.style.fontWeight = "normal"
	}
	
	if ( document.purchase.sname.value == "Enter your surname" || document.purchase.sname.value == "" ) {
	alert("Please enter your surname")
	document.purchase.sname.style.border = "2px solid red"
	document.purchase.sname.style.backgroundColor = "#FEE"
	document.purchase.sname.style.fontWeight = "Bold"
	document.purchase.sname.focus()
	return false;
	} else {
	document.purchase.sname.style.border = "1px solid #999"
	document.purchase.sname.style.backgroundColor = "#FFF"
	document.purchase.sname.style.fontWeight = "normal"
	} 
	
	if ( document.purchase.phone.value == "Your phone number" || document.purchase.phone.value == "" ) {
	alert("Please enter your phone number")
	document.purchase.phone.style.border = "2px solid red"
	document.purchase.phone.style.backgroundColor = "#FEE"
	document.purchase.phone.style.fontWeight = "Bold"
	document.purchase.phone.focus()
	return false;
	} else {
	document.purchase.phone.style.border = "1px solid #999"
	document.purchase.phone.style.backgroundColor = "#FFF"
	document.purchase.phone.style.fontWeight = "normal"
	} 
	
	if ( document.purchase.em.value == "Your email address" || document.purchase.em.value == "" ) {
	alert("Please enter your email address")
	document.purchase.em.style.border = "2px solid red"
	document.purchase.em.style.backgroundColor = "#FEE"
	document.purchase.em.style.fontWeight = "Bold"
	document.purchase.em.focus()
	return false;
	} else {
	document.purchase.em.style.border = "1px solid #999"
	document.purchase.em.style.backgroundColor = "#FFF"
	document.purchase.em.style.fontWeight = "normal"
	} 
	
	
	prints = 0
	
	//prints = parseInt(document.paypal.prints.value) + parseInt(document.paypal.enlarge.value) + parseInt(document.paypal.enlarge2.value);
	prints = parseInt(document.paypal.enlarge.value) + parseInt(document.paypal.enlarge2.value) + parseInt(document.paypal.enlarge3.value);;
	
	if (document.paypal.digital.checked == true) {
	prints = prints + 1
	}
	
	if (document.paypal.mag.checked == true) {
	prints = prints + 1
	}
		
	if ( prints == 0) {
	alert("Please select which photographs you would like to order")
	document.location.hash = "options"
	return false;			
	} else {
	return true;
	}
	
	}
	
	function showad() {
	document.getElementById("xadlarge").style.display = "block";
	}
	
	function hidead() {
	document.getElementById("xadlarge").style.display = "none";
	}