function PopUp(id){
	if(id!=""){
		var strURL = "/boost/photo.asp?id=" + id
		var objPhotoWindow = window.open(strURL,'photo','height=500,width=550,left=10,top=10,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=1,resizable=0,status=0,toolbar=0');
	}
}

function PrintMap(id,imageNumber){
	if(id!=""){
		var strURL = "/map.asp?id=" + id + "&map=" + imageNumber
		var objMapWindow = window.open(strURL,'map','height=250,width=350,left=10,top=10,directories=0,fullscreen=0,location=0,menubar=1,scrollbars=1,resizable=0,status=0,toolbar=0');
	}
}

function goURL(strURL){
	if(strURL!=""){
		document.location.href=strURL;
	}
}
function externalURL(strURL,targetWindow){
	if(strURL!="" && targetWindow!=1){
		document.location.href=strURL;
	}else if(strURL!=""){
		var newWindow = window.open(strURL,'','');
	}
}


  var today = new Date();
  var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days

  function setCookie(name, value) {
    if (value != null && value != "")
      document.cookie=name + "=" + escape(value) + ";expires=" + expiry.toGMTString();
  }

function SwapImage(strImageSRC,intHeight,intWidth,strTitle,strCaption){
	var imgObj = getObj("featureIMG")
	var captionObj = getObj("featureCaption")
	var titleObj = getObj("featureTitle")
	if (typeof(intWidth)=="number") imgObj.width=intWidth;
	if (typeof(intHeight)=="number") imgObj.height=intHeight;
	if (strImageSRC!='') imgObj.src=strImageSRC;	
	titleObj.innerHTML=strTitle;	
	captionObj.innerHTML=strCaption;	
}

function strTrim(strText) {
	for (i=0; i<strText.length; ++i) {
		if (strText.charAt(i) != ' ') break;
	}
	if (i >= strText.length) return ('');
	if (i > 0) strText = strText.substring(i, strText.length);
	for (j=strText.length-1; j > i; --j) {
		if (strText.charAt(j) != ' ') break;
	}
	if (j < strText.length -1)
		strText = strText.substring(0, j+1);
	return strText;

}
function ValidEmail(s){
    var i = 1;
    var sLength = s.length;
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }
    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
} 
function ValidText(strText, intMin)
{
	if (strText == "" || strText.length < intMin)
		return false;
	else
		return true;
}

function DisplayPassword(){
	var obj = xDOM("forgotPassword",0);
	if(obj.style.height == "0px"){
		obj.style.height = "150px";
		setTimeout("setPassFocus()",10);
	}else{
		obj.style.height = "0px";
	}	
}



function setPassFocus(){
	var objInput = xDOM("forgotForm",0);
	objInput.email.focus();	
}



// Cross Browser DOM Functions used to create objects and get top / left coords
// copyright Stephen Chapman, 4th Jan 2005
// you may copy this code but please keep the copyright notice as well
var aDOM = 0, ieDOM = 0, nsDOM = 0
var stdDOM = document.getElementById;
if (stdDOM) aDOM = 1; else {
  ieDOM = document.all;
  if (ieDOM) aDOM = 1; else {
    nsDOM = (
      (navigator.appName.indexOf('Netscape') != -1)
      && (parseInt(navigator.appVersion) ==4));
    if (nsDOM) aDOM = 1;
  }
}
function xDOM(objectId, withStyle) {
var st = ''; if (withStyle) st = '.style';
if (stdDOM) return (eval('document.getElementById(objectId)'+st));
if (ieDOM) return (eval('document.all[objectId]'+st));
if (nsDOM) return (document.layers[objectId]);
}





function ValidateLoginForm(obj){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;

		var strEmail = strTrim(obj.email.value);
		if(strEmail == "") {
			strAlert += "- Enter an email address\n";
			isAlert = true;
		}else if(!ValidEmail(strEmail)){
			strAlert += "- Enter a valid email address\n";
			isAlert = true;
		}
		
		var strPassword = strTrim(obj.password.value);
		if (strPassword==""){
			strAlert += "- Enter a password\n";
			isAlert = true;
		}
								
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}
}
function ValidateCheckout(obj){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;
	if(obj.clear.value != '1'){
		var strFirstName = strTrim(obj.nameFirst.value);
		var strLastName = strTrim(obj.nameLast.value);
		var strCompany = strTrim(obj.organisation.value);		
		var strEmail = strTrim(obj.email.value);		
		var strPhone = strTrim(obj.workPhone.value);
		
		if (strFirstName==""){
			strAlert += "- Enter your first name\n";
			isAlert = true;
		}
		if (strLastName==""){
			strAlert += "- Enter your surname\n";
			isAlert = true;
		}		
		if (strCompany==""){
			strAlert += "- Enter your company\n";
			isAlert = true;
		}				
		if (strLastName==""){
			strAlert += "- Enter your last name\n";
			isAlert = true;
		}				
		if(strEmail == "") {
			strAlert += "- Enter an email address\n";
			isAlert = true;
		}else if(!ValidEmail(strEmail)){
			strAlert += "- Enter a valid email address\n";
			isAlert = true;
		}
		if (strPhone==""){
			strAlert += "- Enter your contact number\n";
			isAlert = true;
		}		

								
		if (isAlert == true){
			strAlert += "\n\n______________________________________";
			alert (strAlert);
			return false;
		}else{
			return true;
		}
	}else{
		return true	
	}
}
function ValidateForgottenForm(obj){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;

		var strEmail = strTrim(obj.email.value);
		if(strEmail == "") {
			strAlert += "- Enter an email address\n";
			isAlert = true;
		}else if(!ValidEmail(strEmail)){
			strAlert += "- Enter a valid email address\n";
			isAlert = true;
		}
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}	
	
	
}

function ValidateNewUserForm(obj){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;

		var strFirstName = strTrim(obj.nameFirst.value);
		if (strFirstName==""){
			strAlert += "- Enter your first name\n";
			isAlert = true;
		}
		
		var strLastName = strTrim(obj.nameLast.value);
		if (strLastName==""){
			strAlert += "- Enter your last name\n";
			isAlert = true;
		}

		var strEmail = strTrim(obj.email.value);
		if(strEmail == "") {
			strAlert += "- Enter an email address\n";
			isAlert = true;
		}else if(!ValidEmail(strEmail)){
			strAlert += "- Enter a valid email address\n";
			isAlert = true;
		}
		
		var strWorkPhone = strTrim(obj.workPhone.value);
		if (strWorkPhone==""){
			strAlert += "- Enter your work phone number\n";
			isAlert = true;
		}
		
		var strPassword = strTrim(obj.password.value);
		var strPassword2 = strTrim(obj.password2.value);
		if (strPassword==""){
			strAlert += "- Enter a password\n";
			isAlert = true;					
		} 
		if (strPassword2==""){
			strAlert += "- Enter a confirmation password\n";
			isAlert = true;
		}
		if (strPassword!=strPassword2){
				strAlert += "- Your confirmation password does not match your password.\n";
				isAlert = true;
		}
								
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}
}			

function ValidatePersonalDetails(obj){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;

		var strFirstName = strTrim(obj.nameFirst.value);
		if (strFirstName==""){
			strAlert += "- Enter your first name\n";
			isAlert = true;
		}
		
		var strLastName = strTrim(obj.nameLast.value);
		if (strLastName==""){
			strAlert += "- Enter your last name\n";
			isAlert = true;
		}
		
		var strEmail = strTrim(obj.email.value);
		if(strEmail == "") {
			strAlert += "- Enter an email address\n";
			isAlert = true;
		}else if(!ValidEmail(strEmail)){
			strAlert += "- Enter a valid email address\n";
			isAlert = true;
		}
		
		var strWorkPhone = strTrim(obj.workPhone.value);
		if (strWorkPhone==""){
			strAlert += "- Enter your work phone number\n";
			isAlert = true;
		}

		var strPassword = strTrim(obj.password.value);
		var strPassword2 = strTrim(obj.password2.value);
		if (strPassword!=""){
			if (strPassword!=strPassword2){
				strAlert += "- Your confirmation password does not match your password.\n";
				isAlert = true;
			}
		}
	
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}
}

function getObj(id){
	if(document.getElementById){
		return document.getElementById(id);
	}else{
		return document.all[id];
	} 
}

function NavImageSwap(SwapName,SwapImage){
	eval("document." +SwapName+ ".src = '"+SwapImage+"'");
}


