// JScript source code
/**
 * SWFObject v1.4.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){
var _25=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);_25=new deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_23&&_25.major>_23.major){return _25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}
catch(e){}}}return _25;};
deconcept.PlayerVersion=function(_29){
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;
this.minor=parseInt(_29[1])||0;
this.rev=parseInt(_29[2])||0;};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}return true;};
deconcept.util={getRequestParameter:function(_2b){
var q=document.location.search||document.location.hash;
if(q){var _2d=q.indexOf(_2b+"=");
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;
if(q.length>1&&_2d>-1){return q.substring(q.indexOf("=",_2d)+1,_2e);}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
var _2f=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2f.length;i++){
for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=null;}}}};
if(typeof window.onunload=="function"){
var oldunload=window.onunload;
window.onunload=function(){deconcept.SWFObjectUtil.cleanupSWFs();oldunload();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}
if(Array.prototype.push==null){
Array.prototype.push=function(_32){
this[this.length]=_32;
return this.length;};}

var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for backwards compatibility
var SWFObject = deconcept.SWFObject;

// Date Validation
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		//alert("The date format should be : dd/mm/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		//alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){		
		return false;
	}
	else{
		return true;
	}
}

var pcrex = new RegExp("^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$","i");

// JS Functions
function addLoadEvent(func) {	
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;		
	} 
	else {
		window.onload = function() {
		oldonload();
		func();
		}
	}
}

function emailCloak() {		
	if (document.getElementById) {
		var alltags = document.all? document.all : document.getElementsByTagName("*");
		for (i=0; i < alltags.length; i++) {
			if (alltags[i].className == "emailCloak") {
			var oldText = alltags[i].firstChild;
			var emailAddress = alltags[i].firstChild.nodeValue;
			var user = emailAddress.substring(0, emailAddress.indexOf("("));
			var website = emailAddress.substring(emailAddress.indexOf(")")+1, emailAddress.length);
			var newText = user+"@"+website;
			var a = document.createElement("a");
			a.href = "mailto:"+newText;
			var address = document.createTextNode(newText);
			a.appendChild(address);
			alltags[i].replaceChild(a,oldText);
			}
		}
	}	
}
addLoadEvent(emailCloak);

// Form Validation
function isValidEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return true;
	}
	else {
		return false;
	}
}

function isPostcode(pcode){
	if (pcrex.test(pcode)){
		return true;
	}
	else {
		return false;
	}
}

// Display Date
function displayDate(){
	// Get today's current date.
	var now = new Date();

	// Array list of days.
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

	// Array list of months.
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	
	// Day
	var ardate = new Array("0th","1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");
	var myweekday = now.getDate();

	// Calculate the number of the current day in the week.
	var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
		

	// Calculate four digit year.
	function fourdigits(number)	{
		return (number < 1000) ? number + 1900 : number;
									}

	// Join it all together
	today =  days[now.getDay()] + ", " + ardate[myweekday] + " " + months[now.getMonth()] + " " + (fourdigits(now.getYear())) ;
	
	// Print out the data.
	document.write(today);
}

// Search Validation
function checksearch(){
	if (document.quicksearch.Criteria.value==''){
		alert('Please specify your Search Criteria.');
		return false;
	}
	else {
		return true;
	}
}

// Text Size
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function changeTextSize(size){
	var sitetext = document.getElementById('wrapper');  
	sitetext.style.fontSize = size + '%'; 
	createCookie('ssccifontsize',size,1)
}

// Print and Email Functions
function PrintThisPage() 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=750,height=600,left=100,top=25";    
   var winprint=window.open('PrintPage.asp','Print',sOption);  
   winprint.focus(); 
}

function EmailThisPage(){	  
	var LeftPosition = (screen.width) ? (screen.width-320)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-240)/2 : 0;	
	var winprint=window.open('EmailPage.asp','Email','resizable=yes,scrollbars=no,width=420,height=560,left='+ LeftPosition +',top=' + TopPosition);  
	winprint.focus(); 
}

// Various Functions
function followquicklink(valuestr){
	if (valuestr!==''){
		var valuearr = valuestr.split("|")
		location.href='yourbusiness_viewpage.asp?PageID=' + valuearr[1] + '&ServicePageID=' + valuearr[0];
	}
}

function checkenquiry(){
	var ftxt = '';
	
	if (document.enquiryform.Name.value==''){
		ftxt += '\n- Please enter your Name.';
	}
	
	if (document.enquiryform.Company.value==''){
		ftxt += '\n- Please enter your Company Name.';
	}
	
	if (document.enquiryform.Telephone.value==''){
		ftxt += '\n- Please enter your Telephone Number.';
	}
	
	if (isValidEmail(document.enquiryform.email.value)==false){
		ftxt += '\n- Please enter your Email Address.';
	}

	if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else{
		return true;
	}
}

function checkmemberlogin(){
	var ftxt = '';
	
	if (isValidEmail(document.memberlogin.WebUserEmail.value)==false){
		ftxt += '\n- Please enter your Email Address.';
	}
	
	if (document.memberlogin.WebUserPassword.value==''){
		ftxt += '\n- Please enter your Password.';
	}
	
	if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else{
		return true;
	}
}

function checkforgottenpassword(){
	if (isValidEmail(document.forgottenpassword.WebUserEmail.value)==false){
		alert('Please enter your Email Address.');
		return false;
	}
	else {
		return true;
	}
}

function checkquickenewssignup(){
	if (isValidEmail(document.enewssignup.email.value)==false){
		alert('Please enter your Email Address.');
		return false;
	}
	else {
		return true;
	}
}

function clearemailfield(fieldVal){
	if (isValidEmail(fieldVal)==false){
		document.enewssignup.email.value='';
	}
}

function checkenews(){
	var ftxt = '';
	
	var bsubscribeoptions = false;
	for (var i=0;i<2;i++){
		if (document.enewsform.SubscribeOptions[i].checked==true){
			bsubscribeoptions = true;
		}
	}
	if (bsubscribeoptions==false){
		ftxt += '\n- Please select at least one Subscription Option.';
	}
	
	if (document.enewsform.Name.value==''){
		ftxt += '\n- Please enter your Name.';	
	}
	
	if (isValidEmail(document.enewsform.email.value)==false){
		ftxt += '\n- Please enter your Email Address.';
	}
	
	if (document.enewsform.Company.value==''){
		ftxt += '\n- Please enter your Company Name.';
	}
	
	if (document.enewsform.Address.value==''){
		ftxt += '\n- Please enter your Address.';
	}

	if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else{
		return true;
	}
}

function highlightlink(selectedId, counter) {   
	for (var i=1;i<=counter;i++){
	    if (i == selectedId) {
	        //document.getElementById("ServiceLink" + i).className = 'highlightedservice';
	        document.getElementById("ServiceLink" + i).style.color = '#D0103A';        
		}
		else {
		    //document.getElementById("ServiceLink"+i).className='';
		    document.getElementById("ServiceLink" + i).style.color = '#757575';
		}
	}
}

function confirmRemoveEventBasket(submitString){
	if (confirm('Are you sure you want to remove this event from your basket?')){
		location.href=submitString;
	}
}

/* Join Now Functions */
function dataCatch(formName,exvatamount,vatamount,incvatamount){ 	
    eval('document.'+formName+'.amount').value = incvatamount;
    document.getElementById("exvatamount").innerHTML = exvatamount;
    document.getElementById("vatamount").innerHTML = vatamount;
    document.getElementById("totalamount").innerHTML = incvatamount; 
}

function getPrice(classid,quantity){
	if (classid!==''){
		if(document.layers && document.layers['datadiv'].load){				
			document.layers['datadiv'].load('Scripts/GetRegisterPrice.asp?MemberClassID='+ classid +'&Quantity='+quantity + '&FormName=memberjoin',0);		
		}
		else if(window.frames && window.frames.length){				
			window.frames['dataframe'].window.location.replace('Scripts/GetRegisterPrice.asp?MemberClassID='+ classid +'&Quantity='+quantity + '&FormName=memberjoin');				
		}	
		//alert('Scripts/GetRegisterPrice.asp?MemberClassID='+ classid +'&Quantity='+quantity + '&FormName=memberjoin');
	}	
}

function updateEmployeesCount(maxmembers){
	var dropDown = document.memberjoin.MembersCount;	
	var subsection = "";	
	
	if (dropDown)  {		
		dropDown.length = 0;

		for(index=0; index<maxmembers; index++)	{								
			dropDown[index] = new Option(index+1,index+1);			
		}	
	}
}

var borgdetails = false;
function checkorgdetails(){
	var reqcount = 11;
	var fcount = 0;
	
	var fieldarr = new Array('OrganisationName|','Address1|','Town|','County|','Postcode|isPostcode','TelephoneNumber|','EmailAddress|isValidEmail','kTradingStatusCode|','YearEstablished|isDate','kBusinessTypeMain|','CompanyDesc|');
	
	for (var i=0;i<fieldarr.length;i++){
		var fieldin = fieldarr[i].split("|");
		var valfieldin = document.getElementById("val" + fieldin[0])
				
		if (fieldin[1]==''){
			if (eval('document.memberjoin.'+fieldin[0]+'.value')!==''){
				fcount +=1;
				valfieldin.className='fieldname';
			}
			else {
				valfieldin.className='fieldnamehighlight';				
			}
		}		
		else {			
			if (fieldin[1]=='isPostcode'&&isPostcode(eval('document.memberjoin.'+fieldin[0]+'.value'))){
    			fcount +=1				
			    valfieldin.className='fieldname';				
			}
			else {
				valfieldin.className='fieldnamehighlight';			
			}
						
			if (fieldin[1]=='isValidEmail'&&isValidEmail(eval('document.memberjoin.'+fieldin[0]+'.value'))){
				fcount +=1				
			    valfieldin.className='fieldname';				
			}
			else {
				valfieldin.className='fieldnamehighlight';			
			}
			
			if (fieldin[1]=='isDate'&&isDate(eval('document.memberjoin.'+fieldin[0]+'.value'))){
				fcount +=1
				valfieldin.className='fieldname';
			}
			else {
				valfieldin.className='fieldnamehighlight';			
			}
		}			
	}
	
	var orgdetailsicon = document.getElementById("OrgDetailsIco");
	if (fcount==reqcount){
		borgdetails = true;	
		orgdetailsicon.src='Images/JoinIcon_Tick.gif';
	}
	else {
		orgdetailsicon.src='Images/JoinIcon_Cross.gif';
	}
}

var badditionaldetails = false;
function checkaddorgdetails(){
	var reqcount = 2;
	var fcount = 0;
	var reasonsjoiningcount = document.memberjoin.ReasonsforJoiningCount.value;
	
	var breasonsjoin = false;
	for (var i=0;i<reasonsjoiningcount;i++){
		if (document.memberjoin.ReasonsforJoining[i].checked==true){
			breasonsjoin = true;
		}
	}
	
	if (breasonsjoin==true){
		fcount +=1;
		document.getElementById("valReasonsforJoining").className='fieldname';
	}
	else {
		document.getElementById("valReasonsforJoining").className='fieldnamehighlight';
	}
	
	if (document.memberjoin.ContactName.value!==''&&document.memberjoin.ContactName.value!=='Enter name here'){
		fcount +=1;
		document.getElementById("valContactName").className='fieldname';
	}
	else {
		document.getElementById("valContactName").className='fieldnamehighlight';
	}

	var orgdetailsicon = document.getElementById("AddOrgDetailsIco");
	if (fcount==reqcount){
		badditionaldetails = true;	
		orgdetailsicon.src='Images/JoinIcon_Tick.gif';
	}
	else {
		badditionaldetails = false;	
		orgdetailsicon.src='Images/JoinIcon_Cross.gif';
	}
}

function checkjoinform(){
	var ftxt = '';
	
	if (borgdetails==false){
		ftxt += '\n- Please ensure you have entered all of your Organisation Details.';
	}	
	
	if (badditionaldetails==false){
		ftxt += '\n- Please ensure you have entered all of your Additional Organisation Information.';
	}
	
	if (document.memberjoin.PaymentMethod.checked==false){
		ftxt += '\n- Please select the Payment Option.';
	}
	
	if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else{
		return true;
	}
}

function clearfield(fieldVal,fieldName){
	if (fieldVal=='Enter name here'){				
		document.getElementById(fieldName).value='';
	}
}

// Membership Update Form
var bupdateorgdetails = false;
function checkupdateorgdetails(){
	var reqcount = 9;
	var fcount = 0;
	
	var fieldarr = new Array('Address1|','Town|','County|','Postcode|isPostcode','TelephoneNumber|','EmailAddress|isValidEmail','kTradingStatusCode|','kBusinessTypeMain|','CompanyDesc|');
	
	for (var i=0;i<fieldarr.length;i++){
		var fieldin = fieldarr[i].split("|");
		var valfieldin = document.getElementById("val" + fieldin[0])
				
		if (fieldin[1]==''){
			if (eval('document.memberupdateform.'+fieldin[0]+'.value')!==''){
				fcount +=1;
				valfieldin.className='fieldname';
			}
			else {
				valfieldin.className='fieldnamehighlight';				
			}
		}		
		else {			
			if (fieldin[1]=='isPostcode'&&isPostcode(eval('document.memberupdateform.'+fieldin[0]+'.value'))){
    			fcount +=1				
			    valfieldin.className='fieldname';				
			}
			else {
				valfieldin.className='fieldnamehighlight';			
			}
						
			if (fieldin[1]=='isValidEmail'&&isValidEmail(eval('document.memberupdateform.'+fieldin[0]+'.value'))){
				fcount +=1				
			    valfieldin.className='fieldname';				
			}
			else {
				valfieldin.className='fieldnamehighlight';			
			}			
		}			
	}
	
	var orgdetailsicon = document.getElementById("OrgDetailsIco");
	if (fcount==reqcount){
		bupdateorgdetails = true;	
		orgdetailsicon.src='Images/JoinIcon_Tick.gif';
	}
	else {
	    bupdateorgdetails = false;
		orgdetailsicon.src='Images/JoinIcon_Cross.gif';
	}
}

var bupdatecontacts = false;
function checkupdatecontacts(){	
	var fcount = 0;	
	var reqcount = (4*document.memberupdateform.LastRealRecord.value);
	
	for (var i=0;i<(document.memberupdateform.LastRealRecord.value);i++){        
        if (document.getElementById("verName"+(i+1)).value!==''){
            fcount += 1;            
            document.getElementById("valName"+(i+1)).className='fieldname';
        }
        else {
            document.getElementById("valName"+(i+1)).className='fieldnamehighlight';
        }  
        
        if (document.getElementById("verkContactRespForID"+(i+1)).value!==''){
            fcount += 1;            
            document.getElementById("valkContactRespForID"+(i+1)).className='fieldname';
        }
        else {
            document.getElementById("valkContactRespForID"+(i+1)).className='fieldnamehighlight';
        }      
        
        if (isValidEmail(document.getElementById("verContactEmail"+(i+1)).value)){
            fcount += 1;            
            document.getElementById("valContactEmail"+(i+1)).className='fieldname';
        }
        else {
            document.getElementById("valContactEmail"+(i+1)).className='fieldnamehighlight';
        } 
        
        if (document.getElementById("verContactTel"+(i+1)).value!==''){
            fcount += 1;            
            document.getElementById("valContactTel"+(i+1)).className='fieldname';
        }
        else {
            document.getElementById("valContactTel"+(i+1)).className='fieldnamehighlight';
        } 
    }
		
	var orgcontactssicon = document.getElementById("OrgContactsIco");
	if (fcount==reqcount){
		bupdatecontacts = true;	
		orgcontactssicon.src='Images/JoinIcon_Tick.gif';
	}
	else {
	    bupdatecontacts = false;
		orgcontactssicon.src='Images/JoinIcon_Cross.gif';
	}
}

function checkupdateform(){
    var ftxt = '';
   
    if (bupdateorgdetails==false){
		ftxt += '\n- Please ensure you have entered all of your Organisation Details.';
	}	
	
	if (bupdatecontacts==false){
	    ftxt += '\n- Please ensure you have entered all of the Contact Information.';
	} 
    
    if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else{
		return true;
	}
}

function addContact(){
    document.memberupdateform.bAddContact.value='True';
    document.memberupdateform.submit();
}

function updateRegistration(){
    document.memberupdateform.bUpdateRegistration.value='True';
    document.memberupdateform.submit();
}

// Random Locations (All Pages)
function displayLocations(){
    var msgArr1 = new Array("Branston","Brewood","Uttoxeter","Shenstone");	
	var msgArr2 = new Array("Cannock","Norton Canes","Chasetown","Codsall");	
	var msgArr3 = new Array("Fazeley","Gailey","Burton Upon Trent","Hednesford");	
	var msgArr4 = new Array("Lichfield","Marchington","Penkridge");	
	var msgArr5 = new Array("Rugeley","Burntwood","Tamworth");
	var msgArr6 = new Array("Tutbury","Whittington","Brereton","Bridgtown");
	
	var locstring = msgArr1[Math.floor(Math.random()*msgArr1.length)] + ' / ' + msgArr2[Math.floor(Math.random()*msgArr2.length)] + ' / ' + msgArr3[Math.floor(Math.random()*msgArr3.length)] + ' / ' + msgArr4[Math.floor(Math.random()*msgArr4.length)] + ' / ' + msgArr5[Math.floor(Math.random()*msgArr5.length)] + ' / ' + msgArr6[Math.floor(Math.random()*msgArr6.length)] 
	var locstring = locstring.toLowerCase();
	
	document.write(locstring);
}

// Event Functions
function changeEventDelegates(feventid,fdelegates){
    // You cannot detract numbers from the event delegates selected!	
    document.eventform.ChangeCourseEventID.value=feventid;
    document.eventform.ChangeDelegateNumber.value=fdelegates;
	document.eventform.submit();
}

function checkeventsimplebooking(formnumber) {
    var ftxt = '';

    if (eval('document.eventform' + formnumber + '.Firstname.value') == '') {
        ftxt += '\n- Please enter your First Name.';
    }

    if (eval('document.eventform' + formnumber + '.Lastname.value') == '') {
        ftxt += '\n- Please enter your Last Name.';
    }

    if (eval('document.eventform' + formnumber + '.Company.value') == '') {
        ftxt += '\n- Please enter your Company.';
    }

    if (eval('document.eventform' + formnumber + '.Telephone.value') == '') {
        ftxt += '\n- Please enter your Telephone Number.';
    }

    if (isValidEmail(eval('document.eventform' + formnumber + '.EmailAddress.value'))==false) {
        ftxt += '\n- Please enter your Email Address.';
    }
	
	if (eval('document.eventform' + formnumber + '.Address.value') == '') {
        ftxt += '\n- Please enter your Address.';
    }
	
	if (eval('document.eventform' + formnumber + '.NatureofBusiness.value') == '') {
        ftxt += '\n- Please describe the Nature of your Business.';
    }

    if (ftxt !== '') {
        alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
        return false;
    }
    else {
        return true;
    }
}

/* Service Sub Navigation */
function showhidenavigation(){
    var servicelistcontainer = document.getElementById("servicelistcontainer");
    var navigationexpandlink = document.getElementById("navigationexpandlink");
    
    if (servicelistcontainer.style.display=='none'){
        servicelistcontainer.style.display='block';
        navigationexpandlink.innerHTML = 'Click here to hide navigation';
        navigationexpandlink.title = 'Click here to hide navigation';
    }
    else {
        servicelistcontainer.style.display='none';
        navigationexpandlink.innerHTML = 'Click here to show navigation';
        navigationexpandlink.title = 'Click here to show navigation';
    }
}

/* SucceSS Functions */
function checksuccesssignup(){
    var ftxt = '';
    
    if (document.signupform.Name.value==''){
        ftxt += '\n- Please enter your Name.';
    }
    
    if (document.signupform.JobTitle.value==''){
        ftxt += '\n- Please enter your Job Title.';
    }
    
    if (document.signupform.OccupationalCategory.value==''){
        ftxt += '\n- Please select your Occupational Category.';
    }
    
    if (document.signupform.ProfessionalQualifications.value==''){
        ftxt += '\n- Please specify your Professional Qualifications.';
    }
    
    if (document.signupform.SpecialistExperience.value==''){
        ftxt += '\n- Please specify your Specialist Experience.';
    }
    
    if (document.signupform.CompanyName.value==''){
        ftxt += '\n- Please enter your Company Name.';
    }
    
    if (document.signupform.BusinessAddress.value==''){
        ftxt += '\n- Please specify your Business Address.';
    }
    
    var btradestatus = false;
    for (var i=0;i<6;i++){
        if (document.signupform.TradingStatus[i].checked==true){
            btradestatus = true;
        }        
    }    
    
    if (btradestatus==false){
        ftxt += '\n- Please specify a Trading Status.';
    }
            
    if (isValidEmail(document.signupform.email.value)==false){
        ftxt += '\n- Please enter your Personal Email Address.';
    }
    
    if (document.signupform.DirectLine.value==''){
        ftxt += '\n- Please enter your Direct Line/Mobile Number.';
    }
    
    if (document.signupform.CareerOutlook.value==''){
        ftxt += '\n- Please specify your Career Outlook.';
    }
    
    var bexpectations = false;
    for (var i=0;i<3;i++){
        if (document.signupform.Expectations[i].checked==true){
            bexpectations = true;
        }
    }
    if (bexpectations==false){
        ftxt += '\n- Please select your Expectations of SucceSS.';
    }

    if (ftxt !== '') {
        alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
        return false;
    }
    else {
        return true;
    }
}

function checksuccessquick(){
    if (document.successquick.SectorID.value==''){
        alert('Please select an Industry Sector.');
        return false;
    }
    else {       
        document.successquick.submit();
    }
}

function checkdirectorysearchform(){
    if (document.directorysearchform.SectorID.value==''&&document.directorysearchform.Keywords.value==''){
        alert('Please select an Industry Sector or Enter your Keywords to search.');
        return false;
    }
    else {
        return true;
    }
}

function PrintMemberInfo() 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=750,height=600,left=100,top=25";    
   var winprint=window.open('PrintPage.asp?ID=searchpanel','Print',sOption);  
   winprint.focus(); 
}

function checkquestionform(usermode){
    var ftxt = '';

    if (usermode==false){
        if (document.postquestion.Name.value==''){
            ftxt += '\n- Please enter your Name.';
        }
        
        if (isValidEmail(document.postquestion.Email.value)==false){
            ftxt += '\n- Please enter your Email Address.';
        }
    }
    
    if (document.postquestion.SectionID.value==''){
        ftxt += '\n- Please select an Industry Sector.';
    }
    
    if (document.postquestion.Question.value==''){
        ftxt += '\n- Please enter a Question / Requirement.';
    }
    
    if (ftxt !== '') {
        alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
        return false;
    }
    else {
        return true;
    }
}

function checkselectvoucher(){
    var bvoucher = false;
    for (var i=0;i<document.voucherbuy.VoucherCount.value;i++){
        if (document.voucherbuy.Buy[i].checked==true){
            bvoucher = true;
        }
    }
    if (bvoucher==false){
        alert('Please select a Voucher Pack.');
        return false;
    }
    else {
        return true;
    }
}

function checkvoucherlogin(){
    var ftxt = '';
    
    if (isValidEmail(document.voucherlogin.EmailAddress.value)==false){
        ftxt += '\n- Please enter your Email Address.';
    }
    
    if (document.voucherlogin.Password.value==''){
        ftxt += '\n- Please enter your Password.';
    }
    
    if (ftxt !== '') {
        alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
        return false;
    }
    else {
        return true;
    }
}

function checkvoucherform(){
    var ftxt = '';

    if (ftxt !== '') {
        alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
        return false;
    }
    else {
        return true;
    }
}

function checksuccessupdateform(){
    var ftxt = '';
    
    if (document.updateform.ContactFirstName.value==''){
        ftxt += '\n- Please enter your First Name.';
    }
    
    if (document.updateform.ContactSurname.value==''){
        ftxt += '\n- Please enter your Surname.';
    }
    
    if (document.updateform.JobTitle.value==''){
        ftxt += '\n- Please enter a Job Title.';
    }
    
    var bcategory = false;
    for (var i=0;i<document.updateform.SectionCount.value;i++){
        if (document.updateform.SectorID[i].checked==true){
            bcategory = true;
        }
    }
    if (bcategory==false){
        ftxt += '\n- Please select at least one Occupational Category.';
    }
    
    if (document.updateform.Address1.value==''){
        ftxt += '\n- Please enter your Business Address 1.';
    }
    
    if (document.updateform.Town.value==''){
        ftxt += '\n- Please enter your Town.';
    }
    
    if (document.updateform.County.value==''){
        ftxt += '\n- Please enter your County.';
    }
    
    if (document.updateform.PostCode.value==''){
        ftxt += '\n- Please enter your Postcode.';
    }
    
    if (isValidEmail(document.updateform.ContactEmail.value)==false){
        ftxt += '\n- Please enter your Email Address.';
    }
    
    if (document.updateform.ContactTel.value==''){
        ftxt += '\n- Please enter your Direct Line/Mobile Number.';
    }
    
    if (document.updateform.DirQualifications.value==''){
        ftxt += '\n- Please enter your Professional Qualifications.';
    }
    
    if (document.updateform.DirSpecialistIn.value==''){
        ftxt += '\n- Please enter your Specialist Experience.';
    }
    
    if (document.updateform.DirCareerOutlook.value==''){
        ftxt += '\n- Please enter your Career Outlook.';
    }
    if (document.updateform.IsExtended.value){
        if (document.updateform.DirCompanyInformation.value==''){
            ftxt += '\n- Please enter your Company Information.';
        }
    }
    
    if (ftxt !== '') {
        alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
        return false;
    }
    else {
        return true;
    }
}

function confirmMembershipUpgrade(submitstring,vouchertotal){
    if (confirm('Are you sure you want to upgrade your membership? This will cost you a total of ' + vouchertotal + ' SucceSS vouchers.')){
        location.href=submitstring;
    }
}

function confirmDirectoryUpgrade(submitstring,vouchertotal){
    if (confirm('Are you sure you want to upgrade your directory type? This will cost you a total of ' + vouchertotal + ' SucceSS vouchers.')){
        location.href=submitstring;
    }
}

function confirmDownloadDelete(submitstring){
    if (confirm('Are you sure you want to delete this download?')){
        location.href=submitstring;
    }
}

function confirmLinkDelete(submitstring){
    if (confirm('Are you sure you want to delete this link?')){
        location.href=submitstring;
    }
}

function closeExtended(){
    document.getElementById("sextended").style.display='none';
}

function openExtended(){
    document.getElementById("sextended").style.display='block';
}

function confirmSuccessLogout(){
    if (confirm('Are you sure you want to logout?')){
        location.href='success.asp?Logout=True'
    }
}

function textCounter(field,cntfield,maxlimit) {
    if (field.value.length > maxlimit) // if too long...trim it!
    field.value = field.value.substring(0, maxlimit);
    // otherwise, update 'characters left' counter
    else
    cntfield.value = maxlimit - field.value.length;
}

function confirmDeleteLogo(submitstring){
    if (confirm('Are you sure you want to delete this logo from your profile?')){
        location.href=submitstring;
    }
}

function confirmDeletePhoto(submitstring){
    if (confirm('Are you sure you want to delete this photo from your profile?')){
        location.href=submitstring;
    }
}