// add the current page to favourites page title unless a substitute is supplied
function addToFavorite( favTitle ){
   if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) {
      ft = (favTitle) ? favTitle : document.title;
      window.external.AddFavorite(location.href, unescape(ft));
   }
}

// call from the onsubmit event to display the contents of the form in an alert box, returning false unless true is specified
// e.g. onsubmit="return showFormElements( this )"
function showFormElements( oForm ){
	els = oForm.elements;
	txt = 'FORM ' + oForm.name + " (" + els.length + " element" + ((els.length>1) ? "s" : "") + ")\n\n";
	for (var x=0; x<els.length; x++){
		txt += els[x].name + " = " + els[x].value + "\n";
		}
  txt += "\nClicking OK to submit form, CANCEL to, well, cancel";

	return confirm(txt);
}

// this lot will allow a field to be cleared when it it receives the focus for the first time (ONLY!)
var rClearOnFirstClick = new Array();

function clearOnFirstClick(thisfield) {
	if (!rClearOnFirstClick[thisfield.id]) {
		thisfield.value = "";
		rClearOnFirstClick[thisfield.id]=1;
	}
}

function countChecked( oField ) {
	count = 0;

	if (oField.length == undefined) {
		count += (oField.checked);
	}
	else
		for (ii=0; ii<oField.length; ii++) {
			count += (oField[ii].checked);
		}
	return count;
}


//##################################################     T R I M     F U N C T I O N S     #############################
// remove trailing spaces from a string
function rTrim( strText ) {
strTemp = strText;
while( strTemp.length > 0 && strTemp.charAt(strTemp.length-1)==" " ) {
	strTemp = strTemp.substring(0,strTemp.length-1);
}
return strTemp;
}

// remove leading spaces from a string
function lTrim( strText ) {
strTemp = strText;
while( strTemp.length > 0 && strTemp.charAt(0)==" " ) {
	strTemp = strTemp.substring(1,strTemp.length-1);
}
return strTemp;
}

// remove leading & trailing spaces from a string
function Trim( strText ) {
return lTrim( rTrim( strText ) );
}

//##################################################     T R I M     M E T H O D S     #############################
// http://www.developingskills.com/ds.php?article=jstrim&page=1
function strltrim() {
	//Match spaces at beginning of text and replace with a null string
	return this.replace(/^\s+/,'');
}

function strrtrim() {
	//Match spaces at end of text and replace with a null string
	return this.replace(/\s+$/,'');
}

function strtrim() {
	//Match spaces at beginning and end of text and replace with null strings
	//return this.replace(/^\s+/,'').replace(/\s+$/,'');
	return this.ltrim().rtrim();
}

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim  = strtrim;
                  

//##############################################      F O R M     V A L I D A T I O N      ################################

function validateForm( oForm, tMsg ) {
//  alert( oForm.elements.length );
	ok = true;
	str = "";
	if (!tMsg) tMsg = 'Errors must be corrected before you can update this record';
	
	// this loop basically checks to see that all required fields have a value in
	for (ii=0;ii<oForm.elements.length;ii++) {
		xx = oForm.elements[ii];

		// this bit changes the class on any description fields for images/thumbs/supers
		if (xx.name && (prefix=xx.name.substr(0,5).toLowerCase()))
			if (prefix == 'image' || prefix == 'thumb' || prefix == 'super') {
				// getting the prefix allows for image10..image999 etc.
				prefix = (pos = xx.name.indexOf('_')) ? xx.name.substr(0,pos) : xx.name;
				if (desc = eval("oForm." + prefix + "Desc"))	{		// e.g. Image1Desc
					desc.className = xx.value ? 'required' : '';
//					alert( desc.name + " class changed to : " + desc.className );
					window.status = desc.name + " class changed to : " + desc.className;
				}
			}
		fldName = (xx.title) ? xx.title : (xx.name) ? xx.name : xx.id;		// use Title, else Name, else Id for alert box
		
		// if field classname says it's a required field
		if (xx.className.substr(0,8) == "required") {
			switch( xx.type ) {
				case "radio":
					break;
				case "checkbox":
					if (!xx.checked) {
						str += fldName + "\n";
						if (ok) oField = xx;    		// identify first field in error
						ok = false;
					}
					break;
				default:
					xx.value = xx.value.trim();		// remove leading and trailing spaces
					if (xx.value == "") {
						str += fldName + "\n";
						if (ok) oField = xx;    		// identify first field in error
						ok = false;
		//				alert( fldName + " classname=" + xx.classname + " type=" + xx.type +  " value=" + xx.value + " result=" + ok);
					}
			} // switch
		}	// required
	}	// for
		 
	// if all required fields have a value, check to see that it's of the required (!) type
	if (ok) {
		for (ii=0;ii<oForm.elements.length;ii++) {
			xx = oForm.elements[ii];
			fldName = (xx.title) ? xx.title : (xx.name) ? xx.name : xx.id;
			if (xx.value != '') {
				valType = (xx.className.substr(8)).toLowerCase();		// drop off 'required' or 'optional'
				switch( valType ) {
					case "n" :
						xx.value = xx.value.replace("%","");					// handle percentages
//						xx.value = eval(xx.value.replace(",",""));		// remove commas from numbers
						xx.value = xx.value.replace(",","");		// remove commas from numbers
						
						if (xx.value.match(/^\d*$/)==null) {	// zero or more digits only
							str += fldName + " must be a valid integer\n";
							window.status = xx.value + " must be a valid integer";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					case "phone" :
						xx.value = xx.value.replace(" ","");		// remove commas from numbers
						if (xx.value.match(/^\d*$/)==null) 
						{	
							str += fldName + " must be a valid phone number\n";
							window.status = xx.value + " must be a phone number";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					case "email":
						var exclude = /[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
						var check = /@[\w\-]+\./;
						var checkend = /\.[a-zA-Z]{2,6}$/;
//						alert( xx.value.search(exclude) + "\n" + xx.value.search(check) + "\n" + xx.value.search(checkend) );
						if(((xx.value.search(exclude) != -1) || (xx.value.search(check)) == -1) || (xx.value.search(checkend) == -1)) {
							str += fldName + " must be a valid email address\n";
							window.status = xx.value + " is not a valid email address";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					case "price" :
						xx.value = xx.value.replace("£","");					// remove pound signs
						xx.value = eval(xx.value.replace(",",""));		// remove commas from numbers
						// match pounds only or pounds and 2 decimal pence
						if (xx.value.match(/^\d+(\.\d{2})?$/) == null) {
							str += fldName + " must be a valid price\n";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					case "file" :
//					allow colons and back slashes through as they'll go during the POST process.
						if (xx.value.match(/^([\w]|[-]|[ ]|[:]|[\\])+\./) == null) {
							str += fldName + " - filename can only contain letters, digits, space, hyphen or underscore\n";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						// must END with one of specified document types
						if (xx.value.match(/\.(doc|csv|mdb|pdf|ppt|sfi|xls|zip)+$/) == null) {
							str += fldName + " - file can only be of the following types : .doc, .csv, .mdb, .pdf, .ppt, .sfi, .xls, .zip\n";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					case "image" :
//					allow colons and back slashes through as they'll go during the POST process.
						imgname = xx.value.split('\\');
												
						if (imgname[imgname.length-1].match(/^([\w]|[-]|[:]|[\\])+\./) == null) {
							str += fldName + " - filename can only contain letters, digits, hyphen or underscore\n";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						// must END with one of specified image types
						if ((xx.value.toLowerCase()).match(/\.(gif|jpeg|jpg|wmf)+$/) == null) {
							str += fldName + " - file can only be of the following types : .gif, .jpeg, .jpg, .wmf\n";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					case "date" :
					case "datetime" :
						// match dates in 1900-2099, no checks on days in month though
						// match 1-9, 01-09 or 10-29, or 30-31, then /, then 1-9, 01-09, or 10-12, then /, then 20, or null, then 00-99
						if (valType == "date")
							dtArr = xx.value.match(/^([0]?[1-9]|[1-2][0-9]|[3][0-1])(\/)([0]?[1-9]|[1][0-2])(\/)((19|20)?[0-9][0-9])$/);
						else {
							// this works for datetime values, but they're not nice to enter on a form for a user
							dtArr = xx.value.match(/^([0]?[1-9]|[1-2][0-9]|[3][0-1])(\/)([0]?[1-9]|[1][0-2])(\/)((19|20)?[0-9][0-9])?(( )+([0-1][0-9]|[2][0-3])(:)([0-5][0-9]))?$/);
//							alert(xx.value + " = " + dtArr);
							}


						if ((dtArr) != null) {
							dt = new Date();
							if ((dtYear = dtArr[5]).length == 2) dtYear = dt.getFullYear().toString().substr(0,2) + dtYear;	// prefix yy years with current cc (20 I guess!)
							dtLeap = (dtYear % 4 == 0) && (dtYear % 400 != 0); 
	//						window.status = xx.value + " = " + dtArr + " " + dtLeap;
							switch ( dtArr[3] * 1 ) {		// month entered
								case 4:	case 6: case 9: case 11:
									if (dtArr[1]*1 > 30) {
										str += fldName + " must be a valid date\n";
										window.status = xx.value + " is not a valid date [2]";
										if (ok) oField = xx;    		// identify first field in error
										ok = false;
									}
									break;
								case 2:
									if (dtArr[1]*1 > (28+dtLeap)) {
										str += fldName + " must be a valid date\n";
										window.status = xx.value + " is not a valid date [3]";
										if (ok) oField = xx;    		// identify first field in error
										ok = false;
									}
									break;
								default:
							} // switch							
						}
						else {
							str += fldName + " must be a valid date\n";
							window.status = xx.value + " is not a valid date [1]";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					case "date2" :
						// match dates in 2003-9, no checks on days in month though
						// match 1-9, 01-09 or 10-29, or 30-31, then /, then 1-9, 01-09, or 10-12, then /, then 20, or null, then 00-99
						window.status = xx.value + " = " + 
							(xx.value.match(/^([0]?[1-9]|[1-2][0-9]|[3][0-1])(\/)([0]?[1-9]|[1][0-2])(\/)((20)?[0-9][0-9])?$/));
						break;
					case "time" :
						if (xx.value.match(/^([0-1][0-9]|[2][0-3])(:)([0-5][0-9])$/) == null) {
							str += fldName + " must be a valid time\n";
							window.status = xx.value + " is not a valid time";
							if (ok) oField = xx;    		// identify first field in error
							ok = false;
						}
						break;
					default :
				}		// switch
			}
		}	// for
		if (!ok) {
			alert( str += "\n" + tMsg );
			if (oField.type != "hidden")
				oField.focus();   // set focus on first field in error
		}
	}
	else {
		alert( str += "\n" + tMsg );
		if (oField.type != "hidden")
			oField.focus();   // set focus on first field in error
	}

	window.status = "final value WOULD have been : " + ok;
	setTimeout("window.status=''", 1500);
	if (oForm.debug && oForm.debug.value.toLowerCase()=='y')			// if debugging is 'on'
		ok = ok && showFormElements(oForm);		// do whatever user wants to do, if OK

	return ok;											// go ahead and submit
}


function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
/**********************************************************************
coutesy of 4 guys from rolla... fixed by JPN!!!!!!!!!!!

IN:
		NUM - the number to format
		decimalNum - the number of decimal places to format the number to
		bolLeadingZero - true / false - display a leading zero for
										numbers between -1 and 1
		bolParens - true / false - use parenthesis around negative numbers
		bolCommas - put commas as number separators.
 
	RETVAL:
		The formatted number!
 **********************************************************************/
{ 
        if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
//	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	// this FIX added by JPN 19 March 2004 to stop errors by division and conversion to binary
	if (decimalNum>0)
		tmpNumStr = tmpNumStr.substring(0,tmpNumStr.length-decimalNum) + '.' + tmpNumStr.substring(tmpNumStr.length-decimalNum);
	else
		tmpNum /= Math.pow(10,decimalNum);		// originally higher up!


	// See if we need to strip out the leading zero or not.
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0)
			tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
		else
			tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
		
	// See if we need to put in the commas
	if (bolCommas && (num >= 1000 || num <= -1000)) {
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0)
			iStart = tmpNumStr.length;

		iStart -= 3;
		while (iStart >= 1) {
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}		
	}

	// See if we need to use parenthesis
	if (bolParens && num < 0)
		tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

	return tmpNumStr;		// Return our formatted string!
}


	function isEmpty(o) {
		var i, v;
		if (typeOf(o) == 'object') {
			for (i in o) {
				v = o[i];
				if (v != undefined && typeOf(v) != 'function') {
					return false;
				}
			}
		}
		return true;
	}


	function isChecked(oForm) {
	var correct = true;
	var count 	= 0
	var newcount = 0
	//var l = document.getElementByName("schoolkid")
	var len 	= document.addtobasket.schoolkid.length;
	var f1 = (document.forms[0].length);
	for(i=0;i<=(f1-1);i++){
		if(document.forms[0].elements[i].name=="schoolkid"){
			if(document.forms[0].elements[i].checked){
				count = count + 1
			}
		}
	}
	//alert("stepClear 1")
	//alert(newcount)
		//for(i=1;i<=(newcount);i++) {
			//if(document.addtobasket.schoolkid[1].checked) {
			//	count = count + 1
			//}
		//}
	if(count==0) {
		err = "Please select one of your photos to apply this product to";
		document.getElementById("floatingAlert").style.top = 200;
		document.getElementById("floatingAlert").style.left = 510;
		document.getElementById("floatingAlert").style.display = 'block';
			document.getElementById("errorMessage").innerHTML = err + '<img style=\"float:right;\" src=\"http://www.myschoolpictures.co.uk/images/errorArrowDown.gif\" border=\"0\">';
		correct =false;
		}
	//alert("stepClear 2")
	//alert(eval(document.getElementById("myType")))
	
	exists = eval(document.getElementById("myType"));
	if(exists) {
	if(document.getElementById("myType").value=="") {
		err = "Please select from the product row above";
		//err = "Please select one of your photos to apply this product to";
		document.getElementById("floatingAlert").style.top = 120;
		document.getElementById("floatingAlert").style.display = 'block';
			document.getElementById("errorMessage").innerHTML = '<img style=\"display:block;\" src=\"http://www.myschoolpictures.co.uk/images/errorArrowUp.gif\" border=\"0\">' + err;
		correct = false;
		correct = false;
	}
	}else{
		alert("Please select a MAIN category\nPrints | Frames | Packs | Novely | Special\nFrom the navigation above")
		correct = false;
	}
	//alert("step")
	
	//dropdown
	
	if(document.getElementById("myType")) {
		if(document.addtobasket.myType.value=="") {
		//if(document.addtobasket.UC_recordId.value=="") {
			err = "Please select a product from the list above";
			document.getElementById("floatingAlert").style.top = 100;
			document.getElementById("floatingAlert").style.display = 'block';
			document.getElementById("errorMessage").innerHTML = '<img style=\"display:block;\" src=\"http://www.myschoolpictures.co.uk/images/errorArrowLeft.gif\" border=\"0\">' + err;
			correct = false;
		}
	}
	//if(correct){return validateForm(document.addtobasket)}
	
	var exists = eval(document.addtobasket["dropdown"]);
		if(exists) {
			if(document.addtobasket.UC_recordId.value=="") {
				err = "Please select a product style from the list";
				document.getElementById("floatingAlert").style.top = 120;
				document.getElementById("floatingAlert").style.left = 440;
				document.getElementById("floatingAlert").style.display = 'block';
				document.getElementById("errorMessage").innerHTML = '<img style=\"display:block;\" src=\"http://www.myschoolpictures.co.uk/images/errorArrowLeft.gif\" border=\"0\">' + err;
				correct = false;
			}
		}

	return correct;
	}


	function validateneworderform( oForm, element ) {
		var correct = true;
		var msg = "<strong>THERE WERE PROBLEMS WITH THE FORM YOU ARE SUBMITTING</strong><br />"
		if(oForm.Col_ref.value=="") {msg = msg + '<div class="error">Please enter a proof number found on your proof card</div><br />'; correct = false;}
		if(oForm.passcode.value=="") {msg = msg + '<div class="error">Please enter a passcode found on your proof card</div><br />'; correct = false;}
		if(oForm.firstname.value=="") {msg = msg + '<div class="error">Please enter the firstname of your child</div><br />'; correct = false;}
		if(oForm.surname.value=="") {msg = msg + '<div class="error">Please enter the surname of your child</div><br />'; correct = false;}
		if(oForm.Col_photographer.value=="") {msg = msg + '<div class="error">Please select a photographer, your photographer is found on your proof card</div><br />'; correct = false;}
	//var exists = false;
	exists = eval(oForm["mySchool"]);
		if(exists) {
		if(oForm.mySchool.value=="") {msg = msg + '<div class="error">Please select the school the child attends</div><br />'; correct = false;}
		}
	//var exists = false;
	exists = eval(oForm.terms);
		if(exists) {
			if(!oForm.terms.checked) {msg = msg + '<div class="error">You MUST agree to our terms of business!</div><br />'; correct = false;}
			if(oForm.email.value=="") {msg = msg + '<div class="error">Please provide us with a valid email address</div><br />'; correct = false;}
			if(oForm.holdingemail.value!=oForm.email.value) {msg = msg + '<div class="error">Your email address does not match what you have already entered!<br /><br />Please be sure to have this correct for security reasons</div><br />'; correct = false;}
		}
		if(!correct) {
			document.getElementById("floatingAlertx").style.top = 100;
			document.getElementById("floatingAlertx").style.display = 'block';
			document.getElementById("errorMessagex").innerHTML = msg;
			document.getElementById(element).style.marginTop = '50px';
			document.getElementById(element).style.display = 'none';
		}
		//alert(correct);
		//return false;
		return correct;
	}

	function closeErrorsButShowForm(layer, element) {
			document.getElementById(element).style.display = 'block';
			document.getElementById(layer).style.display = 'none';
		}

	function do_remove(obj) {
		if(obj==1) {
				document.forms[0].qty.value = 0;
				//count = count + 1
				document.forms[0].submit();
			}else{
//		if(null(document.forms[0].qty[obj-1].value)) {;}
		//var oForm
		//alert(oForm)
		//to reset the value of qty
		//var count = 0
		//alert(document.forms[0].qty.length);
		//alert(obj);
		//alert(document.checkout.qty.length)
		//alert(obj)
		//for(i=0;i<=(f1-1);i++){
			//if(document.forms[0].elements[i].name=="qty"){
				//if(document.forms[0].elements[i].checked){
				document.forms[0].qty[obj-1].value = 0;
				//count = count + 1
				document.forms[0].submit();
				//}
				//count = count + 1
			//}
		//}
//	alert(count)
//		document.addtobasket.qty[0].value = '0';
		}
	}

	//script to close the error message
	function closeErrors(obj) {document.getElementById(obj).style.display = 'none';}



//##############################################################################################
// 							DROPPED IN FROM HOME PAGE - INHERITED NASTY CODE!!!!
//##############################################################################################

		var newwindow;
		function contactpop(url)
		{
			newwindow=window.open(url,'name','height=180,width=400');
			if (window.focus) {newwindow.focus()}
		}


	function printwindow() {
	//alert("hello World");
	//var sel = document.getElementById("detailstable");
	//sel.style.display = 'block';
	window.location.href = 'index.asp?pageID=41&display=checkout&printing=true';
}

	//function to autofill the deliveryaddress
	function fillMe() {
	var oForm = document.oBounce
	//alert(document.oBounce.title.value)
	oForm.deliveryname.value 		= oForm.title.value + " " + oForm.firstname.value + " " + oForm.lastname.value;
	oForm.Daddress1.value 			= oForm.address1.value;
	oForm.Daddress2.value 			= oForm.address2.value;
	oForm.Dtown.value 				= oForm.town.value;
	oForm.Dcounty.value 			= oForm.county.value;
	oForm.Dpostcode.value 			= oForm.postcode.value;
	oForm.telephone.value 			= oForm.daytimetelephone.value;
	}


//check email addresses match before submitting customer
	//details at checkout
	function checkEmailFirst( oForm ) {
		var correct = true;
		if(oForm.email.value!=oForm.email2.value) {
		correct = false;
		alert("your email addresses do not match!\nPlease correct your errors");
		}
		if(correct) {
		return validateForm( oForm )
		}
		return correct;
	}
	function ShowDetails(thisval, count) {
		var thisval
		var count
		var sel
//		alert(count);
//		alert(thisval);
		for(i=1;i<count+1;i++) {
//		alert(i);
		sel = document.getElementById("tbl_" + i);
		sel.style.display = 'none'; //: 'none';
		sel = document.getElementById("img_" + i);
		sel.style.display = 'none'; //: 'none';
		}
		if(thisval != "0") {
		sel = document.getElementById("tbl_" + thisval);
		sel.style.display = 'block'; //: 'none';
		sel = document.getElementById("img_" + thisval);
		sel.style.display = 'block'; //: 'none';
		}
		sel = document.getElementById("shop");
		sel.style.display = 'block'; //: 'none';
	}
	
	function clearCart() {
		var clearMe = confirm('This will clear the shopping basket contents!'); 
		if(clearMe == true) {
			window.location.href='<%=UC_EmptyCart%>';
			}
		return clearMe
	}
	function hidedisplayBox(nullVal) {
//	alert(nullVal);
	if( nullVal > 0 ) {
		var newsel = document.getElementById('displayBox');
		newsel.style.display = 'none';
		}
	if( nullVal < 1 ) {
		var newsel = document.getElementById('displayBox');
		newsel.style.display = 'block';
		}
	}


//if(window.attachEvent)
 //   window.attachEvent("onload",restoreStyles);

  //function restoreStyles(){
   // inputList = document.getElementsByTagName("INPUT");
    //for(i=0;i<inputList.length;i++)
     // inputList[i].style.backgroundColor = "";
    //selectList = document.getElementsByTagName("SELECT");
    //for(i=0;i<selectList.length;i++)
    //  selectList[i].style.backgroundColor = "";
 // }
	//-->


function getPermission(form){ 
		ok = true;
		if(confirm("Have you read and agreed with our terms and conditions?")) { 
			ok = true;
		}else{
			ok = false;
		}
		return ok;
	}
	
	//check the proof numbers 
	function checkProof( oForm ) {
		var ok = true;
		if(confirm("Have you read and agreed with our terms and conditions?")) { 
			ok = true;
		}else{
			ok = false;
		}
		if(oForm.Col_ref.value!=oForm.Col_ref2.value) {
			alert("your proof number is different");
			ok = false;
		}
		if(oForm.Col_ref.value=="") {
			alert("please re-enter your proof number");
			ok = false;
		}
		return ok;
	}
	
	function keystrokes() {
		onKeydown
	}
	
	function getPhotographer( SchoolName ) {
		var a = document.lookup.Col_ref.value
		var b = document.lookup.firstname.value
		var c = document.lookup.surname.value
		var d = document.lookup.mySchool.value
		var e = document.lookup.passcode.value
		var f = document.lookup.NumberOfProofs.value
		var mypath		= '/'
		window.location.href = mypath + 'index.asp?pageID=41&proofs=' + f + '&reference=' + a + '&firstname=' + b + '&surname=' + c +'&mySchool=' + d +'&passcode=' + e
	}
	function getSchool( Photographer ) {
		var a = document.lookup.Col_ref.value
		var b = document.lookup.firstname.value
		var c = document.lookup.surname.value
		var d = document.lookup.Col_photographer.value
		var e = document.lookup.passcode.value
		var f = document.lookup.NumberOfProofs.value
		var mypath		= '/'
		window.location.href = mypath + 'index.asp?pageID=41&proofs=' + f + '&reference=' + a + '&firstname=' + b + '&surname=' + c +'&myPhotographer=' + d +'&passcode=' + e
	}


	function positionCursor(oForm, oField) {
		oForm.elements[oField].focus();
	}

	function validateSendToFriendForm( oForm ) {
		var correct = true;
		if(oForm.yourname.value=="") {alert("please enter your name"); correct = false;}
		if(oForm.friends1email.value=="") {alert("please enter the first email address"); correct = false;}
		if(oForm.friends1name.value=="") {alert("please enter the first name"); correct = false;}
		return correct;
	}


	function showMainTable() {
			document.getElementById("checkoutbox").style.display = 'block';
		}
	//#990000
	//-->

	function ShowDescription(si, iLoop) {
		var oSi = si;
		for(i=1;i<=(iLoop);i++){ document.getElementById("tbl_" + i).style.display = 'none'; }
		
		for(i=1;i<=(iLoop);i++){ document.getElementById("img_" + i).style.display = 'none'; }
	
		document.getElementById("tbl_" + oSi).style.display = 'block';
		document.getElementById("img_" + oSi).style.display = 'block';//displayBox
		document.getElementById("displayBox").style.display = 'none';

		document.addtobasket.Col_Price1.value = document.getElementById("price" + si).value;
		document.addtobasket.Col_Name.value = document.getElementById("model" + si).value;
		document.addtobasket.prodId.value = document.getElementById("productid" + si).value;
	}

	function loadDetails(obj1, obj2) {
		//alert("firefox!!")
		var a = document.getElementById(obj1).value;
		var b = obj2 //document.getElementById(obj2).value;
			//alert(a + ' ' + b);
		var html = 'By clicking add to basket you will add ' + a + ' ' + b + ' to the children below';
		document.getElementById("productContent").innerHTML = html;
	}

	function CheckThisValue( obj, oVal ) {
		if(oVal==0) { obj.value = '1'; }
	}
	
	function showLargerImage(obj, state) {
	var id = document.getElementById(obj);
	if(state.checked) {
		id.style.display = 'block';
		document.getElementById("bottomtext").style.display = 'none';
	}else{
		id.style.display = 'none';
	}
	}
