var W3CDOM;
			W3CDOM = (document.getElementById) ? true : false;
			function hideMenu(id) {
				if (W3CDOM) {
					document.getElementById(id).style.visibility="hidden";
				}
			}
			function showMenu(id) {
				if (W3CDOM) {
					document.getElementById(id).style.visibility="visible";
				}
			}

function viewAnyOptions(optName,optType,typeCode) {
  var codeName;
  switch (typeCode) {
    case '': codeName = ''; break;
    case 'T': codeName = 'type'; break;
    case '2': codeName = 'ink2'; break;
  }
  var openStr;
  openStr = "ViewOptions.aspx?option=" + optName;
  if (!(codeName == '')) {
    openStr = openStr + "&" + codeName + "=" + optType;
  }
  window.open(openStr,"childWindow","toolbar=0,scrollbars,width=700,height=500")
}

function DesignOptionsWindow(imprintLine) {
          window.open("ViewDesignOptions.aspx?option=ink&line="+imprintLine,"childWindow","toolbar=0, scrollbars, width=700, height=500")
     }

function removeItem(){
    return confirm("WARNING, clicking OK will remove this item from your shopping cart! Click CANCEL to keep the item.") 
}

function ApplyInkToAll() {
	var ink1List = eval("document.Form1.IMPRINT_LINE_1_COLOR");
	var ink1Sel = ink1List.options[ink1List.selectedIndex].value;
	var inkNextList = '';
	var brkFlg = 0;
	for (i=2; i < 100; i++) {
		try {
		  inkNextList = eval("document.Form1.IMPRINT_LINE_" + i + "_COLOR");
		  if (inkNextList.length > 0) {
		    var inkCnt = inkNextList.length;
            for (j=0; j < inkCnt; j++) {
              if (inkNextList.options[j].value == ink1Sel) {
                inkNextList.selectedIndex = j; 
                break;
              }
            }
          }
		} catch(ex) {
		  brkFlg = 1;
		}
		if (brkFlg == 1) {
		  break;
		}
	}
}

function selectFont(Selection){
    var fontList = document.Form1.ImprintFontDDL;
    var fontCnt = fontList.length;
      for (i=0; i < fontCnt; i++) {
      if (fontList.options[i].value == Selection) {
        fontList.selectedIndex = i; 
		break;
      }
    }
}

function SelectCallerOpt(Selection,ListID){
    var OptList = eval("window.opener.document.Form1." + ListID);
    var OptCnt = OptList.length;
      for (i=0; i < OptCnt; i++) {
      if (OptList.options[i].value == Selection) {
        OptList.selectedIndex = i; 
		break;
      }
    }
    window.opener.document.Form1.submit();
    window.close();
}

function JSAssocCharge(itemName, company){
			  var allImprint = "";
			  var iHLen = 0;
			  var xHLen = 0;
			  var nNam = "";
			  var IDx = "";
			  var valx = "";
			  var oldChg = 0.00;
			  var newQty = 0;
			  var newChg = 0.00;
			  var priceLen = 0;
			  var oldPrice = 0;
			  var totalLen = 0;
			  var oldTotal = 0;
			  var newPrice = "";
			  var newTotal = "";
			  			  
			  var form = document.getElementById("Form1")
			  for(i = 0; i < form.length; i++) {
		        var tempobj = form.elements[i];
		        if(tempobj.alt == "assoc") {
			        allImprint = allImprint + tempobj.value;
			    }
			  }
			  
			  newQty = document.getElementById("QuantList").value * 1;
			  priceLen = document.getElementById("txtAssocImprintCharge").value.length;
			  oldChg = document.getElementById("txtAssocImprintCharge").value.substring(1,priceLen) * 1;
			  priceLen = (document.getElementById("txtItemPrice").value).replace(",","").length;
			  oldPrice = (document.getElementById("txtItemPrice").value).replace(",","").substring(1,priceLen) * 1;
			  totalLen = (document.getElementById("txtItemTotal").value).replace(",","").length;
			  oldTotal = (document.getElementById("txtItemTotal").value).replace(",","").substring(1,totalLen) * 1;
			  if (allImprint == "") {
				newPrice = oldPrice - oldChg;
				newTotal = oldTotal - oldChg;
				document.getElementById("txtAssocImprintCharge").value = "";
				}
			  else {  
			    if (itemName == "P5PE" | itemName == "P5PIVE" | itemName == "P4IV-E" | itemName == "P4WH-E" | itemName == "P3WH-E" | itemName == "P3IV-E" | itemName == "B4265WHE" | itemName == "E4256WHE" | itemName == "E4173WHE"){
			        if (newQty > 500){
			            newChg = (((newQty / 100) - 5 ) * 0.65) + 12.45;
			        } else {
			            newChg = 12.45;
			        }			    
			        if (newChg < 12.45){
			            newChg = 12.45;
			        }
			    }else{
			        if (company == "01"){			        
			            if (newQty<=100){
			                newChg = 15;
			            }else{
			                newChg = 15 + ((newQty - 100)/25)*2.5;
			            }
			        }else{
			            newChg = 10 + (newQty * .08);
			            if (newChg < 16){
			                newChg = 16;
			            }
			        }
			    }
			    newPrice = oldPrice - oldChg + newChg;
			    newTotal = oldTotal - oldChg + newChg;
                document.getElementById("txtAssocImprintCharge").value = formatCurrency(newChg); 
			  }
              //document.getElementById("txtItemPrice").value = formatCurrency(newPrice);
              document.getElementById("txtItemTotal").value = formatCurrency(newTotal); 
            }

            function formatCurrency(num) {
              num = num.toString().replace(/\$|\,/g,'');
              if(isNaN(num))
                num = "0";
                sign = (num == (num = Math.abs(num)));
                num = Math.floor(num*100+0.50000000001);
                cents = num%100;
                num = Math.floor(num/100).toString();
                if(cents<10)
                  cents = "0" + cents;
                  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
                     num = num.substring(0,num.length-(4*i+3))+','+
                     num.substring(num.length-(4*i+3));
                     return (((sign)?'':'-') + '$' + num + '.' + cents);
	        }
/*			
function chkFor123(inCat) {
  if (inCat == "9999") {
    window.location = "http://www.123print.com";
    return false;
  }
  else {
    return true;
  }
}
function CheckNumber(inFrmFld){
 var fldVal = document.getElementById(inFrmFld).value;
    if (fldVal != "" && isNaN(fldVal)) {
          window.alert("You must enter only numeric values for this field.");
       document.getElementById(inFrmFld).focus();
       return false;
   }
}
function AddtoCart(){
		document.Form1.action="addtocart.aspx"
		document.Form1.submit()
	}

function viewItem(preview) {
    window.open("LargePreview.aspx?image=" + preview,"NewWindow","toolbar=0, scrollbars")
}
function navContShop(){
    window.location.href("default.aspx", "_top")
}
function refresh(){
document.frmDisplayCart.submit();
}
function JSEditAssocCharge(itemName, company){
			  var allImprint = "";
			  var iHLen = 0;
			  var xHLen = 0;
			  var nNam = "";
			  var IDx = "";
			  var valx = "";
			  var oldChg = 0.00;
			  var newQty = 0;
			  var newChg = 0.00;
			  var priceLen = 0;
			  var oldPrice = 0;
			  var totalLen = 0;
			  var oldTotal = 0;
			  var newPrice = 0;
			  var newTotal = 0;
			  			  
			  var form = document.getElementById("Form1")
			  for(i = 0; i < form.length; i++) {
		        var tempobj = form.elements[i];
		        if(tempobj.alt == "assoc") {
			        allImprint = allImprint + tempobj.value;
			    }
			  }
			  newQty = document.getElementById("QuantList").value * 1;
			  priceLen = document.getElementById("txtAssocImprintCharge").value.length;
			  oldChg = document.getElementById("txtAssocImprintCharge").value.substring(1,priceLen) * 1;
			  priceLen = document.getElementById("txtItemPrice").value.length;
			  oldPrice = document.getElementById("txtItemPrice").value.substring(1,priceLen) * 1;
			  totalLen = document.getElementById("txtItemTotal").value.length;
			  oldTotal = document.getElementById("txtItemTotal").value.substring(1,totalLen) * 1;
			  
			  if (allImprint == "") {
				newPrice = oldPrice - oldChg;
				newTotal = oldTotal - oldChg;
				document.getElementById("txtAssocImprintCharge").value = "";
				}
			  else { 
			    if (itemName == "P5PE" | itemName == "P5PIVE" | itemName == "P4IV-E" | itemName == "P4WH-E" | itemName == "P3WH-E" | itemName == "P3IV-E" | itemName == "B4265WHE" | itemName == "E4256WHE" | itemName == "E4173WHE"){
			        if (newQty > 500){
			            newChg = (((newQty / 100) - 5 ) * 0.65) + 12.45;
			        } else {
			            newChg = 12.45;
			        }			    
			        if (newChg < 12.45){
			            newChg = 12.45;
			        }
			    }else{
			        if (company == "01"){			        
			            if (newQty<=100){
			                newChg = 15;
			            }else{
			                newChg = 15 + ((newQty - 100)/25)*2.5;
			            }
			        }else{
			            newChg = 10 + (newQty * .08);
			            if (newChg < 16){
			                newChg = 16;
			            }
			        }
			    }
			    newPrice = oldPrice - oldChg + newChg;
			    newTotal = oldTotal - oldChg + newChg;
                document.getElementById("txtAssocImprintCharge").value = formatCurrency(newChg); 
			  }
              document.getElementById("txtItemPrice").value = formatCurrency(newPrice); 
              document.getElementById("txtItemTotal").value = formatCurrency(newTotal); 
              document.getElementById("txtAssocQuantity").value = document.getElementById("QuantList").value;
            }
function formatCurrency2(num) {
    num = num.toString().replace(/\$|\,/g,'');
    if(isNaN(num))
        num = "0";
        sign = (num == (num = Math.abs(num)));
        num = Math.floor(num*100+0.50000000001);
        cents = num%100;
        num = Math.floor(num/100).toString();
        if(cents<10)
            cents = "0" + cents;
            for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
                num = num.substring(0,num.length-(4*i+3))+','+
                num.substring(num.length-(4*i+3));
            return (((sign)?'':'-') + '$' + num + '.' + cents);
        }
function OnChange(dropdown)
{
	var myindex = document.getElementById(dropdown).selectedIndex;
	var SelValue = document.getElementById(dropdown).options[myindex].value;
	var baseURL = "/ItemDisplay.aspx?categoryid=" + SelValue;
	top.location.href = baseURL;
	
	return true;	
}
function OnChangeItem(dropdown)
{
	var myindex = document.getElementById(dropdown).selectedIndex;
	var SelValue = document.getElementById(dropdown).options[myindex].value;
	var baseURL = "../itemoptions.aspx?itemname=" + SelValue;
	top.location.href = baseURL;
	
	return true;	

}
*/
