isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function mailpage()
{
mail_str = "mailto:?subject=Check out the " + document.title;
mail_str += "&body=I thought you might be interested in the " + document.title;
mail_str += ". You can view it at, " + location.href; 
location.href = mail_str;
}

function SwapImage(ImgID,fname,Bigfname) {
		document.getElementById('large-pic-inner').style.display = ''
		document.getElementById('movie').style.display = 'none'
		MM_swapImage(ImgID,'',fname,1);
		lnk=document.getElementById("link1");
		lnk.href = Bigfname
		lnk=document.getElementById("enlarge-link");
		lnk.href = Bigfname

}

function ShowMovie() {
		document.getElementById('large-pic-inner').style.display = 'none'
		document.getElementById('movie').style.display = ''
}


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_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 formCheck()
  {
    returntype=false;  
    var wchecked = false;
    
    for (var x = 0; x <= (document.Add2Basket.Warranty.length-1); x++)
   {
	if (document.Add2Basket.Warranty[x].checked==true)
		{
			wchecked=true;
		}
   
   }

	if (!wchecked)
    {
      alert("Please select a warranty option");
      return false;
    }
    
    return true;
    }
    

function showProductDiv(submenu) {
		obj = document.getElementsByTagName('div');
		for (i=0; i<obj.length; i++) {
			if (obj[i].id == submenu) 
			{
				if (obj[i].style.display == 'none')
				{
					obj[i].style.display = '';
				}
			
			}
			else if (obj[i].id != '')
			{
				if (obj[i].id.substring(0,7) == 'Product'){
					obj[i].style.display = 'none';
					}
			}
		}	
     
}

function showProductDiv2(submenu) {
		obj = document.getElementsByTagName('div');
		for (i=0; i<obj.length; i++) {
			if (obj[i].id == submenu) 
			{
				if (obj[i].style.display == 'none')
				{
					obj[i].style.display = '';
				}
			
			}
			else if (obj[i].id != '')
			{
				if (obj[i].id.substring(0,2) == 'cs'){
					obj[i].style.display = 'none';
					}
			}
		}	
     
}

function setCookie(name, value, expires, path, domain, secure)
{
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}

function SortChange(){
	setCookie('Sort', document.Filter.SortBy.options[document.Filter.SortBy.selectedIndex].value, 'Friday 31-Dec-2099 00:00:00 GMT', '/'); 
	document.Filter.submit();
}
    

function MM_jumpMenu(targ,selObj,restore){ //v3.0
   if (selObj.options[selObj.selectedIndex].value != "") {
  eval("window.location='"+selObj.options[selObj.selectedIndex].value+"'");
  }
  if (restore) selObj.selectedIndex=0;
}


function showDiv(submenu,menu) {
		var expireDate = new Date();
        expireDate.setYear(expireDate.getYear() - 1);
		document.cookie = 'jNav=' + submenu +'; path=/';
		obj = document.getElementsByTagName('tr');
		for (i=0; i<obj.length; i++) {
			if (obj[i].id == submenu) 
			{
				if (obj[i].style.display == 'none')
				{
					obj[i].style.display = '';
					document.getElementById('Plus' + submenu).className = "NavLinksOver"+menu;
				}
				else {
					obj[i].style.display = 'none';
					document.getElementById('Plus' + submenu).className = "NavLinks"+menu;
				}
			}
			else if (obj[i].id != '')
			{
				obj[i].style.display = 'none';
				document.getElementById('Plus' + obj[i].id).className = replaceSubstring(document.getElementById('Plus' + obj[i].id).className,"Over","");
			}
		}	
     
}


function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function

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 changeContent(theDiv,theLayer,newText) {
	if (isNS4){
	   elm = document.layers[theLayer];
	   elm.document.open();
       elm.document.write(newText);
       elm.document.close();

	}
	else if (isIE4) {
	   elm = document.all[theDiv];
	   elm.innerText = newText;
	}
	else if (isIE5) {
	   elm = document.getElementById(theDiv);
		if (elm) {
	   		elm.innerText = newText;
	   	}
	}
	else if (isNS6) {
		var elmw = document.getElementById(theDiv);
    	if (elmw) {
    		elmw.childNodes[0].nodeValue = newText;
    	}	
	}
}	


   function presentValue(value) {
	dp=2
	pt="£"
        if(value<=0.9999) {
            newPounds='0';
        } else {
            newPounds=parseInt(value);
        }
        dec='1';
        for (var i=1; i<=dp;i++) {
            dec=dec+'0';
        }
        if (value>0) {
            newPence=Math.round((eval(value)+.000008 - newPounds)*(eval(dec)));
        } else {
            newPence=0;
        }
        compstring='9';
        for (var i=1; i <=dp-1;i++) {
            if (eval(newPence) <= eval(compstring)) newPence='0'+newPence;
            compstring=compstring+'9';
        }
        if (dp>0) {
            if (newPence==eval(dec)) { newPounds++; newPence='00'; }
            newString=pt+newPounds+"."+newPence;
        } else {
            newString=pt+newPounds+at;
        }
        return (newString);
    }	
    

function OutOfStock(showhide){

var winW = 630, winH = 460;

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}

winW = (winW/2)-190
winH = (winH/2)-150
	
		createIbox2();
		showBG2();
		
		var ibox_p = getElem('popupbox-'+showhide);
		ibox_p.style.display = "";
		posToCenter(ibox_p);

        document.getElementById('popupbox-'+showhide).style.visibility="visible"; 
  }    
    
    
function HideOOS(showhide)
{

hideBG();
document.getElementById('popupbox-'+showhide).style.visibility=""; 

}
    
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 changeContent(theDiv,theLayer,newText) {
	if (isNS4){
	   elm = document.layers[theLayer];
	   elm.document.open();
       elm.document.write(newText);
       elm.document.close();

	}
	else if (isIE4) {
	   elm = document.all[theDiv];
	   elm.innerText = newText;
	}
	else if (isIE5) {
	   elm = document.getElementById(theDiv);
		if (elm) {
	   		elm.innerText = newText;
	   	}
	}
	else if (isNS6) {
		var elmw = document.getElementById(theDiv);
    	if (elmw) {
    		elmw.childNodes[0].nodeValue = newText;
    	}	
	}
}	


function presentValue(value) {
	dp=2
	pt="£"
        if(value<=0.9999) {
            newPounds='0';
        } else {
            newPounds=parseInt(value);
        }
        dec='1';
        for (var i=1; i<=dp;i++) {
            dec=dec+'0';
        }
        if (value>0) {
            newPence=Math.round((eval(value)+.000008 - newPounds)*(eval(dec)));
        } else {
            newPence=0;
        }
        compstring='9';
        for (var i=1; i <=dp-1;i++) {
            if (eval(newPence) <= eval(compstring)) newPence='0'+newPence;
            compstring=compstring+'9';
        }
        if (dp>0) {
            if (newPence==eval(dec)) { newPounds++; newPence='00'; }
            newString=pt+newPounds+"."+newPence;
        } else {
            newString=pt+newPounds+at;
        }
        return (newString);
}	




function toggleLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
		}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
		}
	else if (document.layers)	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
		} // if
	}	
	
function toggleLayerOpen(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"none";
		}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"none";
		}
	else if (document.layers)	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"none";
		} // if
	}		
function flip()
{
	if(document.getElementById("morecontent").style.visibility == "hidden")
	{
	  document.getElementById("morecontent").style.visibility = "visible";
	  document.getElementById("morecontent").style.display = "block"; 
  }
  else
  {
	  document.getElementById("morecontent").style.visibility = "hidden";
	 document.getElementById("morecontent").style.display = "none"; 
  }
}

var selected;
var loop_tracker = 1;
var loop_current = 1;
var run_slideshow = 1;
var banner_bm = 1;
var next_banner;

function RotateHPBanner(banner_pointer, this_loop) {
	
	/*if(!document.getElementById('Banner_Rotation_images_' + banner_pointer)) {
		run_slideshow = false;
		alert(banner_pointer + ' does not exist');
	} else {
		
	}*/
	
	if(run_slideshow == banner_bm && this_loop == loop_tracker) {
		
		if(!document.getElementById('Banner_Rotation_images_' + banner_pointer)) { 
			var tmp = 0;
			while(document.getElementById('Banner_Rotation_images_markers_' + tmp)) {
				tmp++;
			}
			banner_pointer = parseInt(tmp)-parseInt(1); 
			next_banner = 0;
		} else {		
			next_banner = banner_pointer + 1;
		}
		
		if(!document.getElementById('Banner_Rotation_images_' + next_banner)) { 
			next_banner = 0; 
		}
		
		var tmp = 0;
		while(document.getElementById('Banner_Rotation_images_markers_' + tmp)) {
			document.getElementById('Banner_Rotation_images_markers_' + tmp).className = '';
			if(tmp != next_banner) {
				Effect.Fade("Banner_Rotation_images_" + tmp, { duration:1});
			}
			tmp++;
		}
		
		if (document.getElementById('Banner_Rotation_images_markers_' + banner_pointer)) {
			document.getElementById('Banner_Rotation_images_markers_' + banner_pointer).className = '';
		}
		if (document.getElementById('Banner_Rotation_images_markers_' + next_banner)) {
			document.getElementById('Banner_Rotation_images_markers_' + next_banner).className = 'active';
		}
		if (document.getElementById('Banner_Rotation_images_' + banner_pointer)) {
			Effect.Fade("Banner_Rotation_images_" + banner_pointer, {
				duration: 1
			});
		}
		if (document.getElementById('Banner_Rotation_images_' + next_banner)) {
			Effect.Appear("Banner_Rotation_images_" + next_banner, {
				duration: 1
			});
		}
		
		if (document.getElementById('Banner_Rotation_images_' + next_banner)) {
			setTimeout("Effect.Appear('Banner_Rotation_images_" + next_banner + "', { duration:1});", 1000);
			setTimeout("RotateHPBanner(" + next_banner + ", " + this_loop + ")", 5000);
		}
		
		
		
	}
	
}function updateHomepageImage(banner_pointer) {
	loop_tracker++;
	if(run_slideshow == 0) {
		run_slideshow = banner_bm;
	}
	banner_pointer = parseInt(banner_pointer)-parseInt(1);
	if(banner_pointer < 0) {
		var tmp = 0;
		while(document.getElementById('Banner_Rotation_images_' + tmp)) {
			tmp++;
		}
		banner_pointer =  parseInt(tmp)+parseInt(1);
	}
	/*if(!document.getElementById('Banner_Rotation_images_' + banner_pointer)) {
		var tmp = 0;
		while(document.getElementById('Banner_Rotation_images_' + tmp)) {
			tmp++;
		}
		banner_pointer = tmp;
	}
	if(next_banner) {
		//alert('Fading ' + next_banner);
		Effect.Fade("Banner_Rotation_images_" + next_banner, { duration:1});
	}
	Effect.Appear("Banner_Rotation_images_" + banner_pointer, { duration:1});*/
	//alert('Passing ' + banner_pointer);
	RotateHPBanner(banner_pointer, loop_tracker);
}function pauseHomepageSlideshow() {
	if(run_slideshow == banner_bm) {
		run_slideshow = 0;
		document.getElementById('Banner_Rotation_control').className = 'Banner_Rotation_control_play';
	} else {
		banner_bm++;
		document.getElementById('Banner_Rotation_control').className = 'Banner_Rotation_control_pause';
		run_slideshow = banner_bm;
	}
	document.getElementById('Banner_Rotation_control').blur();
	RotateHPBanner(next_banner, loop_current);
}


function toggleall()
{
	toggle('DivMoreLink');
	toggle('DivLessLink');
	toggle('MoreText');
}

function toggle(id)
{
	el = document.getElementById(id);
	if (el.style.display =='none'){
		el.style.display = '';
	} else {
		el.style.display = 'none';
	}
	return true;
}