var busy=false;function AddDirectlyToShopCart(form,count,isEmb)
{var BooleanRes=validateProductDisForm(form,count,isEmb);var catalogId=document.getElementById('WC_CachedProductItemDisplay_FormInput_catalogId_In_OrderItemAddForm_1').value;String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");}
if(!busy&&BooleanRes==true){var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;dataString.trim();}
form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}}
function Add2ShopCartEmbSel(form,count,isEmb)
{var BooleanRes=validateProductDisForm(form,count,isEmb);var catalogId=document.getElementById('WC_CachedProductItemDisplay_FormInput_catalogId_In_OrderItemAddForm_1').value;if(catalogId==12551){isEmb=0;}
String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");}
if(!busy&&BooleanRes==true){if(isEmb==0){var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;dataString.trim();}
form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}else{var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
var foilQtyLess=false;if(isEmb==3){for(var i=0;i<form.length;i++){if(form.elements[i].name.substring(0,9)=="quantity_"){if(form.elements[i].value<25){foilQtyLess=true;}}}}
for(var i=0;i<form.length;i++){if(form.elements[i].name!="URL"){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;}}
if(foilQtyLess==true&&isEmb==3){form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}else if(isEmb==3){form.action=contextAndURLpattern+"FoilStampSelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value=dataString;form.submit();}else{form.action=contextAndURLpattern+"EmbroiderySelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.falshDetect.value=flashDetect();form.URL.value=dataString;form.submit();}}}}
function Add2ShopCartEmbSelMultipleProducts(form,count,isEmb)
{var BooleanRes=validateProductDisForm(form,count,isEmb);String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");}
if(!busy&&BooleanRes==true){if(isEmb==0){var dataString="";var ctr=1;for(var i=1;i<=count;i++){var attrVal1="WC_attrValue_"+(ctr++);var attrVal2="WC_attrValue_"+(ctr++);if(document.getElementById(attrVal1)&&document.getElementById('attributesColor')){document.getElementById(attrVal1).value=document.getElementById('attributesColor').value;}
if(document.getElementById(attrVal2)&&document.getElementById('attributesCorColor')){document.getElementById(attrVal2).value=document.getElementById('attributesCorColor').value;}}
for(var i=0;i<form.length;i++){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;dataString.trim();}
form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}else{var dataString="";var ctr=1;for(var i=1;i<=count;i++){var attrVal1="WC_attrValue_"+(ctr++);var attrVal2="WC_attrValue_"+(ctr++);if(document.getElementById(attrVal1)&&document.getElementById('attributesColor')){document.getElementById(attrVal1).value=document.getElementById('attributesColor').value;}
if(document.getElementById(attrVal2)&&document.getElementById('attributesCorColor')){document.getElementById(attrVal2).value=document.getElementById('attributesCorColor').value;}}
var foilQtyLess=false;if(isEmb==3||isEmb==4){for(var i=0;i<form.length;i++){if(form.elements[i].name.substring(0,9)=="quantity_"){if(form.elements[i].value!=''&&form.elements[i].value<25){foilQtyLess=true;}}}}
for(var i=0;i<form.length;i++){if(form.elements[i].name!="URL"){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;}}
if(foilQtyLess==true&&isEmb==3){form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}else if(isEmb==3){form.action=contextAndURLpattern+"FoilStampSelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value=dataString;form.submit();}else if(isEmb==4){form.action=contextAndURLpattern+"VASMenuCoverSelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value=dataString;form.submit();}else{form.action=contextAndURLpattern+"EmbroiderySelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.falshDetect.value=flashDetect();form.URL.value=dataString;form.submit();}}}}
function Add2ShopCartPrdct(form,count)
{if(!busy){var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;}
form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}}
function Add2ShopCart(form,catEntryId,catEntryQuantity)
{if(!busy){busy=true;form.errorViewName.value=contextAndURLpattern+"CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}}
function Add2RFQ(form){if(form.Type[0].checked){form.action=contextAndURLpattern+"RFQCreateDisplay?endresult=0";}else{form.action=contextAndURLpattern+"AddToExistRFQListDisplay?isContract=Y";}
form.submit();}
function validateProductDisForm(form,count,isEmb){var chooseCol="";var cornerAtr="";if(count!=0){var lengthAtr="";if(document.getElementById('attributesColor')){chooseCol=document.getElementById('attributesColor').options[document.getElementById('attributesColor').selectedIndex].value;}
if(document.getElementById('WC_CachedProduct_AttrName_1')){lengthAtr=document.getElementById('WC_CachedProduct_AttrName_1').value;}
if(isEmb==3&&document.getElementById('attributesCorColor')){cornerAtr=document.getElementById('attributesCorColor').options[0].selected;}
if(document.getElementById('attributesColor')&&chooseCol==""){if(lengthAtr=="SIZEMENI"){alert("Please select a Length");return false;}else{alert("Please select a color");return false;}}
if(document.getElementById('attributesCorColor')&&cornerAtr==true&&chooseCol!=""){alert("Please select a Corner Color");return false;}}
var BooleanValue=false;for(var i=0;i<form.length;i++){if(form.elements[i].name.substring(0,9)=="quantity_"){if(form.elements[i].value>0){BooleanValue=true;}}}
if(BooleanValue==false){alert("Please enter an order quantity");return false;}
return true;}
function Add2CustomGSShopCartEmbSel(form,count,isEmb)
{var BooleanRes=validateProductDisForm(form,count,isEmb);String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");}
if(!busy&&BooleanRes==true){if(isEmb==0){var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;dataString.trim();}
form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}else{var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){if(form.elements[i].name!="URL"){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;}}
if(isEmb==1||isEmb==2){form.action=contextAndURLpattern+"GuestServicesEmbSelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value=dataString;form.submit();}}}}
function Add2CustomMCShopCartEmbSel(form,count,isEmb)
{var BooleanRes=validateProductDisForm(form,count,isEmb);String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");}
if(!busy&&BooleanRes==true){if(isEmb==0){var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;dataString.trim();}
form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}else{var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){if(form.elements[i].name!="URL"){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;}}
if(isEmb==1){form.action=contextAndURLpattern+"McGrathsEmbSelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value=dataString;form.submit();}}}}
function Add2CustMCCormicShopCartEmbSel(form,count,isEmb)
{var BooleanRes=validateProductDisForm(form,count,isEmb);String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");}
if(!busy&&BooleanRes==true){if(isEmb==0){var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;dataString.trim();}
form.action=contextAndURLpattern+"OrderItemUpdate";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value='SetPendingOrder?URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.&attrName*=&memberId*=&attrValue*=&quantity*=&partNumber*=&attrValueColor*=';form.submit();}else{var dataString="";for(var i=1;i<=count;i++){var attrValname='WC_attrValue_'+i;if(document.getElementById(attrValname)&&document.getElementById('attributesColor')){document.getElementById(attrValname).value=document.getElementById('attributesColor').value;}}
for(var i=0;i<form.length;i++){if(form.elements[i].name!="URL"){dataString=form.elements[i].name+"="+ form.elements[i].value.toString()+"&"+ dataString;}}
if(isEmb==1){form.action=contextAndURLpattern+"McCormickEmbSelectionView";form.errorViewName.value="CatalogItemAddErrorView";form.URL.value=dataString;form.submit();}}}}
function flashDetect(){if(swfobject.hasFlashPlayerVersion("10")){return"true";}else{return"false";}}
