

// trophy functions - display selected item and setup buy id

function trFigSel(fig) {
var newImg =  "<img src='/ZF_Toppers/" + trFig[fig] + ".gif' border='0'>";
document.getElementById("topPer").innerHTML = newImg;
fig = parseInt(fig) + 1; trFigBuyId = trFig[fig];
}

function trTrmRtSel(trm) {
var newImg =  "<img src='/ZT_Trims/" + trTrimR[trm] + ".gif' border='0'>";
document.getElementById("trimmRt").innerHTML = newImg;
trm = parseInt(trm) + 1; trTrimRBuyId = trTrimR[trm];
}

function trTrmLtSel(trm) {
var newImg =  "<img src='/ZT_Trims/" + trTrimL[trm] + ".gif' border='0'>";
document.getElementById("trimmLt").innerHTML = newImg;
trm = parseInt(trm) + 1; trTrimLBuyId = trTrimL[trm];
}

function trTrmCtSel(trm) {
var newImg =  "<img src='/ZT_Trims/" + trTrimC[trm] + ".gif' border='0'>";
document.getElementById("trimmCt").innerHTML = newImg;
trm = parseInt(trm) + 1; trTrimCBuyId = trTrimC[trm];
}

function trColSel(col) {
var colSize = trSize; var newImg = "";
if (colSize == "21") {colSize = "14"; newImg = "<img class='img21' src='/COL2/" + trCol[col] + "-" + colSize + ".gif' border='0'>"; var top21HTML = "<img class='img21top' src='/COL2/" + trCol[col] + "-10.gif' border='0'><br><img class='img21top' src='/trophy_bases/" + trBaseUpV + ".gif' border='0'>"; document.getElementById("top21").innerHTML = top21HTML};
newImg = newImg + "<img src='/COL2/" + trCol[col] + "-" + colSize + ".gif' border='0'>";
document.getElementById("colUmn").innerHTML = newImg;
col = parseInt(col) + 1; trColBuyId = trCol[col];
}


function meRibSel(rib) { // modify for use with the medals. Show the image of the medal.
zoomHTML = "";
var newImg =  "<img src='/ZN_Neckstrap/" + meRib[rib] + ".gif' border='0'>";
document.getElementById("imgRibn").innerHTML = newImg;
zoomHTML = zoomHTML + "<div  class='zmDiv'><a href='javascript:;' onclick='zoomClos()'>Click to close<br><img src='/ZN_Neckstrap/zm_" + meRib[rib] + ".gif' border='0' alt='click to close' title='click to close' class='zmTop'><div class='zmBot'><img src='/ME_Medals/zm-" + itemId + ".gif' border='0' alt='click to close' title='click to close'></div><br style='clear:both'>Click to close</a></div>";
rib = parseInt(rib) + 1; meRibBuyId = meRib[rib];
var newImg2 =  "<img src='/ME_Medals/" + itemId + ".gif' border='0'>";
document.getElementById("imgMedl").innerHTML = newImg2;
document.getElementById("zoomImg").innerHTML = zoomHTML;
document.getElementById("zoomClk").style.display="block";
} // end meRibSel


function myDeclSel(dcl) {
var newImg =  "<img src='/ZM_Mylar/" + myDecl[dcl] + ".gif' border='0'>";
document.getElementById("imgDecl").innerHTML = newImg;
dcl = parseInt(dcl) + 1; myDeclBuyId = myDecl[dcl];
} // end fun







// show larger image functions
var opc2 = 0;

function zmImg() {
//document.getElementById("topnav").style.visibility = "hidden";
//document.getElementById("addItmm").style.visibility = "hidden";
var ims2 = document.getElementById("zoomImg").style;
ims2.zoom="1"; ims2.filter = "alpha(opacity=0)"; ims2.opacity = (0); ims2.MozOpacity = (0); ims2.KhtmlOpacity = (0);
document.getElementById("zoomImg").style.display = "block";
showDiv2() }
function showDiv2() {
var ele2 = document.getElementById("zoomImg").style;
if (opc2 <= 100) {setOpacity(opc2,ele2); opc2 += 10; setTimeout("showDiv2()",50);}}
function zoomClos() {
var div2 = document.getElementById("zoomImg").style;
if (opc2 > 0) {setOpacity(opc2,div2); opc2 -= 20; setTimeout("zoomClos()",20);}
else {//document.getElementById("topnav").style.visibility = "visible";
//document.getElementById("addItmm").style.visibility = "visible";
document.getElementById("zoomImg").style.display = "none";
zoomHTML = "";
setOpacity('100',div2); opc2=0}}
// end fade up of larger image





// START ADD TO CART FUNCTIONS
var theQty; var relQty; var lastPlate = 1; var pltHt;  var pltWt; var pltWt1;
function testQty() { // add code to check for itmMinQ and see if oQty is less than. Then display the correct message.
oQty = document.getElementById("qty");  relQty = parseInt(oQty.value); theQty = relQty + 1; // minQ = itmMinQ
var oErrQ = document.getElementById("errQty");
if (itmMinQ != "") {itmMinQ = parseInt(itmMinQ); if (itmMinQ > relQty || oQty.value == "") {oErrQ.innerHTML = "Quantity is less than minimum"; oErrQ.className=""; oQty.focus()}  else {oErrQ.innerHTML = ""; oErrQ.className="none"; hasQty()}} else {if (oQty.value == "" || relQty == 0) {oErrQ.innerHTML = "Please indicate a quantity"; oErrQ.className=""; oQty.focus()} 	else {oErrQ.innerHTML = ""; oErrQ.className="none"; 		hasQty()}}
} // end function




var itmImgHtml = ""; var pltEnWidth = 2; var pltHeight = 0.75;
function hasQty() {
switch (classType) {
	case "trop" : if (forcPlat) {itmImgHtml = document.getElementById("mainImg").innerHTML} else {itmImgHtml = document.getElementById("trophImg").innerHTML; pltEnWidth = trBase[3]; pltHeight = trBase[2];} setupPlates(); break; 
	case "tcup" : setupPlates(); break;
	case "medl" : itmImgHtml = document.getElementById("medlImg").innerHTML; setupPlates(); break;
	case "plaq" : addText(); break;
	case "mylr" : itmImgHtml = document.getElementById("mylrImg").innerHTML; setupPlates(); break;
	case "resn" : itmImgHtml = document.getElementById("mainImg").innerHTML; pltEnWidth = 2.5; pltHeight = .5; setupPlates(); break;	
	default : addText()
}} // end switch and end fun
	



// ADD TO CART functions

function chckVer() {
if (document.getElementById("chkVer").checked == true) {
	var addCartSpHTML = "<a href='javascript:;' onclick='addCart();' id='addCartBtn' class='active'><img src='/img/spacer.gif' width='113' height='34' border='0'></a>"; 
	document.getElementById("errChck").style.display = "none";} 
else {var addCartSpHTML = "<a href='javascript:;' onclick='addCartD();' id='addCartBtn' class='disab'><img src='/img/spacer.gif' width='113' height='34' border='0'></a>";
} // end else true
document.getElementById("addCartSp").innerHTML = addCartSpHTML;
} // end fun

function addCartD() {
	document.getElementById("errChck").style.display = "inline";}

function addCart() {
document.getElementById("addCartSp").innerHTML = "<a href='javascript:;' id='addCartBtn' class='wait'><img src='/img/spacer.gif' width='112' height='28' border='0'></a>";
document.getElementById("wait2").style.display="block";
zQty = document.getElementById("qty").value; 
enTxt = "for " + disName + " (qty - "+ zQty +") :: ";
// gather font and text boxes.
enTxt = enTxt + "The Fonts:";
for (j=1;j< numLines; j++) {
enTxt = enTxt + " > Line " + j + " - " + ftWt[j] + ", " + ftSt[j] + ", " + ftFt[j] + ", " + ftSz[j] + ", ";
} // end j
enTxt = enTxt + " The Text:";
for (var g=1; g <= zQty; g++) { 
enTxt = enTxt + " >> Item " + g + " - ";
for (var n=1; n < numLines; n++) {
theTxt = "itm" + g + "line" + n;
theTextt = document.getElementById(theTxt).value; 
theTextt = theTextt.replace(/#/g,"%23"); 
theTextt = theTextt.replace(/&/g,"%26"); 
enTxt = enTxt + theTextt + " | ";
} // end for numLines
} // end for zQty
//alert(enTxt)
addCartT() } // end fun 


var ss = 0; var ee = 1000; var txtArry = new Array(); var zz = 0;
function addCartT() {
if (enTxt.length > 1000) {
var subTxt = enTxt.substring(ss,ee);
var ff = ee - 4;
var testTxt1 = subTxt.substring(ff,ee)
while (testTxt1 != "Item") {
ee = ee-1; ff = ff-1
testTxt1 = subTxt.substring(ff,ee)
} //end while
subTxt = enTxt.substring(ss,ff);
txtArry[txtArry.length] = subTxt;
enTxt = enTxt.substring(ff,enTxt.length)
if (enTxt.length > 0) {addCartT()}
} // end if enTxt.length > 1000
else {txtArry[txtArry.length] = enTxt; zz = txtArry.length - 1; addCartT2();}
} // end fun Tx

function addCartT2() {
var carTxt = txtArry[zz];
//alert(carTxt)
//carTxt = escape(carTxt); 
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid=1413&qty=1&custcol113=" + carTxt + "&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	
if (zz > 0) {carTxt = ""; cartUrlT = ""; zz=zz-1; setTimeout("chkIframe('addCartT2')",400);} else {carTxt = ""; cartUrlT = ""; setTimeout("chkIframe('addCart2')",400)}
} // end fun


var itmQty; 
function addCart2() {
itmQty = document.getElementById("qty").value;
ADDmyDecl()
} // end fun addcart2

// add each component item to the cart one at a time via a seperate function. 
function ADDmyDecl() {
if (myDecl != "") {	
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ myDeclBuyId +"&qty="+ itmQty +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDmeRib')",500)} else {ADDmeRib()}} // end fun

function ADDmeRib() {
if (meRib != "") {
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ meRibBuyId +"&qty="+ itmQty +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrTrimCBuyId')",500)} else {ADDtrTrimCBuyId()}} // end fun

function ADDtrTrimCBuyId() {
if (trTrimCBuyId != "") {trTrimCQ = trTrimCQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trTrimCBuyId +"&qty="+ trTrimCQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrTrimLBuyId')",500)} else {ADDtrTrimLBuyId()}} // end fun
	
function ADDtrTrimLBuyId() {
if (trTrimLBuyId != "") {trTrimLQ = trTrimLQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trTrimLBuyId +"&qty="+ trTrimLQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
	 setTimeout("chkIframe('ADDtrTrimRBuyId')",500)} else {ADDtrTrimRBuyId()}} // end fun
	
function ADDtrTrimRBuyId() {
if (trTrimRBuyId != "") {trTrimRQ = trTrimRQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trTrimRBuyId +"&qty="+ trTrimRQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrPlate')",500)} else {ADDtrPlate()}} // end fun

function ADDtrPlate() {
if (trPlate != "") {trPlateQ = trPlateQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trPlate +"&qty="+ trPlateQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrBaseUp')",500)} else {ADDtrBaseUp()}} // end fun

function ADDtrBaseUp() {
if (trBaseUp != "") {trBaseUpQ = trBaseUpQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trBaseUp +"&qty="+ trBaseUpQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrBaseL')",500)} else {ADDtrBaseL()}} // end fun

function ADDtrBaseL() {
if (trBase[0] != "") {trBaseQ = trBaseQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trBase[0] +"&qty="+ trBaseQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrLid')",500)} else {ADDtrLid()}} // end fun
	
function ADDtrLid() {
if (trLid != "") {trLidQ = trLidQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trLid +"&qty="+ trLidQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrCapnut')",500)} else {ADDtrCapnut()}} // end fun

function ADDtrCapnut() {
if (trCapnut != "") {trCapnutQ = trCapnutQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trCapnut +"&qty="+ trCapnutQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrRisr')",500)} else {ADDtrRisr()}} // end fun

function ADDtrRisr() {
if (trRisr != "") {trRisrQ = trRisrQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trRisr +"&qty="+ trRisrQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
	 setTimeout("chkIframe('ADDtrCup')",500)} else {ADDtrCup()}} // end fun

function ADDtrCup() {
if (trCup != "") {trCupQ = trCupQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trCup +"&qty="+ trCupQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrNut')",500)} else {ADDtrNut()}} // end fun

function ADDtrNut() {
if (trNut != "") {trNutQ = trNutQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trNut +"&qty="+ trNutQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
	 setTimeout("chkIframe('ADDtrFerr')",500)} else {ADDtrFerr()}} // end fun

function ADDtrFerr() {
if (trFerr != "") {trFerrQ = trFerrQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trFerr +"&qty="+ trFerrQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
	 setTimeout("chkIframe('ADDtrRodB')",500)} else {ADDtrRodB()}} // end fun

function ADDtrRodB() {
if (trRodB != "") {trRodBQ = trRodBQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trRodB +"&qty="+ trRodBQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDtrRodT')",500)} else {ADDtrRodT()}} // end fun
	
function ADDtrRodT() {
if (trRodT != "") {trRodTQ = trRodTQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trRodT +"&qty="+ trRodTQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
	 setTimeout("chkIframe('ADDtrColBuyId')",500)} else {ADDtrColBuyId()}} // end fun
	
function ADDtrColBuyId() {
if (trColBuyId != "") {trColQ = trColQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trColBuyId +"&qty="+ trColQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
	 setTimeout("chkIframe('ADDtrFigBuyId')",500)} else {ADDtrFigBuyId()}} // end fun
	
function ADDtrFigBuyId() {
if (trFigBuyId != "") {trFigQ = trFigQ * itmQty;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+ trFigBuyId +"&qty="+ trFigQ +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html"; 
	 setTimeout("chkIframe('ADDMainItem')",500)} else {ADDMainItem()}} // end fun

function ADDMainItem() {
	var itmQtyy = document.getElementById("qty").value;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+  itmId +"&qty="+ itmQtyy +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
setTimeout("chkIframe('showCart')",500)}




var enTxt = "";
// PLAQUE and similar items add to cart functions
function addText() {
if (document.getElementById("theContBtn").className == "active") {document.getElementById("theContBtn").className="wait"} else {var oErrQ1 = document.getElementById("errQty"); oErrQ1.innerHTML = "Check an Engraving option checkbox above."; oErrQ1.className=""; document.getElementById("emlLnk").style.backgroundColor="#FFE8EC"; return} 
// if txtBox is blank or doesn't exist go to addItem2() else go to addTextItm()
 if (document.getElementById("txtBox")) {enTxt = document.getElementById("txtBox").value; if (enTxt == "") {addItem2()} else {addTextItm()}} else {addItem2()}

} // end fun

function addTextItm() {
	var engTxt = escape(enTxt); 
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid=1413&qty=1&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html" +"&custcol113=" + engTxt; 
// wait a bit then go to the main item add to cart function
setTimeout("addItem2()",1500);
//setTimeout("chkIframe('addItem2')",140)
}

function addItem2() {
	var itmQtty = document.getElementById("qty").value;
	frames[iframID].location = "/app/site/backend/additemtocart.nl?c=660285&buyid="+  itmId +"&qty="+ itmQtty +"&custcol_email_reff="+ reffId + "&redirect=/ns_itemadded.html";
setTimeout("showCart2()",1500);
//setTimeout("chkIframe('showCart')",140)
}

function showCart() {
itmQty = 0; setTimeout("showCart2()",1500);
}

function showCart2() {
window.location.href ="/s.nl/sc.3/.f";
}


var theFrm = "";
function chkIframe(funct) {
var functt = funct;
if (window.frames[iframID].document.getElementById("itemAdded")) {
theFrm = window.frames[iframID].document.getElementById("itemAdded").innerHTML; 
if (theFrm == "Item added") {theFrm = ""; eval(functt+"()")} 
else {eval('setTimeout("chkIframe(\''+ functt +'\')",200)')}
} 
else {eval('setTimeout("chkIframe(\''+ functt +'\')",200)')}
}



// END ADD TO CART FUNCTIONS
function doNothing() {}

var myBaseBuyId = ""; var myDeclBuyId = "";



// SHOW Nameplates functions 
function setupPlates() {
// Please wait buttons
document.getElementById("theContBtn").className = "wait"; document.getElementById("wait1").style.display="block";
// set up image and font selection area.
// itmImgHtml set when checking the quantity based on type of item
numChar = 8 * pltEnWidth; numChar = Math.floor(numChar); pltHt = Math.floor(pltHeight * 96);  pltWt = Math.floor(pltEnWidth * 68); pltWt1 = pltWt - 1;
var namFont = "<table width='100%' border='0' cellspacing='3' cellpadding='0'><tr><td class='fntImgtd' rowspan='4' align='center' valign='top'><h1 class='itmH1'>" + disName + "</h1><div id='theItm' class='itmTroParts namPlt'>"+ itmImgHtml +"</div></td><td valign='top'></td><td valign='top'><h4>" + disTag + "</h4></td></tr><tr><td width='3%' valign='top'><strong>1.</strong></td><td width='52%' valign='top'>Select up to three lines of text for your item.<br>  <select name='selLines' id='selLines' onChange='setLines()'> <option value='3' selected>Three lines of text</option> <option value='2'>Two lines of text</option><option value='1'>One line of text</option></select></td></tr><tr><td valign='top'><strong>2.</strong></td><td valign='top'>Select the font type, style, and size for each line of ALL your items. Type in the text you want each item to have the same text.<div id='fontSel'><div id='line1'><input name='alltext1' type='text' id='alltext1' onKeyUp='setAll(1)' size='18' maxlength='"+numChar+"' value='Line 1 text' onFocus='if (this.value==\"Line 1 text\") {this.value = \"\";}' onBlur='if (this.value==\"\") {this.value =\"Line 1 text\";}'>&nbsp;<select name='type1' id='type1' onChange='setFont(1)'><option value='arial'>Arial</option><option value='times'>Times</option></select><select name='size1' id='size1' onChange='setSize(1)'><option value='small'>Small</option><option value='medium'>Medium</option><option value='large'>Large</option></select><a href='javascript:;' onClick='setWeight(1)' class=''>&nbsp;B&nbsp;</a> <a href='javascript:;' onClick='setStyle(1)' class=''><em>&nbsp;I&nbsp;</em></a></div><div id='line2'><input name='alltext2' type='text' id='alltext2' size='18' maxlength='"+numChar+"' onKeyUp='setAll(2)' value='Line 2 text' onFocus='if (this.value==\"Line 2 text\") {this.value = \"\";}' onBlur='if (this.value==\"\") {this.value =\"Line 2 text\";}'>&nbsp;<select name='type2' id='type2' onChange='setFont(2)'><option value='arial'>Arial</option><option value='times'>Times</option></select><select name='size2' id='size2' onChange='setSize(2)'><option value='small'>Small</option><option value='medium'>Medium</option><option value='large'>Large</option></select><a href='javascript:;' onClick='setWeight(2)' class=''>&nbsp;B&nbsp;</a> <a href='javascript:;' onClick='setStyle(2)' class=''><em>&nbsp;I&nbsp;</em></a></div><div id='line3'><input name='alltext3' type='text' id='alltext3' size='18' maxlength='"+numChar+"' onKeyUp='setAll(3)' value='Line 3 text' onFocus='if (this.value==\"Line 3 text\") {this.value = \"\";}' onBlur='if (this.value==\"\") {this.value =\"Line 3 text\";}'>&nbsp;<select name='type3' id='type3' onChange='setFont(3)'><option value='arial'>Arial</option><option value='times'>Times</option></select><select name='size3' id='size3' onChange='setSize(3)'><option value='small'>Small</option><option value='medium'>Medium</option><option value='large'>Large</option></select><a href='javascript:;' onClick='setWeight(3)' class=''>&nbsp;B&nbsp;</a> <a href='javascript:;' onClick='setStyle(3)' class=''><em>&nbsp;I&nbsp;</em></a></div></div></td></tr><tr><td valign='top'><strong>3.</strong></td><td valign='top'>Fill in or edit the text by clicking on any line in the nameplates below. You can edit a line that has already been filled. Plates shown below are not actual size however the maximum character for each line based on selected font is accurate.</td></tr></table>";  
document.getElementById("nameFont").innerHTML=namFont; // end if

// set up add to cart
var addCartHTML ="<div id='wait2' class='wait2'>Please wait while we process your order...<br><br><img src='/img/wait2.gif'></div><div id='addmore'><a href='javascript:;' onClick='addOneMore()'><img src='img/addoneitem.jpg' title='Click to add one item' alt='Add one item' border='0'></a> <a href='javascript:;' onClick='remLastOne()'><img src='/img/removelast.jpg' title='Click to remove last item' alt='Remove last item' border='0'></a></div> <div id='itmAdd'>" +disName+ " &nbsp;&nbsp;&nbsp;&nbsp; Quantity: <span id='relQtyy'>"+ relQty +"</span></div> <table id='plateCartTbl' border='0' cellspacing='2' cellpadding='0' align='center'><tr><td valign='top'><strong>4.</strong></td></td><td>By checking this box I verify that all information<br> is correct and authorize production of trophies.</td><td valign='middle'><input type='checkbox' name='chkVer' id='chkVer' value='chkVer' onClick='this.blur()' onChange='chckVer();'></td><td><span id='addCartSp'><a href='javascript:;' onClick='addCartD();' id='addCartBtn' class='disab'><img src='/img/spacer.gif' width='113' height='34' border='0'></a></span></td></tr></table><p class='varErr' style='display: none' id='errChck'>Check the above checkbox to activate the Add to Cart button.<p>";
document.getElementById("nameCart").innerHTML=addCartHTML;

// set up name Text div
var namText = "<h2>Click On Any Line To Change Text<h2>";
for (var g=1; g < theQty; g++) {lastPlate = g; var nxtOne = g + 1;
namText = namText + "<table border='0' width='"+ pltWt +"' cellspacing='0' cellpadding='0' class='plateTxt' id='pltID"+g+"'><tr><td  width='"+ pltWt1 +"' align='center' valign='middle' class='plateCapt'>item "+g+"</td><td width='1'></td></tr><tr><td align='center' valign='middle' class='plateTxttd'><input name='itm"+g+"line1' id='itm"+g+"line1' type='text' class='txtline1' size='"+numChar+"' maxlength='"+numChar+"' onFocus='this.className=\"txtline1\"' onBlur='this.className=\"txtline1 gold\"'><input name='itm"+g+"line2' id='itm"+g+"line2'  type='text' class='txtline2' size='"+numChar+"' maxlength='"+numChar+"'  onFocus='this.className=\"txtline2\"' onBlur='this.className=\"txtline2 gold\"'><input name='itm"+g+"line3' id='itm"+g+"line3' type='text' class='txtline3' size='"+numChar+"' maxlength='"+numChar+"'  onFocus='this.className=\"txtline3\"' onBlur='this.className=\"txtline3 gold\"'></td>  <td><div class='plateHeight' style='height: " + pltHt + "px'></div></td></tr></table><span id='nextone"+nxtOne+"'></span>";
} // end for
document.getElementById("nameText").innerHTML=namText + "<div style='display:none'>"  +numChar+"</div>";
viewNameP()
} // end fun

function addOneMore() {
 lastPlate = lastPlate + 1; var putNewID = "nextone" + lastPlate; var nextOne = lastPlate + 1;
var lin1val = ""; lin1val = document.getElementById("alltext1").value;
var lin2val = ""; lin2val = document.getElementById("alltext2").value;
var lin3val = ""; lin3val = document.getElementById("alltext3").value;
var newOne = "<table border='0' width='"+ pltWt +"' cellspacing='0' cellpadding='0' class='plateTxt' id='pltID"+lastPlate+"'><tr><td  width='"+ pltWt1 +"' align='center' valign='middle' class='plateCapt'>item "+lastPlate+"</td><td width='1'></td></tr><tr><td align='center' valign='middle' class='plateTxttd'><input name='itm"+lastPlate+"line1' id='itm"+lastPlate+"line1' type='text' value = '"+lin1val+"' class='txtline1' size='"+numChar+"' maxlength='"+numChar+"' onfocus='this.className=\"txtline1\"' onblur='this.className=\"txtline1 gold\"'><input name='itm"+lastPlate+"line2' id='itm"+lastPlate+"line2'  type='text' value = '"+lin2val+"'  class='txtline2' size='"+numChar+"' maxlength='"+numChar+"'  onfocus='this.className=\"txtline2\"' onblur='this.className=\"txtline2 gold\"'><input name='itm"+lastPlate+"line3' id='itm"+lastPlate+"line3' type='text' value = '"+lin3val+"'  class='txtline3' size='"+numChar+"' maxlength='"+numChar+"'  onfocus='this.className=\"txtline3\"' onblur='this.className=\"txtline3 gold\"'></td>  <td><div class='plateHeight' style='height: " + pltHt + "px'></div></td></tr></table><span id='nextone"+nextOne+"'></span>";
document.getElementById(putNewID).innerHTML = newOne;
var newQty = lastPlate; 
document.getElementById("qty").value = newQty; 
document.getElementById("relQtyy").innerHTML = newQty;
} // end fun

function remLastOne() {
	var lastPlateID = "pltID" + lastPlate; var rem = document.getElementById(lastPlateID); rem.parentNode.removeChild(rem); lastPlate = parseInt(lastPlate) - 1; var newQty = lastPlate; document.getElementById("qty").value = newQty; document.getElementById("relQtyy").innerHTML = newQty; } // end fun

// plate font functions
var ftWt = new Array("Z","N","N","N");
var ftSt = new Array("Z","N","N","N");
var ftFt = new Array("Z","A","A","A");
var ftSz = new Array("Z","S","S","S");
var lin; var numChar = 28; 


// Large
// Arial bold or italics- 5 Letters
//Arial regular - 6
//Times regular or Italics- 6 letters 
//Times Bold- 5 letters



function setCharLen() {
var theCpi = 8;
var toTest = "";
if (ftSz[linn] == "S") {if (ftWt[linn] == "N") {theCpi = 9} else {theCpi = 8}}
if (ftSz[linn] == "M") {if (ftWt[linn] == "N") {theCpi = 8} else {theCpi = 7}}
if (ftSz[linn] == "L") {if (ftWt[linn] == "N") {theCpi = 6} else {theCpi = 5}}
// end if to find theCpi
//calculate characters based on eng width
numChar = theCpi * pltEnWidth; numChar = Math.floor(numChar);
// now go thru to this line in gray box and set the size value then go to every instance of this line and set its size. 
var chgLine = "alltext" + linn;
var oLinn = document.getElementById(chgLine);
var theCont = oLinn.value;
theCont = theCont.substr(0,numChar)
oLinn.setAttribute("maxlength",numChar);
oLinn.value = theCont;

// cycle thru all the nameplates
for (var g=1; g < theQty; g++) { 
chgLine = "itm" + g + "line" + linn;
var oLinn = document.getElementById(chgLine);
var theCont = oLinn.value;
theCont = theCont.substr(0,numChar)
oLinn.setAttribute("size",numChar);
oLinn.setAttribute("maxlength",numChar);
oLinn.value = theCont;
} // end for
} // end function

function setWeight(line) {
if (theRules[line].style.fontWeight=="normal") {theRules[line].style.fontWeight="bold"; theID = "line" + line;  document.getElementById(theID).getElementsByTagName("a")[0].className="sel"; ftWt[line] = "B"} else {theRules[line].style.fontWeight="normal"; theID = "line" + line;  document.getElementById(theID).getElementsByTagName("a")[0].className=""; ftWt[line] = "N"} 
linn = line; setCharLen()
} //end fun
function setStyle(line) {
if (theRules[line].style.fontStyle=="normal") {theRules[line].style.fontStyle="italic"; theID = "line" + line;  document.getElementById(theID).getElementsByTagName("a")[1].className="sel"; ftSt[line] = "I"} else {theRules[line].style.fontStyle="normal"; theID = "line" + line;  document.getElementById(theID).getElementsByTagName("a")[1].className=""; ftSt[line] = "N"} 
linn = line; setCharLen()
} //end fun
function setFont(line) {
var fonttype = "type" + line;
var font = document.getElementById(fonttype).selectedIndex;
if (font == "0") {theRules[line].style.fontFamily="Arial, Helvetica, sans-serif"; ftFt[line] = "A"} else {theRules[line].style.fontFamily="'Times New Roman', Times, serif"; ftFt[line] = "T"}
linn = line; setCharLen()
} //end fun
function setSize(line) {
var fontSz = "size" + line;
var fontS = document.getElementById(fontSz).selectedIndex;
if (fontS == "0") {theRules[line].style.fontSize="12px"; ftSz[line] = "S"} 
else if (fontS == "1") {theRules[line].style.fontSize="14px"; ftSz[line] = "M"}
else {theRules[line].style.fontSize="16px"; ftSz[line] = "L"}
linn = line; setCharLen()
} //end fun

function setAll(line) {
oQty = document.getElementById("qty"); theQty = parseInt(oQty.value) + 1;
var theTexto = "alltext" + line;
var theText = document.getElementById(theTexto).value;
 for (var h=1; h < theQty; h++) {
 var theLine = "itm" +h+ "line" + line;
 document.getElementById(theLine).value = theText;
 if (theText != "") {var clasNam = "txtline" + line + " gold"} else {var clasNam = "txtline" + line}
 document.getElementById(theLine).className = clasNam;
 } // end for
} //end fun

var numLines = 4; 
function setLines() {
var lin = document.getElementById("selLines").selectedIndex; 
if (lin == 2) {theRules[3].style.display="none"; theRules[2].style.display="none"; document.getElementById("line3").style.display="none";document.getElementById("line2").style.display="none"; numLines = 2}
if (lin == 1) {theRules[3].style.display="none"; theRules[2].style.display="block";document.getElementById("line3").style.display="none";document.getElementById("line2").style.display="block"; numLines = 3}
if (lin == 0) {theRules[3].style.display="block"; theRules[2].style.display="block";document.getElementById("line3").style.display="block";document.getElementById("line2").style.display="block"; numLines = 4}
} // end fun


// plates fade in and out functions
function viewNameP() {//document.getElementById("relItmTbl").style.visibility = "hidden";
var ims = document.getElementById("namePlates").style;
ims.zoom="1"; ims.filter = "alpha(opacity=0)"; ims.opacity = (0); ims.MozOpacity = (0); ims.KhtmlOpacity = (0);
ims.display = "block";
showDiv() }

function showDiv() {
var ele = document.getElementById("namePlates").style;
if (opc <= 100) {setOpacity(opc,ele); opc += 10; setTimeout("showDiv()",30);} else {
document.getElementById("itemDetails").style.display = "none";
document.getElementById("relItmTbl").style.display = "none";
document.getElementById("namePlates").style.position = "relative";
//document.getElementById("namePlates").style.top = "18px";
}}

function hideLrgr() {
var div = document.getElementById("namePlates").style;
if (opc > 0) {setOpacity(opc,div); opc -= 20; setTimeout("hideLrgr()",15);}
else {//document.getElementById("relItmTbl").style.visibility = "visible";
document.getElementById("namePlates").style.display = "none";
setOpacity('100',div); opc=0}}
// end fade up of name plates



// view larger image
function viewLrgr2() {
//document.getElementById("topnav").style.visibility = "hidden";
//document.getElementById("addItmm").style.visibility = "hidden";
document.getElementById("lrgImgDiv").innerHTML = lrgImg;
var ims = document.getElementById("lrgImgDiv").style;
ims.zoom="1"; ims.filter = "alpha(opacity=0)"; ims.opacity = (0); ims.MozOpacity = (0); ims.KhtmlOpacity = (0);
document.getElementById("lrgImgDiv").style.display = "block";
showDiv3() }
function showDiv3() {
var ele = document.getElementById("lrgImgDiv").style;
if (opc <= 100) {setOpacity(opc,ele); opc += 10; setTimeout("showDiv3()",50);}}
function hideLrgr2() {
var div = document.getElementById("lrgImgDiv").style;
if (opc > 0) {setOpacity(opc,div); opc -= 20; setTimeout("hideLrgr2()",20);}
else {//document.getElementById("topnav").style.visibility = "visible";
//document.getElementById("addItmm").style.visibility = "visible";
document.getElementById("lrgImgDiv").style.display = "none";
setOpacity('100',div); opc=0}}


function setOpacity(opacity,ele){
ele.filter = "alpha(opacity=" + opacity +")"; 
ele.opacity = (opacity/100);
ele.MozOpacity = (opacity/100);  
ele.KhtmlOpacity = (opacity/100); 
return;} 
