	var IntTime = 9000;
	var clubname=getCookie('F4lessClub');
			//var Clubs = ["Birmingham","Bristol"];
			// Must Keep In Order
			var Clubs = [];
			Clubs[0] = 'Bristol';
			Clubs[1] = 'Birmingham';
			Clubs[2] = 'Watford';
			
			var HTML = '';
			var SELECTi = '<span id="ClubStatusBar">:&nbsp;<select id="ChooseClub" name="ChooseClub" onchange="DropChangeClub();">';
			SELECTi += '<option value="">Please select</option>';
		var arLen=Clubs.length;
		
		for ( var i=0, len=arLen; i<len; ++i ){
			//SELECTi +=  '<option value="' + Clubs[i] + '"'+ SelectedClub + '>' + Clubs[i] + '</option>';
			SELECTi +=  '<option value="' + Clubs[i] + '">' + Clubs[i] + '</option>';
		}
		
		SELECTi +=  '</select></span>';
		
		var SetId = '#club_log_box';
				
		if (clubname!=null && clubname!="") {
			//alert("Loggin in as " + clubname);
			HTML = 'You are logged into' + SELECTi + ' Club';
  				$(document).ready(function(){
				 $(SetId).empty().append(HTML);
 
				});	
				FindIndex(clubname);
		  } else {
			HTML = 'Please select your club:' + SELECTi;
  				$(document).ready(function(){
				 $(SetId).empty().append(HTML);
				});	

		  }
		  
	function DropChangeClub()
	{
	  var DClub = document.getElementById('ChooseClub').value;
	  if (DClub !== "") {
	  	ClickSelectClub(DClub);
	  }
	}
		  
	function DisplayDiv(id)
	{			
		id = '#'+id;
		$(document).ready(function(){
 
     		$(id).show("slow");
 
 });

	}
	function MailLink(rec, domain, style, id, image)
	{
		var EmailAddr = rec + '@' + domain;
		id = '#'+id;
		if (image === 'Image')
		{			
			location.href="mailto:" + EmailAddr;
		} else {
			
		
			id = '#'+id;
			var Mail = '<a class="' + style + '" href="mailto:' + EmailAddr + '">' + EmailAddr + '</a>';
			$(document).ready(function(){
    			$(id).append(Mail);
  				});
		}
	}
	function CookieExpiration(ExpLength)
	{
		var Weekday_array = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
		var Month_array = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
		var CookieExp = 'Fri, 31 Dec 2010 23:59:59 GMT';
		var now = new Date();
		var This_Year = now.getFullYear();
		var This_Hours = now.getHours()+1 + parseFloat(ExpLength);
		var CookieExpShow = Weekday_array[now.getDay()] + ', ' + now.getDate() + ' ' + Month_array[now.getMonth()] + ' ' + This_Year + ' ' + This_Hours + ':' + now.getMinutes() + ':00 GMT';
		return CookieExpShow;
	}
	function FormLogin() 
	{
				
				//var FormData = $("#MemberZoneForm").serialize() + '&MemberID=' + $("#MembershipNo").val();
				//alert(FormData);
				//return false;
				$.post("http://www.fitness4less.co.uk/MemberZone/MemberFunctions.php", { EmailAddress: $("#EmailAddress").val() , MemberID: $("#MembershipNo").val(), club: $("#club").val() }, function(data){
				data = jQuery.trim(data);
				if (data !== "OK") {
					alert("Cannot login with these details. Please try again");
				} else {
					$("#LoginStatusBar").empty().append("<em>Logged in. Please wait<\/em>");
					$("#LoginStatusBar").css("background-color","#F68422");

					var CookieName = 'F4LMember';
					var ClubName = document.getElementById('club').value;
					//location.reload();
					var CookieExpiryTime = CookieExpiration('1');
					SetCookie(CookieName,CookieExpiryTime,ClubName);
					//Set Memberid cookie
					var MembersID = document.getElementById('MembershipNo').value;
					SetCookie('MemberID',CookieExpiryTime,MembersID);
					// Check if this is first visit

					var t=setTimeout("window.location = 'MemberZone.php'",1200)
				}
		   });

	}
	function ClubSelector()
	{
		// Check for cookie	
		clubname=getCookie('F4lessClub');
		if (clubname!=null && clubname!="")
		  {
		  document.write('You are currently logged on to join our :');
		  }
		else
		  {
		  document.write('Please select your club :');
		  }
	}

/* CLUB DROP DOWN */	

	function SetJoiningFee()
	{
  
		if (document.getElementById("joiningfee") != null) 	{
			if ($('#ClubSelect').val() === 'Watford') {
			$("#joiningfee").empty().append("39");
			} else {
			$("#joiningfee").empty().append("33");	
			}
		} 
	}
		function ClubDropDownODL(SelectID,ElementID)
	{
		//var Clubs = ["Birmingham","Bristol"]; Already global
		var SelectedClub;
		var ClubCookie = getCookie('F4lessClub');
		var HTML = '<select id="'+SelectID+'" name="'+SelectID+'")>';
		HTML += '<option value="">Please select<\/option>';
		var arLen=Clubs.length;
		
		for ( var i=0, len=arLen; i<len; ++i ){
			HTML += '<option value="' + Clubs[i] + '"'+ SelectedClub + '>' + Clubs[i] + '<\/option>';
		}
		
		HTML += '<\/select>';
		var SetId = '#'+ElementID;
				$(document).ready(function(){
				 $(SetId).empty().append(HTML);
				 document.getElementById(SelectID).value=ClubCookie;
				});	
	}


	function ClubDropDown(SelectID,ElementID)
	{
		//var Clubs = ["Birmingham","Bristol"]; Already global
		var SelectedClub;
		var ClubCookie = getCookie('F4lessClub');
		var HTML = '<select id="'+SelectID+'" name="'+SelectID+'" onchange="SetJoiningFee();")>';
		HTML += '<option value="">Please select</option>';
		var arLen=Clubs.length;
		
		for ( var i=0, len=arLen; i<len; ++i ){
			HTML += '<option value="' + Clubs[i] + '"'+ SelectedClub + '>' + Clubs[i] + '</option>';
		}
		
		HTML += '</select>';
		var SetId = '#'+ElementID;
				$(document).ready(function(){
				 $(SetId).empty().append(HTML);
				 document.getElementById(SelectID).value=ClubCookie;
				});	
	}

/* GET COOKIE */

	function getCookie(c_name)
	{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
		{
		c_start=c_start + c_name.length+1;
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		}
	  }
	return "";
	}

/* CHECK MEDICAL */

	function CheckMedical() 
	{
	
		var count = 0;
		var elt = "";
		var theItem = "";
		var result;
		
		for (var i=1; i<=10; i++) {
			theItem = "qs" + i;
			elt = "document.forms['check']" + "." + theItem + "[0]" + ".checked";
			elt2 = "document.forms['check']" + "." + theItem + "[1]" + ".checked";
			result = eval(elt);
				
				if (result === false) {
					if (eval(elt2) === true) {
						count++;
					}
				} else {
					window.location='sorry.html';
					return false;
				}
			}
			if (count < 10) {
			alert ("Please answer all questions.");
			return false;
		
			} else {
			window.location='https://fitness4less.co.uk/join_step2.html?medical=yes';
			return false;
			}
	}

/* JQUERY HIDE */
	function HideElement(id) 
	{
		id = "#"+id;
		$("#di").hide();
		$("#ku").hide();
	}

/* CHECK MEMBERSHIP */

	function CheckMembershipForm() 
	{
		var obj = document.forms.membership;
		
		/* Email validation */
		var ValidEmail = /^[\w_\.\-]+?@[A-Za-z0-9\-\.]{2,}?\.((\w{2})|(aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel))$/;
		if (obj.email.value.search(ValidEmail)==-1) {
			alert("A valid email address is compulsory for Fitness4less membership.");
			return false;
		
		}
		
		if (obj.email.value != obj.emailconfirmation.value) {
			alert("These email addresses do not match. Please re-enter your email address.");
			return false;
		}
		
		/* Over 18 Consent */
		sm = obj.dob_month.value;
		sy = obj.dob_year.value;
		sd = obj.dob_day.value;
		 
		if ((sy >= 1991) && (sm >= 10) && (sd > 9)) {
		document.getElementById('under18').style.visibility = 'visible';
			if (obj.agree18.checked === false) {
				alert("You must have parental consent to join Fitness4less");
				return false;
			}
		}
		/* Address Error */
		if (obj.town.value == "undefined") {
		alert("Sorry, we cannot process your address.\nPlease try address lookup, or manually enter your address.");
		return false;
		}
	
		/* Club Type */
		if (obj.ClubSelect.value == "") {
		alert("Please choose a Fitness4less club.");
		obj.ClubSelect.focus();
		return false;
		}
		
		/* Accept Terms & Conditions */
		if (obj.acceptterms.checked === false) {
		alert("Please tick the box to confirm to you agree with Fitness4less Terms and Conditions of membership.");
		obj.acceptterms.focus();
		return false;
		}
	
		/* Membership Type */
		if (obj.membertype.value == "") {
		alert("Please choose a membership type.");
	
		return false;
		}
		 
		for(var i=0; i<obj.elements.length; i++)
			{ 	if ((obj.elements[i].value == "") && (obj.elements[i] != "lookup")) {
					if (obj.elements[i].name == "house_number") {
						alert("Please enter house number or use address lookup.");
						//Show Address Form
						$('#address').show("slow");
					} else {
						obj.elements[i].focus(); 
						obj.elements[i].className='errorfield';
						alert("Please complete all sections of the form. "); // + obj.elements[i].name);
					}
				return false;
				} 	
			}
		 var ValidChars = "0123456789.+-";
		 var Char;
		 var IsNumber=true;
		 
		 for (i = 0; i < obj.telephone.value.length && IsNumber == true; i++) 
			  { 
			  Char = obj.telephone.value.charAt(i); 
			  if (ValidChars.indexOf(Char) == -1) {
				 IsNumber = false;
				 alert("Please check telephone number contains no letters");
				 obj.telephone.focus();
				 obj.telephone.className='errorfield';
				 return false;
				 }
		}	
		return true;
	}
	
/* GET ADDRESS FUNCTION */

	function getaddress() 
	{
		var id = 'lookup';
		var ref = document.udpform.street_name.value;
		var url = 'scripts/get_address.php?udp=' + ref;
		
		$.get(url, function(data){
 		 //alert(data);
		 	
		var addr_array=data.split("^");
		
		// Check if any error thrown:
		var FirstLine = addr_array[0];
		var err = 'Undefined'; //'<br /> <b>Notice</b>:';
		var AddChk = FirstLine.indexOf(err);
		if (AddChk != '-1') {
			FirstLine = 'N/A';
		}
				document.forms.membership.house_number.value = FirstLine;
				document.forms.membership.StreetName.value = addr_array[1];
				document.forms.membership.town.value = addr_array[2];
				document.forms.membership.county.value = addr_array[3];
		});

	}

/* DISPLAY FUNCTION */
	function display(id,status) 
	{
		obj = document.getElementById(id);
		obj.style.display = status;
	}

	$(document).ready(function(){
    
    $("#LookUpClose").click(function () {
      $("#lookup").hide("slow");
    });
	return false;
  });

/* SHOW FORM FUNCTION */
	function showform() 
	{
		var postcode = document.membership.post_code.value;
		if (postcode === '') {
			alert("Please enter a post code.");
			return false;
		}
		var url = 'scripts/get_postcode.php?postcode=' + postcode;
		
		$(document).ready(function(){
       	$('#lookup').show("slow");
		$.get(url, function(data){
 		 
		 $('#PostCodeResults').empty().append(data);
		});

   	});
//		processajax(id,url);
	}
	
	function ClickSelectClub(ClubName) 
	{
		 var date = new Date();
		 var name = 'F4lessClub';
		 var Expiry = "not set";
		 var clubcookie=getCookie(name);
		 if (clubcookie!=null && clubcookie!="")
		  {
		  	DeleteCookie(name);
		  }	
		 
		var CookieExpiryTime = ReturnTime(ClubName);
		SetCookie(name,CookieExpiryTime,ClubName);
		ClubDropDown('ChooseClub','ClubStatusBar');
	}
	
	function ReturnTime(ClubName)
	{
				url = 'scripts/SetClub.php';
		
			$.get(url, { club: ClubName }, function(data){
			 return data;
   		});
	
	}
	
	function SetCookie(CookieName,Expiry,Value)
	{
		document.cookie = CookieName+"="+Value+"; expires="+Expiry+"; domain=www.fitness4less.co.uk; path=/";
	}
	function DeleteCookie(CookieName)
	{
		//document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
	}
	
	function PayPal()
	{
		url = window.location.href;
		url = url.replace(/join_step_3.html/, "paypal.html");
		url = url.replace(/#/, "");
		window.location= url;
		
	}
	function Sage() 
	{
		url = window.location.href;
		url = url.replace(/join_step_3.html/, "sagepay.html");
		url = url.replace(/#/, "");
		//alert(url);
		window.location= url;
	}
	
	function FillSageForm()
	{
		
		var test = 'http://www.fitness4less.co.uk/live/sagepay.html?session=F4Lessf031ddae6a02920441f0bc0adc4c1052&osm=f5f77lf7nnn4';
		var url = 'scripts/SageForm.php?' + GetUrlData();
		
		$.get(url, function(data){
		
		var sage_array=data.split("^");
		if (sage_array[0] > 3600) {
		 	alert("Your session has now timed out. Please start the registration process again.");	
		} else {
			document.forms.SagePayForm.cardholder.value = sage_array[1];
			document.forms.SagePayForm.billingaddress.value = sage_array[2].replace(',',',\n');
			document.forms.SagePayForm.postcode.value = sage_array[3];
			document.forms.SagePayForm.MemberID.value = sage_array[4];
			document.forms.SagePayForm.membertype.value = sage_array[5];
			
			var urlquery = location.href.split("?");
			
			var GetBits = urlquery[1].split("&")
			
			var sessionF = GetBits[0].split("=");
			var osmF = GetBits[1].split("=");
			document.forms.SagePayForm.session.value = sessionF[1];
			document.forms.SagePayForm.osm.value = osmF[1];
			
			}
		});
		// Check for Errors in SagePay.php
		var ErrorsChk = document.forms.SagePayForm.ErrorMsg.value;
		if (ErrorsChk !== '') {
			var ErrorAr = ErrorsChk.split("^");
			var ErStatus = ErrorAr[1].replace(/^\s+|\s+$/g,'');

			/* June 10th */
			if (ErrorAr[0] === ' The VendorTxCode has been used before.  All VendorTxCodes should be unique.')
			{
				var FillDDForm = '<div style="padding:10px; color:#6E6E70; font-weight:bold">Your payment has been successfully taken';
				var MemberShipType = $('#membertype').val(); 
				if (MemberShipType === '4') { 
					FillDDForm += ', however you have not been automatically directed to the next portion of the setup.<p>';	
					FillDDForm += 'Please	click <a href="http://www.fitness4less.co.uk/DirectDebit_Timeout.html">HERE</a> to complete you membership';
				} else {
					FillDDForm += ' and your membership is now complete.';
				}
			$("#news_box_4").empty().append(FillDDForm+'</div>');
	
			} else {
				alert(ErrorAr[0]);
			}
			
			switch(ErStatus) {
				
				case "cardholder":
				document.forms.SagePayForm.cardholder.focus();
				document.forms.SagePayForm.cardholder.style.border = '2px solid red';
				break;
				
				case "cardnumber":
				document.forms.SagePayForm.cardnumber.focus();
				document.forms.SagePayForm.cardnumber.style.border = '2px solid red';
				break;
				
				case "cardsecuritycode":
				document.forms.SagePayForm.cardsecuritycode.focus();
				document.forms.SagePayForm.cardsecuritycode.style.border = '2px solid red';
				break;
				
				case "cardtype":
				document.forms.SagePayForm.cardtype.focus();
				document.forms.SagePayForm.cardtype.style.border = '2px solid red';
				break;
				
				case "expirymonth":
				document.forms.SagePayForm.expirymonth.focus();
				document.forms.SagePayForm.expirymonth.style.border = '2px solid red';
				break;
				
				case "expiryyear":
				document.forms.SagePayForm.expiryyear.focus();
				document.forms.SagePayForm.expiryyear.style.border = '2px solid red';
				break;
				
				case "validfrommonth":
				document.forms.SagePayForm.validfrommonth.focus();
				document.forms.SagePayForm.validfrommonth.style.border = '2px solid red';
				break;
				
				case "issuenumber":
				document.forms.SagePayForm.issuenumber.focus();
				document.forms.SagePayForm.issuenumber.style.border = '2px solid red';
				break;
				
				default:
					//alert("Error");
				break;
			}
		}
	}
	
	function SageSubmit()
	{
		$("#SageButton").attr("src","images/JoiningFeeWaiting.gif");
		document.forms.SagePayForm.submit();
	}
	
	function GetUrlData()
	{
	//iForm = new Array();
		var CheckURL= location.href.indexOf('?');
			
		if(CheckURL  === -1) {
			alert("Sorry your session has timed out.\nPlease start registration again.");
			return false;
		}
		urlquery=location.href.split("?");
		test = urlquery[1].split("&");
		
		for (var x in test)
		{
	
			var Griffin = test[x];
			
			var GetVal1 = 'jo';
			var GetVal2 = 'matty';
			
			var param1 = Griffin.indexOf(GetVal1);
			var param2 = Griffin.indexOf(GetVal2);
			
			if( param1 > -1) {
			  
			  UrlData = Griffin.split("=");
			  GetVal1 = UrlData[1]
			  alert(GetVal1);
			} 
			else if (param2 > -1) {
			  UrlData = Griffin.split("=");
			  GetVal2 = UrlData[1].replace('#','');
			  alert(GetVal2);
			}

		}
		var returnStr = urlquery[1].replace('#','');
		//GetVal1 + '^' + GetVal2;
		// 
		return returnStr;
		
	}
	
	function Timetables()
	{
	 // Check if club selected	
	 	clubname=getCookie('F4lessClub');
		
		if (clubname!=null && clubname!="")
		  {
		  var url = clubname + '-timetable.html';
		  window.location = url;
		  }
		else
		  {
		  	$(document).ready(function(){
    			$("#TSelect").show("slow");
			});
		  }

	}
    function ShowClubsButtons(page,id)
	{
     var SetId = '#' + id;
	 // Check if club selected	
	 	clubname=getCookie('F4lessClub');
		
		if (clubname!=null && clubname!="")
		  {
		  var url = clubname + page;
		  window.location = url;
		  }
		else
		  {
		  	$(document).ready(function(){
    			$(SetId).show("slow");
			});
		  }

	}
	
	function fullescape(txt) 
	{
		jschars = Array(':','<','/','>',',','dddd','=','"','!','&',';','\'','@','');
		phpchars = Array('%3A','%3C','%2F','%3E','%2C','%E2','%3D','%22','%21','%26','%3B','%5C%27','%40','');
	
		for (i=0;i<jschars.length-1;i++) 
			{
				eval("txt = txt.replace(/"+ phpchars[i] + "/g,jschars[i])");
			}
	
	return txt;
	
	}
	
	function Reveal(id)
	{
    ResetOrange()
	var RightText = '<img width="480" height="60" src="images/sub_menu_faqs_22.jpg"/><img width="480" height="340" src="images/main_top_right_box_faqs_23.jpg"/>';
	$('#top_right_box').empty().append(RightText);
	
	var TopR = document.getElementById('top_right_box');
	TopR.style.width = '480px';
	TopR.style.height = '400px';		
	TopR.style.padding = '0px 0px 0px 0px';
	
	var divlist = new Array();
	
	divlist[0] = 'beforeyouj'
	divlist[1] = 'payingfory'
	divlist[2] = 'planningyo'
	divlist[3] = 'onceyourea'
	divlist[4] = 'youronline'
	divlist[5] = 'leavingthe'
	//var MaxCount = divlist.length - 1;
 	
	obj = document.getElementById(id);
	
	for(i=0;i<divlist.length;i++)
	{
		
		if (id !== divlist[i]) {
		//alert(id + " " +i);
		id2 = divlist[i];
		ChangeIDx = 'Click_'+ divlist[i];
		obj2 = document.getElementById(id2);
		obj2.style.display = 'none';
		document.getElementById(ChangeIDx).style.height = '50px';
		}
	}

var ChangeID = 'Click_' + id;
	 var TheID = '#'+id
	 
	 document.getElementById(ChangeID).style.height = '30px';
	 $(document).ready(function(){
	 
	 $(TheID).show("slow");
		});	
	}
	
	function ClubGallery(SetClub,SetDir) {
		var NumImages = 8;
		var DisplayImages = 8;
		var DisplayBoxes=4;
		/* Birmingham Extra Images */
		if (SetClub === 'Birmingham') {
			NumImages = 8;
			DisplayImages = 8;	
		}
		
		var ImgIndex;
		
		if (SetDir === 'GoLeft')
		{
			ImgIndex = Math.ceil(document.getElementById('ImageCount').value) + 1;
		} else {
			ImgIndex = Math.ceil(document.getElementById('ImageCount').value) - 1;
		}
				
		if (ImgIndex > NumImages) {
			ImgIndex = 0;
		}
		
		if (ImgIndex < 0) {
			ImgIndex = NumImages;
		}
		
		document.getElementById('ImageCount').value = ImgIndex;
		
		var ImageArray = [];
		var ImgHeight = [];
		var ImgDir = 'images/' + SetClub + '/';
		
		switch (SetClub) {
		case "Bristol":
		ImageArray[0] = 'F4L_BRISTOL128.jpg'; // Facade
		ImgHeight[0] = '400';

		// Treadmills
		ImageArray[1] = 'F4L_BRISTOL017.jpg';  //'ladies_gym_cv.jpg';
		ImgHeight[1] = '400';
		
		// Gym Equipment
		ImageArray[2] = 'F4L_BRISTOL048.jpg'; //FitnessClass.jpg';
		ImgHeight[2] = '402'; // width = '602';
		
		ImageArray[3] = 'F4L_BRISTOL071.jpg'; // Powerzone
		ImgHeight[3] = '402'; // width = '';
		
		ImageArray[4] = 'F4L_BRISTOL082.jpg'; // Beefcakes
		ImgHeight[4] = '400'; // width = '';
		
		ImageArray[5] = 'F4L_BRISTOL103.jpg'; // Class
		ImgHeight[5] = '400'; // width = '';
		
		ImageArray[6] = 'F4L_BRISTOL100.jpg'; // Reception
		ImgHeight[6] = '400';
		
		ImageArray[7] = 'F4L_BRISTOL094.jpg'; // Box
		ImgHeight[7] = '400';
		
		ImageArray[8] = 'Studio.jpg';
		ImgHeight[8] = '400';

		break;
		
		case "Birmingham":

		ImageArray[0] = 'F4L_BIRMINHAM025.jpg';
		ImgHeight[0] = '400';

		ImageArray[1] = 'F4L_BIRMINHAM054.jpg'; // treadmills
		ImgHeight[1] = '400';
				
		ImageArray[2] = 'F4L_BIRMINHAM123.jpg'; // Studio
		ImgHeight[2] = '400'; // width = '602';
		
		ImageArray[3] = 'F4L_BIRMINHAM035.jpg'; // more treamills
		ImgHeight[3] = '400';
		
		ImageArray[4] = 'F4L_BIRMINHAM128.jpg'; // Cubicles
		ImgHeight[4] = '400';
		
		ImageArray[5] = 'F4L_BIRMINHAM111.jpg'; // Changing Room
		ImgHeight[5] = '400';
		
		ImageArray[6] = 'F4L_BIRMINHAM103.jpg'; // Bench
		ImgHeight[6] = '400'; 
		
		ImageArray[7] = 'F4L_BIRMINHAM092.jpg'; // More weights
		ImgHeight[7] = '400'; 
		
		ImageArray[8] = 'F4L_BIRMINHAM032.jpg'; // Gym
		ImgHeight[8] = '400';
		break;		
		}
		
		obj = document.getElementById('MainImage');
		obj.src = ImgDir + ImageArray[ImgIndex];

		for (var x=1; x<=DisplayImages; x++) {
		var InnerCount = x-1;	
		var NewImgIndex = ImgIndex + InnerCount;
		if (NewImgIndex < 0) {
			NewImgIndex = NewImgIndex + (DisplayImages + 1);
		}
		if (NewImgIndex > DisplayImages) {
			NewImgIndex = NewImgIndex - (DisplayImages + 1);
		}

			var id2 = 'Viewer' + x;
			if (document.getElementById(id2)) {
			var obj2 = document.getElementById(id2);
			obj2.src = ImgDir + 'thumbs/' + ImageArray[NewImgIndex];
			}
		}
		
		var TopPadding = Math.ceil((350 - ImgHeight[1])/2 + 50);
		//alert("Padding: " + TopPadding);
		obj.style.paddingtop = TopPadding+'px';
	}
	
	function ResetOrange()
	{
	//alert('Reset');
	$(".whitelink").css("color","#58585a");
	}
	
	function DisplayAnswer(Answer)
	{
		Answer = '<div id="AnswersBox">' + fullescape(Answer) + '</div>';
		$('#top_right_box').empty().append(Answer);
		
		var obj = document.getElementById('top_right_box');
		obj.style.backgroundImage = 'url(images/AnswersBack.gif)';
		obj.style.width = '450px';
		obj.style.height = '300px';		
		obj.style.padding = '100px 0px 0px 30px';
		
	}
	
	function FindIndex(Club) {
		var SelectID = '';
		
		$(document).ready(function(){
		if ($('#ChooseClub').length != 0) {
			SelectID = 'ChooseClub';
		}
		else if ($('#ClubSelect').length != 0) {
			SelectID = 'ClubSelect';
		}
		
		if (SelectID !== '') {
			for (var i=0; i <= document.getElementById(SelectID).options.length - 1; i++)
			{
				 var ShowVal = document.getElementById(SelectID).options[i].value
				
				if (Club === Clubs[i]) {
					document.getElementById(SelectID).selectedIndex = i +1;
					break;
				}
			}
		} });
	}
	
	function DropDownJobs() {
		var Jobs = [];
		
		Jobs[0] = 'Full Time Education';
		Jobs[1] = 'Unemployed';
		Jobs[2] = 'General Management';
		Jobs[3] = 'Office &amp; Admin';
		Jobs[4] = 'Media';
		Jobs[5] = 'Retail';
		Jobs[6] = 'Transportation';
		Jobs[7] = 'Education &amp; Training';
		Jobs[8] = 'Health Care &amp; Community';
		Jobs[9] = 'Manufacturing';
		Jobs[10] = 'Legal &amp; Financial';
		Jobs[11] = 'IT &amp; Telecoms';
		Jobs[12] = 'Building &amp; Construction';
		Jobs[13] = 'Arts &amp; Entertainment';	
		
//		Jobs.sort(randOrd);
		var arLen=Jobs.length;
		var DropDownHTML = '<select id="Occupation" name="Occupation"><option value="">Please Select</option>';
		for ( var i=0, len=arLen; i<len; ++i ){
			DropDownHTML += '<option value="'+i+'">'+Jobs[i]+'</option>';
		}
		DropDownHTML += '</select>';
		
		$(document).ready(function(){
				$('#OccupationDD').empty().append(DropDownHTML);
			});
		
	}
	
	function ShowQuotes(id) {
		var Quotes = [];
		Quotes[0] = 'I like its location and value for money. Overall, I loved fitness for less and would certainly recommend it to my friends.';
		Quotes[1] = 'What I like is how cheap it is, I like The Powerzone area and the classes being free ';
		Quotes[2] = 'The quality, despite the low cost it is an excellent gym';
		Quotes[3] = 'I normally hate gyms, but really enjoyed working out in the girls only gym. I also loved the cool room, I didn&rsquo;t feel self conscious at all in this room!';
		Quotes[4] = 'It&rsquo;s excellent value for money, close to work and very friendly. It&rsquo;s very convenient and good value for money and you never really had to wait around to use the equipment.';
		Quotes[5] = 'Value for money, good equipment, nice to have variety of rooms';
		Quotes[6] = 'The low membership fee. No Contract. Location.';
		Quotes[7] = 'Excellent price and very good facilities';
		Quotes[8] = 'The place is very big and I liked the fact that it had lots of space and areas to work in';
		
		var arLen=Quotes.length;
		var num = Math.floor((Math.random() * arLen));
		var Image1 = 'url(images/home_news_quotes5.gif)';
		var Image2 = 'url(images/home_news_quotes4.gif)';
		
		
		if (id === 'news_box_3') {
			Image1 = 'url(images/Christmas09/Box3.gif)';
			Image2 = 'url(images/ClubTour_news3.gif)';
		
		}

		var obj = document.getElementById(id);
		//$('#'+obj).css({display:'none'}); 
		
		if ((num % 3) === 0 ) {
				obj.style.backgroundImage = Image1;
			} else {
				obj.style.backgroundImage = Image2;
			}
		
		//var IntTime = 10000;
		
		
		var QuoteHTML = Quotes[num];
		
			$(document).ready(function(id){
				$('#QuoteBox').empty().append(QuoteHTML);
			});
		var TestFunc = function() { ShowQuotes(id); }
		var t = setTimeout(TestFunc,IntTime);
	}

	function randOrd()
	{
	return (Math.round(Math.random())-0.5); 
	}

	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	function MM_goToURL() { //v3.0
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}
	function NewClubSelection()
	{
	if ($('#ClubsPopUpBox').length) { // implies *not* zero
    $("#ClubsPopUpBox").remove();
  	} else {
		//$("div#menu_item8").mouseover(function(){
		var clubsHTML = '<div id="ClubsPopUpBox" style="position:absolute; width:186px; height:149px; top:-100px; left:40px; background-image:url(images/Bristol/clubsPopUp2.png); background-repeat: no-repeat; z-index:10000;"> \
		<div style="padding:30px 0px 0px 24px; width:148px; height:60px;"> \
		<div style="clear:both; width:148px; height:30px; padding:0px;"><a href="http://www.fitness4less.co.uk/Bristol_Club.html" onclick="ClickSelectClub(\'Bristol\');"><img src="images/Home_Bristol.gif" alt="Bristol Club" width="144" height="28" border="0"  /></a></div> \
		<div style="clear:both; width:148px; height:30px; padding:0px;"><a href="http://www.fitness4less.co.uk/Birmingham_Club.html" onclick="ClickSelectClub(\'Birmingham\');"><img src="images/Home_Birmingham.gif" alt="Birmingham Club" width="144" height="28"  /></a></div> \
		</div></div>';
			$(document).ready(function(){
				//$('div#menu_item8').append(clubsHTML);
				//$('div#top_right_box').append(clubsHTML);
			});
		}
	}