
var lastID = 0;
function SelectImg(hostedsitepath, imageName) {
	var imgMaxWidth = 250;
	var imgMaxHeight = 250;
	var imgName = document.getElementById('image')
	imgName.src = hostedsitepath + "product_images/info/" + imageName;
	var imgNameHid = document.getElementById('hid_imageName')
	imgNameHid.name = imageName;

	imgName.removeAttribute('width');
	imgName.removeAttribute('height');
	var imgWidth = imgName.naturalWidth || imgName.width;
	var imgHeight = imgName.naturalHeight || imgName.height;
	
	if (imgWidth > imgMaxWidth)
	{
		imgName.width = imgMaxWidth;
		imgName.height = imgHeight;
	} else if (imgHeight > imgMaxHeight)
	{
		imgName.height = imgMaxHeight;
		imgName.width = imgWidth;
	} else {
		imgName.height = imgHeight;
		imgName.width = imgWidth;
	}
}




// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = false;

// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=auto,statusbar=0,toolbar=0,menubar=0,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(hostedsitepath, imageName,imageTitle,thumb){
	if (thumb) {
		imageURL = hostedsitepath + "product_images/" + imageName
	} else {
		imageURL = hostedsitepath + "product_images/" + document.getElementById('hid_imageName').name
	}

	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;} a {color: #000; font: 12px arial;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('	 if (isIE){');
		writeln('		width=document.images[0].width+40;');
		writeln('		height=100-(document.body.clientHeight-document.images[0].height)+50;');
		writeln('		if (height > 600) {');
		writeln('		window.resizeTo(width,600);');
		writeln('		} else {');
		writeln('		window.resizeTo(width,600);');
		writeln('		}}');
		writeln('	 if (isNN){');
		writeln('		width=document.images["img_imageToDisplay"].width+40;');
		writeln('		height=document.images["img_imageToDisplay"].height+40;');
		writeln('		if (height > 600)');
		writeln('		{');
		writeln('		window.innerWidth=width;');
		writeln('		window.innerHeight=600;');
		writeln('		} else {');
		writeln('		window.innerWidth=width;');
		writeln('		window.innerHeight=height;');
		writeln('		}');
		writeln('		}');
		writeln('}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		if (!AutoClose) 
			writeln('</head><body bgcolor="#FFFFFF" scroll="auto" onload="reSizeToImage();doTitle();self.focus()">')
		else 
			writeln('</head><body bgcolor="#FFFFFF" scroll="auto" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<CENTER><div id="largeImage"><a href="javascript:window.close();"><img name="img_imageToDisplay" src='+imageURL+' style="display:block"><BR />Close window</a></CENTER></body></html>');
		close();
	}
}

function placeValue(string,formField,formName){
eval("document." + formName+ "." + formField + ".value = string;");
}

function decision(message, url){
	if(confirm(message)) location.href = url;
}

function SwitchMenu(obj){
	if(document.getElementById){
	var tab = document.getElementById("tabs").getElementsByTagName("a");
	var el = document.getElementById(obj);
	var ar = document.getElementById("cont").getElementsByTagName("DIV");
	obj = Right(obj,1);
		if(ar[obj].style.display != "block") {
			if(el.style.display == "none"){
				for (var i=0; i<ar.length; i++){
					tab['menu_'+i].className = 'inactive';
					ar[i].style.display = "none";
				}
				tab['menu_'+obj].className = 'active';
				el.style.display = "block";
			}
		}
	}
}
function Right(STRING,CHARACTER_COUNT){
return STRING.substring((STRING.length - CHARACTER_COUNT),STRING.length);
}


function submitFormVariants(variantID,prdID) {
	document.forms["frm_products"].buy.value = variantID;
	document.forms["frm_products"].prdID.value = prdID;
	document.forms["frm_products"].submit();
}

function submitFormKit(hosted_site_path, prdID) {
	document.forms["frm_products"].buy.value = prdID;
	document.forms["frm_products"].prdID.value = prdID;
	document.forms["frm_products"].action = hosted_site_path + 'kit.asp';
	document.forms["frm_products"].submit();
}

<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
		}
	}
}
mcAccessible = function() {
	var mcEls = document.getElementById("nav").getElementsByTagName("A");
	for (var i=0; i<mcEls.length; i++) {
		mcEls[i].onfocus=function() {
			this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
			this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sfhover"; //li < a:focus
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < a:focus
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < ul < li < a:focus
				}
			}
		}
		mcEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
			this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				}
			}
		}
	}
}

// only ie needs the sfHover script. all need the accessibility script...
// thanks http://www.brothercake.com/site/resources/scripts/onload/
if(window.addEventListener) window.addEventListener('load', mcAccessible, false); // gecko, safari, konqueror and standard
else if(document.addEventListener) document.addEventListener('load', mcAccessible, false); // opera 7
else if(window.attachEvent) { // win/ie
	window.attachEvent('onload', sfHover);
	window.attachEvent('onload', mcAccessible);
} else { // mac/ie5
	if(typeof window.onload == 'function') {
		var existing = onload;
		window.onload = function() {
			existing();
			sfHover();
			mcAccessible();
		}
	} else {
		window.onload = function() {
			sfHover();
			mcAccessible();
		}
	}
}

//--><!]]>
