function SubmitPSE1()
{
  InsertHidden(document.LANSA, 'PRODTYPE', '');
  document.LANSA.PRODTYPE.value=document.productDetailedSearch.product_type.value;
  InsertHidden(document.LANSA, 'PRIMCOLR', '');
  document.LANSA.PRIMCOLR.value=document.productDetailedSearch.primary_color.value;
  InsertHidden(document.LANSA, 'ACNTCOLR', '');
  document.LANSA.ACNTCOLR.value=document.productDetailedSearch.accent_color.value;
  InsertHidden(document.LANSA, 'DSPTHEME', '');
  document.LANSA.DSPTHEME.value=document.productDetailedSearch.theme.value;
  InsertHidden(document.LANSA, 'KEYWORD', '');
  document.LANSA.KEYWORD.value=' ';
  InsertHidden(document.LANSA, 'PATTERN', '');
  document.LANSA.PATTERN.value=' ';
  InsertHidden(document.LANSA, 'CURRPAGE', '');
  document.LANSA.CURRPAGE.value='00';
  InsertHidden(document.LANSA, 'STDRENTRY', '');
  document.LANSA.STDRENTRY.value=' ';
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function SubmitPSE2()
{
  InsertHidden(document.LANSA, 'PRODTYPE', '');
  document.LANSA.PRODTYPE.value=' ';
  InsertHidden(document.LANSA, 'PRIMCOLR', '');
  document.LANSA.PRIMCOLR.value=' ';
  InsertHidden(document.LANSA, 'ACNTCOLR', '');
  document.LANSA.ACNTCOLR.value=' ';
  InsertHidden(document.LANSA, 'DSPTHEME', '');
  document.LANSA.DSPTHEME.value=' ';
  InsertHidden(document.LANSA, 'KEYWORD', '');
  document.LANSA.KEYWORD.value=' ';
  InsertHidden(document.LANSA, 'PATTERN', '');
  document.LANSA.PATTERN.value=document.productPatternSearch.pattern.value;
  InsertHidden(document.LANSA, 'CURRPAGE', '');
  document.LANSA.CURRPAGE.value='00';
  InsertHidden(document.LANSA, 'STDRENTRY', '');
  document.LANSA.STDRENTRY.value=' ';
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function SubmitPSE3()
{
  InsertHidden(document.LANSA, 'PRODTYPE', '');
  document.LANSA.PRODTYPE.value=' ';
  InsertHidden(document.LANSA, 'PRIMCOLR', '');
  document.LANSA.PRIMCOLR.value=' ';
  InsertHidden(document.LANSA, 'ACNTCOLR', '');
  document.LANSA.ACNTCOLR.value=' ';
  InsertHidden(document.LANSA, 'DSPTHEME', '');
  document.LANSA.DSPTHEME.value=' ';
  InsertHidden(document.LANSA, 'KEYWORD', '');
  document.LANSA.KEYWORD.value=document.productKeywordSearch.product_type.value;
  InsertHidden(document.LANSA, 'PATTERN', '');
  document.LANSA.PATTERN.value=' ';
  InsertHidden(document.LANSA, 'CURRPAGE', '');
  document.LANSA.CURRPAGE.value='00';
  InsertHidden(document.LANSA, 'STDRENTRY', '');
  document.LANSA.STDRENTRY.value=' ';
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function SubmitPSENxt()
{
  document.LANSA.STDRENTRY.value=' ';
  document.LANSA.CURRPAGE.value=parseInt(document.LANSA.CURRPAGE.value,10) + 1;
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function SubmitPSEPrv()
{
  document.LANSA.STDRENTRY.value=' ';
  document.LANSA.CURRPAGE.value=parseInt(document.LANSA.CURRPAGE.value,10) - 1;
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function SubmitPrddtlSample()
{
  document.LANSA.STDRENTRY.value='S';
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function SubmitPrddtlCart()
{
  document.LANSA.STDRENTRY.value='C';
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function SubmitPrddtlMyLib()
{
  document.LANSA.STDRENTRY.value='M';
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function SubmitPrddtlToggle(nxtitem)
{
  document.LANSA.STDRENTRY.value=' ';
  document.LANSA.WW3DTLINT.value='N';
  document.LANSA.YWCITEM.value=nxtitem;
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function PrddtlRun(item)
{
  newURL = location.protocol+'//'+location.host+'/cgi-bin/lansaweb?webapp=WPRDDET1+webrtn=RUN+part='+g_lxmlPartition+'+lang='+g_lxmlLang+'+f(IMLITM)='+item;
  newURL = newURL+'+f(KEYWORD)='+document.LANSA.KEYWORD.value+'+f(PATTERN)='+document.LANSA.PATTERN.value+'+f(PRODTYPE)='+document.LANSA.PRODTYPE.value;
  newURL = newURL+'+f(PRIMCOLR)='+document.LANSA.PRIMCOLR.value+'+f(ACNTCOLR)='+document.LANSA.ACNTCOLR.value+'+f(DSPTHEME)='+document.LANSA.DSPTHEME.value;
  newURL = newURL+'+f(STDWEBC01)='+document.LANSA.STDWEBC01.value;
  newWindow=window.open(newURL, 'RunInformation', 'Height=380,Width=600,status=yes,help=no,resizable=yes,menubar=no,scrollbars=yes,toolbar=no,');
}
function PrddtlSpec(specurl)
{
    newURL = location.protocol+'//'+location.host+specurl;
    newWindow=window.open(newURL, 'SpecSheet', 'Height=480,Width=800,status=yes,help=no,resizable=yes,menubar=no,scrollbars=yes,toolbar=no,');
}
function PrddtlFire(fireurl)
{
    newURL1 = location.protocol+'//'+location.host+fireurl;
    newWindow1=window.open(newURL1, 'FireSheet', 'Height=480,Width=800,status=yes,help=no,resizable=yes,menubar=no,scrollbars=yes,toolbar=no,');
}
function SubmitPrddtlSampleItem(item)
{
  document.LANSA.STDRENTRY.value='S';
  document.LANSA.IMLITM.value=item;
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function SubmitPrddtlCartItem(item)
{
  document.LANSA.STDRENTRY.value='C';
  document.LANSA.IMLITM.value=item;
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function SubmitPrddtlMyLibItem(item)
{
  document.LANSA.STDRENTRY.value='M';
  document.LANSA.IMLITM.value=item;
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function Estimator()
{
  newURL = location.protocol+'//'+location.host+'/include/popup/roll_estimator.htm';
  window.open(newURL, 'estimator', 'titlebar=1,menubar=0,resizable=1,scrollbars=1,left=0,top=0,height=650,width=600');
}
function mikesTest()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}
function ReturnToSearch()
{
  if (document.LANSA.INARMTYP.value != '')
  {
  HandleEvent('WPHOTO1', 'PHOTOD1', document.LANSA, null);
  return;
  }
  if (document.LANSA.INROOMSET.value != '')
  {
  HandleEvent('WPHOTO2', 'PHOTOD2', document.LANSA, null);
  return;
  }
  if (document.LANSA.INWCSE.value != '')
  {
  HandleEvent('WCSE', 'CRESULT', document.LANSA, null);
  return;
  }
  if (document.LANSA.INBRDCOL.value != '')
  {
  HandleEvent('WBRAND3', 'BRANDD3', document.LANSA, null);
  return;
  }
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function SubmitBRAND3Nxt()
{
  document.LANSA.STDRENTRY.value=' ';
  document.LANSA.CURRPAGE.value=parseInt(document.LANSA.CURRPAGE.value,10) + 1;
  HandleEvent('WBRAND3', 'BRANDD3', document.LANSA, null);
}
function SubmitBRAND3Prv()
{
  document.LANSA.STDRENTRY.value=' ';
  document.LANSA.CURRPAGE.value=parseInt(document.LANSA.CURRPAGE.value,10) - 1;
  HandleEvent('WBRAND3', 'BRANDD3', document.LANSA, null);
}
function isValidNumber2(theObj, length, decimals, decimalPoint)
{
	var integers = length - decimals;
	if( theObj != null )
	{
		var valueStr = theObj.value;
		if( valueStr.length <= 0 ) return true;
		var re = new RegExp("^[+]?\\d{0," + integers + "}(\\" + decimalPoint + "\\d{0," + decimals + "})?$");

        return showMessageOnFalse(theObj, stdGetMTextMessageText("BadNum", integers, decimals), re.test(valueStr));
	}
	return showMessageOnFalse(theObj, stdGetMTextMessageText("BadNum", integers, decimals), false);
}
function CreateExcelSheet1(inFile)
{
  newURL = location.protocol+'//'+location.host+inFile;
  newWindow=window.open(newURL, 'EXCEL', 'Height=480,Width=800,status=yes,help=no,resizable=yes,menubar=no,scrollbars=yes,toolbar=no,');
}
function submitKeywordSearch()
{
  InsertHidden(document.LANSA, 'KEYWORD', '');
  document.LANSA.KEYWORD.value=document.LANSA2.query.value;
  InsertHidden(document.LANSA, 'CURRPAGE', '');
  document.LANSA.CURRPAGE.value='00';
  document.LANSA.STDRENTRY.value=' ';
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null, 'HTTP:');
}
function stdCheckboxClickedWW3(checkBox, WAMName, WRName, formName, protocol, target, RFld, chkValue, unchkValue, amount)
{
	var f = getParentForm(checkBox);
	if (f != null)
	{
		var fld = f.elements[RFld];
		if( fld != null )
		{
			fld.value = checkBox.checked ? chkValue : unchkValue;
		}
	}
	if ((WAMName != '') && (WRName != ''))
	{
		if (formName != '') f = createStdHiddenForm(WAMName, WRName, formName, protocol, target);
		if (f != null)
		{
			createReentryFields(f, checkBox.parentNode);
			submitForm(f, WAMName, WRName, target, protocol);
		}
	}
	if (checkBox.checked)
	{
		var calcFld=parseFloat(document.LANSA.WW3TOTPAY.value,10)+amount
		var str = "" + Math.round (eval(calcFld) * Math.pow(10,2));
		while (str.length <= 2) {
			str = "0" + str;
		}
		var decpoint = str.length - 2
		document.LANSA.WW3TOTPAY.value=str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
	} else 	{
		var calcFld=parseFloat(document.LANSA.WW3TOTPAY.value,10)-amount
		var str = "" + Math.round (eval(calcFld) * Math.pow(10,2));
		while (str.length <= 2) {
			str = "0" + str;
		}
		var decpoint = str.length - 2
		document.LANSA.WW3TOTPAY.value=str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
	}
}
function ww3SetShipAddr(csname, saddr1, saddr2, cscity, sstate, spstal, scntry, csnbr)
{
  var a=document.getElementById("LW3CSNAME");
  a.value=csname;
  var b=document.getElementById("LW3SADDR1");
  b.value=saddr1;
  var c=document.getElementById("LW3SADDR2");
  c.value=saddr2;
  var d=document.getElementById("LW3CSCITY");
  d.value=cscity;
  var e=document.getElementById("LW3SSTATE");
  e.value=sstate;
  var f=document.getElementById("LW3SPSTAL");
  f.value=spstal;
  var g=document.getElementById("LW3SCNTRY");
  g.value=scntry;
  var h=document.getElementById("LW3IS001");
  h.value=csnbr;
  var i=document.getElementById("CHG_FLAG");
  i.value='N';
}
function useShipAddr()
{
  var a=document.getElementById("LW3CSNAME");
  var b=document.getElementById("LW3CBNAME");
  b.value=a.value;
  var a=document.getElementById("LW3SADDR1");
  var b=document.getElementById("LW3BADDR1");
  b.value=a.value;
  var a=document.getElementById("LW3SADDR2");
  var b=document.getElementById("LW3BADDR2");
  b.value=a.value;
  var a=document.getElementById("LW3CSCITY");
  var b=document.getElementById("LW3CBCITY");
  b.value=a.value;
  var a=document.getElementById("LW3SSTATE");
  var b=document.getElementById("LW3BSTATE");
  b.value=a.value;
  var a=document.getElementById("LW3SPSTAL");
  var b=document.getElementById("LW3BPSTAL");
  b.value=a.value;
  var a=document.getElementById("LW3SCNTRY");
  var b=document.getElementById("LW3BCNTRY");
  b.value=a.value;
  var i=document.getElementById("CHG_FLAG");
  i.value='N';
}
function fixCmnt(fld) {
  if (fld.value == ' ') {
    fld.value=''
  }
}
function continueShopping() {
  newUrl = newURL = location.protocol+'//'+location.host+'/static/products/main';
  window.location=newUrl;
}
function submitPressSearch(imgid)
{
  InsertHidden(document.LANSA, 'KEYWORD', '');
  document.LANSA.KEYWORD.value=' ';
  InsertHidden(document.LANSA, 'PATTERN', '');
  document.LANSA.PATTERN.value=' ';
  InsertHidden(document.LANSA, 'PRODTYPE', '');
  document.LANSA.PRODTYPE.value=' ';
  InsertHidden(document.LANSA, 'PRESS', '');
  document.LANSA.PRESS.value=imgid;
  InsertHidden(document.LANSA, 'CURRPAGE', '');
  document.LANSA.CURRPAGE.value='00';
  document.LANSA.STDRENTRY.value=' ';
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null, 'HTTP:');
}
function SubmitPSEPag(selpag)
{
  document.LANSA.STDRENTRY.value='P';
  document.LANSA.NEWNBRPAG.value=selpag;
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function SubmitPSECPg(clkpag)
{
  document.LANSA.STDRENTRY.value='K';
  document.LANSA.CLKNBRPAG.value=clkpag;
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
gblViewMenuIsOn = false;
function showHideViewMenu(control_ID, intOption)
{
   objMenuControl = document.getElementById(control_ID);
   objMenuControl2 = document.getElementById(control_ID + "2");
      if(gblViewMenuIsOn)
	{
	gblViewMenuIsOn = false;			
	menuObj = document.getElementById('viewMenuContainer');
	menuObj.style.display = "none";	
		
	// Make the arrow go left...
	objMenuControl.style.backgroundImage = "url('/images/arrowLeft.gif')";
	}
	else
	{
	gblViewMenuIsOn = true;				
	menuObj = document.getElementById('viewMenuContainer');			
	menuObj.style.top = (findPos(objMenuControl)[1]+ 24) + "px";
	menuObj.style.left = (findPos(objMenuControl)[0]) + "px";	
	menuObj.style.display = "block";
		
	// Make the arrow go down...
	objMenuControl.style.backgroundImage = "url('/images/arrowDown.gif')";
	}
		
	if(arguments.length == 2)
	{
	// Set selection option in display and hidden field...
	objMenuControl.innerHTML = "View " + Number(intOption) + " per page";
	objMenuControl2.innerHTML = "View " + Number(intOption) + " per page";
	document.getElementById('NBRPAG').value = intOption;
	// Submit the page...
	SubmitPSEPag(intOption);
	}
}
		
/* Function returns the absolute position of any web-object on a page...*/
function findPos(obj) 
{
   var curleft = curtop = 0;
   if(obj.offsetParent) 
   {
	curleft = obj.offsetLeft
	curtop = obj.offsetTop
	while(obj = obj.offsetParent) 
         {
	  curleft += obj.offsetLeft
	  curtop += obj.offsetTop
	  }
   }
/* Returns an array of the element's x/y coordinates... */
return [curleft,curtop];
}
// jQuery: onload, insert menu block...
$(document).ready(insertViewMenuBockBeforeRootDiv)
function insertViewMenuBockBeforeRootDiv()
{
  if (!(document.getElementById('root')))
  {
     return;
  }
  newObj = document.createElement("div");
  newObj.id = 'viewMenuContainer';
  newObj.innerHTML = "<div onClick=\"showHideViewMenu('arrowContainer','09');\">View 09 per page</div><div onClick=\"showHideViewMenu('arrowContainer','18');\">View 18 per page</div><div onClick=\"showHideViewMenu('arrowContainer','27');\">View 27 per page</div><div onClick=\"showHideViewMenu('arrowContainer','36');\">View 36 per page</div><div onClick=\"showHideViewMenu('arrowContainer','45');\">View 45 per page</div>";
  rootObj = document.getElementById('root');
  rootObj.parentNode.insertBefore(newObj, rootObj);
}
function SubmitBRAND3Pag(selpag)
{
  document.LANSA.STDRENTRY.value='P';
  document.LANSA.NEWNBRPAG.value=selpag;
  HandleEvent('WBRAND3', 'BRANDD3', document.LANSA, null);
}
function SubmitBRAND3CPg(clkpag)
{
  document.LANSA.STDRENTRY.value='K';
  document.LANSA.CLKNBRPAG.value=clkpag;
  HandleEvent('WBRAND3', 'BRANDD3', document.LANSA, null);
}
function showHideViewMenu2(control_ID, intOption)
{
   objMenuControl = document.getElementById(control_ID);
   objMenuControl2 = document.getElementById(control_ID + "2");
      if(gblViewMenuIsOn)
	{
	gblViewMenuIsOn = false;			
	menuObj = document.getElementById('viewMenuContainer2');
	menuObj.style.display = "none";	
		
	// Make the arrow go left...
	objMenuControl.style.backgroundImage = "url('/images/arrowLeft.gif')";
	}
	else
	{
	gblViewMenuIsOn = true;				
	menuObj = document.getElementById('viewMenuContainer2');			
	menuObj.style.top = (findPos(objMenuControl)[1]+ 24) + "px";
	menuObj.style.left = (findPos(objMenuControl)[0]) + "px";	
	menuObj.style.display = "block";
		
	// Make the arrow go down...
	objMenuControl.style.backgroundImage = "url('/images/arrowDown.gif')";
	}
		
	if(arguments.length == 2)
	{
	// Set selection option in display and hidden field...
	objMenuControl.innerHTML = "View " + Number(intOption) + " per page";
	objMenuControl2.innerHTML = "View " + Number(intOption) + " per page";
	document.getElementById('NBRPAG').value = intOption;
	// Submit the page...
	SubmitBRAND3Pag(intOption);
	}
}
// jQuery: onload, insert menu block...
$(document).ready(insertViewMenuBockBeforeRootDv2)
function insertViewMenuBockBeforeRootDv2()
{
  if (!(document.getElementById('root')))
  {
     return;
  }
  newObj = document.createElement("div");
  newObj.id = 'viewMenuContainer2';
  newObj.innerHTML = "<div onClick=\"showHideViewMenu2('arrowContainer','09');\">View 09 per page</div><div onClick=\"showHideViewMenu2('arrowContainer','18');\">View 18 per page</div><div onClick=\"showHideViewMenu2('arrowContainer','27');\">View 27 per page</div><div onClick=\"showHideViewMenu2('arrowContainer','36');\">View 36 per page</div><div onClick=\"showHideViewMenu2('arrowContainer','45');\">View 45 per page</div>";
  rootObj = document.getElementById('root');
  rootObj.parentNode.insertBefore(newObj, rootObj);
}
function CloseOutCart()
{
  InsertHidden(document.LANSA, 'RTNFLG', '');
  document.LANSA.RTNFLG.value='N';
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function CloseOutCartRtn()
{
  InsertHidden(document.LANSA, 'RTNFLG', '');
  document.LANSA.RTNFLG.value='Y';
  HandleEvent('WPSE', 'RESULTS', document.LANSA, null);
}
function CloseOutCartCSE()
{
  InsertHidden(document.LANSA, 'RTNFLG', '');
  document.LANSA.RTNFLG.value='N';
  HandleEvent('WCSE', 'CRESULT', document.LANSA, null);
}
function CloseOutCartCSERtn()
{
  InsertHidden(document.LANSA, 'RTNFLG', '');
  document.LANSA.RTNFLG.value='Y';
  HandleEvent('WCSE', 'CRESULT', document.LANSA, null);
}
function CloseOutCartPrdDtl()
{
  InsertHidden(document.LANSA, 'RTNFLG', '');
  document.LANSA.RTNFLG.value='N';
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function CloseOutCartPrdDtlRtn()
{
  InsertHidden(document.LANSA, 'RTNFLG', '');
  document.LANSA.RTNFLG.value='Y';
  HandleEvent('WPRDDET1', 'LWBOE07D1', document.LANSA, null);
}
function SbmReturnForm()
{
  InsertHidden(document.LANSA, 'WCUSTNAME', ''); 
  document.LANSA.WCUSTNAME.value=objForm.name.value; 
  HandleEvent('WRETURN', 'RETURNS', document.LANSA, null);
}
function RPhotoRun(item)
{
  newURL = location.protocol+'//'+location.host+'/cgi-bin/lansaweb?webapp=WPRDDET1+webrtn=RUN+part='+g_lxmlPartition+'+lang='+g_lxmlLang+'+f(IMLITM)='+item;
  newURL = newURL+'+f(STDWEBC01)='+document.LANSA.STDWEBC01.value;
  newWindow=window.open(newURL, 'RunInformation', 'Height=380,Width=600,status=yes,help=no,resizable=yes,menubar=no,scrollbars=yes,toolbar=no,');
}
