﻿//detection stuff


var bName = navigator.appName;
var bVersion = parseInt(navigator.appVersion);
var plat = navigator.platform;
ua=navigator.userAgent;

if (bName.indexOf('Netscape') != -1){
var isNS = 1;
}
else if(bName.indexOf('Microsoft') != -1){
var isIE = 1;
}

if(plat.indexOf('Win')!= -1){
var isWin = 1;
}

if(ua.indexOf('AOL') != -1){
var isAOL = 1;
}

// script to set menu items
function set_menu(item){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(item) : document.all(item)
	obj.style.background='#edebe6';
	obj.style.color='#000000';
}


/*
function set_last_visited(item){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(item) : document.all(item)
if(obj){	obj.style.background='#d4e7ee';
	obj.style.color='#000000';}
	
}
*/

function set_last_visited(this_itemno){
for (var itemno=1;itemno<200;itemno++)
	{
	obj = (document.getElementById ? 1 : 0) ? document.getElementById(itemno) : document.all(itemno)
	if(obj)
		{
		obj.style.background='#ffffff';
		obj.style.color='#000000';
		}
	}
	this_obj = (document.getElementById ? 1 : 0) ? document.getElementById(this_itemno) : document.all(this_itemno)
	if(this_obj)
		{
		this_obj.style.background='#d4e7ee';
		this_obj.style.color='#000000';
		}
}



// script to set menu items in tools
function set_menu_tools(item){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(item) : document.all(item)
	obj.style.background='#edebe6';
	obj.style.color='#000000';
}


// script to set lev3 menu
function set_month(item){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(item) : document.all(item)
	obj.style.borderTopWidth='1';obj.style.borderBottomWidth='1';obj.style.borderLeftWidth='0';obj.style.borderRightWidth='0';obj.style.borderColor='#000000';obj.style.borderStyle='solid';
}

function swappreview(itemno) { //v2.0
itemna="tab"+itemno;
for (var tabno=1;tabno<100;tabno++){
	tabna="tab"+tabno;
	layna="preview"+tabno;
	obj = (document.getElementById ? 1 : 0) ? document.getElementById(tabna) : document.all(tabna);
	tabcol=(tabno==itemno)?'#000000':'#bea043';
	if(obj){obj.style.background=tabcol;}
	obj = (document.getElementById ? 1 : 0) ? document.getElementById(layna) : document.all(layna);
	layvis=(tabno==itemno)?'block':'none';
	if(obj){obj.style.display=layvis;}
	}
}


/*Hide all layers and show a single specified one.
Change the value of the totallayers to the number of layers that you want to show and hide.
Change the value of l to reflect the naming system used for layers e.g. l='fred';
In sh1() below, the layers should be named lay0, lay1, lay2, lay3 etc
sh1() below works on just 1 layer
When calling sh1(), pass as an argument the name at the end of the layer you want to show (i.e. 0, 1 or 2 etc), it will hide all the other layers.
<<<<<<<<<<<<<<USAGE>>>>>>>>>>>>>>>>>
On a couple of browsers, in a framed page, the back button fails to invoke the show hide script.
To avoid this problem, in the page that is loaded, have an onLoad=sh1() in the body tag 
or if it's a frameset itself have an onLoad=sh1() in the frameset tag. 
*/
function sh1(){
var totallayers=1;
l='lay'; 

if(document.all){d='';s='.style';gs='';ge='';}
else if(document.getElementById){d='document.';gs="getElementById('";ge="')";s='.style';}
else{d='document.';s='';gs='';ge='';}

for(var i=0;i<totallayers;i++){
lc=eval(d+gs+l+[i]+ge+s);lc.visibility='hidden';}
ag=arguments;

for(var j=0;j<ag.length;j++){
ln=eval(d+gs+l+[ag[j]]+ge+s);ln.visibility="visible";}
}






//sh9() below works on 9 layers
function sh9(){
var totallayers=9;
l='lay'; 

if(document.all){d='';s='.style';gs='';ge='';}
else if(document.getElementById){d='document.';gs="getElementById('";ge="')";s='.style';}
else{d='document.';s='';gs='';ge='';}

for(var i=0;i<totallayers;i++){
lc=eval(d+gs+l+[i]+ge+s);lc.visibility='hidden';}
ag=arguments;

for(var j=0;j<ag.length;j++){
ln=eval(d+gs+l+[ag[j]]+ge+s);ln.visibility="visible";}
}






/*
To show a layer called lay2 in the frame called 'thetopframe'
Put this function in the head of the page called from a link in the nav e.g. services.htm
Call loaded() by putting an onLoad="loaded()" in the body tag of services.htm.
At the bottom of the frame named thetopframe put the script:

<script language="JavaScript">
var done=true;
</script>

*/
function loaded()
{
	if(parent.frames.thetopframe.done)
	{
		parent.frames.thetopframe.sh3('2');							
	}			
	else{setTimeout('loaded()',100);}
}		





/*
Swap 1 image
All the following swap image scripts might benefit from if(document.images) before it does the swap.
*/
function swap_img_1(img1,ref1)				
{			
document.images[img1].src = ref1;
}






//swap 2 images - this can be shortened, I'm sure - not got round to it yet
function swap_img_2(img1,ref1,img2,ref2)				
{			
document.images[img1].src = ref1;
document.images[img2].src = ref2;
}





function swap_img_3(img1,ref1,img2,ref2,img3,ref3)				
{			
document.images[img1].src = ref1;
document.images[img2].src = ref2;
document.images[img3].src = ref3;
}







/*
swap 1 image that is in a layer - pass the entire layer name.
The normal swap_img script does not work for images in layers in nn4.
*/
function swap_img_1_layers(img1,ref1,layername){
        if (document.all){
			document.images[img1].src = ref1;
        
		}else if (document.getElementById){ 
			document.getElementById(img1).src = ref1;  
			
        }else  {
			document.layername.document.images[img1].src = ref1;
}
}






/*
swap 1 image that is in a layer - pass only the number of the layer.
The normal swap_img script does not work for images in layers in nn4.
*/
function swap_img_1_layers(img1,ref1,i){
        if (document.all){
			document.images[img1].src = ref1;
        
		}else if (document.getElementById){ 
			document.getElementById(img1).src = ref1;  
			
        }else  {
			document.eval('lay'+i).document.images[img1].src = ref1;
}
}






/*
Swap 2 images that are in layers.
The normal swap_img script does not work for images in layers in nn4 .
This can be shortened, I'm sure - not got round to it yet.
*/
function swap_img_2_layers(img1,ref1,i,img2,ref2,j){
        if (document.all){
			document.images[img1].src = ref1;
			document.images[img2].src = ref2;
			
		}else if (document.getElementById){ 
			document.getElementById(img1).src = ref1;  
			document.getElementById(img2).src = ref2;  

        }else  {
			document.eval('lay'+i).document.images[img1].src = ref1;
			document.eval('lay'+i).document.images[img2].src = ref2;
}
}









/*
Open a new window called win2.
Switch the window features on or off as required e.g. scrollbars=yes
The size is dependent on the browser/platform etc.
This could be rewritten to tie in with the detection stuff at the top of this page.
*/
function openWin(url) {
var x=10,y=10
//var x=(screen.availWidth-630)
var vs=navigator.appVersion,v=parseFloat(vs),m=(vs.indexOf('Mac')>-1?true:false),w=(vs.indexOf('Win')>-1?true:false),ie=(document.all?true:false);
var bts=vs.split(' ');for(var i=0;i<bts.length;i++){if(parseFloat(bts[i])>=5&&parseFloat(bts[i])<10)v=parseFloat(bts[i])};

	if(ie&&m&&v>=4&&v<5)
			var sz=",width=610,height=426";		

		else if(ie&&m&&v>=5) 
			var sz=",width=610,height=406";		

		else if(ie&&w&&v>=4)
			var sz=",width=610,height=388";		

		else 
			var sz=",width=610,height=408";      

window.open(url,'win2','left='+x+',top='+y+',screenX='+x+',screenY='+y+',status=yes,scrollbars=no,resizable=no,menubar=yes'+sz);
}



function openwin_counter(url) {
window.open(url,'win2','width=50,height=50,status=no,resizable=no,menubar=no,scrollbars=no');
}


///////////////////  HIDE EMAILS FROM SPAMBOTS - START ////////////////////

//pick up lines for valentine's day
function emailhider_pickuplines()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'pickuplines';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<font color="#FFFFFF">');
document.write('<strong>email us</strong>'); 
//span text formatting ends here
document.write('</font>');
document.write('</a>');
}

//comments for vw polo suicide bomber viral
function emailhider_comments()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'comments';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<strong>email us</strong>'); 
//span text formatting ends here
document.write('</a>');
}

//captions competition
function emailhider_captions()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'captions';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<strong>email us</strong>'); 
//span text formatting ends here
document.write('</a>');
}


//nic stevens
function emailhider_nic()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'nic';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<span class="tools">'); 
document.write('&#110;&#105;&#099;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;'); 
//span text formatting ends here
document.write('</span>'); 
document.write('</a>');
}


//contribute
function emailhider_contribute()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'contribute';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('" onfocus="this.blur()">'); 
//span text formatting starts here
document.write('<span class="tools">'); 
document.write('&#099;&#111;&#110;&#116;&#114;&#105;&#098;&#117;&#116;&#101;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;'); 
//span text formatting ends here
document.write('</span>'); 
document.write('</a>');
}




//contribute - contact page
function emailhider_contribute_contact_page()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'contribute';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<span class="tools">'); 
document.write('&#099;&#111;&#110;&#116;&#114;&#105;&#098;&#117;&#116;&#101;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;'); 
//span text formatting ends here
document.write('</span>'); 
document.write('</a>');
}



//sophie
function emailhider_sophie()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'sophie';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<span class="tools">'); 
document.write('&#115;&#111;&#112;&#104;&#105;&#101;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;'); 
//span text formatting ends here
document.write('</span>'); 
document.write('</a>');
}




//subscribe
function emailhider_subscribe()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'subscribe';
var the_domain = 'boreme';
var ext = 'com'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<span class="tools">'); 
document.write('email us'); 
//span text formatting ends here
document.write('</span>'); 
document.write('</a>');
}


//harry
function emailhider_harry()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'boreme';
var the_domain = 'hotcherry';
var ext = 'co.uk'; 
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext); 
document.write('">'); 
//span text formatting starts here
document.write('<span class="tools">'); 
document.write('&#098;&#111;&#114;&#101;&#109;&#101;&#064;&#104;&#111;&#116;&#099;&#104;&#101;&#114;&#114;&#121;&#046;&#099;&#111;&#046;&#117;&#107;'); 
//span text formatting ends here
document.write('</span>');
document.write('</a>');
}

///////////////////  HIDE EMAILS FROM SPAMBOTS - END ////////////////////


// Flash active x workaround

//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

