var ns4 = document.layers;
var op5 = (navigator.userAgent.indexOf("Opera 5")!=-1)||(navigator.userAgent.indexOf("Opera/5")!=-1);
var op6 = (navigator.userAgent.indexOf("Opera 6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1);
var agt=navigator.userAgent.toLowerCase();
var mac = (agt.indexOf("mac")!=-1);
var ie = (agt.indexOf("msie") != -1); 
var mac_ie = mac && ie;

var imageWin = null;

floatX=5;
floatY=120;
layermargin=0;
layerwidth=146;
layerheight=400;
delayspeed=0;
floatBarMaxHeight=684;

NS6=false;
IE4=(document.all);
if (!IE4) {NS6=(document.getElementById);}
NS4=(document.layers);
//ileftX=getRealLeft("LeftBar");
//irightX=getRealLeft("RightBar");
//ifloatY=getRealTop("LeftBar");
ileftX=floatX;
irightX=floatX;
ifloatY=floatY;

rightLastX=-1;
leftLastX=-1;
lastY=-1;
prevY=-1;


  <!-- ******************** BEGIN Floating Navigation Bar code ******************** -->
function floatBarInit() {
floatBarDefine();
window.onresize=floatBarDefine;
floatBarAdjust();
}

function floatBarDefine() {
	leftX=ileftX;
	rightX=document.body.offsetWidth-irightX-layerwidth-layermargin;
	floatY=ifloatY;
}

function floatBarAdjust() {
if (document.all){
  if (leftLastX==-1 || delayspeed==0) {
		leftLastX=document.body.scrollLeft + leftX;
		rightLastX=document.body.scrollLeft + document.body.offsetWidth-irightX-layerwidth-layermargin;
		lastY=getScrollPosY() + floatY;

  } else {
	var dx=Math.abs(document.body.scrollLeft+leftX-leftLastX);
	var dy=Math.abs(document.body.scrollTop+floatY-lastY);
	var d=Math.sqrt(dx*dx+dy*dy);
	var c=Math.round(d/10);
	if (document.body.scrollLeft+leftX>leftLastX) leftLastX=leftLastX+delayspeed+c;
	if (document.body.scrollLeft+leftX<leftLastX) leftLastX=leftLastX-delayspeed-c;
	if (document.body.scrollLeft+rightX>rightLastX) rightLastX=rightLastX+delayspeed+c;
	if (document.body.scrollright+rightX<rightLastX) rightLastX=rightLastX-delayspeed-c;
	if (document.body.scrollTop+floatY>lastY) lastY=lastY+delayspeed+c;
	if (document.body.scrollTop+floatY<lastY) lastY=lastY-delayspeed-c;
  }
		document.all['LeftBarLayer'].style.posLeft = leftLastX;
if(floatBarMaxHeight<getWindowHeight())document.all['LeftBarLayer'].style.posTop = lastY;
		document.all['RightBarLayer'].style.posLeft = rightLastX;
if(floatBarMaxHeight<getWindowHeight())document.all['RightBarLayer'].style.posTop = lastY;

} else if ((NS4) || (NS6)) {
  if (leftLastX==-1 || delayspeed==0) {
		leftLastX=window.pageXOffset + leftX;
		rightLastX=window.pageXOffset + rightX;
		lastY=window.pageYOffset + floatY;
  } else {
	var dx=Math.abs(window.pageXOffset+leftX-leftLastX);
	var dy=Math.abs(window.pageYOffset+floatY-lastY);
	var d=Math.sqrt(dx*dx+dy*dy);
	var c=Math.round(d/10);
	if (window.pageXOffset+leftX>leftLastX) {leftLastX=leftLastX+delayspeed+c;}
	if (window.pageXOffset+leftX<leftLastX) {leftLastX=leftLastX-delayspeed-c;}
	if (window.pageXOffset+rightX>rightLastX) {rightLastX=rightLastX+delayspeed+c;}
	if (window.pageXOffset+rightX<rightLastX) {rightLastX=rightLastX-delayspeed-c;}
	if (window.pageYOffset+floatY>lastY) {lastY=lastY+delayspeed+c;}
	if (window.pageYOffset+floatY<lastY) {lastY=lastY-delayspeed-c;}
  }
  if (NS4){
			document.layers['LeftBarLayer'].pageX = leftLastX;
			document.layers['LeftBarLayer'].pageY = lastY;
			document.layers['RightBarLayer'].pageX = rightLastX;
			document.layers['RightBarLayer'].pageY = lastY;
  }
  if (NS6){
			document.getElementById('LeftBarLayer').style.left=leftLastX+"px";
			document.getElementById('LeftBarLayer').style.top=lastY+"px";
			document.getElementById('RightBarLayer').style.left=rightLastX+"px";
			document.getElementById('RightBarLayer').style.top=lastY+"px";
  }
}
	if (lastY != prevY) 
	{
		prevY = lastY;
	}

	setTimeout('floatBarAdjust()',50);
}

function getWindowHeight() { 
	if (document.all) return document.body.offsetHeight; 
    else return window.innerHeight; 
} 

function getWindowWidth() { 
    if (document.all) return document.body.offsetWidth; 
    else return window.innerWidth; 
} 

function getScrollPosY() {
    if (document.body && document.body.scrollTop)
      return document.body.scrollTop;
    if (document.documentElement && document.documentElement.scrollTop)
      return document.documentElement.scrollTop;
    if (window.pageYOffset)
      return window.pageYOffset;
    return 0;
}

function convertSemiColons(prodDescrText) {
document.write('<div style="padding:10px;">'+prodDescrText.replace(/;/g,"<br>")+'</div>');
} 

  <!-- ******************** END of Floating Navigation Bar code ******************** -->
function getRealLeft(el) {
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getRealTop(el) {
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while(tempEl != null){
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

function showHideMenuNode(node_id, image_id){
	n = document.getElementById(node_id);
	i = document.getElementById(image_id);
	if(n){
		n.style.display = n.style.display == "none" ? "block" : "none";
		if(i){
			i.src = n.style.display == "none" ? skin_images + "/menu_tree_plus.gif" : skin_images + "/menu_tree_minus.gif";
		}
	}
}


function getElementHeight(Elem) {
	if(ns4){
		var elem = document.getElementById(Elem);
		return elem.clip.height;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) { 
			xPos = elem.style.pixelHeight;
		} else {
			xPos = elem.offsetHeight;
		}
		return xPos;
	} 
}

function getElementWidth(Elem) {
	if (ns4) {
		var elem = document.getElementById(Elem);
		return elem.clip.width;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) {
			xPos = elem.style.pixelWidth;
		} else {
			xPos = elem.offsetWidth;
		}
		return xPos;
	}
}


if(document.layers){
	_browser = "nn";
}
if(document.all){
	_browser = "ie";
}
if(navigator.userAgent.toLowerCase().match("gecko")){
	_browser= "gecko";
}
function isEmail(entry){
	var rex= /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,5})(\]?)$/;
	return rex.test(entry);
}

function delay(gap){ /* gap is in millisecs */
	var then, now; 
	then = new Date().getTime();
	now = then;
	while((now-then) < gap){
		now=new Date().getTime();
	}
}

function showProductImage(image_url, image_width, image_height){
	image_width = image_width == "" ? 400 : image_width;
	image_height = image_height == "" ? 380 : image_height;

	var w = screen.width;
	var h = screen.height;
	var ww = image_width * 1 + 20;
	var wh = image_height * 1 + 35;
	var wx = (w - ww)/2;
	var wy = (h - wh)/2;
	
	if(imageWin != null){
		imageWin.close();
	}
	imageWin = null;
	imageWin = window.open(
		"", 
		"ProductImageWindow", 
		"titlebar=yes, toolbar=no, menubar=no, status=no, directories=no, resizable=yes, scrollbars=yes, top=" + wy.toString() + ", left=" + wx.toString() + ", width=" + ww.toString() + ", height=" + wh.toString() + ""
	);
	while(imageWin==null);
	imageWin.focus();
	
	imageWin.document.body.innerHTML = "";
	imageWin.document.write('<body style="padding:10px;margin:0px">');
	imageWin.document.write('<div align="center"><img hspace="0" vspace="0" src="' + image_url + '"></div><br/>');
	imageWin.document.write('<div align="center" style="font-family:arial;font-color:black;font-size:11px;"><a href="javascript:window.close();" style="color:#0000AA;">Close Window</a></div>');
	imageWin.document.write('</body>');
	imageWin.width = ww;
	imageWin.height = wh;
}

function showPrinterPage(url){
	var prWin = null;
	prWin = window.open(
		url,
		"PrintVer", 
		"titlebar=yes, toolbar=no, menubar=yes, status=yes, directories=no, resizable=yes, scrollbars=yes, top=20, left=20, width=810, height=600"
	);
	while(prWin==null);
	prWin.focus();
}
productWin = null;
function showProductPage(url){
	productWin = null;
	productWin = window.open(
		url,
		"Product", 
		"titlebar=yes, toolbar=no, menubar=no, status=no, directories=no, resizable=yes, scrollbars=yes, top=20, left=20, width=540, height=600"
	);
	while(productWin==null);
	productWin.focus();
}

function closeProductPage(){
	if (productWin!=null) window.productWin.close();
	productWin = null;
}

function OnButton(bt){
	document.images[bt].src = skin_images + bt + "_on.gif";
	
}
function OffButton(bt){
	document.images[bt].src = skin_images + bt + "_off.gif";
}

function OnMenu(cid){
	document.images["menul_" + cid].src = skin_images + "catl_bg_on.gif";
	document.all["menur_" + cid].background = skin_images + "catr_bg_on.gif";
}
function OffMenu(cid){
	document.images["menul_" + cid].src = skin_images + "catl_bg_off.gif";
	document.all["menur_" + cid].background = skin_images + "catr_bg_off.gif";
}
var RecentTimeOut, CartTimeOut;

function ShowCart(){
	window.clearTimeout(CartTimeOut);
	if(_browser == "ie"){
		cartDiv.style.visibility = 
			cartDiv.style.visibility == "hidden"?"visible":"hidden";
			document.images["cartImage"].src =
				cartDiv.style.visibility == "hidden"?
				(skin_images + "ic_expand.gif"):
				(skin_images + "ic_collapse.gif");
	}
	else if(_browser == "gecko"){
		document.getElementById('cartDiv').style.visibility = 
			document.getElementById('cartDiv').style.visibility == "hidden"?"visible":"hidden";
		document.images["cartImage"].src =
			document.getElementById('cartDiv').style.visibility == "hidden"?
			(skin_images + "ic_expand.gif"):
			(skin_images + "ic_collapse.gif");
	}
	else{
		document.cartDiv.visibility = document.cartDiv.visibility  == "hidden"?"visible":"hidden";
	}
	closeProductPage();
}


function ShowRecent(){
	window.clearTimeout(RecentTimeOut);
	if(_browser == "ie"){
		recentDiv.style.visibility = 
			recentDiv.style.visibility == "hidden"?"visible":"hidden";
		document.images["recentImage"].src =
			recentDiv.style.visibility == "hidden"?
			(skin_images + "ic_expand.gif"):
			(skin_images + "ic_collapse.gif");
	}
	else if(_browser == "gecko"){
		document.getElementById('recentDiv').style.visibility = 
			document.getElementById('recentDiv').style.visibility == "hidden"?"visible":"hidden";
		document.images["recentImage"].src =
			document.getElementById('recentDiv').style.visibility == "hidden"?
			(skin_images + "ic_expand.gif"):
			(skin_images + "ic_collapse.gif");
	}
	else{
		document.recentDiv.visibility = document.recentDiv.visibility  == "hidden"?"visible":"hidden";
	}
}

function PopUpCart(){
	CartTimeOut = window.setTimeout('ShowCart();', 1000);
}

function PopUpRecent(){
	RecentTimeOut = window.setTimeout('ShowRecent();', 1000);
}

function OnMenu(img){
	document.images[img].src = skin_images + "menu_arrow_on.gif";
}
function OffMenu(img){
	document.images[img].src = skin_images + "menu_arrow.gif";
}

function ShowPopup(src){
	var bWin = null;
	bWin = window.open(
		src, 
		"PopupWind", 
		"titlebar=no, toolbar=no, menubar=no, status=no, directories=no, resizable=no, scrollbars=no, top=20, left=20, width=320, height=240"
	);
	while(bWin==null);
	bWin.focus();
}

function PopUpImage(image_source, image_width, image_height){
	var bWin = null;
	bWin = window.open(
		image_source, 
		"ImageWind", 
		"titlebar=no, toolbar=no, menubar=no, status=no, directories=no, resizable=no, scrollbars=no, top=20, left=20, width=" + (image_width + 20) + ", height=" + (image_height + 20)
	);
	while(bWin==null);
	bWin.focus();
}

function ConfirmLogout(){
	if(orderItemsCount > 0){
		if(confirm("You have items in your cart. Logging out will empty your cart\nAre you sure want to continue?")){
			document.location = urlLogout;
		}
	}
	else{
		if(confirm("Do you really want to logout?")){
			document.location = urlLogout;
		}
	}
}

function CartConfirmDeleteItem(ocid){
	if(confirm(msg_confirm_delete_item)){
		document.location = CartDeleteItemUrl + '&ocid=' + ocid;
	}
}
function CartConfirmEmpty(){
	if(confirm(msg_confirm_empty_cart)){
		document.location = CartEmptyUrl;
	}
}