if(!typeof(w3url)=='string'||typeof(w3url)=='undefined'||!w3url.substring(0,4)=='http') {
	var w3url; // this should come in from user web page but if not, set it to default w3shoppingcart
	(location.href.substring(0,5)=="https")?w3url="https://w3safesecure.com/w3shoppingcart":w3url="http://www.w3shoppingcart.com";	 
}  
/* 
 SCRIPTS HERE FOR TOP MENU SLIDE(DROP)-DOWNS 
USING JQUERY 
*/ 
document.write('<sc');document.write('ript language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></s');document.write('cript>');
function getElemOffset(what, offsettype){
	return (what.offsetParent)? what[offsettype]+getElemOffset(what.offsetParent, offsettype) : what[offsettype];
}
function getElementTopPosition(id) {
	if(getContainer(id)) return getContainer(id).offsetTop; 
   /* the below returns the offset from the entire document, not the offset from the TD parent */
	//if(getContainer(id)) return getElemOffset(getContainer(id), "offsetTop");//+"px";    
    return -1;
} 
function getElementLeftPosition(id) {  
	if(getContainer(id)) return getContainer(id).offsetLeft; 
	/* the below returns the offset from the entire document, not the offset from the TD parent */
	//if(getContainer(id)) return getElemOffset(getContainer(id), "offsetLeft");//+"px"; //getContainer() is in master.js  
	return -1;
}  
var isMenuDown;
function slideDownTopMenu(id) {  
	isMenuDown=eval("isMenuDown"+id);  
	if(!isMenuDown) {
			eval("isMenuDown" + id + "=true;"); // set dynamic variable=true; 
			var idDo = "#TopMenuSub"+id;
			//$(idDo).css('margin-top', '10');
			$(idDo).slideDown(300, "linear", function() {
			    // Animation complete.
				//alert("slide down done");   
			});
	}
}
function slideUpTopMenu(id) {  
	isMenuDown=eval("isMenuDown"+id); 
	if(isMenuDown) {
			eval("isMenuDown" + id + "=false;"); // set dynamic variable  
			var idDo = "#TopMenuSub"+id;
			  $(idDo).slideUp(300, "linear", function() {
			  	  // Animation complete.  
			  }); 
	  }
}  
if(!typeof(isK)=='boolean'||typeof(isK)=='undefined') {  
	var isK=0;
} 
function positionTopMenuSubs() {
	if(!typeof(TopMenuSubMenuIdArray)=='array'||typeof(TopMenuSubMenuIdArray)=='undefined') { 
		//no sub menus
	}
	else {  
		var subMenuDivId; var mainMenuSpanId; var mainMenuSpanContainer; var subMenuDivContainer; var top; var left; var ztop;
		for(var x=0; x<TopMenuSubMenuIdArray.length; x++) { 
			mainMenuSpanId = "TopMenu"+TopMenuSubMenuIdArray[x];
			subMenuDivId = "TopMenuSub"+TopMenuSubMenuIdArray[x]; 
			mainMenuSpanContainer=getContainer(mainMenuSpanId); 
			subMenuDivContainer=getContainer(subMenuDivId);
			if(mainMenuSpanContainer) { // && subMenuDivContainer
				// find the corresponding location of the SPAN that goes with it
				top = getElementTopPosition(mainMenuSpanId); // these are in cute cart net js script
				left = getElementLeftPosition(mainMenuSpanId);
				if(top>=0&&left>=0) {
					// position the submenu div here 
					 if(subMenuDivContainer) { 
					 	 ztop = top + TopMenuLetterHeightPx + 1 ;  // 0 works too
						 subMenuDivContainer.style.top = ztop + "px"; 
					 	 subMenuDivContainer.style.left = left+ "px";
					 }
				}
				else {  if(isK) alert(mainMenuSpanId + " SPAN POSITION does not exist on the page top/left: " + top + "/" + left);  }				
			} //IF 
			else { if(isK) alert(mainMenuSpanId + " SPAN CONTAINER id does not exist on the page"); }	
		}//FOR
	}
}
function closeAllSubMenus(exceptID) {
	if(!exceptID) exceptID=0;
	var subMenuDivContainer;
	var id=0;
	for(var x=0; x<TopMenuSubMenuIdArray.length; x++) { 
		id = TopMenuSubMenuIdArray[x];
		if(id != exceptID) { 
			subMenuDivContainer=getContainer("TopMenuSub"+id);
			 if(subMenuDivContainer) {  
				subMenuDivContainer.style.display="none";// do not use slide up!
				eval("isMenuDown" + id + "=false;"); // set dynamic variable  
			 }
		 }
	} 
}
function closeSubMenu(id) {
	var subMenuDivContainer=getContainer("TopMenuSub"+id);
	if(subMenuDivContainer) { 
		subMenuDivContainer.style.display="none"; // do not use slide up!
		eval("isMenuDown" + id + "=false;"); // set dynamic variable   
	}
}
function openSubMenu(id,how) {
	if(!how) how="slide";
	var subMenuDivContainer=getContainer("TopMenuSub"+id);
	if(subMenuDivContainer) {
		if(how=="slide") slideDownTopMenu(id);
		else {
			subMenuDivContainer.style.display="block";
			eval("isMenuDown" + id + "=true;"); // set dynamic variable 
		}
		//subMenuDivContainer.style.display="block"; // eventually use slide down 
	}
}
function checkMenuSubs(id) { 
	closeAllSubMenus(id);// close all sub menus except given id 
	openSubMenu(id,'slide'); // open this sub menu 
} 

// for new popup images in css / js
document.write('<link rel="stylesheet" type="text/css" href="'+w3url+'/srv/css/preview_templates.css">');
document.write('<sc');document.write('ript language="javascript" type="text/javascript" src="'+w3url+'/srv/js/loader.js"></s');document.write('cript>');
document.write('<sc');document.write('ript language="javascript" type="text/javascript" src="'+w3url+'/srv/js/preview_templates.js"></s');document.write('cript>');
// for validating forms and other util stuff
document.write('<sc');document.write('ript language="javascript" type="text/javascript" src="'+w3url+'/srv/js/master.js"></s');document.write('cript>');
// vars for create target js vars
var myHeight = self.screen.height-25;
var myWidth = 660;
var isResizable = true;    
function sForm(theForm) {  // pop
	if (!formValidate(theForm)) return false;
	createTarget(theForm);
	return true; 
} 
function sFormFull(theForm) {  // full and frame-in
	if (!formValidate(theForm)) return false; 
	return true; 
} 
function createTarget(form) {  
	form.target = "foobar";// change the target of the form
	var attribs="height="+myHeight+",width="+myWidth+",left=0,top=0,scrollbars=1,menu=0,location=0,toolbar=1,resizable=1,status=1";
	var zwin = window.open("",form.target,attribs);  
	if(typeof(focus)=="function") zwin.focus();	 
	return true;
} 
function popUpImage(sImgPath, iImgW, iImgH, windo, idescr) { 
	if (!windo) windo='wr' + Math.floor(Math.random()*10001); // random number 0 - 10000
	var zPopWidth=iImgW+20;
	var zPopHeight=iImgH+75; 
	var hasDescription=false; 
	if (idescr && idescr.length > 0) {
		hasDescription=true;
		zPopHeight=zPopHeight+35;
	}
	// align center screen
	var pTop=  (screen.height - (zPopHeight+50)) / 2; // wTop = document.body.scrollTop+50;  
	var pLeft =  (screen.width - (zPopWidth+50)) / 2;    
	var sHeader = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n<head>\n<title>Enlarged Image</title>\n<script language=\"javascript\" type=\"text/javascript\">\n<!--\nwindow.focus();\n//-->\n</script></head>\n<body>\n"; 
	var sFooter = "</body>\n</html>";
	var oWin = window.open(windo, null, "width=" + zPopWidth + ",height=" + zPopHeight + ",left=" + pLeft + ",top=" + pTop + ",directories=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0"); 
	oWin.document.open();
	oWin.document.write(sHeader);
	if (hasDescription)  {
		oWin.document.write("<div align=left style=\"font-family:arial,helvetica,sans-serif;font-size:12px;color:black;margin-bottom:2px;\">" + idescr + "</div>\n"); 
	}
	oWin.document.write("<div align=center><IMG SRC=\"" + sImgPath + "\" width=" + iImgW + " height=" + iImgH + ">\n"); 
	oWin.document.write("<div style=\"margin:3px;\"><a href=\"javascript:window.close();\" style=\"font-size:10px;font-weight:normal;font-family:arial,helvetica,sans-serif;color:blue\">CLOSE WINDOW</a></div></div>");
	oWin.document.write(sFooter);
	oWin.document.close();
}  
function switchCatGroup(group) {  
	if (document.getElementById) {
		ck_navgp="navDiv" + group;
		ck_bodgp="group" + group;
		ck_nav=document.getElementById(ck_navgp).innerHTML;
		ck_bod=document.getElementById(ck_bodgp).innerHTML;
		document.getElementById("navDivTop").innerHTML=ck_nav;
		document.getElementById("navDivBottom").innerHTML=ck_nav;
		document.getElementById("prodDiv").innerHTML=ck_bod;
	}
	else {
		ck_navTop="navDivTop.innerHTML=navDiv" + group + ".innerHTML";
		ck_navBottom="navDivBottom.innerHTML=navDiv" + group + ".innerHTML";
		ck_bod="prodDiv.innerHTML=group" + group + ".innerHTML";
		eval(ck_bod);
		eval(ck_navTop);
		eval(ck_navBottom);
	}
}   

