<!--

/*	This JavaScript is copyright © Gavin Orland Gear Ltd, December 2001, except where noted		*/


function skipIntro(value){
	d=new Date();
	hour = 3600;
	day = hour*24;
	number_of_days = 365;
	expiry_time = day*number_of_days*1000;
	d.setTime(d.getTime()+expiry_time);
	top.document.cookie = "skip_intro="+value+';expires='+d.toGMTString();
	alert("Your preference will be remembered");
}

// Cookie handlers by Bill Dortch, hIdaho Design (bdortch@netw.com) 

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset); 
	if (endstr == -1) 
	endstr = document.cookie.length;
	//	alert(unescape(document.cookie.substring(offset, endstr)))
	return unescape(document.cookie.substring(offset, endstr));

}

function getCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0; 
	while (i < clen) {
	var j = i + alen; 
    if (document.cookie.substring(i, j) == arg)
	//		alert(document.cookie.substring(i, j));
    	return getCookieVal (j); 
		break; 
	}
    return null; 
}
	 
chromeless = function(varName, url, width, height, winName) {
	props='toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,top=200,left=200,scrollbars=0,fullscreen=1';
	window[varName]=window.open(url,winName,props);
	with (window[varName]){
		self.onLoad=self.resizeTo(400,200),self.moveTo(200,200);
	}
	return false;
	//	setTimeout("window."+varName+".close()",2000);
}

function doForm () {

	var fieldArray= ['First_Name','Surname','E-mail_Address','Referrer','Comments'];
	var blank=0;	
	for (i=0;i<fieldArray.length;i++) {
		if (document.contactForm[i].value=='') var blank=1;
	}
	if (blank==1) {
		alert ('Please complete the whole form');
	} else {
		window.document.contactForm.submit();
		window.location='thankyou.html';
	}

}


function z() {
// do nothing
}

function insertDate() {
	now= new Date();
	days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
	theDay=days[now.getDay()];
	theDate=now.getDate();
	months=['January','February','March','April','May','June','July','August','September','October','November','December'];
	theMonth=months[now.getMonth()];
	theYear=now.getFullYear();
	document.write(theDay+' '+theDate+' '+theMonth+' '+theYear)
}

function openingSoon() {
window.alert('This section is opening soon');
}

function goHome() {
with (parent.nav) {
	MM_nbGroup('down','navbar1','ccs_logo','images/nav/ccs_logo.gif',1);
	parent.main.location='../front/front.html';
	};
}

function printPage() {
	navigator.appName.indexOf('Microsoft') != -1 ? y='IE' : y='Netscape';
	navigator.platform.indexOf('Win') != -1 ? z = 'Windows' : z = 'Mac';
	z =='Mac' ? window.alert('To print this page please press \n\'Command-P\' on your keyboard') : self.print()
}

function setNav() {
if (!parent.nav) {
	parent.nav=window.open('nav.html','nav');
	}	
}

function goProducts() {
with (parent.nav) {
	MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1)
	};
this.location='../product_ranges/index.html'
}

function goLocator() {
with (parent.nav) {
	MM_nbGroup('down','navbar1','product_locator','images/nav/product_locator_f3.gif',1)
	};
this.location='../product_locator/index.html'
}

// routed from product locator results:

function goRange(range) {
with (parent.nav) {
	MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1)
	};
this.location='../../../../product_ranges/'+range+'/index.html'
}

function goRange2(range) {
with (parent.nav) {
	MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1)
	};
this.location='../product_ranges/'+range+'/index.html'
}

//----------------------------


function correctImage(target,badSource,goodSource){
	if (document.images[target].src==badSource){
	document.images[target].src=goodSource
	}
}

function initStatus() {
	self.defaultStatus=' ';
	nav.defaultStatus=' ';
	main.defaultStatus=' ';
	footer.defaultStatus=' ';
	}
	
	
// window openers

function openWin(url,windowName,theName,centre,width,height) {

if (!window[theName] || window[theName].closed) {

  if (centre==1){
     leftPos = (screen.availWidth/2)-(width/2);
     topPos = (screen.availHeight/2)-(height/2);
     properties = "scrollbars=0,width="+width+",height="+height+",top="+topPos+",left="+leftPos; 
  }
  else 
  {
     properties = "scrollbars=0,width="+width+",height="+height;
  }
  
  window[theName]=window.open(url,windowName,properties);

}
else

{
    window[theName].focus();
}

}


function openPlan(width,height) {

if (!window.plan || window.plan.closed) {
leftPos = (screen.availWidth/2)-(width/2);
topPos = (screen.availHeight/2)-(height/2);
plan=window.open("plan.html","plan","scrollbars=0,width="+width+",height="+height);
}

}

function doPromo(width,height) {

if (!window.promoWin || window.promoWin.closed) {
leftPos = 100 //(screen.availWidth/2)-(width/2);
topPos = 100 //(screen.availHeight/2)-(height/2);
promoWin=window.open("../promotion/wessex.html","promoWin","scrollbars=0,width="+width+",height="+height);
}
else {
promoWin.focus()
}

}

frontToRange=function(mainrange) {
	//	go to a particular product range
	with (top.nav) {
		MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1);
	}
	self.location='../product_ranges/'+mainrange+'/index.html';
}

frontToSub=function(mainrange,subrange) {
	//	go to a particular product range and send a search string for a subrange
	with (top.nav) {
		MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1);
	}
	self.location='../product_ranges/'+mainrange+'/index.html?'+subrange;
}


pressToRange=function(mainrange) {
	//	go to a particular product range
	with (top.nav) {
		MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1);
	}
	self.location='../../product_ranges/'+mainrange+'/index.html';
}


pressToSub=function(mainrange,subrange) {
	//	go to a particular product range and send a search string for a subrange
	// doSub() function reads this string
	with (top.nav) {
		MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1);
	}
	self.location='../../product_ranges/'+mainrange+'/index.html?'+subrange;
}

doSub=function() {
	//	called by each main product range menu page.
	//	check whether a product range menu should go to a subsection
	loc=parent.location.toString();
	h=parent.location.hash.toString();
	s=parent.location.search.toString();
	
	if (s!="") {
		// get rid of "?"
		s=s.substring(1,s.length);
		//	depress specified subrange button
		//	if we are in the classic range
		if (loc.indexOf("classic")!=-1){
			path="images/menu/";
		} else {
			path ="../images/menus/";
		}
		the_img=path+s+"_f3.gif";
		MM_nbGroup('down','navbar1',s,the_img,1);
		//	send content page to specified subsection
		h=="" ? parent.content.location=s+".html" : parent.content.location=s+".html"+h;
		
	}
}

goSubRange=function(mainrange,subrange) {
	with (top.nav) {
		MM_nbGroup('down','navbar1','product_ranges','images/nav/product_ranges_f3.gif',1);
	}
	window.location='../product_ranges/'+mainrange+'/index.html?'+subrange;
}


function projectWin(url,htmlName){
 if (window.project && (!window.project.closed))     {
   theloc = new String(project.location);
   thepage = theloc.substring((theloc.lastIndexOf("/")+1),theloc.length);
   if (thepage!=url) {                  
     project.location.replace(url);
     project.focus();               
   }
   else {
     project.focus();
   }               
 }
 else {
   project = window.open(url,htmlName,"width=300,height=303,scrollbars=no,resizable=no");
   project.focus();
 }
} 


// frame management

function breakFrame(){
if (self != top)
	top.location.replace(self.location);
}

function framePlacer(){
/*	var framedPage = location.search;
	if (framedPage.length > 1){
		framedPage = framedPage.substring(1);
		var theSplit = framedPage.lastIndexOf('~');
		var thePage = framedPage.substring(0,theSplit);
		var theFrame = framedPage.substring(theSplit+1);
		eval(theFrame+".location.replace('"+ thePage+"')");} */
	}

function framePage(thePage){
// note - I edited this function
if (window.name!='main'){
		top.location.replace('../../home.html?'+thePage+'~main');
		}
}



// flash

function embedMovie(name,width,height){
 
      // check for cookies
	  
      cookString = "?"      
      if(document.cookie != "") {
            theCook = document.cookie.split("; ")
            // add each part of the cookie to a string variable
            for (i = 0; i < theCook.length; i ++) {
                  cookString += theCook[i] + "&"
            }
      }

      // embed movie along with cookies
	  
      document.write('<object '
      +  'classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
      + ' codebase=http://download.macromedia.com/pub/shockwave/'
      + 'cabs/flash/swflash.cab#version=5'
      + ' id=' + name
      + ' width=' + width
      + ' height=' + height + '>'
      + '<param name=movie value='+ name + '.swf' + cookString + '>'
      + '<param name=quality" value=high>'
      + '<param name=menu value=false>'
	  + '<param name=scale value=noborder>'
      + '<param name=bgcolor value=#000000>'
      + '<embed src=' + name + '.swf' + cookString +
      + ' name=' + name
      + ' quality=high bgcolor=#000000'
      + ' width=' + width
      + ' height=' + height
      + ' menu=false'
      + ' type=application/x-shockwave-flash'
      + ' pluginspage=http://www.macromedia.com/shockwave/'
      + 'download/index.cgi?P1_Prod_Version=ShockwaveFlash>'
      + '</embed></object>'
      )
}

// browser and platform detection

function detect() {

var platform;
var browser;
var version;

version = parseInt(navigator.appVersion);

if(navigator.userAgent.indexOf('Win') == -1) {
        platform = 'Macintosh';
} else {
        platform = 'Windows';
}

if(navigator.appName.indexOf('Netscape') == -1) {
        browser = 'IE';
} else {
        browser = 'Netscape';
}

// set parameters for site window - unused now

var launchWidth;
var launchHeight;

if(browser=='IE' && platform=='Windows') {
    launchWidth = '780';
	launchHeight = '420';	
} else if(browser=='IE' && platform=='Macintosh') {
    launchWidth = '764';
	launchHeight = '404';
} else if(browser=='Netscape' && platform=='Windows') {
    launchWidth = '780';
	launchHeight = '420';
} else if(browser=='Netscape' && platform=='Macintosh') {
    launchWidth = '764';
	launchHeight = '404';
}

}

// for product locator

function moveMenu(){
	for (i=0;i<window.questions.radioGrp.length;i++){
		if (window.questions.radioGrp[i].checked==true) {
			self.location.href=window.questions.radioGrp[i].value;
			break;
		}
	}
}


// mm functions

function MM_findObj(n, d) { //v3.0
  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); return x;
}
function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}

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_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_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_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// That's all, folks	-->