cooArr = new Array;
    typedArr = new Array;

    function getObj(f) {
        this.oForm = f;
        this.oUppht = 0;
        this.oFont = "";
        this.oUpPrice = "0.00";
        this.oLoPrice = "0.00";
        this.oFract = 0;
        this.oDepth = 0;
        this.oMount = 0;
        this.oStud = f.stud;
        this.oTempl = 0;
        this.oColor = "";
        this.oPhrase = "";
        this.oPgTotal = "0.00";
        this.oQty = f.qty;
        this.oPattern = "0.00";
        this.oTotal = f.pgTotal;
        this.di = document.images;
        return this, resetForm(), initmb(), doAllSizes(), doAllDepths(), showPicker(g_id('but1'),'color1',1), closePickers(), prep(), tot_cook(), doBgCols();
    };


    function data() {
        var ucpr;
        var siz = oUppht;
        siz = siz == -1 ? 0 : siz;
        var dep = (oDepth==.125)? 1 : (oDepth==.25)? 2 : (oDepth==.375)? 3 : 4;
        var daColor = oColor.substr(0, 4);
        if (siz < dArr[0].length - 1) {
            if (oFract > 0) {
                siz = siz + 1;
            };
        } else {
            oFract = 0;
        };
        this.dStr = dArr[0][siz];
        ucpr = dStr[dep];
        
		var percent=100;
		// oxidized or polished
		percent+= (/6555|5444/.test(oColor))? 15 : (/1144|8555|8777/.test(oColor))? 30 : 0;
        
        //mounts
        percent+=(/Welded/.test(oMount))? 30 : (/Rail/.test(oMount))? 25 : (/Bottom Stud/.test(oMount))? 15 : 0;
		
		ucpr=(ucpr*percent)/100;

		oUpPrice = fixP(ucpr);
		if(siz > 0){
			var x= testFont(oFont,oPhrase);
			if(x) oPhrase=oPhrase.toUpperCase();
		}else{
			var x=true;
			oPhrase=oPhrase.toUpperCase();
		};
        oLoPrice = (x == true)? "N/A" : fixP(ucpr * 90 / 100);
    };

	function testFont(fon,txt){
		var x=false;
		var fons = Fltr.split("~"); 
		var myfon = fon.toLowerCase().replace(/\s/g, "");
		for (k = 0; k < fons.length; k++) {
			//alert(fons[k]+'---'+myfon)
			if(fons[k] == myfon){
				x=true;
				break;
			};
		};
		return x;
	};


  function analysis() {        
	oPgTotal  = '0.00';
 	var inPut      = oPhrase;
	var outPut     = '';
	var pStart       = 0;  if (oPhrase.selectionStart) {pStart=oPhrase.selectionStart;};
	var pEnd         = 0;  if (oPhrase.selectionEnd  ) {pEnd  =oPhrase.selectionEnd;};
 	var pLen       = oPhrase.length;

 	for(var i=0; i< pLen; i++) { var x = inPut.charAt(i);
			outPut +=
 			x.match(/[A-Z]/)? updatePrice(x, 'upper_case') :
			x.match(/[0-9]/)? updatePrice(x, 'nums') :
 			x.match(/[\-\.,~']/)?  updatePrice(x, 'sm_punc') :
			x.match(/[\/&\!@#$%\(\)?<>\+\*\\]/)?  updatePrice(x, 'lg_punc') :
			x.match(/[;:="]/)?  updatePrice(x, 'colo_chars') :
 			x.match(/[a-z]/)? updatePrice(x, 'lower_case') : " ";
	};
	oPhrase = outPut;
	if (oPhrase.selectionStart)
	{
		oPhrase.selectionStart=pStart;
		oPhrase.selectionEnd=pEnd  ;
	};
};

function updatePrice(x, kind) {    

 	var subT =oPgTotal-0;
 	var upcP =oUpPrice-0;
 	var locP =oLoPrice-0;


 	oPgTotal =
 		(kind =='upper_case')? fixP(subT +upcP) :
		(kind =='nums')?  fixP(subT +upcP):
		(kind =='sm_punc')? fixP(subT +(upcP-0)/3) :
		(kind =='lg_punc')? fixP(subT +(upcP-0)) :
		(kind =='colo_chars')? fixP(subT +((upcP-0)/3)*2) :
		(kind =='lower_case' && locP == 0)?
		(x=x.toUpperCase(),fixP(subT +upcP)) : fixP(subT + locP);
	return x;        //to oPhrase.value
 };


    function prep() {
        var myGt = 0, sLen = 0, daLen = 0, addon = 0, ptn = 0;
        var Qty = parseFloat(oQty.value);
        var pt = "";
        var mnt = 0;
        oPhrase = "";
        oPattern = "0.00";
        for (var i = 1; i < 5; i++) {
            var pObj = "line" + i, sObj = "upperheight" + i, fObj = "font" + i, dObj = "depth" + i, cObj = "color" + i, mObj = "mount" + i, tObj = "template" + i, frObj = "fraction" + i;
            if (oForm[pObj].value.replace(/\s/g, "").length > 0) {
                oForm.align.disabled = i > 1 ? false : true;
                if (i > 1 && i < 5) g_id('L' + i).style.display = "";
                if (i > 1 && i < 5) g_id("mnts" + i).style.display = "";
                if (i > 0 && i < 4) g_id("I" + i).style.display = "";
                oPhrase = oForm[pObj].value;
                oFont = oForm[fObj].value;
                oDepth = oForm[dObj][oForm[dObj].selectedIndex].value;
                oUppht = oForm[sObj].selectedIndex;
                oFract = oForm[frObj].selectedIndex;
                oColor = oForm[cObj].value;
                oMount = oForm[mObj].value;
                oTempl = oForm[tObj].selectedIndex;
                data();
                analysis();
                oMount = mnt;
                oForm[pObj].value = oPhrase;
                sLen += oForm[pObj].value.replace(/\s/g, "").length;
                g_id('LD' + i).innerHTML = oForm[dObj][oForm[dObj].selectedIndex].text;
                g_id('UC' + i).innerHTML = oUpPrice;
                g_id('LC' + i).innerHTML = oLoPrice != "N/A" ? oLoPrice : "N/A";
                g_id('LT' + i).innerHTML = oPgTotal;
                if (oLoPrice != "N/A" && typedArr[i] != null) {
                    oForm[pObj].value = typedArr[i];
                };

                pt = oForm[tObj][oForm[tObj].selectedIndex].text.substr(0, 2);
                if (pt == "St" || pt == "Po") {
                    daHeight = oForm[sObj][oForm[sObj].selectedIndex].value;
                    daLen = oForm[pObj].value.replace(/\s/g, "").length;
                    addon = patternPrice;
                    ptn += addon * daLen;
                   g_id("PP"+i).innerHTML = "$" + fixP(addon * daLen);
                    oPattern = fixP(addon * daLen);
                } else {
                    g_id("PP"+i).innerHTML = "0.00";
                    oPattern = "0.00";
                };
                g_id('TP'+i).innerHTML = "$" + fixP(parseFloat(oPgTotal) + parseFloat(oPattern));
                myGt += parseFloat(oPgTotal);
                oForm[frObj].disabled = (oForm[sObj].selectedIndex == oForm[sObj].options.length - 1)? (oForm[frObj].selectedIndex = 0, true) : false;
            } else {
                if (i < 4) {
                    oForm["line" + (i + 1)].value = "";
                    g_id("I" + i).style.display = "none";
				};
                if (i > 1 && i < 5) g_id('L' + i).style.display = "none";
                if (i > 1 && i < 5) g_id("mnts" + i).style.display = "none";
                typedArr[i] = null;
            };
        };
       	g_id('ptn').innerHTML = oPattern = fixP(ptn * Qty);
        g_id("bl").innerHTML = "$" + fixP(myGt + ptn);
        g_id('tLtrs').innerHTML = sLen * Qty;
        g_id('tfl').innerHTML = oPgTotal = fixP(myGt * Qty);
        g_id('pgTotal').innerHTML = fixP(parseFloat(oPgTotal) + parseFloat(oPattern));
    };


function doAbility(lObj, x) {
        var fObj = "font" + x;
        var sObj = "upperheight" + x;
        var cObj = "color" + x;
        var dObj = "depth" + x;
        var frObj = "fraction" + x;
        var fObj = "font" + x;
        if (lObj.value.replace(/\s/g, "").length == 0) {
            if (x > 1) {
                for (i = x; i < 5; i++) {
                    oForm[fObj].disabled = true;
                    oForm[sObj].disabled = true;
                    oForm[cObj].disabled = true;
                    oForm[dObj].disabled = true;
                    oForm[frObj].disabled = true;
                };
            };
        } else {
            oForm[fObj].disabled = false;
            oForm[sObj].disabled = false;
            oForm[cObj].disabled = false;
            oForm[dObj].disabled = false;
            oForm[frObj].disabled = false;
        };
    };



// dyn Template
function dyTemp(x) {
	var mObj='mount'+x, tObj='template'+x;
	var mnt=oForm[mObj].value;
	z= (/Stud|Combination|Combo|Keyhole/.test(oForm[mObj].value))? 1 : 0;
		var daLen = pArr[z].length;
		for (var j =(oForm[tObj].options.length -1); j >0; j--) { oForm[tObj].options[j] = null; };
		for(var k=0; k< daLen; k++) {
			oForm[tObj].options[k] = new Option(pArr[z][k][0], pArr[z][k][1]);
		};
};


    function doSize(x) {
        var fObj = "font" + x, sObj = "upperheight" + x, dObj = "depth" + x;
        var hOld = oForm[sObj][oForm[sObj].selectedIndex].value;
		var d =  oForm[dObj][oForm[dObj].selectedIndex].value;
		for (j = oForm[sObj].options.length - 1; j > 0; j--) {oForm[sObj].options[j] = null;
        };
        var daLen = dArr[0].length;
		for (k = 0; k < daLen; k++) {
            oForm[sObj].options[k] = new Option(dArr[0][k][0] + "\"", dArr[0][k][0]);
			if(dArr[0][k][0]==hOld) oForm[sObj].selectedIndex = k;
        };
    };

	function doAllSizes() {
        sObj = "upperheight";
        for (var i = 1; i < 5; i++) {
            var daLen = dArr[0].length;
            for (var j = oForm[sObj + i].options.length - 1; j > 0; j--) {
                oForm[sObj + i].options[j] = null;
            };
            for (var k = 0; k < daLen; k++) {
                oForm[sObj + i].options[k] = new Option(dArr[0][k][0] + "\"", dArr[0][k][0]);
            };
            oForm[sObj + i].selectedIndex = 2;
        };
    };

    function doDepth(x) {
        dObj = "depth" + x;
        hObj = "upperheight" + x;
        var dOld = oForm[dObj][oForm[dObj].selectedIndex].text;
        for (var j = oForm[dObj].options.length - 1; j > 0; j--) {
            oForm[dObj].options[j] = null;
        };
        var z = oForm[hObj].selectedIndex < 2 ? 0 : 1;
        var daLen = tArr[z].length;
        var newVal = 0;
        for (var k = 0; k < daLen; k++) {
            oForm[dObj].options[k] = new Option(tArr[z][k][0] + "\"", tArr[z][k][1]);
            if (tArr[z][k][0] + "\"" == dOld) {
                newVal = k;
            };
        };
        oForm[dObj].selectedIndex = newVal;
    };


    function doAllDepths() {
        dObj = "depth";
        hObj = "upperheight";
        for (var i = 1; i < 5; i++) {
            var daLen = tArr[1].length;
            for (var j = oForm[dObj + i].options.length - 1; j > 0; j--) {
                oForm[dObj + i].options[j] = null;
            };
            for (var k = 0; k < daLen; k++) {
                oForm[dObj + i].options[k] = new Option(tArr[1][k][0] + "\"", tArr[1][k][1]);
            };
            oForm[dObj + i].selectedIndex = 0;
        };
    };


    function addTo() {
        prep();
        var qVal = oForm.qty.value;
		if(oForm.line1.value.replace(/\s/g, "").length == 0) return alert("No letters have been entered in Line 1!");
		for (i = 1; i < 5; i++) {
			var pObj = "line" + i, mObj = "mount" + i, cObj = "color" + i, tpObj = "template" + i;
			if (oForm[pObj].value.replace(/\s/g, "").length > 0) {
					if(/Choose/.test(oForm[cObj].value)) return alert("Please select Color on line "+i); 
					if(/Choose/.test(oForm[mObj].value)) return alert("Please Select Mount on line "+i);
			};
		};
        var cookStr = "", lTotal = 0,ptnPr = 0, lookahead = "", cnt = 1;
        var daColor = null, daHeight = 0;
        for (i = 1; i < 5; i++) {
            cnt++;
            var pObj = "line" + i, sObj = "upperheight" + i, dObj = "depth" + i, fObj = "font" + i, tObj = "gt" + i, cObj = "color" + i, laObj = "line" + cnt, mObj = "mount" + i;
            var stObj = "stud" + i, spObj = "spacer" + i, tpObj = "template" + i, bkObj = "brick" + i, frObj = "fraction" + i;
			
            lookahead = cnt == 5 || oForm[laObj].value.length == 0 ? doChars(document.getElementById("oImg").src) : pObj;
            
			if (oForm[pObj].value.replace(/\s/g, "").length > 0) {
               
			   // calcs total allows for price of one pattern only
				lTotal =  parseFloat(g_id('LT'+i).innerHTML);
				ptnPr = parseFloat(g_id('PP'+i).innerHTML.substr(1));
				lTotal = (lTotal * qVal)+ptnPr;

                daHeight = oForm[frObj].selectedIndex > 0 ? parseFloat(oForm[sObj][oForm[sObj].selectedIndex].value) + parseFloat(oForm[frObj][oForm[frObj].selectedIndex].value) : oForm[sObj][oForm[sObj].selectedIndex].text;
                
				cookStr = 
					"Type   		~  Flat Cut Bronze" + 
					"|Letters  		~ " + doChars(oForm[pObj].value) + 
					"|Font          ~ " + oForm[fObj].value + 
					"|Height        ~ " + daHeight + 
					"|Depth         ~ " + oForm[dObj][oForm[dObj].selectedIndex].text + 
					"|Color         ~ " + oForm[cObj].value + 
					"|Mount         ~ " + oForm[mObj].value + 
					"|Ptn		    ~ " + (oForm[tpObj].selectedIndex == 1 ? oForm[tpObj][oForm[tpObj].selectedIndex].text + " " + oForm.align[oForm.align.selectedIndex].text : oForm[tpObj][oForm[tpObj].selectedIndex].text) + 
					"|sLen			~ " + oForm[stObj][oForm[stObj].selectedIndex].text + 
					"|Spacer Length	~ " + (oForm[spObj].disabled == false && oForm[spObj].selectedIndex > 0 ? oForm[spObj][oForm[spObj].selectedIndex].text : "") + 
					"|Mortar Gap    ~ " + oForm[bkObj].value + 
					"|Image         ~ " + lookahead + 
					"|Qty      		~ " + parseFloat(qVal) + 
					"|Price         ~ " + fixP(lTotal);
               
			    cookStr = cookStr.replace(/\s+\~\s/g, "~");
                cookStr = cookStr.replace(/\s+\|\s/g, "|");
                cookStr = cookStr.replace(/["]/g, "#Y");
                cookStr = cookStr.replace(/[']/g, "#Z");
                toCook("item_", cookStr);
            };
        };
        location.href = "s_viewCart.htm";
    };


function showPicker(inputObj, formField, line){
	    var myObj=formField.substr(0,formField.length-1)+'_picker_div';
		g_id(myObj).linenum=line;		
		g_id(myObj).elem=formField;
		if(myObj=='font_picker_div') {
			createFontList();
			g_id(myObj).style.left = getLeftPos(inputObj) - 600 + "px";
        	g_id(myObj).style.top = getTopPos(inputObj) + inputObj.offsetHeight + 2 + "px";
		}else if(myObj=='mount_picker_div') {
			createMountList();
			g_id(myObj).style.left = getLeftPos(inputObj) -138 + "px";
        	g_id(myObj).style.top = getTopPos(inputObj) + inputObj.offsetHeight -271 + "px";
			doMounts(line);
		}else{
			var dObj='depth'+line;
			createMetalList();
			g_id(myObj).style.left = getLeftPos(inputObj) - 650 + "px";
			g_id(myObj).style.top = getTopPos(inputObj) + inputObj.offsetHeight + 2 + "px";
			doColors(line);
		};
		closePickers(myObj);
		g_id(myObj).style.display="block";
};


//colors


function createMetalList(){
		if(g_id('metalList').innerHTML.length>0) return;
        var myList = '<table border="0" bgColor="#D7D2CD"><tr>';
        for (i = 0; i < colors[0].length; i++) {
            var c=colors[0][i].split('/');
			var mImg = "__colors/tiles/painted/" + c[0].substr(0,4) + ".jpg";
			var oImg = "__colors/tiles/painted/swatch/" + c[0].substr(0,4) + ".jpg";
			if(i%4 ==0) myList +='</tr><tr>';
			myList += '<td align="center"><img id="'+c[0].substr(0,5)+'" src="'+mImg+'" onmouseover="getImgLabel(this.id,\''+oImg+'\')" onclick="if(this.src.indexOf(\'_d.jpg\')==-1) {colorSelect(\''+c[0]+'\',\''+c[1]+'\')}" /></td>';
		};
        myList += '</tr></table>';
		g_id('metalList').innerHTML = myList;
};


function getImgLabel(id,Img){
	g_id(id).style.cursor=(g_id(id).src.indexOf('_d.jpg')==-1)? 'pointer' : 'default';
	g_id('cSwatch').src= (g_id(id).src.indexOf('_d.jpg')==-1)? Img : "__colors/tiles/metal/0000.jpg"; 
};

function colorSelect(color,hex){
		var myObj=g_id('color_picker_div').elem;
		g_id(myObj).value = color; g_id(myObj).alt = hex.substr(1);
		g_id('color_picker_div').style.display="none";
		doMounts(g_id('color_picker_div').linenum);
		prep();
		if(oForm.autoupdate.checked) oForm.update.click();
};

function doColors(line){	
	var cObj='color'+line;
	var dObj='depth'+line;
	var sObj='upperheight'+line;
	var oldval = oForm[cObj].value;
	var dep= oForm[dObj][oForm[dObj].selectedIndex].value;
	var siz= oForm[sObj][oForm[sObj].selectedIndex].value;
	var nArr= new Array();
	for(var i=0;i<colors[0].length;i++){
		var myid=colors[0][i].substr(0,5);
		var greyImg='__colors/tiles/metal/'+ colors[0][i].substr(0,4) +'_d.jpg';
		var Img='__colors/tiles/metal/'+ colors[0][i].substr(0,4) +'.jpg';
		if(i!=3){
			//satin, patina  or oxidized
			g_id(myid).src= Img;
			nArr[i]=true;
		}else{
			//polished 
			if(siz==1){
				g_id(myid).src=greyImg;
				nArr[i]=false;
			}else if(siz > 2 && dep ==.125 || siz > 1 && dep > .125){
				g_id(myid).src=Img;
				nArr[i]=true;
			}else{
				g_id(myid).src=greyImg;
				nArr[i]=false;
			};
		};
		if(oldval==colors[0][i].substr(0,oldval.length)) var itm = i;
	};
	// try to keep users chosen color
	oForm[cObj].value = (nArr[itm]==true)? oldval : "Choose Color";
};



//fonts
function createFontList(){
	   if(g_id('fontlist0').innerHTML.length>0) return;
	   for (j = 0; j < fonts.length; j++) { 
			var fObj = 'fontlist'+j;
			var lName = "";
			var myList = '<table border="0" width="100%" bgColor="#ffffff">';
			for (i = 0; i < fonts[j].length; i++) {
				var fIdx =i;
				var daFon = "fontimages/smallfonts/" + fonts[j][i].replace(/\s/g, "") + ".gif";
				daFon=daFon.toLowerCase();
				lName =fonts[j][i];
				myList += '<tr><td id='+lName+' style="height:26px" onmouseover="this.style.cursor=\'pointer\'" onclick="fontSelect(\''+fonts[j][i]+'\',\''+fIdx+'\')">';
				myList += '<img src="'+daFon+'" onmouseover="this.style.borderStyle=\'solid\'; this.style.borderWidth=\'thin\'" onmouseout="this.style.border=\'none\'" ></img></td></tr>';
			};
			myList += '</table>';
			g_id(fObj).innerHTML = myList;
			myList="";
	   };
};

function fontSelect(myfont,fonIdx){
		var line=g_id('font_picker_div').linenum;
		var myObj=g_id('font_picker_div').elem;
		g_id(myObj).value = myfont; g_id(myObj).alt = fonIdx;
        g_id('font_picker_div').style.display="none";
		doSize(line);
		prep();
		if(oForm.autoupdate.checked) oForm.update.click();
};


//mounts
mountNames = new Array('plain','welded','tapped','bottom','botrail','doubleRail');
mountLabels = new Array('No Mounts','Welded Stud Mount','Removable Stud Mount','Bottom Stud Mount','Bottom Rail Mount','Double Rail Mount');
function createMountList(){
        if(g_id('mountList').innerHTML.length>0) return;
		var myList = '<table border="0" bgColor="#D7D2CD"><tr>';
        for (i = 0; i < mountNames.length; i++) {
            mImg = "__mounts/tiles/flatmetal/" + mountNames[i] + ".jpg";
			lName = mountNames[i];
		if(i==6) myList +='</tr><tr>';
		var myid="mountchoices"+i;
		myList += '<td><img id="'+myid+'" src="'+mImg+'" width="120" height="120" onmouseover="this.style.cursor=(this.src.indexOf(\'_d.jpg\')==-1)? \'pointer\' : \'default\'; showLabel(this.id,'+i+')" onclick="if(this.src.indexOf(\'_d.jpg\')==-1) mountSelect(\''+mountLabels[i]+'\')" /></td>';
		};
        myList += '</tr></table>';
		g_id('mountList').innerHTML = myList;
};

function mountSelect(mount){
		var myObj=g_id('mount_picker_div').elem;
		g_id(myObj).value = mount;
		g_id('mount_picker_div').style.display="none";
		var line=g_id('mount_picker_div').linenum;
		var stObj='stud'+line, spObj='spacer'+line, mObj='mount'+line; bkObj='brick'+line;
		oForm[stObj].disabled=(/(Welded|Removable|Bottom Stud)/.test(oForm[mObj].value))? false : (oForm[stObj].selectedIndex=0,true); 
		oForm[spObj].disabled=(/(Welded|Removable|Bottom Stud)/.test(oForm[mObj].value))? false : (oForm[spObj].selectedIndex=0,true); 
		oForm[bkObj].disabled=(/(Welded|Removable)/.test(oForm[mObj].value))? false : (oForm[bkObj].selectedIndex=0,true); 
		dyTemp(line);
		prep();
};


function doMounts(line){
	var o=g_id('mountchoices1');if(!o) return;
	var sObj='upperheight'+line, dObj = 'depth'+line, cObj = 'color'+line, mObj = "mount"+line;
	var oldval = oForm[mObj].value;
	var siz= oForm[sObj][oForm[sObj].selectedIndex].value;
	var dep= oForm[dObj][oForm[dObj].selectedIndex].value;
	var colr = (/Polished/.test(oForm[cObj].value));
	var nArr= new Array();
	for(var i=0;i<mountNames.length;i++){
		var myid='mountchoices'+i;
		var greyImg='__mounts/tiles/flatmetal/'+mountNames[i]+'_d.jpg';
		var Img='__mounts/tiles/flatmetal/'+mountNames[i]+'.jpg';
		if(colr){
			if(i==0){
				//plain
				g_id(myid).src=greyImg;
				nArr[i]=false;
			}else if(i==1){
				//welded stud
				g_id(myid).src=(dep==.125 && siz > 2)? (nArr[i]=true,Img) : (nArr[i]=false,greyImg);
			}else if(i==2){
				//removable stud
				g_id(myid).src=(dep > .125 && siz > 1  )? (nArr[i]=true,Img) : (nArr[i]=false,greyImg);
			}else{
				//bottom stud -bottom rail - rails
				g_id(myid).src=(dep > .25 && siz > 3  )? (nArr[i]=true,Img) : (nArr[i]=false,greyImg);
			};
		}else{
			if(i==0){
				//plain
				g_id(myid).src=Img;
				nArr[i]=true;
			}else if(i==1){
				//welded stud
				g_id(myid).src=(siz>2 && dep < .25)? (nArr[i]=true,Img) : (nArr[i]=false,greyImg);
			}else if(i==2){
				//removable stud
				g_id(myid).src=(siz>1 && dep > .125)? (nArr[i]=true,Img) : (nArr[i]=false,greyImg);
			}else{
				//bottom stud -bottom rail - rails
				g_id(myid).src=(dep > .25 && siz>3  )? (nArr[i]=true,Img) : (nArr[i]=false,greyImg);
			};
		};
		if(oldval==mountLabels[i]) var itm = i;
	};
	// try to keep users chosen mount
	oForm[mObj].value = (nArr[itm]==true)? oldval : "Choose Mount";
};


function showLabel(id,idx){
	var naTxt = (idx<3)? "Not available because you choose a polished finish. This type of finish must include a stud or rail type mount" : 
				(idx==3)? "Welded studs are only used on 1/8 thick material. The removable stud is used on thicker material" :
				(idx ==4)? "Removable studs are only available on 1/4 inch or thicker materials." : 
				(idx < 8)? "Bottom stud and rail mounts require at least a 4 inch letter height along with a 3/8 or thicker material" : 
				"Only Available on letters at least 6 inch tall and 3/8 or 1/2 inch thick materials.";
	var bImg = g_id(id).src;
	if(bImg.indexOf('_d.jpg') == -1) { 
		g_id("mountinfo").innerHTML = mount[idx];
	}else{
		g_id("mountinfo").innerHTML = naTxt;
	};
}

function pr(){
var pt = "<table bgcolor=\"#666666\" ALIGN=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\">"
		pt += "<tr><td bgcolor=\"#ffffff\" class=\"fb\" colspan=\"1\"></td>";
		pt += "<td bgcolor=\"#ffffff\" class=\"fBBB-blue\" colspan=\"7\"><div align=\"center\">PRICED ON THICKNESS and HEIGHT</div></td>";
		pt += "<tr><td bgcolor=\"#ffffff\" class=\"fb\" colspan=\"1\"></td>";
		pt += "<td bgcolor=\"#ffffff\" class=\"fb\" colspan=\"6\"><div align=\"center\">--- Material Thickness ---<br>Prices are for satin brushed finish<br>other finishes are extra</div></td></tr>";
	    pt += "<tr><td bgcolor=\"#ffffff\" class=\"fb\" colspan=\"1\"></td>";
        pt += "<td bgcolor=\"#ffffff\" class=\"fb\" colspan=\"1\"><div align=\"center\">No Mount</div></td>";
        pt += "<td bgcolor=\"#ffffff\" class=\"fb\" colspan=\"6\" ><div align=\"center\">--- Stud Mount ---</div></td></tr>";
        pt += "<tr><td bgcolor=\"#cccccc\" class=\"fb\"><div align=\"center\">Letter<br>Height</div></td>";
        pt += "<td bgcolor=\"#ffffff\" class=\"fb\"><div align=\"center\">1/8 Inch</div></td>";
        pt += "<td bgcolor=\"#ffffff\" class=\"fb\"><div align=\"center\">1/4 Inch</div></td>";
        pt += "<td bgcolor=\"#ffffff\" class=\"fb\"><div align=\"center\">3/8 Inch</div></td>";
        pt += "<td bgcolor=\"#ffffff\" class=\"fb\"><div align=\"center\">1/2 Inch</div></td>";
        pt += "<td bgcolor=\"#ffffff\" class=\"fb\"><div align=\"center\">3/4 Inch</div></td>";
        pt += "</tr>";
        var result; var ucpr=0;
		for (j = 0; j < dArr[0].length; j++) {
            pt += "<tr align=\"center\"><td bgcolor= \"#cccccc\" >" + dArr[0][j][0] + "</td>";
            for (i = 1; i < 6; i++) {
                ucpr=dArr[0][j][i];
				result = dArr[0][j][i] > 0 ? "$" + fixP(ucpr) : "N/A";
                if (result != "N/A") {
                    pt += "<td bgcolor= \"#FFFF99\" >" + result + "</td>";
                } else {
                    pt += "<td bgcolor= \"#00FFFF\" >" + result + "</td>";
                };
            };
            pt += "</tr>";
        };
        pt += "</table>";
        document.getElementById("priceTable").innerHTML = pt;
};

function zoomer(img,alt){
	$('box').innerHTML="<div id='mTxt'><img src="+img+" class=\"zoom\" onclick=\"hm('box')\"/><br /><center>"+alt+"</center></div>";
	sm('box',316,330);
};



function loadTooltips(){
			g_id("sprytooltip1").innerHTML="<div class='content'><p>To get started, type in the letters, numbers and punctuation, exactly as you want it to read when you make your sign. For multiple line signs, there are 3 other lines that will become available. What you type is what you will get. If lower case letters typed and the size is too small or lower case is not available in the chosen font, those letters will automatically convert to upper case and should convert back again when you change the height or size to something that has availability. What you type here will display in the area below with correct real world dimensions when you leave the text box.</p></div><div class='bottom'></div>";
			g_id("sprytooltip2").innerHTML="<div class='content'><p>Select the uppercase height for the line you are working on. The fraction box will add a fractional unit to the inch box ie; 3-1/2&quot; This gives you a lot of adjustment in your finished line lengths for a set of letters. Only one size can be on one line so if you want large capitals followed by small capitals, you would have to those in an empty line. For those using all lower case, only the ascenders such as 'd I h' are the same height as the corresponding uppercase letter. Body letters such as 'a c s' will be about 2/3rds smaller.</p></div><div class='bottom'></div>";
			g_id("sprytooltip3").innerHTML="<div class='content'><p>The depth measurement is the thickness of the letter when measured front to back. The width of a letter is controlled by the font. Letter depth for sheet cut letters in metal and plastic will determine the price, along with other factors. Depths can be accentuated during installation by choosing spacer stand offs from the mounting options. These allow letters to stand away by a pre-determined length of spacer, giving the letters a shadow effect.</p></div><div class='bottom'></div>";
			g_id("sprytooltip4").innerHTML="<div class='content'><p>The color \/ finish \/ material list is a multi-part selection box allowing you to choose a material(some forms) and a color or finish to apply to the material. For instance, in cut metal letters there are tabs on the top of the selection window where you can select from Aluminum, Bronze, Bronze etc; and each tab will have colors or finishes applicable to that material. Aluminum also has a window for baked enamel colors. On other order forms, only the colors applicable to the product are shown. Please be aware that all colors and finishes are representative, not actual. Although we cannot provide free color samples, our website allows you to buy a single letter as a sample.</p></div><div class='bottom'></div>";
			g_id("sprytooltip6").innerHTML="<div class='content'><p>The font list contains a selection of the most popular fonts. In cut materials, those that have a \"DEPTH\" setting, the font does not contribute to the price. Further, the font does not have to be on this list for us to be able to cut it, which means we can cut your provided font, usually at no extra charge. On other products, such as Cast metal, formed or injection molded plastics, the font chosen will be part of the determining factor of price. Further, custom fonts cannot be done in Injection molded plastic but are available in Vacuum formed plastic and cast metal. See the menu for estimators to price custom fonts and logos. Lastly and importantly, the font chosen will control the width of a given line of text. For shorter lenghts choose a condensed type font.</p></div><div class='bottom'></div>";
			g_id("sprytooltip7").innerHTML="<div class='content'><p>Aligns the display output below either left, right or center justified. TIP: You can also indent display view text by using spaces before the text to move the line text to the right. </p></div><div class='bottom'></div>";
			g_id("sprytooltip8").innerHTML="<div class='content'><p>The backgrounds allow you to see how your chosen letter color might look against a chosen background color. This is helpful for determining the correct color letter to apply to your wall color. No backgrounds are included with actual order. We do not make finished signs. All letters are individual unless specified otherwise.</p></div><div class='bottom'></div>";
			g_id("sprytooltip10").innerHTML="<div class='content'><p>Which mounting hardware best suits your project requires an understanding of the various mounts available for different types of letters. If you are not sure what kind of mounts to get, we strongly recommend reviewing our installation page with helpful videos explaining many of the mounting methods and their uses. A link to the page can be found on the site menu.</p></div><div class='bottom'></div>";
			g_id("sprytooltip11").innerHTML="<div class='content'><p>Standard stud length is the same as no preference. The factory will decide what lengths to include based on the type of letter, its height and depth. Unless you have a specific need for a specific length, this setting can be left at standard.</p></div><div class='bottom'></div>";
			g_id("sprytooltip12").innerHTML="<div class='content'><p>Stand off is where you want your letters to stand slightly away from the mounting surface for effect. Spacers are pre cut hollow tubes the slip over studs to provide a space between the letter and wall. On Vacuum Formed and Injection Molded letters, a combination all mount replaces the sleeve type mount with adjustable pads that can provide multiple depths by screwing the pad in or out along its stud.</p></div><div class='bottom'></div>";
			g_id("sprytooltip13").innerHTML="<div class='content'><p>Stud for brick applys only to letters mounting to brick walls. To avoid you having to drill into the actual brick, the factory aligns the stud mounts in equal lines that should fall on the mortar gaps between the bricks. You need to supply the measurement of your brick. Measure a single brick vertically. Standard bricks are 2-5/8&quot but your bricks may not be standard size.</p></div><div class='bottom'></div>";
			g_id("sprytooltip14").innerHTML="<div class='content'><p>A mounting pattern is a full size drawing of the letters you order, laid out with proper spacing and alignment. A pattern is critical for stud type mounts and shows you where to drill for the studs. NOTE: Gemini products require multiple patterns for multiple sets of letters. Without it, you will not get a good result and spend much time and frustration. For other types of mounts, a full size pounce pattern with inked letters that are perforated on their outlines, allows you to rub chalk through leaving an impression on the wall.</p></div><div class='bottom'></div>";

	var sprytooltip1 = new Spry.Widget.Tooltip("sprytooltip1","#ttLetters", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip2 = new Spry.Widget.Tooltip("sprytooltip2","#ttHeight", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip3 = new Spry.Widget.Tooltip("sprytooltip3","#ttDepth", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip4 = new Spry.Widget.Tooltip("sprytooltip4","#ttColor", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip6 = new Spry.Widget.Tooltip("sprytooltip6","#ttFont", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip7 = new Spry.Widget.Tooltip("sprytooltip7","#ttAlign", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip8 = new Spry.Widget.Tooltip("sprytooltip8","#ttBackground", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip10 = new Spry.Widget.Tooltip("sprytooltip10","#ttMounts", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip11 = new Spry.Widget.Tooltip("sprytooltip11","#ttStud", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip12 = new Spry.Widget.Tooltip("sprytooltip12","#ttStandoff", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip13 = new Spry.Widget.Tooltip("sprytooltip13","#ttBrick", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
	var sprytooltip14 = new Spry.Widget.Tooltip("sprytooltip14","#ttPattern", {useEffect:"blind", showDelay:250, hideDelay:500, followMouse:true});
};
