	var origcolor = "";
	var validate_list = new Array();
	
	function setup(){
		var stretchers = document.getElementsByClassName('stretcher'); //div that stretches
		var toggles = document.getElementsByClassName('stretchtoggle'); //h3s where I click on

		var pageswithsubnav = new Array("/_pages/_navpages/services.shtml");

		for(var x=0;x<pageswithsubnav.length;x++){

			var address = location.href;
			address = address.replace(/[^_]*/,'/');

			//alert(pageswithsubnav[x]+'?menu=open'+": "+(pageswithsubnav[x]+'?menu=open' == address));
			if(pageswithsubnav[x] == address){
				var myAccordion = new fx.Accordion(
					toggles, stretchers, {opacity: true, duration: 400}
				);
				stretchers[0].style.display = 'block';					//unhide accordion
				myAccordion.showThisHideOpen(stretchers[0]);		//open accordion
			}
		}
	}

	function break_url(){
		var s = location.href;
		s = s.split("?");
		if(s[1]){
			var params = s[1].split("&");
			for(var x=0; x<=params.length-1; x++){
				var s1 = params[x].split("=");
				//alert(s1[0] + " " + s1[1]);
				if(s1[0]=="fp"){
					if(s1[1]) toggle_forgotten_pass();
				}else{
					var obj = document.getElementById(s1[0]);
					if(obj) obj.value = s1[1];
				}
			}
		}
		return -1;
	}
	
	var detect = navigator.userAgent.toLowerCase();
	//alert(detect);
	var OS,browser,version,total,thestring;

	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (checkIt('firefox')) browser = "Firefox"
	else if (!checkIt('compatible'))
	{
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";

	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS = "an unknown operating system";
	}

	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}

	function dyn_build_button(classprefix,overlay,btnfilename,functioncall,offset,alttxt,target){ 
		//alert("browser: "+browser+"  | OS: "+OS);
		var targetTxt = "";
		if(target == 1)  targetTxt = " target='_blank'";
		if((OS == 'Windows' && (browser == 'Firefox' || browser == 'Internet Explorer'))||(OS == 'Mac' && (browser == 'Firefox'))){
			document.write ("<div class='"+classprefix+"_shadow' style='left:"+offset+"px;'>");
			if(overlay) document.write ("<div class='btn_owl_overlay'></div>");
			document.write ("<A HREF=\""+functioncall+"\" class='"+classprefix+"_btn' "+targetTxt+"><IMG SRC='"+btnfilename+"' BORDER='0' alt='"+alttxt+"' title='"+alttxt+"'></A>");
		}else{
			document.write ("<div class='"+classprefix+"_shadow' style='left:"+offset+"px;'>");
			document.write ("<A HREF=\""+functioncall+"\""+targetTxt+"><IMG SRC='"+btnfilename+"' BORDER='0' alt='"+alttxt+"' title='"+alttxt+"'></A>");
		}
		document.write ("</div>");
	}

	function result_toggle(value,chkval,id){
		var obj = document.getElementById(id);
		//alert(value +' = '+ chkval);
		if(obj){
			obj.style.display = (value == chkval)?'block':'none';
		}
	}

	function UpdateMultiSelect(id,copyid){
		var sObj = document.getElementById(id);
		var cObj = document.getElementById(copyid);
		var values = "";
		if(sObj && cObj){
			var opts = sObj.options;
			for(var x=0;x<=opts.length-1;x++){
				if(opts[x].selected){
					values += ((values == '')?'':',') + opts[x].value;
				}
			}
			//alert("Value: "+values);
			values = values.replace(/\-1,/g,'');
			cObj.value = values;
		}
	}

	function truncate(s,x){
		var out = '';
		var y = 0;
		var z = 0;
		var nobreak = 0;
		var c = '';
		if(x >= s.length){
			return s;
		}
		while ((y < x) && (z < s.length)){
			c = s.charAt(z);
			if(c == '&') nobreak = 1;
			if((c == ';') && (nobreak)) nobreak = 0;
			if(c == '<') nobreak = 1;
			if((c == '>') && (nobreak)) nobreak = 0;
			if(!nobreak) y++;
			z++;
			out += c;
		}
		if(c == '.') return out + '..';
		return out + '...';
	}

	function multi_layer_switcher(id,tabObj){
		var obj1 = document.getElementById('destination_panels');
		var obj2 = document.getElementById('destination_tabs');
		var elements = obj1.getElementsByTagName('div');
		if(obj1){
			var elements = obj1.getElementsByTagName('div');
			for(var x=0;x<elements.length;x++){
				if(elements[x].id == 'panel_'+id){
					elements[x].style.display = 'block';
				}else if(elements[x].id.indexOf('panel_') != -1){
					elements[x].style.display = 'none';
				}
			}
			var elements = obj2.getElementsByTagName('table');
			for(var x=0;x<elements.length;x++){
				if(elements[x].id.indexOf('dest_tab_') != -1){
					elements[x].id = 'dest_tab_off';
				}
			}
			if(tabObj)	tabObj.id = 'dest_tab_on';
		}
	}


	function toggle_forgotten_pass(){
		var fpObj = document.getElementById('forgotpass_form');
		var lObj = document.getElementById('login_form');
		if(fpObj && lObj){
			fpObj.style.display = (fpObj.style.display == 'block')?'none':'block';
			lObj.style.display = (fpObj.style.display == 'none')?'block':'none';
		}
	}

	function submit_form(action,frmname){
		if(!frmname) frmname = 'mainform';
		var frmObj = document.forms[frmname];
		//alert(frmObj + " name: " + frmname + " action: " + action);
		if(frmObj && verifylist(frmObj,validate_list)){
			if(action && action != -1) frmObj.ac.value = action;
			//alert(frmObj.ac.value);
			//update_sent_count();
			frmObj.submit();
		}
	}

	function submit_search(){
		var frmObj = document.forms['searchform'];
		if(frmObj){
			if(!isBlank(frmObj.searchtext.value)){
				frmObj.submit();
			}else{
				alert("Please enter search text");
			}
		}
	}

	function submit(){
		var frmObj = document.forms['mainform'];
		if(frmObj){
			update_sent_count();
			frmObj.submit();
		}
	}

	function update_sent_count(){
		var sentObj = document.getElementById('sent_flag');
		if(sentObj) sentObj.value = parseInt(sentObj.value) + 1;
	}

	var TID=null;
	// called on mouseover
	function toggle_navigation(idx){
		if (TID) clearTimeout(TID);
		var obj = document.getElementById('nav_padding');
		if(obj){
			var elements = obj.getElementsByTagName('table');
			//alert(elements.length);
			var n=0;
			for(var x=0;x<elements.length;x++){
				if(elements[x].id.indexOf('highlite') != -1){
					elements[x].style.visibility = ((n+1)==idx)?'visible':'hidden';
					n++;
				}
				if(elements[x].id.indexOf('nolite') != -1){
					elements[x].style.visibility = ((n+1)!=idx)?'visible':'hidden';
				}
			}
		}
	}

	//function open_sub_nav(text){
	//	var Obj = document.getElementById('sub_nav_'+text);
	//	if(Obj){
	//		Obj.style.display = 'block';
	//	}
	//}

	//function page_has_sub_nav(link){
	//	load_page(link+'?subnav=1','');
	//}

	function load_page(url,windowtype){
		//alert("URL: "+url+"  Window Type: "+windowtype);
		if(url != 0 && url != '' && location.href != url){
			if((windowtype) && windowtype == 'blank'){
				OpenWindow(new Array(0,url,'Link',840,600,0,1,0,0,0,0,0));
			}else if((windowtype) && windowtype == 'newwindow'){
				OpenWindow(new Array(0,url,'whitelabel',840,600,1,1,1,1,1,1,1));
			}else if((windowtype) && windowtype == 'banner'){
				OpenWindow(new Array(0,url,'banner',560,64,0,0,0,0,0,0,0));
			}else if((windowtype) && windowtype == 'parent'){
				parent.location.href=url;
			}else{
				location.href=url;
			}
		}
	}

	/***********************************************
	* Bookmark site script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
	* This notice MUST stay intact for legal use
	* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
	***********************************************/

	function bookmarksite(){
		var title = document.title;
		var url = location.href;
		if (document.all){
			window.external.AddFavorite(url, title);
		}else if (window.sidebar){
			window.sidebar.addPanel(title, url, 0);
		}
	}


	//////////////
	// Example call
	// OpenWindow(new Array(0,path,'hotpic',490,600,0,1,0,0,0,0,0));
	function OpenWindow(action) {
		//alert(action[1]);
		var wf = "";
		wf = wf + "top=10,left=10";
		wf = wf + ",width=" + action[3];
		wf = wf + ",height=" + action[4];
		wf = wf + ",resizable=" + (action[5] ? "yes" : "no");
		wf = wf + ",scrollbars=" + (action[6] ? "yes" : "no");
		wf = wf + ",menubar=" + (action[7] ? "yes" : "no");
		wf = wf + ",toolbar=" + (action[8] ? "yes" : "no");
		wf = wf + ",directories=" + (action[9] ? "yes" : "no");
		wf = wf + ",destination=" + (action[10] ? "yes" : "no");
		wf = wf + ",status=" + (action[11] ? "yes" : "no");
		return window.open(action[1],action[2],wf);
	}

	//////////////
	// Example call
	// var num=OpenWindowModal(new Array(0,path,'calc',120,140,0,0,0,0,0,0,0));
	function OpenWindowModal(action,def) {
		var wf = "";
		wf = wf + "";
		wf = wf + "dialogWidth:" + action[3] + "px";
		wf = wf + ";dialogHeight:" + action[4] + "px";
		wf = wf + ";resizable:" + (action[5] ? "yes" : "no");
		wf = wf + ";scroll:" + (action[6] ? "yes" : "no");
		wf = wf + ";menubar:" + (action[7] ? "yes" : "no");
		wf = wf + ";toolbar:" + (action[8] ? "yes" : "no");
		wf = wf + ";directories:" + (action[9] ? "yes" : "no");
		wf = wf + ";destination:" + (action[10] ? "yes" : "no");
		wf = wf + ";status:" + (action[11] ? "yes" : "no");
		// make path different each time to stop browser cache giving old page
		var pg = action[1];
		if (pg.indexOf('?')==-1){
			pg += "?xyz="+escape(new Date());
		}else{
			pg += "&xyz="+escape(new Date());
		}
		return showModalDialog(pg,def,wf);
	}

	function copy_to_forgot_pass(value){
		var obj = document.forms['forgotpass'].fp_email;
		if(obj) obj.value = value;
	}

	function dump(obj){
		alert(obj);
		var sd="";
		var n=0;
		for (var p in obj){
			sd += p + " = " + obj[p] + "\n";
			n++;
			if (n>10){
				alert(sd);
				sd="";
				n=0;
			}
		}
		alert(sd);
	}

	//===========================================================

	function isBlank(s){
		for(var i=0; i<s.length; i++) {
			var c = s.charAt(i);
			if((c!='')&&(c!='\t')&&(c!='\n')&&(c!=' ')){
				return false;
			}
		}
		return true;  // corrected 28/2/2006 BC/CM
	}

	//#####################################################

	function build_availiablity_inputs(id){
		var sourceObj = document.getElementById(id);
		if(sourceObj){
			var btnObj = document.getElementById('button');
			var ok_btnObj = document.getElementById('ok_button');
			var outputObj = document.getElementById('input_output');
			var templateObj = document.getElementById('template');
			var dates = sourceObj.innerHTML.split(/<br>/i);
			var outputHTML = "";

			for(var x=0;x<dates.length;x++){
				if(dates[x] != ''){
					var tempBlk = templateObj.innerHTML;
					tempBlk = tempBlk.replace(/%date%/g,dates[x]);
					tempBlk = tempBlk.replace(/%cnt%/g,x);
					//alert('"'+dates[x]+'"');
					outputHTML += tempBlk;
				}
			}

			if(ok_btnObj) ok_btnObj.style.display = (outputHTML == '')?'block':'none';
			if(btnObj) btnObj.style.display = (outputHTML == '')?'none':'block';
			if(outputObj) outputObj.innerHTML = (outputHTML == '')?"<div class='pbody'><B>No dates have been selected</B></div>":outputHTML;
		}else{
			alert('sourceObj not found! id: '+id);
		}
	}

	//#####################################################

	function tick_all(cnt){
		var checkboxes = new Array("morning_","afternoon_","evening_");
		for(var x=0;x<checkboxes.length;x++){
			var obj = document.getElementById(checkboxes[x] +''+ cnt);
			if(obj){
				obj.checked = true;
			}else{
				alert('item: "'+checkboxes[x] + cnt + '" was not found');
			}
		}
	}

	//#####################################################


	//===========================================================

	function checkStrength(s){
		var strength = 0;
		var regNumber = /[0-9]+/;
		var regChar = /[a-z]+/;
		var regUnusual = /[\.,\\!\-+]+/;
		if(s.length >= 3){ 
			strength++; 
			alert('length >= 3');	
		}
		if(s.length >= 6){
			strength++; 
			alert('length >= 6');
		}
		if(s.length >= 9){
			strength++; 
			alert('length >= 9');	
		}
		var cnt2 = 0;
		for(var i = 0; i < s.length; i++) {
			var c = s.charAt(i);
			//if(regNumber.test(c)) alert();
		}
		alert(s.indexOf(/\d/));
		if(s.indexOf(/[0-9]+/) != -1){ 
			alert('pass has numbers');	
			strength++;	
		}
		if(s.indexOf(/[\.\\,*]+/) != -1){
			alert('pass has unusual characters');	
			strength++;	
		}
		if(s.indexOf(/[a-z]+/i) != -1){ 
			alert('pass has letters');	
			strength++;	
		}
		//alert(strength);
	}