
// JavaScript Document
  Image1Red = 'http://www.headnhome.com/layout/start_red.gif';
  Image2Red = 'http://www.headnhome.com/layout/webshop_red.gif';
  Image3Red = 'http://www.headnhome.com/layout/our_hats_red.gif';
  Image4Red = 'http://www.headnhome.com/layout/about_us_red.gif';
  Image5Red = 'http://www.headnhome.com/layout/espanol_red.gif';
  Image1Blue = 'http://www.headnhome.com/layout/start_blue.gif';
  Image2Blue = 'http://www.headnhome.com/layout/webshop_blue.gif';
  Image3Blue = 'http://www.headnhome.com/layout/our_hats_blue.gif';
  Image4Blue = 'http://www.headnhome.com/layout/about_us_blue.gif';
  Image5Blue = 'http://www.headnhome.com/layout/espanol_blue.gif';
  Image1BlueBigger = 'http://www.headnhome.com/layout/bigger_blue_home.gif';
  Image2BlueBigger = 'http://www.headnhome.com/layout/webshop_blue_bigger.gif';
  Image3BlueBigger = 'http://www.headnhome.com/layout/bigger_blue_ourhats.gif';
  Image4BlueBigger = 'http://www.headnhome.com/layout/bigger_blue_aboutus.gif';
  Image5BlueBigger = 'http://www.headnhome.com/layout/bigger_blue_esp';

m0off_1 = -267;
m1off_1 = -170;
m2off_1 = -79;
m3off_1 = 12;
//m3offNav = 0;
m4off_1 = 103;

m0off_2 = -176;
m1off_2 = -267;
m2off_2 = -79;
m3off_2 = 12;
//m3offNav = 0;
m4off_2 = 103;

m0off_3 = -85;
m1off_3 = -267;
m2off_3 = -176;
m3off_3 = 12;
//m3offNav = 0;
m4off_3 = 103;

m0off_4 = 6;
m1off_4 = -267;
m2off_4 = -176;
m3off_4 = -85;
//m3offNav = 0;
m4off_4 = 103;

m0off_5 = 103;
m1off_5 = -267;
m2off_5 = -176;
m3off_5 = -85;
//m3offNav = 0;
m4off_5 = 6;





moveAll = 10;

ypos = 202;


function isInteger(s) {
if (s == "") return;
for (i = 0 ; i < s.length ; i++) {
if ((s.charAt(i) < '0') || (s.charAt(i) > '9')) return false
}
return true;
}

function getTax(zip)
{
	if(zip>= 90000 && zip <97000)
	  return 8.25;
	else
	  return 0;
}


function hej()
{
   document.writeln(document.body.offsetHeight);

   document.writeln(document.body.clientHeight);

   document.writeln(document.documentElement.clientHeight);

   document.writeln(document.body.offsetWidth);

   document.writeln(document.body.clientWidth);

   document.writeln(document.documentElement.clientWidth);

document.write("<br />Browser name: "+ BrowserDetect.browser);
document.write("<br />");


}

function showMenu(doc, nr, xoff)
{
    //m3off = 10;
	if(nr==1)
	  name="menu1";
	else if(nr==2)
	  name="menu2";
	else if(nr==3)
	  name="menu3";
	else if(nr==4)
	  name="menu4";
	else if(nr==0)
	  name="menuActive";
	

minW = 859;
yoff = 0;

browser = BrowserDetect.browser

if(browser=="Firefox")
{
   minW=857;
   yoff = -8;
   xoff = xoff + 5;
   //m3off += m3offNav;
   //document.writeln("Netscape");
}
else if(browser=="Safari")
{
   minW=856;
   yoff = -31;
   xoff = xoff + 3;
   //m3off += m3offNav;
	//document.writeln("Safari");
}
else if(browser=="Chrome")
{
   minW=856;
   yoff = -25;
   xoff = xoff + 4;
   //m3off += m3offNav;
	//document.writeln("Safari");
}
else
{
   yoff = -10;
}

if (doc.innerHeight) // all except Explorer
{
	W = self.innerWidth;
}
else if (doc.documentElement && doc.documentElement.clientHeight)
	// Explorer 6 Strict Mode
{
	W = doc.documentElement.clientWidth;
}
else if (document.body) // other Explorers
{
	W = document.body.clientWidth;
}

if(W>minW)
  xpos = Math.floor (W / 2) + xoff + moveAll;
else
  xpos = Math.floor (minW/2) + xoff + moveAll;
		  

    if (doc.all)
    {
		doc.all[name].style.left=xpos+"px";
		doc.all[name].style.top=(ypos + yoff) +"px";
	    doc.all[name].style.visibility="visible";      //Explorer 4,5 har denna hierarki
    }
    else if (doc.layers)
    {
	    doc.layers[name].style.left=xpos+"px";
		doc.layers[name].style.top=(ypos + yoff)+"px";
		doc.layers[name].style.visibility="visible";
	                                        //Netscape 4 har denna hierarki
    }
    else if (doc.getElementById)
    {
		doc.getElementById(name).style.left=xpos+"px";
		doc.getElementById(name).style.top=(ypos + yoff)+"px";
	    doc.getElementById(name).style.visibility="visible";    //Netscape 6 har denna hierarki
    }
  //hej();
}


function hideMenu(doc, nr)
{
	if(nr==1)
	  name="menu1";
	else if(nr==2)
	  name="menu2";
	else if(nr==3)
	  name="menu3";
	else if(nr==4)
	  name="menu4";
	  
    if (doc.all)
    {
	  doc.all[name].style.visibility="hidden";      //Explorer 4,5 har denna hierarki
    }
    else if (doc.layers)
    {
	  doc.layers[name].visibility="hidden";         //Netscape 4 har denna hierarki
    }
    else if (doc.getElementById)
    {
	  doc.getElementById(name).style.visibility="hidden";    //Netscape 6 har denna hierarki
    }
	
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
