// 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 {
    var 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]);
}



var IE = document.all?true:false
window.onload=function(){
	if(IE)correctPNG();
}
function correctPNG(){
   for(var i=0; i<document.images.length; i++){
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	 }
  }
}



var objOpenPaper = ''
function ShowPaperDetails(strID){
	var objPaper = xDOM(strID,0);
	var objDetail = xDOM(strID + 'detail',0);
	if(objOpenPaper!=''){ClosePaperDetails(objOpenPaper)}
	objPaper.style.display = 'none';
	objDetail.style.display = 'block';
	objOpenPaper = strID;
}
function ClosePaperDetails(strPaper){
	var objPaper = xDOM(strPaper,0);
	var objDetail = xDOM(strPaper + 'detail',0);	
	objDetail.style.display = 'none';
	objPaper.style.display = 'block';
	objOpenPaper = ''
}


function ViewReports(objForm){
	var intSelectedIndex = objForm.reportViewOptions.selectedIndex
	if (intSelectedIndex!=0){
		return true;	
	}else{
		alert("Please select an option.")	
		return false;
	}
}

function AddCart(strOrderType){
	if(strOrderType=="confSeat"){
		alert("Your are unable to add a conference seat\nto the cart as you have a Report in your cart.\nYou can only order Reports OR Conference seats,\nnot both.")
	}else{
		alert("Your are unable to add a Report\nto the cart as you have a Conference Seat in your cart.\nYou can only order Reports OR Conference seats,\nnot both.")
	}
}

function StartCheckOut(){
	document.cart.action.value = "startCheckout";
	document.cart.submit();
	
}

function CheckPaymentType(objSelect,strValue){
	if (strValue != ""){
		var strSelectValue = strValue
	}else{
		var strSelectValue = objSelect[objSelect.selectedIndex].value;
	}
	
	var objCC = xDOM("CCDetails",0);
	if(strSelectValue.substring(0,1) == '1'){
		objCC.style.display = "block";
	}else{
		objCC.style.display = "none";	
		
	}
}




function CheckDelegate(objCheckBox,strElementPrfx,indID,strFirstName,strLastName,strEmail,strPosition,strMobile,strOrganisationName,strpostAddressID,strpostAddress1,strpostAddress2,strpostCity,strpostState,strpostPostcode,strMyIndustry){
	var frm = "document.delegates.";
	if(objCheckBox.checked){
		document.getElementById("lookup_1").style.display = "none"
		eval(frm + strElementPrfx + "_indID").value = indID
		eval(frm + strElementPrfx + "_FirstName").value= strFirstName;
		eval(frm + strElementPrfx + "_FirstName").disabled = true;
		eval(frm + strElementPrfx + "_FirstName").style.backgroundColor = "#e5e5e5";
		eval(frm + strElementPrfx + "_LastName").value = strLastName;
		eval(frm + strElementPrfx + "_LastName").disabled = true;
		eval(frm + strElementPrfx + "_LastName").style.backgroundColor = "#e5e5e5";
		eval(frm + strElementPrfx + "_Position").value = strPosition;
		eval(frm + strElementPrfx + "_Organisation").value = strOrganisationName;
		//eval(frm + strElementPrfx + "_Position").disabled = true;
		//eval(frm + strElementPrfx + "_Position").style.backgroundColor = "#e5e5e5";
		eval(frm + strElementPrfx + "_Email").value = strEmail;
		eval(frm + strElementPrfx + "_Email").disabled = true;
		eval(frm + strElementPrfx + "_Email").style.backgroundColor = "#e5e5e5";
		eval(frm + strElementPrfx + "_Mobile").value=strMobile
		//eval(frm + strElementPrfx + "_Mobile").disabled = true;
		//eval(frm + strElementPrfx + "_Mobile").style.backgroundColor = "#e5e5e5";		
		//alert("Please update your mobile number if its incorrect.")
		eval(frm + strElementPrfx + "_postAddressID").value = strpostAddressID;
		eval(frm + strElementPrfx + "_postAddress1").value = strpostAddress1;
		eval(frm + strElementPrfx + "_postAddress2").value = strpostAddress2;
		eval(frm + strElementPrfx + "_postCity").value = strpostCity;
		eval(frm + strElementPrfx + "_postState").value = strpostState;
		eval(frm + strElementPrfx + "_postPostcode").value = strpostPostcode;
		PopulateMyIndustry(frm,strElementPrfx,strMyIndustry);
	}else{
		document.getElementById("lookup_1").style.display = "inline"	
		eval(frm + strElementPrfx + "_indID").value = "X";
		eval(frm + strElementPrfx + "_FirstName").disabled = false;
		eval(frm + strElementPrfx + "_FirstName").style.backgroundColor = "";		
		eval(frm + strElementPrfx + "_LastName").disabled = false;
		eval(frm + strElementPrfx + "_LastName").style.backgroundColor = "";		
		eval(frm + strElementPrfx + "_Position").disabled = false;
		eval(frm + strElementPrfx + "_Position").style.backgroundColor = "";		
		eval(frm + strElementPrfx + "_Email").disabled = false;
		eval(frm + strElementPrfx + "_Email").style.backgroundColor = "";		
		eval(frm + strElementPrfx + "_Mobile").disabled = false;
		eval(frm + strElementPrfx + "_Mobile").style.backgroundColor = "";	
		eval(frm + strElementPrfx + "_Mobile").value= '';
		eval(frm + strElementPrfx + "_FirstName").value= '';		
		eval(frm + strElementPrfx + "_LastName").value = '';
		eval(frm + strElementPrfx + "_Email").value= '';
		eval(frm + strElementPrfx + "_Position").value = '';
		eval(frm + strElementPrfx + "_Organisation").value = '';
		eval(frm + strElementPrfx + "_postAddressID").value = '';
		eval(frm + strElementPrfx + "_postAddress1").value = '';
		eval(frm + strElementPrfx + "_postAddress2").value = '';
		eval(frm + strElementPrfx + "_postCity").value = '';
		eval(frm + strElementPrfx + "_postState").value = '';
		eval(frm + strElementPrfx + "_postPostcode").value = '';
		DePopulateMyIndustry(frm,strElementPrfx,strMyIndustry);
	}
}

function PopulateMyIndustry(frm,strElementPrfx,strValue)
{
	var myArray=strValue.split(",");
	var temp="";
	var flag;
	for(i=0;i<=eval(frm + strElementPrfx + "_myindustry").options.length-1;i++)
	{
		flag=false;
		eval(frm + strElementPrfx + "_myindustry").options[i].selected=false;
		for(j=0;j<=myArray.length-1;j++)
		{
			if(myArray[j] == eval(frm + strElementPrfx + "_myindustry").options[i].value)
			{
				eval(frm + strElementPrfx + "_myindustry").options[i].selected=true;
				flag=true;
				break;
			}
		}
		if (flag)
		{
			temp+= i + " = " + eval(frm + strElementPrfx + "_myindustry").options[i].value;
		}
	}
	//alert(""+strValue);
	//eval(frm + strElementPrfx + "_myindustry").selectedIndex = 2;	
}

function DePopulateMyIndustry(frm,strElementPrfx,strValue)
{
	for(i=0;i<=eval(frm + strElementPrfx + "_myindustry").options.length-1;i++)
	{
		eval(frm + strElementPrfx + "_myindustry").options[i].selected=false;
	}
}

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 ShowMore(){
	var objMore = xDOM("ReportMore",1)
	if(objMore.display == "block"){
		objMore.display = "none"	
	}else{
		objMore.display = "block"
	}
}

function Order(){
	document.additem.action = "/checkout.html/step/cart"
	document.additem.submit();
}

var xmlhttp=false;
function CreateXMLHttpRequestObject(){
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	  xmlhttp = new XMLHttpRequest();
	}	
}
function CheckIndividual(strFormPrefix,intCount){
	if(!ValidEmail(eval("document.delegates." + strFormPrefix + "_Email.value"))){
		alert("Please enter a valid email address for attendee " + intCount +".");
		eval("document.delegates." + strFormPrefix + "_Email.focus()")
	}else{
		xmlhttp.open("GET", "/getUserDetailsDB.asp?login=" + eval("document.delegates." + strFormPrefix + "_Email.value"),true);
		xmlhttp.onreadystatechange = function() {
		    if (xmlhttp.readyState == 4) {
		        //alert(xmlhttp.responseText)
		        if (xmlhttp.responseText == "false") {
		            alert("User not found. Please enter delegate " + intCount + "'s details");
		            eval("document.delegates." + strFormPrefix + "_FirstName.focus()")
		        } else {

		            var arrFormElements = xmlhttp.responseText.split("~");
		            eval("document.delegates." + strFormPrefix + "_FirstName.value = arrFormElements[0]")
		            eval("document.delegates." + strFormPrefix + "_FirstName").disabled = true;
		            eval("document.delegates." + strFormPrefix + "_FirstName").style.backgroundColor = "#e5e5e5";

		            eval("document.delegates." + strFormPrefix + "_LastName.value = arrFormElements[1]")
		            eval("document.delegates." + strFormPrefix + "_LastName").disabled = true;
		            eval("document.delegates." + strFormPrefix + "_LastName").style.backgroundColor = "#e5e5e5";

		            eval("document.delegates." + strFormPrefix + "_indID.value = arrFormElements[2]")
		            eval("document.delegates." + strFormPrefix + "_Mobile.value = arrFormElements[3]")
		            eval("document.delegates." + strFormPrefix + "_Position.value = arrFormElements[4]")
		            eval("document.delegates." + strFormPrefix + "_Organisation.value = arrFormElements[5]")
					tempaddress = arrFormElements[6];
					tempindex = tempaddress.indexOf("|");
					addressstring1 = "";
					addressstring2 = "";
					if(tempindex>=0){
						addressstring1 = tempaddress.substr(0,tempindex);
						addressstring2 = tempaddress.substr(tempindex+1);
					}else{
						addressstring1 = tempaddress;
						addressstring2 = "";
					}
					
		            eval("document.delegates." + strFormPrefix + "_postAddress1.value = addressstring1")
					eval("document.delegates." + strFormPrefix + "_postAddress2.value = addressstring2")
		            eval("document.delegates." + strFormPrefix + "_postCity.value = arrFormElements[7]")
		            eval("document.delegates." + strFormPrefix + "_postState.value = arrFormElements[8]")
		            eval("document.delegates." + strFormPrefix + "_postPostcode.value = arrFormElements[9]")
		            eval("document.delegates." + strFormPrefix + "_Email").disabled = true;
		            eval("document.delegates." + strFormPrefix + "_Email").style.backgroundColor = "#e5e5e5";
					PopulateMyIndustry("document.delegates.",strFormPrefix,arrFormElements[10]);
		            eval("document.delegates." + strFormPrefix + "_postAddressID.value = arrFormElements[11]")
		            alert(arrFormElements[0] + " " + arrFormElements[1] + " was found and the details entered.")
		        }
		    }
		}
		xmlhttp.send(null)	
	}
}

function ResetDelegate(strFormPrefix){
		
		eval("document.delegates." + strFormPrefix + "_Email").disabled = false;
		eval("document.delegates." + strFormPrefix + "_Mobile").disabled = false;	
		eval("document.delegates." + strFormPrefix + "_FirstName").disabled = false;
		eval("document.delegates." + strFormPrefix + "_LastName").disabled = false;	
		
		eval("document.delegates." + strFormPrefix + "_FirstName").style.backgroundColor = "";	
		eval("document.delegates." + strFormPrefix + "_LastName").style.backgroundColor = "";	
		eval("document.delegates." + strFormPrefix + "_Mobile").style.backgroundColor = "";	
		eval("document.delegates." + strFormPrefix + "_Email").style.backgroundColor = "";	
		
		eval("document.delegates." + strFormPrefix + "_Email.value = ''")
		eval("document.delegates." + strFormPrefix + "_FirstName.value = ''")
		eval("document.delegates." + strFormPrefix + "_LastName.value = ''")
		eval("document.delegates." + strFormPrefix + "_Position.value = ''")	
		eval("document.delegates." + strFormPrefix + "_Organisation.value = ''")	
		eval("document.delegates." + strFormPrefix + "_Mobile.value = ''")	
		eval("document.delegates." + strFormPrefix + "_indID.value = 'X'")
		
		eval("document.delegates." + strFormPrefix + "_postAddressID").value = '';
		eval("document.delegates." + strFormPrefix + "_postAddress1").value = '';
		eval("document.delegates." + strFormPrefix + "_postAddress2").value = '';
		eval("document.delegates." + strFormPrefix + "_postCity").value = '';
		eval("document.delegates." + strFormPrefix + "_postState").value = '';
		eval("document.delegates." + strFormPrefix + "_postPostcode").value = '';
		var strMyIndustry = "";
		var frm = "document.delegates.";
		DePopulateMyIndustry(frm,strFormPrefix,strMyIndustry);
}

function DisplayLookupInfo(strFormPrefix,intCount){
	//alert(intCount)
	document.getElementById("lookup_" + intCount).innerHTML = '&#160;<a tabindex="100" href="Javascript:ResetDelegate(\'' + strFormPrefix + '\')">Reset</a>'
}

function CheckPassChange(objForm){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;
	var strOldPass = strTrim(objForm.oldpass.value);
	var strNewPass = strTrim(objForm.password.value);
	var strConfirmPass = strTrim(objForm.confirmpassword.value);

	if(strOldPass==""){
		strAlert += "- Enter your old password\n";
		isAlert = true;	
	}
	if(strNewPass=="" || strNewPass.length < 6 ){
		strAlert += "- Enter your new password of at least 6 charachters\n";
		isAlert = true;	
	}else if(strNewPass!=strConfirmPass){
		strAlert += "- Ensure your new password and confirmation password match.\n";
		isAlert = true;			
	}
	if(strOldPass==strNewPass){
		strAlert += "- Your new password cannot be the same as your old password\n";
		isAlert = true;	
	}	
	
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}	

}



function ValidateUpdateUser(objForm){
	
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;
	var strFirstName = strTrim(objForm.firstName.value);
	var strLastName = strTrim(objForm.lastName.value);
	var strTelephone = strTrim(objForm.telephone.value);
	var strEmail = strTrim(objForm.email.value);
	var strPostAddress1 = strTrim(objForm.postAddress1.value);
	var strPostAddress2 = strTrim(objForm.postAddress2.value);
	var strCity = strTrim(objForm.postCity.value);
	var strState = strTrim(objForm.postState.value);
	var strPostcode = strTrim(objForm.postPostcode.value);
	var strCountry = strTrim(objForm.postCountry.value);
	
	/** Admin Password **/
	
	var strOldAdminPass = strTrim(objForm.oldAdminpassword.value);
	var strAdminPassword = strTrim(objForm.adminpassword.value);
	var strConfirmAdminPassword = strTrim(objForm.confirmadminpassword.value);


	/** Unit password **/
	var strOldPassword = strTrim(objForm.oldpassword.value);
	var strPassword = strTrim(objForm.password.value);
	var strConfirmPassword = strTrim(objForm.confirmpassword.value);
	
	if (strFirstName==""){
		strAlert += "- Enter your first name\n";
		isAlert = true;
	}
	if (strLastName==""){
		strAlert += "- Enter your last name\n";
		isAlert = true;
	}			
	if (strTelephone==""){
		strAlert += "- Enter your telephone number\n";
		isAlert = true;
	}						
	if(strEmail == "") {
		strAlert += "- Enter your email address\n";
		isAlert = true;
	}else if(!ValidEmail(strEmail)){
		strAlert += "- Enter a valid email address\n";
		isAlert = true;
	}		
	
	if(strOldAdminPass!=''){
		if(strAdminPassword==""){
			strAlert += "- Enter your new Admin password\n";
			isAlert = true;			
		}else if(strAdminPassword.length < 5){
			strAlert += "- Ensure your new Admin password is at least 5 characters\n";
			isAlert = true;
		}else if(strAdminPassword != strConfirmAdminPassword){
			strAlert += "- Ensure your new Admin password and confirm password match\n";
			isAlert = true;
		}					
	}
	if(strOldPassword!=''){
		if(strPassword==""){
			strAlert += "- Enter your new Unit password\n";
			isAlert = true;			
		}else if(strPassword.length < 5){
			strAlert += "- Ensure your new Unit password is at least 5 characters\n";
			isAlert = true;
		}if(strPassword != strConfirmPassword){
			strAlert += "- Ensure your new Unit password and confirm password match\n";
			isAlert = true;
		}					
	}

	if (strPostAddress1 == "" && strPostAddress2 == "") {
	    strAlert += "- Enter your Postal Address\n";
	    isAlert = true;
	}
	if (strCity == "") {
	    strAlert += "- Enter your Postal Suburb\n";
	    isAlert = true;
	}
	if (strState == "") {
	    strAlert += "- Enter your Postal State\n";
	    isAlert = true;
	}
	if (strPostcode == "") {
	    strAlert += "- Enter your Postal Postcode\n";
	    isAlert = true;
	}
	if (strCountry == "") {
	    strAlert += "- Enter your Postal Country\n";
	    isAlert = true;
	}		
	
	
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}
	
}


function SameAddress(obj)
{
	if(!obj.checked){
		document.newcustomerform.strAddress1.value = "";
		document.newcustomerform.strAddress2.value = "";
		document.newcustomerform.strCity.value = "";
		document.newcustomerform.strState.value = "";
		document.newcustomerform.strPostcode.value = "";
		document.newcustomerform.strCountry.selectedIndex = 0;
	}
	else{
		document.newcustomerform.strAddress1.value = document.newcustomerform.postAddress1.value;
		document.newcustomerform.strAddress2.value = document.newcustomerform.postAddress2.value;
		document.newcustomerform.strCity.value = document.newcustomerform.postCity.value;
		document.newcustomerform.strState.value = document.newcustomerform.postState.value;
		document.newcustomerform.strPostcode.value = document.newcustomerform.postPostcode.value;
		document.newcustomerform.strCountry.selectedIndex = document.newcustomerform.postCountry.selectedIndex;
	}
}
function ValidateNewUser(objForm){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;
	var strFirstName = strTrim(objForm.firstName.value);
	var strLastName = strTrim(objForm.lastName.value);
	var strTelephone = strTrim(objForm.telephone.value);
	//var strLogin = strTrim(objForm.loginName.value);
	var strEmail = strTrim(objForm.email.value);
	var strPassword = strTrim(objForm.password.value);
	var strConfirmPassword = strTrim(objForm.confirmpassword.value);
	var strAdminPassword = strTrim(objForm.adminpassword.value);
	var strConfirmAdminPassword = strTrim(objForm.confirmadminpassword.value);	
	var strPostAddress1 = strTrim(objForm.postAddress1.value);
	var strPostAddress2 = strTrim(objForm.postAddress2.value);
	var strCity = strTrim(objForm.postCity.value);
	var strState = strTrim(objForm.postState.value);
	var strPostcode = strTrim(objForm.postPostcode.value);
	var strCountry = strTrim(objForm.postCountry.value);
	
	if (strFirstName==""){
		strAlert += "- Enter your first name\n";
		isAlert = true;
	}
	if (strLastName==""){
		strAlert += "- Enter your last name\n";
		isAlert = true;
	}			
	if (strTelephone==""){
		strAlert += "- Enter your telephone number\n";
		isAlert = true;
	}						
	if(strEmail == ""){
		strAlert += "- Enter your email address\n";
		isAlert = true;
	}else if(!ValidEmail(strEmail)){
		strAlert += "- Enter a valid email address\n";
		isAlert = true;
	}		
	//if (strLogin=="" || strLogin.length < 5){
	//	strAlert += "- Enter a login name of at least 5 charachaters\n";
	//	isAlert = true;
	//}	
	
	if(strPassword == "") {
		strAlert += "- Enter a password\n";
		isAlert = true;
	}else if(strPassword.length < 6){
		strAlert += "- Ensure your password is at least 6 characters\n";
		isAlert = true;
	}else if(strPassword != strConfirmPassword){
		strAlert += "- Ensure your password and confirm password match\n";
		isAlert = true;
	}	
	
	if(strAdminPassword == "") {
		strAlert += "- Enter an admin password\n";
		isAlert = true;
	}else if(strAdminPassword.length < 5){
		strAlert += "- Ensure your Admin password is at least 5 characters\n";
		isAlert = true;
	}else if(strAdminPassword != strConfirmAdminPassword){
		strAlert += "- Ensure your Admin password and confirm password match\n";
		isAlert = true;
	}			

	if (strPostAddress1 == "" && strPostAddress2 == ""){
		strAlert += "- Enter your Postal Address\n";
		isAlert = true;
	}			
	if (strCity==""){
		strAlert += "- Enter your Postal Suburb\n";
		isAlert = true;
	}			
	if (strState==""){
		strAlert += "- Enter your Postal State\n";
		isAlert = true;
	}			
	if (strPostcode==""){
		strAlert += "- Enter your Postcode\n";
		isAlert = true;
	}			
	if (strCountry==""){
		strAlert += "- Enter your Postal Country\n";
		isAlert = true;
	}			
	
	
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}
}


function ValidateDelegates(objFrm,intItmID,intQuantity){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;
	var frm = "document.delegates.del_" + intItmID + "_";

	for (var i = 1; i <= intQuantity; i++) {
	    var indId = strTrim(eval(frm + i + "_indID.value"));
	    if (indId.length >0) {
	       	// If its not a number then we gotta check the Name, email, position etc...
			var strFirstName = strTrim(eval(frm + i + "_FirstName.value"));
			var strLastName = strTrim(eval(frm + i + "_LastName.value"));
			var strPosition = strTrim(eval(frm + i + "_Position.value"));
			var strEmail = strTrim(eval(frm + i + "_Email.value"));
			var strpostAddress1 = strTrim(eval(frm + i + "_postAddress1.value"));
			var strpostCity = strTrim(eval(frm + i + "_postCity.value"));
			var strpostState = strTrim(eval(frm + i + "_postState.value"));
			var strpostPostcode = strTrim(eval(frm + i + "_postPostcode.value"));
			
			if (strFirstName==""){
				strAlert += "- Enter the first name for delegate " + i + "\n";
				isAlert = true;
			}
			if (strLastName==""){
				strAlert += "- Enter the last name for delegate " + i + "\n";
				isAlert = true;
			}			
			if (strPosition==""){
				strAlert += "- Enter the position for delegate " + i + "\n";
				isAlert = true;
			}						
			if(strEmail == "") {
				strAlert += "- Enter an email address for delegate " + i + "\n";
				isAlert = true;
			}else if(!ValidEmail(strEmail)){
				strAlert += "- Enter a valid email address for delegate " + i + "\n";
				isAlert = true;
			}
			if (strpostAddress1==""){
				strAlert += "- Enter the postal address for delegate " + i + "\n";
				isAlert = true;
			}			
			if (strpostCity==""){
				strAlert += "- Enter the postal suburb for delegate " + i + "\n";
				isAlert = true;
			}			
			if (strpostState==""){
				strAlert += "- Enter the postal state for delegate " + i + "\n";
				isAlert = true;
			}			
			if (strpostPostcode==""){
				strAlert += "- Enter the postcode for delegate " + i + "\n";
				isAlert = true;
			}			
		}
	}
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}
}


function CheckPayment(objForm){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;

	var paymentMethod = objForm.paymentType.options[objForm.paymentType.selectedIndex].value;	
	var intCreditCard = strTrim(objForm.ccnumber.value)
	var intCreditCardName = strTrim(objForm.nameoncard.value)
	if(paymentMethod==""){
		strAlert += "- Please select a payment method.\n";
		isAlert = true;		
	}else if(paymentMethod.substring(0,1) == '1'){ // Its a credit card
		if (intCreditCardName==""){
			strAlert += "- Please enter the name on your Credit Card\n";
			isAlert = true;
		}
		if (intCreditCard==""){
			strAlert += "- Please enter a valid Credit Card number\n";
			isAlert = true;
		}		
	}
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}	
	
}

function CheckLogin(objForm){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;

	var username = strTrim(objForm.username.value)
	var password = strTrim(objForm.password.value)

	if (username==""){
		strAlert += "- Please enter your e-mail address\n";
		isAlert = true;
	}		

	if (password==""){
		strAlert += "- Please enter your password\n";
		isAlert = true;
	}			
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}	
}

function CheckAdminLogin(objForm){
	var strAlert = "";
	strAlert = "______________________________________\n\nPlease\n\n";
	var isAlert = false;

	var password = strTrim(objForm.adminpass.value)

	if (password==""){
		strAlert += "- Please enter your admin password\n";
		isAlert = true;
	}			
	if (isAlert == true){
		strAlert += "\n\n______________________________________";
		alert (strAlert);
		return false;
	}else{
		return true;
	}	
}
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;
}

// Credit Card Validation Javascript
// copyright 12th May 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function validateCreditCard(s) {
	var v = "0123456789";
	var w = "";
	for (var i=0; i < s.length; i++) {
	x = s.charAt(i);
	if (v.indexOf(x,0) != -1)
	w += x;
	}
	var j = w.length / 2;
	if (j < 6.5 || j > 8 || j == 7) return false;
	var k = Math.floor(j);
	var m = Math.ceil(j) - k;
	var c = 0;
	for (var i=0; i<k; i++) {
	a = w.charAt(i*2+m) * 2;
	c += a > 9 ? Math.floor(a/10 + a%10) : a;
	}
	for (var i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1;
	return (c%10 == 0);
}

function PrivacyPolicy(){
	var objPrivacyWindow = window.open('/privacy.asp','privacy','height=600,width=600,left=10,top=10,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=1,resizable=0,status=0,toolbar=0');
}

// scripts for home page feature puff scroller

var intTotalHF = "";
var intPreviousHF = "";
var intSecondBetweenItems = 5;
var blnCycleFeatures = true;

function displayHF(strPos){
    objPrevDisplay = getObj("hf" + intPreviousHF);
    objDisplay = getObj("hf" + strPos);
    objPrevBanner = getObj("bnr" + intPreviousHF);
    objBanner = getObj("bnr" + strPos);
    objPrevDisplay.style.display='none';
    objDisplay.style.display='block';
    objPrevBanner.style.display='none';
    objBanner.style.display='block';
    if(intTotalHF == parseInt(strPos)){
		intNextHF = 1	;
	}else{
		intNextHF = parseInt(strPos) + 1;	
	}		
	intPreviousHF = strPos;
}

function cycleHF(strID){
    if(blnCycleFeatures){
        displayHF(strID);
        setTimeout("cycleHF(intNextHF)", intSecondBetweenItems*1000);
    }    
}

function hfNext(){
    blnCycleFeatures = false;
    displayHF(intNextHF);
}
function hfPrev(){
    blnCycleFeatures = false;
    intNextHF = parseInt(intPreviousHF) - 1
	if(intNextHF < 1){
		intNextHF = intTotalHF;	
	}	
	displayHF(intNextHF);
}

function getObj(id){
	if(document.getElementById){
		return document.getElementById(id);
	}else{
		return document.all[id];
	} 
}
