function goMake(){
	window.location=document.manusearch.manu.options[document.manusearch.manu.options.selectedIndex].value;}

function newLink(link){
	window.open(link,'newWindow','width=800,height=600,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
}
function siteLink(link){
	window.location(link);
}
function showPostCodeChange(e,text){ 
      document.getElementById("ToolTip").innerHTML="<table><tr><td class=ToolTipTD>"+text+"</td></tr></table>"; 
      document.getElementById("ToolTip").style.left=(window.screen.availWidth/2)+'px'; 
      document.getElementById("ToolTip").style.top=(window.screen.availHeight/2)+'px'; 
      document.getElementById("ToolTip").style.visibility="visible"; 
      document.getElementById("ToolTip").style.zindex=300; 
}

// Bookmark AP Site
function addfav(title,url) {
    if (window.sidebar)
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ 
	var book = document.createElement('a');
	book.setAttribute('href',url);
	book.setAttribute('title',title);
	book.setAttribute('rel','sidebar');
	book.click();
} 
else if(document.all)
	window.external.AddFavorite(url, title);
}

function go_there()
{
 var where_to= confirm("This page shows our full product list and will take a long time to be displayed. Is this OK?");
 if (where_to==true)
 {
   window.location="http://www.applianceplanet.co.uk/eshop/products.htm";
 }
 else
 {
  window.location="http://www.applianceplanet.co.uk";
  }
}
function showToolTip(e,text){ 
      document.getElementById("ToolTip").innerHTML="<table><tr><td class=ToolTipTD>"+text+"</td></tr></table>"; 
      document.getElementById("ToolTip").style.left=(e.clientX+15+document.documentElement.scrollLeft)+'px';
 	  //document.getElementById("ToolTip").style.left=(e.x+15+document.body.scrollLeft)+'px'; 
 	  // document.getElementById("ToolTip").style.top=(e.y+document.body.scrollTop)+'px'; 
      document.getElementById("ToolTip").style.top=(e.clientY+document.documentElement.scrollTop)+'px'; 
      document.getElementById("ToolTip").style.visibility="visible"; 
      document.getElementById("ToolTip").style.zindex=300; 
} 

function showWhyBuy(e,text){ 
      document.getElementById("WhyBuy").innerHTML="<table width=\"300\">"+text+"</table>"; 
      document.getElementById("WhyBuy").style.left=(e.clientX+15+document.documentElement.scrollLeft)+'px';
 	  //document.getElementById("ToolTip").style.left=(e.x+15+document.body.scrollLeft)+'px'; 
 	  // document.getElementById("ToolTip").style.top=(e.y+document.body.scrollTop)+'px'; 
      document.getElementById("WhyBuy").style.top=(e.clientY+document.documentElement.scrollTop)+'px'; 
      document.getElementById("WhyBuy").style.visibility="visible"; 
      document.getElementById("WhyBuy").style.zindex=300; 
}

function showCenterToolTip(e,text){ 
			
	
      document.getElementById("ToolTip").innerHTML="<table><tr><td class=ToolTipTD>"+text+"</td></tr></table>"; 
      document.getElementById("ToolTip").style.left=(screen.width/2)+'px';
 	  //document.getElementById("ToolTip").style.left=(e.x+15+document.body.scrollLeft)+'px'; 
 	  // document.getElementById("ToolTip").style.top=(e.y+document.body.scrollTop)+'px'; 
      document.getElementById("ToolTip").style.top=(screen.height/2)+'px'; 
      document.getElementById("ToolTip").style.visibility="visible"; 
      document.getElementById("ToolTip").style.zindex=300; 
} 

function showPriceBox(e,text){ 
      document.getElementById("ToolTip").innerHTML="<table><tr><td class=ToolTipTD>"+text+"</td></tr></table>"; 
      document.getElementById("ToolTip").style.left=(350)+'px';
 	  //document.getElementById("ToolTip").style.left=(e.x+15+document.body.scrollLeft)+'px'; 
 	  // document.getElementById("ToolTip").style.top=(e.y+document.body.scrollTop)+'px'; 
      document.getElementById("ToolTip").style.top=(e.clientY+document.documentElement.scrollTop)+'px'; 
      document.getElementById("ToolTip").style.visibility="visible"; 
      document.getElementById("ToolTip").style.zindex=300; 
} 

function showQuestions(whichLayer)
{ 
		var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  }
  
 function showMoreOptions(whichLayer)
{ 
		var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'inline':'none';
  vis.display = (vis.display==''||vis.display=='inline')?'none':'inline';
  }
   
function hideToolTip(){ 
      //ToolTip.style.visibility="hidden"; 
      document.getElementById("ToolTip").style.visibility="hidden"; 
} 

function hideWhyBuy(){ 
      //ToolTip.style.visibility="hidden"; 
      document.getElementById("WhyBuy").style.visibility="hidden"; 
}
//imbed the flash movie into the page of choice -  this is a simplified version

function imbedThisFlash(thePath, flashFileName, nWidth, nHeight)
{
	isIE = (document.all);
	var strWidth = nWidth.toString();
	var strHeight = nHeight.toString();
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
	document.write(' id='+flashFileName+' width='+strWidth+' height='+strHeight+'>');
	document.write(' <param name="movie" value="'+thePath+'/'+flashFileName+'.swf"> <param name="quality" value="high">'); 
	document.write(' <embed src="'+thePath+'/'+flashFileName+'.swf" quality="high" ');
	document.write(' width="'+strWidth+'" height="'+strHeight+'" name="'+flashFileName+'"');
	document.write(' type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer">');
	document.write(' </embed>');
	document.write(' </object>');
}

//this makes striped table rows
 function stripe(id) {
    var table = document.getElementById(id);
    if (! table) { return; }
    var trs = table.getElementsByTagName("tr");
    for (var i = 0; i < trs.length; i += 2) {
      trs[i].className += " even";
    }
	}
	
var state = 'hidden';

function showhide(layer_ref) 
{

	if (state == 'visible') 
	{
	state = 'hidden';
	}
	else 
	{
		state = 'visible';
	}
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.visibility = state");
	}	
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].visibility = state;
		}
	if (document.getElementById && !document.all) 
	{
	maxwell_smart = document.getElementById(layer_ref);
	maxwell_smart.style.visibility = state;
	}

}	


function postcodechecker(){ //check postcode format is valid
 pcode1 = document.postcodeenter.setpostcode1.value; size = pcode1.length
 pcode1 = pcode1.toUpperCase(); //Change to uppercase
 pcode2 = document.postcodeenter.setpostcode2.value; size2 = pcode2.length
 pcode2 = pcode2.toUpperCase(); //Change to uppercase
 
 while (pcode1.slice(0,1) == " ") //Strip leading spaces
  {pcode1 = pcode1.substr(1,size-1);size = pcode1.length
  }
   while (pcode2.slice(0,1) == " ") //Strip leading spaces
  {pcode2 = pcode2.substr(1,size2-1);size2 = pcode2.length
  }
  
  
 while(pcode1.slice(size-1,size)== " ") //Strip trailing spaces
  {pcode1 = pcode1.substr(0,size-1);size = pcode1.length
  }
  while(pcode2.slice(size2-1,size2)== " ") //Strip trailing spaces
  {pcode2 = pcode2.substr(0,size2-1);size2 = pcode2.length
  }
  
 document.postcodeenter.setpostcode1.value = pcode1; //write back to form field
 document.postcodeenter.setpostcode2.value = pcode2; //write back to form field
 
 if (size < 2){
	alert("1st part of postcode  is not a valid length");
  document.postcodeenter.setpostcode1.focus();
  return false; 
	} 
  else if ( size2 < 3){ 
		alert("2nd part of postcode is not a valid length");
  		document.postcodeenter.setpostcode2.focus();
  		return false;
	}
  
 else if (!(isNaN(pcode1.charAt(0)))){ //leftmost character must be alpha character rule
   alert(pcode1 + pcode2 + " is not a valid postcode - cannot start with a number");
   document.postcodeenter.setpostcode1.focus();
   return false;
  }
 else if (isNaN(pcode2.charAt(size2-3))){ //first character of inward code must be numeric rule
   alert(pcode1 + pcode2 + " is not a valid postcode - 2nd part of postcode must start with number");
   document.postcodeenter.setpostcode2.focus();
   return false;
  }
 else if (!(isNaN(pcode2.charAt(size2-2)))){ //second character of inward code must be alpha rule
   alert(pcode1 + pcode2 + " is not a valid postcode - 2nd character of 2nd part must be alpha character");
   document.postcodeenter.setpostcode2.focus();
   return false;
  }
 else if (!(isNaN(pcode2.charAt(size2-1)))){ //third character of inward code must be alpha rule
   alert(pcode1 + pcode2 + " is not a valid postcode - 3rd character of 2nd part must be alpha character");
   document.postcodeenter.setpostcode2.focus();
   return false;
  }
else {
return true;
}
}



  