<!--
// Set global path
// var pth = new String (document.location);
// if (pth.indexOf("localhost") > 0) pth = "http://localhost:9080/storefrontMod/twos/";
// else if (pth.indexOf("mayaman") > 0) pth = "http://mayaman:9080/storefrontMod/twos/";
//	 else pth = "http://ecommerce.twoscompany.com:9080/storefrontMod/twos/";
//
var doDebug = false;
//
var pthShop = new String (document.location);
if (pthShop.indexOf("localhost") > 0) pthShop = "http://localhost:9080/storefrontB2BWEB/";
else if (pthShop.indexOf("mayaman") > 0) pthShop = "http://mayaman:9080/storefrontB2BWEB/";
	 else pthShop = "/storefrontB2BWEB/";
//
var pth = pthShop + "twos/";
//
// Disable right-mouse click script
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")  
//
// Rollver image script
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
     x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
     if ((x=MM_findObj(a[i]))!=null){
	     document.MM_sr[j++]=x; 
		 //alert(a[i]);
	     if(!x.oSrc) x.oSrc=x.src; 
		 x.src=a[i+2];
     }
}

function f_setImage(imgName) {
	var s = new String( MM_findObj(imgName).src );
	s = s.replace(/Off\.gif/i, "On.gif");
	MM_findObj(imgName).src = s;
}

var pageSection = "";
var loc = new String(document.location);
if (loc.search(/\/shop\//i) > 0) pageSection = "shop";
else {
	if (loc.search(/\/collections\//i) > 0) pageSection = "collections";
	if (loc.search(/\/company\//i) > 0) pageSection = "company";
	if (loc.search(/\/contact\//i) > 0) pageSection = "contact";
	if (loc.search(/\/press\//i) > 0) pageSection = "press";
	if (loc.search(/\/showrooms\//i) > 0) pageSection = "showrooms";
	if (loc.search(/\/stores\//i) > 0) pageSection = "stores";
}

function f_navPreload() {
	// var loc = new String(document.location);
	// if (loc.search(/\/shop\//i) > 0) f_setImage("ShopImg1");
	// if (loc.search(/\/collections\//i) > 0) f_setImage("CollectionsImg1");
	// if (loc.search(/\/company\//i) > 0) f_setImage("CompanyImg1");
	// if (loc.search(/\/contact\//i) > 0) f_setImage("ContactImg1");
	// if (loc.search(/\/press\//i) > 0) f_setImage("PressImg1");
	// if (loc.search(/\/showrooms\//i) > 0) f_setImage("ShowroomsImg1");
	// if (loc.search(/\/stores\//i) > 0) f_setImage("StoresImg1");
	var img = new Array();
	img[0] = pth + 'images/navShopOn.gif',
	img[1] = pth + 'images/navCollOn.gif',
	img[2] = pth + 'images/navShowOn.gif',
	img[3] = pth + 'images/navPressOn.gif',
	img[4] = pth + 'images/navStoresOn.gif',
	img[5] = pth + 'images/navContactOn.gif',
	img[6] = pth + 'images/navCompOn.gif';
    MM_preloadImages(img[0], img[1], img[2], img[3], img[4], img[5], img[6]);
}

function f_genNavi() {
	var nText = "";
	nText += '<table cellpadding="0" cellspacing="0"><tr>';
	if (pageSection == "shop") nText += '<td><a href="' + pthShop + 'z_home.do#view=shop" > <img src="' + pth + 'images/navShopOn.gif" name="ShopImg1" width="43" height="25" border="0" id="ShopImg1"></a></td>';
	else nText += '<td><a href="' + pthShop + 'z_home.do#view=shop" onMouseOver="MM_swapImage(\'ShopImg1\',\'\',\'' + pth + 'images/navShopOn.gif\',0)" onMouseOut="MM_swapImgRestore()"> <img src="' + pth + 'images/navShopOff.gif" name="ShopImg1" width="43" height="25" border="0" id="ShopImg1"></a></td>';
	if (pageSection == "collections") nText += '<td><a href="' + pthShop + 'z_home.do#view=collection"> <img src="' + pth + 'images/navCollOn.gif" name="CollectionsImg1" width="134" height="25" border="0" id="CollectionsImg1"></a></td>';
	else nText += '<td><a href="' + pthShop + 'z_home.do#view=collection" onMouseOver="MM_swapImage(\'CollectionsImg1\',\'\',\'' + pth + 'images/navCollOn.gif\',0)" onMouseOut="MM_swapImgRestore()"> <img src="' + pth + 'images/navCollOff.gif" name="CollectionsImg1" width="134" height="25" border="0" id="CollectionsImg1"></a></td>';
	if (pageSection == "showrooms") nText += '<td><a href="' + pthShop + 'z_home.do#view=showroom"> <img src="' + pth + 'images/navShowOn.gif" name="ShowroomsImg1" width="99" height="25" border="0" id="ShowroomsImg1"></a></td>';
	else nText += '<td><a href="' + pthShop + 'z_home.do#view=showroom" onMouseOver="MM_swapImage(\'ShowroomsImg1\',\'\',\'' + pth + 'images/navShowOn.gif\',0)" onMouseOut="MM_swapImgRestore()"> <img src="' + pth + 'images/navShowOff.gif" name="ShowroomsImg1" width="99" height="25" border="0" id="ShowroomsImg1"></a></td>';
	if (pageSection == "press") nText += '<td><a href="' + pthShop + 'z_home.do#view=press" > <img src="' + pth + 'images/navPressOn.gif" name="PressImg1" width="56" height="25" border="0" id="PressImg1"></a></td>';
	else nText += '<td><a href="' + pthShop + 'z_home.do#view=press" onMouseOver="MM_swapImage(\'PressImg1\',\'\',\'' + pth + 'images/navPressOn.gif\',0)" onMouseOut="MM_swapImgRestore()"> <img src="' + pth + 'images/navPressOff.gif" name="PressImg1" width="56" height="25" border="0" id="PressImg1"></a></td>';
	if (pageSection == "stores") nText += '<td><a href="' + pthShop + 'z_home.do#view=store" > <img src="' + pth + 'images/navStoresOn.gif" name="StoresImg1" width="124" height="25" border="0" id="StoresImg1"></a></td>';
	else nText += '<td><a href="' + pthShop + 'z_home.do#view=store" onMouseOver="MM_swapImage(\'StoresImg1\',\'\',\'' + pth + 'images/navStoresOn.gif\',0)" onMouseOut="MM_swapImgRestore()"> <img src="' + pth + 'images/navStoresOff.gif" name="StoresImg1" width="124" height="25" border="0" id="StoresImg1"></a></td>';
	if (pageSection == "contact") nText += '<td><a href="' + pthShop + 'z_home.do#view=contact" > <img src="' + pth + 'images/navContactOn.gif" name="ContactImg1" width="82" height="25" border="0" id="ContactImg1"></a></td>';
	else nText += '<td><a href="' + pthShop + 'z_home.do#view=contact" onMouseOver="MM_swapImage(\'ContactImg1\',\'\',\'' + pth + 'images/navContactOn.gif\',0)" onMouseOut="MM_swapImgRestore()"> <img src="' + pth + 'images/navContactOff.gif" name="ContactImg1" width="82" height="25" border="0" id="ContactImg1"></a></td>';
	if (pageSection == "company") nText += '<td><a href="' + pthShop + 'z_home.do#view=company" > <img src="' + pth + 'images/navCompOn.gif" name="CompanyImg1" width="80" height="25" border="0" id="CompanyImg1"></a></td>';
	else nText += '<td><a href="' + pthShop + 'z_home.do#view=collection#view=company" onMouseOver="MM_swapImage(\'CompanyImg1\',\'\',\'' + pth + 'images/navCompOn.gif\',0)" onMouseOut="MM_swapImgRestore()"> <img src="' + pth + 'images/navCompOff.gif" name="CompanyImg1" width="80" height="25" border="0" id="CompanyImg1"></a></td>';
	nText += '</tr></table>';
    // alert(nText);
    document.write(nText);
}

// Search page
function f_search(words) {
	if (words=="") return;
	document.location = "/storefrontB2BWEB/z_showcollection.do?search=" + escape(words);
	//document.location = "/storefrontB2BWEB/z_showcollection.do?collection=cameo";
}
// View cart
function f_viewCart() {
	document.location = "/storefrontB2BWEB/cart.do?action=cart_view";
}
// View cart
function f_showAccount() {
	document.location = "/storefrontB2BWEB/editaccount.do?action=edit_account";
}
// Show flash top login
function f_doFlashTopLogin(movie) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="337" height="25">');
    document.write('<param name="movie" value="' + movie + '">');
    document.write('<param name="wmode" value="transparent">');
    document.write('<param name="quality" value="high"><param name="SCALE" value="noborder"><param name="LOOP" value="false">');
    document.write('<embed src="' + movie + '" wmode="transparent" width="337" height="25" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="noborder"></embed>');
    document.write('</object>');
}
// Debug message
function f_debug(txt) {
	if (doDebug) {
		document.getElementById("debugger").style.visibility = "visible";
		document.getElementById("debugger").innerHTML=txt;
	}
}
// Execute simple search
function go_search(words) {
	// if (words=="") return;
	// alert("Searching with words " + words);
	// document.simpleSearchForm.keyword.value = words; 
	// document.simpleSearchForm.submit();
	f_search(words); 
}
//-->