var categoryCode = "";

var productCode = ""; 

var productPart = ""; 

var productType = "";

var extraPart = ""; 

var menuCategory = "";

var productcategorytype = "";

var topmenudisplay = "";

var queryKeys = getKeys();

categoryCode = queryKeys["cc"];

productCode = queryKeys["pc"]; 

productType = queryKeys["cat"]; 

category = 
extraimage1 = new Image();
extraimage1.src = "Images/ZentiExtraOneAct.gif";
extraimage2 = new Image();
extraimage2.src = "Images/ZentiExtraOneInAct.gif";
extraimage3 = new Image();
extraimage3.src = "Images/ZentiExtraTwoAct.gif";
extraimage4 = new Image();
extraimage4.src = "Images/ZentiExtraTwoInAct.gif";
extraimage5 = new Image();
extraimage5.src = "Images/ZentiExtraThreeAct.gif";
extraimage6 = new Image();
extraimage6.src = "Images/ZentiExtraThreeInAct.gif";

var extraLink1 = "<a href=\"products.html?cat=zymol&cc=300&pc=Zenti055\"><b>zymöl Starter Kit</b><br><img src=\""+datasource+"Images/Zenti055small.gif\" alt=\"\" border=\"0\" align=\"center\"></a>";
var extraLink2 = "<a href=\"products.html?cat=aquagleam&cc=010&pc=Zenti125\"><b>Aqua Gleam De-ionising Water Filter</b><br><img src=\""+datasource+"Images/Zenti125small.gif\" alt=\"\" border=\"0\" align=\"center\"></a>";
var extraLink3 = "<a href=\"products.html?cat=batterycharger&cc=110&pc=Zenti400\"><b>CTEK MULTI Battery Smart Charger</b><br><img src=\""+datasource+"Images/Zenti400small.gif\" alt=\"\" border=\"0\" align=\"center\"></a>";

if (!extraPart)
{
	extraPart = "1";
}

var thisExtraLink1;
var thisExtraLink2;
var thisExtraLink3;

function setExtra()
{
	var randomnumber=Math.floor(Math.random()*4)
	if (randomnumber <= 1)
	{
		thisExtraLink1 = extraLink1;
		thisExtraLink2 = extraLink2;
		thisExtraLink3 = extraLink3;
	} else if (randomnumber <= 2)
	{
		thisExtraLink1 = extraLink2;
		thisExtraLink2 = extraLink3;
		thisExtraLink3 = extraLink1;
	} else
	{
		thisExtraLink1 = extraLink3;
		thisExtraLink2 = extraLink1;
		thisExtraLink3 = extraLink2;
	}
}

function changeExtra(id)
{
	extraPart=id;
	var myExtraText=document.getElementById('productExtraText');
	var myExtraMenu1=document.getElementById('extraMenu1');
	var myExtraMenu2=document.getElementById('extraMenu2');
	var myExtraMenu3=document.getElementById('extraMenu3');

	if (id == 1) {
		myExtraText.innerHTML=thisExtraLink1;
		myExtraMenu1.innerHTML= extraoneact;
		myExtraMenu2.innerHTML= extratwoinact;
		myExtraMenu3.innerHTML= extrathreeinact;
	} else if (id == 2) {
		myExtraText.innerHTML=thisExtraLink2;
		myExtraMenu1.innerHTML= extraoneinact;
		myExtraMenu2.innerHTML= extratwoact;
		myExtraMenu3.innerHTML= extrathreeinact;
	} else if (id = 3) {
		myExtraText.innerHTML=thisExtraLink3;
		myExtraMenu1.innerHTML= extraoneinact;
		myExtraMenu2.innerHTML= extratwoinact;
		myExtraMenu3.innerHTML= extrathreeact;
	}	
}

function displayExtra()
{
document.writeln("    <td align=\"center\" background=\""+columnspacerright+"\"></td>");
document.writeln("    <td valign=\"top\" align=\"center\">");
document.writeln("	<table align=\"left\" width=\"170\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
document.writeln("	<COL WIDTH=\"170\">");
document.writeln("	  <tr><td><br>"+extratop+"</td></tr>");
document.writeln("	  <tr><td height=\"5\"></td></tr>");
document.writeln("	  <tr>");
document.writeln("	    <td valign=\"center\" align=\"center\" height=\"\" "+extraborderstyle+">");
document.writeln("	<table align=\"left\" width=\"170\" height=\"200\"cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
document.writeln("	<COL WIDTH=\"5\"><COL WIDTH=\"140\"><COL WIDTH=\"25\">");
document.writeln("	  <tr><td></td><td align=center>");

document.writeln("<div id=\"productExtraText\"></div>");

document.writeln("</td><td valign=top align=right "+extraborderright+"><br>");
document.writeln("<table align=\"\" width=\"19\" height=\"57\"cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
document.writeln("<COL WIDTH=\"19\">");

document.writeln("<tr><td  height=19><div id=\"extraMenu1\"></div></td></tr>");
document.writeln("<tr><td  height=19><div id=\"extraMenu2\"></div></td></tr>");
document.writeln("<tr><td  height=19><div id=\"extraMenu3\"></div></td></tr>");

setExtra();
changeExtra(1);

document.writeln("	</table>");

document.writeln("</td></tr>");
document.writeln("	</table>");

document.writeln("</td>");
document.writeln("	  </tr>");
document.writeln("  	<tr><td height=100% valign=top><br><a href=\"contact.html\" alt=\"Contact Us\" border=\"0\">"+contactus+"</a></td></tr>");
document.writeln("	</table>");

document.writeln("    </td>");
document.writeln("  </tr>");

}

function displayTop(page, menu) //Blank, apps
{
	if (!menu) { menu = ""; }

	document.writeln("<tr><td colspan=\"5\" height=\"112\" valign=\"top\">"+toplogo+"</td></tr>");
	document.writeln("  <tr>");

	if (root2.length != 1)
	{
//alert(productstextstart+menu+productstextend);
		document.writeln("  	<td valign=\"top\" height=\"44\" "+productstextstart+menu+productstextend+">&nbsp;</td>");
	} else
	{
		document.writeln("  	<td valign=\"top\" height=\"44\" "+productstextstart+root2[0][0][0]+productstextend+">&nbsp;</td>");
	}
	document.writeln("    <td colspan=4 valign=\"top\" height=\"44\" "+topspacer+">"+topmenustart+page+topmenuend+"</td>");
	document.writeln("  </tr>");
}

function displayMenu(page, menu)
{
if (!menu) { menu = ""; }

if (root2.length == 1)
{
	menu = root2[0][0][0];
	if (page != "About")
	{
		page="Blank";
	}
}

document.writeln("  <tr>");
document.writeln("    <td align=\"left\" valign=\"top\">");
document.writeln("			<table align=\"center\" width=\"186\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
document.writeln("  		  <tr><td valign=\"top\" class=linksmall><SCRIPT language=\"JavaScript\" type=\"text/javascript\">displayCatMenu();</SCRIPT></td></tr>");
document.writeln("  		  <tr><td valign=\"top\" height=10></td></tr>");
document.writeln("  		  <tr><td valign=\"top\"><SCRIPT language=\"JavaScript\" type=\"text/javascript\">var menu = \""+menu+"\"; displayRootMenu(menu);</SCRIPT></td></tr>");
document.writeln("  		</table>");
document.writeln("    </td>");
document.writeln("    <td valign=\"top\" align=\"center\" background=\""+columnspacerleft+"\"></td>");
}

function displayBottom()
{
document.writeln("  <tr>");
document.writeln("    <td height=95 valign=top>"+bottomlogo+"</td>");
document.writeln("  </tr>");
document.writeln(" </table>");
}

function top()
{
  document.writeln("<table align=\"center\" valign=\"top\" height=100% cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
  document.writeln("<COL WIDTH=\"10000\"><COL WIDTH=\"950\"><COL WIDTH=\"10000\">");
  document.writeln("<tr>");
  document.writeln("  <td rowspan=100 valign=\"top\" "+topbackgroundcolour+"></td>");
  document.writeln("    <td valign=\"top\">");
  document.writeln("<table align=\"center\" valign=\"top\" width=\"950\" height=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
  document.writeln("<COL WIDTH=\"186\"><COL WIDTH=\"9\"><COL WIDTH=\"560\"><COL WIDTH=\"20\"><COL WIDTH=\"175\">");
}

function bottom()
{
  document.writeln("    <td rowspan=3 "+topbackgroundcolour+"></td>");
  document.writeln("  </tr>");
  document.writeln("</table>");
}

// Function is dummy to satisfy call from product .js files
function setDetailedProductData(productNumber, setBasketNumber, setBasketNumberReadonly, setBasketTotal)
{}
// Function is dummy to satisfy call from product .js files
function setDetailedProductDataMultipleOptions(productNumber, setBasketNumberArray, setBasketNumberReadonlyArray, setBasketTotalArray)
{}

function digitvalidation(entered, min, max, alertbox, datatype)
{
 with (entered)
 {
  checkvalue=parseFloat(value);
  if (datatype)
  {
   smalldatatype=datatype.toLowerCase();
   if (smalldatatype.charAt(0)=="i") 
   {
   	checkvalue=parseInt(value);
	if (value.indexOf(".")!=-1) 
	{
	 checkvalue=checkvalue+1;
	}
   }
  }
  if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
  {
   if (alertbox!="") 
   {
   	alert(alertbox);
   }
   return false;
  }
  else 
  {
   return true;
  }
 }
} 

function getKeys() 
{ 
   var keys = new Object(); 
   var queryString = location.search.substring(1); 
   var keyPairs = queryString.split("&"); 
    
   for(var i = 0; i < keyPairs.length; i++) 
   { 
      var position = keyPairs[i].indexOf('='); 
        if (position == -1) continue; 
        
       var keyname = keyPairs[i].substring(0, position ); 
        
       var keyvalue = keyPairs[i].substring(position + 1); 
       keys[keyname] = unescape(keyvalue); 
   } 
   return keys; 
}

function emailvalidation(entered, alertbox)
{
 with (entered)
 {
  apos=value.indexOf("@"); 
  dotpos=value.lastIndexOf(".");
  lastpos=value.length-1;
  if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
  {
   if (alertbox) 
   {
   	alert(alertbox);
   }
   return false;
  }
  else 
  {
   return true;
  }
 }
} 

function emptyvalidation(entered, alertbox)
{
 with (entered)
 {
  if (value==null || value=="")
  {
   if (alertbox!="") 
   {
   	alert(alertbox);
   }
   return false;
  }
  else 
  {
   return true;
  }
 }
}

// Function returns string of dollar/cent value for given number
function dollarIt(price) {
	var newPrice;
	var decimalPart;
	var wholePart;
	newPrice = "$ ";
	decimalPart = "";
	wholePart = "";
//
	wholePart = Math.floor(price);
	decimalPart = Math.round((price-wholePart) * 100);
	newPrice += wholePart + ".";
	if (decimalPart > 99) {
		decimalPart = Math.round(decimalPart / 10);
	}
	if (decimalPart == 0) {
		decimalPart = "00";
	}
	else if (decimalPart < 10) {
		decimalPart = "0" + decimalPart;	
	}
	newPrice += decimalPart;
	return newPrice;
}

// Function returns string representation in Kg of given number
function weightIt(weight) {
	return weight+" Kg";
}

function loadCatData()
{
  var tmp = "\<script language=\"Javascript\" src=\""+datasource+productType+".js\"><\/script>";
  document.writeln(tmp);
  tmp = "\<script language=\"Javascript\" src=\""+datasource+productType+"cat"+categoryCode+".js\"><\/script>";
  document.writeln(tmp);
}

var productHighlighCols=2;

function displayBrands()
{
  document.writeln("<tr>");
  document.writeln(" <td valign=top colspan=5>");
	document.writeln("<table align=\"center\" width=\"940\" cellspacing=\"0\" cellpadding=\"5\" border=\"0\">");
	for (var i = 0; i < productHighlighCols; i++)
	{
		document.writeln("<COL WIDTH=\"300\">");
	}
	document.writeln("  <tr><td colspan="+productHighlighCols+" align=\"center\">");
	document.writeln("<p><h1>Featured Brands and Product Lines</h1></p>");
	document.writeln("  </td></tr>");

	var tmphighlightnum=1;
	for (var i=0; i < root2.length; i++)
	{
		if (root2[i][0][4] == 1)
		{
			if (tmphighlightnum == 1)
			{
				document.writeln("<tr>");
			}
			document.writeln("  <td valign=top align=center>");
			document.writeln("<a href=\""+root2[i][0][1]+"\"><img src=\"Images/"+root2[i][0][3]+"highlight.gif\" alt=\"\" border=\"0\"></a>");
			document.writeln("<table align=\"center\" width=\"300\" cellspacing=\"0\" cellpadding=\"5\" border=\"0\">");
			document.writeln("  <tr><td align=center>");
			document.writeln("<a href=\""+root2[i][0][1]+"\"><img src=\""+datasource+"Images/"+root2[i][0][3]+".gif\" alt=\"\" border=\"0\" width=100></a>");
			document.writeln("<br>");
			document.writeln(root2[i][0][5]);
			document.writeln("  </td></tr>");
			document.writeln("</table>");
			document.writeln("  </td>");
			if (tmphighlightnum == productHighlighCols)
			{
				document.writeln("</tr>");
				tmphighlightnum=1;
			} else
			{
				tmphighlightnum+=1;
			}
		}
	}
	document.writeln("	</table></td></tr>");

}

function displayIndex()
{
  displayTop("Home");
  displayMenu("Home");
  displayHome();
  displayExtra();
	if (homepageDisplayOption == 0)
	{
  	displayBrands();
	}
  displayBottom();
selectMenu(2);
}

var root = new Array();
var root2 = new Array();
var tmpproductnum = 0;

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "zymol"; // Written Name
root2[tmpproductnum][0][1] = "about.html?cat=zymol"; // Default Link
root2[tmpproductnum][0][2] = "zymolproductsmenu"; // Image Menu
root2[tmpproductnum][0][3] = "zymol"; // Logo & Highlight Image
root2[tmpproductnum][0][4] = 1; // 1 == Active
root2[tmpproductnum][0][5] = "You may be new to the art of caring for and enhancing the appearence of your vehicle. Or you may be an old hand at doing it (with other maker's products). The zymöl system has some basic differences from as well as similarities to any other system on the market or which you may have used.";
tmpproductnum+= 1;

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "Aqua Gleam";
root2[tmpproductnum][0][1] = "products.html?cat=aquagleam&cc=010&pc=Zenti125";
root2[tmpproductnum][0][2] = "aquagleamproductsmenu";
root2[tmpproductnum][0][3] = "aquagleam";
root2[tmpproductnum][0][4] = 1;
root2[tmpproductnum][0][5] = "The final stage of any good car wash system is a pure water rinse that ensures a spot free finish. Now, thanks to the Aqua Gleam in-line filter you can enjoy the benefits of virtually pure water, giving you a spot free finish when washing your car at home.";
tmpproductnum+= 1;


/*
root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "Poorboys";
root2[tmpproductnum][0][1] = "about.html?cat=poorboys";
root2[tmpproductnum][0][2] = "poorboysproductsmenu";
root2[tmpproductnum][0][3] = "poorboys";
root2[tmpproductnum][0][4] = 1;
root2[tmpproductnum][0][5] = "Don't expect fancy packaging...it isn't needed. Do expect ease of use, fast results and an amazing shine. Isn't that what we all want anyway? Poorboy's World Detailing Products sell because people simply love them!";
tmpproductnum+= 1;

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "Pinnacle";
root2[tmpproductnum][0][1] = "about.html?cat=pinnacle";
root2[tmpproductnum][0][2] = "pinnacleproductsmenu";
root2[tmpproductnum][0][3] = "pinnacle";
root2[tmpproductnum][0][4] = 1;
root2[tmpproductnum][0][5] = "Pinnacle Natural Brilliance is a great product line, with Souverän wax at the forefront. Souverän is known world wide as one the best Carnaubas for longevity, protection, and most of all for the incredibly deep, wet sparkle which is what everyone who knows what they want in a car finish wants.";
tmpproductnum+= 1;

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "Wolfgang";
root2[tmpproductnum][0][1] = "about.html?cat=wolfgang";
root2[tmpproductnum][0][2] = "wolfgangproductsmenu";
root2[tmpproductnum][0][3] = "wolfgang";
root2[tmpproductnum][0][4] = 1;
root2[tmpproductnum][0][5] = "After years of trial and testing, research and experimentation Wolfgang has been launched as a concourse worthy range with a high tech paint sealant as its nucleus. The resulting line of products stems from highly advanced German super polymers that are not widely available.";
tmpproductnum+= 1;

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "Detailers Pride";
root2[tmpproductnum][0][1] = "about.html?cat=detailerspride";
root2[tmpproductnum][0][2] = "detailersprideproductsmenu";
root2[tmpproductnum][0][3] = "detailerspride";
root2[tmpproductnum][0][4] = 1;
root2[tmpproductnum][0][5] = "From the same stable as Pinnacle and Wolfgang, Detailers Pride has recently undergone a full product and branding upgrade.";
tmpproductnum+= 1;

*/

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "Battery";
root2[tmpproductnum][0][1] = "about.html?cat=batterycharger";
root2[tmpproductnum][0][2] = "batterychargermenu";
root2[tmpproductnum][0][3] = "batterycharger";
root2[tmpproductnum][0][4] = 1;
root2[tmpproductnum][0][5] = "Bainbridge Technologies deliver a wide range of quality DC to AC and AC to DC power systems and solutions for applications such as boats, recreational vehicles, caravans, motorhomes, 4X4's, utility/emergency vehicles, commercial environments and remote power applications.";
tmpproductnum+= 1;

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "Covercraft";
root2[tmpproductnum][0][1] = "about.html?cat=covercraft";
root2[tmpproductnum][0][2] = "covercraftproductsmenu";
root2[tmpproductnum][0][3] = "covercraft";
root2[tmpproductnum][0][4] = 1;
root2[tmpproductnum][0][5] = "In 1965, Covercraft was opened for business by Bob Lichtmann in Southern California’s San Fernando Valley. At that time, it was just a 2-man operation, manufacturing custom-patterned car covers for street rods, the import sports car market and aftermarket automotive parts suppliers.";
tmpproductnum+= 1;

root2[tmpproductnum] = new Array();
root2[tmpproductnum][0] = new Array();
root2[tmpproductnum][0][0] = "KW Suspension";
root2[tmpproductnum][0][1] = "kwintro.html";
root2[tmpproductnum][0][2] = "kwproductsmenu";
root2[tmpproductnum][0][3] = "KW";
root2[tmpproductnum][0][4] = 0;
root2[tmpproductnum][0][5] = "";
tmpproductnum+= 1;

var defaultColour = "666666";


var root3 = new Array();
tmpproductnum = 0;

root3[tmpproductnum] = new Array();
root3[tmpproductnum][0] = new Array();
root3[tmpproductnum][0][0] = "Detailing Accessories";
root3[tmpproductnum][0][1] = "category.html?cat=detailingaccessories&cc=010";
root3[tmpproductnum][0][2] = "detailingaccessoriesproductsmenu";
root3[tmpproductnum][0][3] = "detailingaccessories";
root3[tmpproductnum][0][4] = 1;
root3[tmpproductnum][0][5] = "";
tmpproductnum+= 1;

root3[tmpproductnum] = new Array();
root3[tmpproductnum][0] = new Array();
root3[tmpproductnum][0][0] = "Washing Products";
root3[tmpproductnum][0][1] = "category.html?cat=washing&cc=010";
root3[tmpproductnum][0][2] = "washingproductmenu";
root3[tmpproductnum][0][3] = "washing";
root3[tmpproductnum][0][4] = 1;
root3[tmpproductnum][0][5] = "";
tmpproductnum+= 1;

root3[tmpproductnum] = new Array();
root3[tmpproductnum][0] = new Array();
root3[tmpproductnum][0][0] = "Cleaning/Polish Products";
root3[tmpproductnum][0][1] = "category.html?cat=cleaning&cc=010";
root3[tmpproductnum][0][2] = "cleaningproductmenu";
root3[tmpproductnum][0][3] = "cleaning";
root3[tmpproductnum][0][4] = 1;
root3[tmpproductnum][0][5] = "";
tmpproductnum+= 1;

root3[tmpproductnum] = new Array();
root3[tmpproductnum][0] = new Array();
root3[tmpproductnum][0][0] = "Protect/Wax Products";
root3[tmpproductnum][0][1] = "category.html?cat=protect&cc=010";
root3[tmpproductnum][0][2] = "protectproductmenu";
root3[tmpproductnum][0][3] = "protect";
root3[tmpproductnum][0][4] = 1;
root3[tmpproductnum][0][5] = "";
tmpproductnum+= 1;


document.writeln("<SCRIPT language=\"JavaScript\" type=\"text/javascript\" src=\""+datasource+"menuoverride.js\"></SCRIPT>");