var ajaxObjects = new Array();

function ShowPartOne() {
	document.getElementById('partone').style.display="inline"; 
	document.getElementById('parttwo').style.display="none"; 
}

function ShowPartTwo() {
	document.getElementById('partone').style.display="none"; 	
	document.getElementById('parttwo').style.display="inline"; 	
}

function alertuser (aF, rs, text) {
	aF.alerts.value=aF.alerts.value + "\n" + text;
//	alert (aF.alerts.value + " -----> " aF.alerts.rows);
	aF.alerts.rows=aF.alerts.rows + rs;
}

function OrderDetails (aF, que, group, prodchg, prod) {
que = (que == '') ? group : que;
if (que.indexOf("S14") >= 0)
	alertuser (aF, 1, "Please make sure to specify exact car year below.");
if ( (que.indexOf("I3000") >= 0) || (que.indexOf("I3002") >= 0) )
	alertuser (aF, 4, "Some 00-03 I30/I35s have an armrest with a button, some have one without. Please make sure to specify below whether or not you need the button cutout in your armrest cover so that we can send the right one!");
if ( (que.indexOf("Maxima00") >= 0) || (que.indexOf("Maxima02") >= 0) )
	alertuser (aF, 4, "Some 00-03 Maximas have an armrest with a button, some have one without. Please make sure to specify below whether or not you need the button cutout in your armrest cover so that we can send the right one!");
if (que.indexOf("I30A32") >= 0)
	alertuser (aF, 3, "The 95-97s have a different armrest than 97-99 ones. Please make sure to specify below the exact year of your car so that we can send the right one!");
if (que.indexOf("MaximaA32") >= 0)
	alertuser (aF, 3, "The 95-97 Maximas have a different armrest than late 97-99 ones. Please make sure to specify below the exact year of your car so that we can send the right one!");
if ( (que.indexOf("Impreza9") >= 0) || (que.indexOf("Subaru9") >= 0) )
	alertuser (aF, 3, "There are different designs for the ebrake for cars with and without the armrest. Please specify if your car has a stock armrest or not. Please also specify whether the armrest is EXTENDED or REGULAR.");
else if ( (que.indexOf("Impreza") >= 0) || (que.indexOf("SubaruWRX") >= 0) )
	alertuser (aF, 5, "Please make sure to specify\n - if your center armrest is EXTENDED or STANDARD and \n - (applicable to STI only) the exact year model since mid to late 2006 and 2007+ boots are different.\n - whether your shift boot has velcro or just a tapered collar.");
if (que.indexOf("Saab92x05") >= 0)
	alertuser (aF, 5, "Please make sure to specify\n - if your center armrest is EXTENDED or STANDARD and \n - (applicable to STI only) the exact year model since mid to late 2006 and 2007+ boots are different.\n - whether your shift boot has velcro or just a tapered collar.");
if (que.indexOf("C4new") >= 0)
	alertuser (aF, 1, "Please specify the EXACT year of your car in the comments field!");
if (que.indexOf("FC") >= 0)
	alertuser (aF, 1, "Please specify the EXACT year of your car in the comments field!");
if (que.indexOf("E39") >= 0)
	alertuser (aF, 3, "Please specify if your armrest is Euro or US (these have the phone cradle in the center). If you're not ordering an armrest just type `neither`.");
if (que.indexOf("C4old") >= 0)
	alertuser (aF, 6, "Please specify in the comments field which version do you need:\n84-87 with overdrive on shifter or\n84-87 with overdrive on console or\n86-88 regular boot, no overdrive");
if (que.indexOf("L32") >= 0)
	alertuser (aF, 3, "Please specify if your car has the reverse lockout on the shifter in the comments field! Nissan introduced it as of 2005 but there are 2005 models with no reverse lockout as well.");
if (que.indexOf("B15") >= 0)
	alertuser (aF, 3, "Please specify if your car has the reverse lockout on the shifter in the comments field! Nissan introduced it as of 2005 but there are 2005 models with no reverse lockout as well.");
if (que.indexOf("B14") >= 0)
	alertuser (aF, 2, "Some B14 Sentra's have a rubber shift factory shift boot. If that is the case with your car, please write so below!");
if (que.indexOf("VWMK4") >= 0)
	alertuser (aF, 3, "Some Mark IV Jetta/Golfs have elastic in the bottom of the boot, some have a silver bezel on the bottom and no elastic. Please make sure to specify which one do you need!");
if (que.indexOf("Forester0305") >= 0)
	alertuser (aF, 2, "Please let us know which year is your car exactly! If you are ordering an armrest cover please advise if you need the REGULAR or EXTENDED one!");
if (que.indexOf("Legacy05") >= 0)
	alertuser (aF, 2, "Please specify if you have the regular or extended armrest. Please also specify if your car is a specB (6-spd) or a regular (5-spd).");
if (que.indexOf("MINI07") >= 0)
	alertuser (aF, 2, "Please let us know if you have the fliptop or sliding center armrest - there are pictures on our MINI armrest pages of both types.");
else if (que.indexOf("MINI") >= 0)
	alertuser (aF, 5, "If ordering the center armrest, please tell us if you need the fliptop or sliding type.\nFor door armrests, please let us know if you have the longer (05+) or the shorter (01-early 05) armrest - there are pictures on our MINI armrest pages of both types.");
if (que.indexOf("Mustang05") >= 0)
	alertuser (aF, 2, "The newer 07+ Mustangs have a slightly different shift boot and armrest. Please be sure to give us the exact year model of your car!");
if (que.indexOf("Civic9294") >= 0)
	alertuser (aF, 1, "Please let us know if you need the REGULAR or EXTENDED armrests!");
if (que.indexOf("Rodeo9195") >= 0)
	alertuser (aF, 1, "Please let us know if your car is a 2WD or 4WD!");
if (que.indexOf("Matrix0305") >= 0)
	alertuser (aF, 3, "Please let us know if you have a one-piece or a two-piece armrest!\nNormally the one-piece armrest is found on the base trim. Xr and Xrs models will have the two-piece one.");
if (que.indexOf("Vibe0305") >= 0)
	alertuser (aF, 3, "Please let us know if you have a one-piece or a two-piece armrest!\nNormally the one-piece armrest is found on the base trim. Xr and Xrs models will have the two-piece one.");
if (que.indexOf("GTO0406") >= 0 )
	alertuser (aF, 1, "Please let us know whether your car is manual or automatic!");
if (que.indexOf("C6") >= 0 )
	alertuser (aF, 3, "Please let us know the EXACT YEAR MODEL of your car! The shift boot is different on the 2009+ year models. If you have an older year model car with the 2009+ shift knob, please make sure to write 2009!");
if (que.indexOf("Miata") >= 0 )
	alertuser (aF, 2, "Please let us know the EXACT YEAR MODEL of your car!");
if (que.indexOf("Yaris9906") >= 0 )
	alertuser (aF, 3, "Please let us know the EXACT YEAR MODEL and CHASSIS TYPE of your car! 07+ cars have different boots, and coupe and sedan are different.");
if (que.indexOf("Xterra0004") >= 0)
    alertuser (aF, 2, "Please let us know if your car has the dual shift boot, or if the shifter is separated from the transfer case with a small gap.");
if (que.indexOf("Civic04") >= 0)
	alertuser (aF, 4, "Please let us know if you need the floor-mounted, non-EP3 version or the radio console-mounted, SI (EP3) version.\nPlease advise if you need the center console-mounted or the seat-mounted armrest!");
if (que.indexOf("GrandAm9904") >= 0)
	alertuser (aF, 1, "Please let us know if your car is manual or automatic.");
if (que.indexOf("Cobalt") >= 0)
	alertuser (aF, 3, "Please make sure to specify\n - engine size and type (shift boot differs)\n - ebrake version (stock handle/MOMO handle)");
if (que.indexOf("S9502") >= 0)
	alertuser (aF, 2, "Please make sure to specify the exact year of your car. The armrests are different on 95-99 and 00-02 models.");
if (que.indexOf("E92") >= 0)
	alertuser (aF, 2, "Please indicate whether your car is an ///M or not, and specify whether or not it comes with iDrive.");
if (que.indexOf("Pathfinder9600") >= 0)
	alertuser (aF, 2, "Ther are two armrest types available. Please specify total length of yours, measured over the curvature of the armrest. It's either 14.5 or 18.5 inches.");
if ((que.indexOf("4runner8489") >= 0) || (que.indexOf("4runner8992") >= 0) )
	alertuser (aF, 5, "Please specify dimension of opening in center console. It can be either\n1. 5 3/4 wide x 12 long\n2. 11 1/2 length, 5 1/2 width in front and 5 width in back\n 3.10 1/2 length, 5 3/8 width.");
if (que.indexOf("Mustang10") >= 0)
	alertuser (aF, 2, "If your car comes with the Premier Trim with Color Accent Package, 401A, you need a tight-collared shift boot. Please indicate if this is so.");
if (que.indexOf("Civic06") >= 0)
	alertuser (aF, 3, "Please indicate if your car is a coupe (2-door) or a sedan (4-door). If not ordering door trim items, just type 'N/A'.");
if (que.indexOf("SupraMK4") >= 0)
	alertuser (aF, 2, "Please indicate if your car is a 5-spd or a 6-spd.");
if (que.indexOf("Wrangler9702") >= 0)
	alertuser (aF, 3, "Please provide the exact year model of your car!");
if (que.indexOf("E92") >= 0)
	alertuser (aF, 3, "Please describe chassis type E90 (sedan), E92 (coupe) or E93 (convertible) and whether is it an M3 or not.");
if (aF.embroidery.value !="No") 
	alertuser (aF, 3, "Please describe placement of embroidery in the comments below. You can choose different logos for different items, please just describe that in the comments and we'll take it from there. :)");
if (aF.seatbeltpads.value=="2E" || aF.seatbeltpads.value == "4E")
	alertuser (aF, 2, "Please DO NOT COUNT seatbelt pads as items to be embroidered, if not embroidering other items select PADS ONLY. :)");

// Here's the bracket recalculation
if (prodchg) {
	aF.bracket.disabled="true";
	aF.bracket.value="No";
// Here we just suggest who gets brackets who does not
	if ((prodchg) && (
	    (que.indexOf ("Xterra0004") >= 0) || (que.indexOf ("Audi4000") >= 0) ||  (que.indexOf ("Cavalier8894") >= 0) || (que.indexOf ("Cavalier9305") >= 0) || 
	    (que.indexOf ("L32") >= 0) || (que.indexOf ("Paseo9295") >= 0) || (que.indexOf ("Paseo9697") >= 0) || (que.indexOf ("ScionxB03") >= 0) || 
	    (que.indexOf ("Corolla03") >= 0) || (que.indexOf ("Conquest8689") >= 0) || (que.indexOf ("GrandAm9698") >= 0) ||
        (que.indexOf ("Carina9296") >= 0) || (que.indexOf ("Altima07") >= 0) || (que.indexOf ("Corolla10") >= 0) || (que.indexOf ("R34") >= 0) || 
        (que.indexOf ("ScionTc11") >= 0) || (que.indexOf ("Matrix09") >= 0) || (que.indexOf ("Vibe09") >= 0) || (que.indexOf ("Tacoma05") >= 0) || (que.indexOf ("IS06") >= 0) || 
        1 == 0 ) )
	    {
		document.getElementById('bracket').style.display="inline";     	
        aF.bracket.disabled = false;
		aF.bracket.value = "No";
		}
// Here we enforce purchasing of brackets
	if (que.indexOf("Rodeo9195") >= 0) {
		document.getElementById('bracket').style.display="inline"; 
		aF.bracket.value = "Yes";
	}
}
// Here's the padding recalculation
if (prodchg) {
document.getElementById('padding').style.display="none";     	
document.getElementById('resize').style.display="none";     	
aF.padding.disabled="true";
aF.padding.value="No";
// Here we just suggest who gets padding who does not
if ( 
/* ( (que.indexOf("S14") >= 0) || (que.indexOf("Z32") >= 0) || (que.indexOf("DSM3") >= 0) || (que.indexOf("Contour9597") >= 0) || (que.indexOf("Cougar9903") >= 0) ||
    (que.indexOf("C6") >= 0) || (que.indexOf("C5") >= 0) || (que.indexOf("Forester0305") >= 0) || (que.indexOf("GrandAm9904") >= 0) || (que.indexOf("Impreza05") >= 0) ||
    (que.indexOf("Impreza9900") >= 0) || (que.indexOf("ImprezaWRX") >= 0) || (que.indexOf("Impreza9298") >= 0) || (que.indexOf("Legacy05") >= 0) ||
    (que.indexOf("Legacy0004") >= 0) || (que.indexOf("Maxima02") >= 0) || (que.indexOf("MaximaA32") >= 0) || (que.indexOf("Maxima00") >= 0) || 
    (que.indexOf("Saab92x05") >= 0) || (que.indexOf("I3000") >= 0) || (que.indexOf("I30A32") >= 0) || (que.indexOf("I3002") >= 0) || 
    (que.indexOf("MINI") >= 0) || (que.indexOf("Mustang05") >= 0) || (que.indexOf("Mustang0104") >= 0) || (que.indexOf("Mustang9900") >= 0) || (que.indexOf("ScionTc04") >= 0) ||
    (que.indexOf("Miata") >= 0) || (que.indexOf("FB") >= 0)  || (que.indexOf("EvoX") >= 0) || (que.indexOf("Cobalt0509") >= 0) ||
    (que.indexOf("TL0508") >= 0)|| (que.indexOf("Fusion0410") >= 0) || (que.indexOf("Mazda3") >= 0) || (que.indexOf("Mazda6") >= 0) ||
    (que.indexOf("Camaro9802") >= 0)|| (que.indexOf("E39") >= 0) || (que.indexOf("Civic06") >= 0) || (que.indexOf("Tacoma05") >= 0) || 
    (que.indexOf("CL0103") >= 0)) 

    && */
    ((prod.indexOf("rmrest") >= 0) || (prod.indexOf("poyabraz") >= 0) || (prod.indexOf("rmlehne") >= 0) ) )
    {
		document.getElementById('padding').style.display="inline"; 
		aF.padding.disabled = false;
		aF.padding.value = "No";
	}
}
if ((prod.indexOf("hift") >= 0) || (prod.indexOf("oth") >= 0) || 
	(prod.indexOf("dos") >= 0) || (prod.indexOf("cambio") >= 0) ||
	(prod.indexOf("chalt") >= 0) || (prod.indexOf("eide") >= 0) )
	    document.getElementById('resize').style.display="inline";   
    CheckFinishing (aF, false);
}

function ApplyDiscount (aF, verbose) {
  	var curr = aF.amt.value;
    var prem = 0;
   	var disc = aF.discountlevel.value;
	// HAPPY DAY/HAPPY WEEKEND
	// disc = 15;
	// HAPPY DAY/HAPPY WEEKEND ENDS
    if (disc < 5)   {
        var pid=getUAMCookieInd("UAMAFF1", 4);
	    while (pid > 2) pid -= 2;
        if (pid == 2) disc = 5;
    }
   	var finishtype = CheckFinishing(aF, verbose);
   	var shiftsize = aF.shiftmod.value;
   	var bracket = aF.bracket.value;
	var padding = aF.padding.value;
    var custom = aF.FinishingColorCustom.value;
    var layout = aF.layout.value;
    var addM = 0;
    var addPads = 0;
    var addEmbroidery = 0;
    var calculated = 0;
    var additions = 0;
    var brideMultiplier = 0;
    var alcMultiplier = 0;
    var seatbeltpads = aF.seatbeltpads.value;
    var embroidery = aF.embroidery.value;
    var embroideryQty = aF.embroideryQty.value;
    // Calculate the Alcantara extra fee
    if (aF.product.value != "reship" && aF.product.value != "samples") {   	
	var L1 = aF.leather.value;
   	var L2 = aF.twotone.value;	 
	if (L1 == "ALC 9040" || L1 == "ALC 9002") {
		if (L2 == "None") alcMultiplier = 60;
		if (L2 != "ALC 9040" &&  L2 != "ALC 9002" && L2 != "None" ) alcMultiplier = 30;
	}
	if (L2 == "ALC 9040" || L2 == "ALC 9002") alcMultiplier += 30;
    }   
    // Calculate the Bride extra fee
    if (aF.product.value != "reship" && aF.product.value != "samples") {   	
        var L1 = aF.leather.value;
   	    var L2 = aF.twotone.value;
   	    var L1L = aF.BrideLetters.value;
   	    var L2L = aF.BrideLetters2.value;
   	    if ((L1 == "BRIDE BLK") || (L1 == "BRIDE RED")) document.getElementById('BrideLetterSpan').style.display="inline"; else {document.getElementById('BrideLetterSpan').style.display="none"; aF.BrideLetters.value = "none"; }
       	if (((L2 == "BRIDE BLK") || (L2 == "BRIDE RED")) && document.getElementById('BrideLetterSpan').style.display=="none") document.getElementById('BrideLetterSpan2').style.display="inline"; else { document.getElementById('BrideLetterSpan2').style.display="none"; aF.BrideLetters2.value = "none"; }
       	if ((L1 == "BRIDE BLK") || (L1 == "BRIDE RED") || (L2 == "BRIDE BLK") || (L2 == "BRIDE RED")) {
       		if (L1L == "NO LETTERS" || L2L == "NO LETTERS") brideMultiplier = 30;
    		if (L1L == "NORMAL LETTERS" || L2L == "NORMAL LETTERS") brideMultiplier = 50;
      		if (L1L == "ALL LETTERS" || L2L == "ALL LETTERS") brideMultiplier = 90;
       	}
	if ((L1 == "BRIDE GRAD") || (L2 == "BRIDE GRAD")) brideMultiplier = 100;
       	// Bride done
       	var threads = aF.thread.value;
        // adding in percentages
       	prem = (finishtype == "STRIPES") ? 15 : 0;
       	prem += (finishtype == "PIPING") ? 20 : 0;
        prem += (finishtype == "RACING") ? 30 : 0;
       	prem += brideMultiplier;
	prem += alcMultiplier;
       	prem += (custom == "M STRIPES" && finishtype == "CUSTOM") ? 30 : 0;
       	prem += (custom == "NISMO" && finishtype == "CUSTOM") ? 30 : 0;
       	prem += (custom == "GERMANFLAG" && finishtype == "CUSTOM") ? 30 : 0;
       	prem += (custom == "ITALIANFLAG" && finishtype == "CUSTOM") ? 30 : 0;
       	prem += (custom == "R-W-B-STRIPES" && finishtype == "CUSTOM") ? 30 : 0;
        // adding in amounts
        switch (custom) {
            case "0": addM = 0; break;
            case "M-STITCH 1": addM = 9; break;
            case "M-STITCH 2": addM = 9; break;
            case "M-STITCH 3": addM = 9; break;
            case "M-STITCH 4": addM = 9; break;
            case "M-STITCH 5": addM = 19; break;
	    case "ALPINA": addM = 9; break;
        }
        if (embroidery != "No")
        switch (embroideryQty) {
	    case "0": addEmbroidery = 0; break;
            case "1": addEmbroidery = 24; break;
            case "2": addEmbroidery = 38; break;
            case "3": addEmbroidery = 59; break;
            case "4": addEmbroidery = 79; break;
            case "5": addEmbroidery = 99; break;
        } 
        else addEmbroidery = 0;
        switch (seatbeltpads) {
            case "0": addPads = 0; break;
            case "2": addPads = 38; break;
            case "2E": addPads = 62; break;
            case "4": addPads = 68; break;
            case "4E": addPads = 116; break;
        }
   	    additions = (finishtype == "QUADRUPLE") ? 9 : 0;
   	    additions += (shiftsize != "0") ? 9 : 0;
  	    additions += (layout == "AXIS") ? 9 : 0;
  	    additions += (threads == "Other") ? 19 : 0;
        additions += addM;
        additions += addPads;
        additions += addEmbroidery;
   	    additions += (bracket == "Yes") ? 19 : 0;
	    additions += (padding == "6/8") ? 19 : 0;
	    additions += (padding == "1+1/8") ? 29 : 0;
// add for two-tone if selected verbosely prem==0 means not stripes not piping
   	    additions += ((L2 != "None") && (L1 != L2)) ? 3 : 0
    }
//   	alert ("L1: " + L1 + " L2: " + L2 + " prem: " + prem + " add: " + additions);
    if (disc >= 0) { 
        calculated = Math.round (curr * (100 - disc + prem)) / 100;
    } 
// Negative discount means a discount in numbers, not percentages
    else {
        calculated = Math.round (curr * (100 + prem)) / 100;
        additions -= -1*disc; 
    }
    calculated += additions;
    aF.amt.value = NormalizeNumberString(calculated);
//    aF.amt1.value = calculated;
    aF.costb4ship.value = calculated;
}

function NormalizeNumberString (inputVar) {
    formatString = new String (inputVar)
    var missZeros = formatString.length - formatString.lastIndexOf(".");
    if (missZeros > formatString.length) formatString = formatString + ".00";
    if (missZeros > 2) formatString = formatString.substring (0,formatString.lastIndexOf(".")+3);
    if (missZeros == 2 & formatString.lastIndexOf (".") != -1) formatString = formatString + "0";
    return formatString;
}

function CalculateShipping(aF, USD) {
    var oldship = aF.shipcharge.value;
    if (lang=='ENG' || USD == true) {
    	if ((aF.shipto.value =="AU") || (aF.shipto.value =="AS") || (aF.shipto.value =="AF") || (aF.shipto.value =="SA"))
    	{ aF.shipcharge.value = "9.00"; } else { aF.shipcharge.value = "9.00"; }
    }
    if (lang=='DEU' && USD == false) {
    	if ((aF.shipto.value =="AU") || (aF.shipto.value =="AS") || (aF.shipto.value =="AF") || (aF.shipto.value =="SA"))
    	{ aF.shipcharge.value = "9.00"; } else { aF.shipcharge.value = "9.00"; }
    }
    if (lang=='ESP' && USD == false) {
    	if ((aF.shipto.value =="AU") || (aF.shipto.value =="AS") || (aF.shipto.value =="AF") || (aF.shipto.value =="SA"))
    	{ aF.shipcharge.value = "9.00"; } else { aF.shipcharge.value = "9.00"; }
    }
   if (aF.amt.value >= spcmin) {
     aF.shipcharge.value = "0.00";
     if (oldship > 0) alert ("CHRISTMAS SPECIAL! We will cover shipping if you complete this order!");
   }
   if (aF.product.value == "reship" || aF.product.value == "samples") {
     aF.shipcharge.value = "0.00";
   }
   aF.total.value = NormalizeNumberString (parseFloat (aF.costb4ship.value, 10) + parseFloat (aF.shipcharge.value, 10) + parseFloat (aF.twm_price.value, 10));
}

function zaladuj() { if (document.e.url.value != "X") parent.location.href=document.e.url.value; }

function ApplyCode (aF, lang) {
    var discountcode = aF.discount.value;
    var fileLink = 'discountcodes/CheckCode.php?code='+discountcode;
    var ajaxIndex = ajaxObjects.length;
    ajaxObjects[ajaxIndex] = new sack();
    ajaxObjects[ajaxIndex].requestFile = fileLink;
//    ajaxObjects[ajaxIndex].onLoading = function(){LoadingDiscount;};
    ajaxObjects[ajaxIndex].onCompletion =   function(){ ProcessDiscount(ajaxIndex, lang); };  
    ajaxObjects[ajaxIndex].runAJAX();  
}    
    
function LoadingDiscount () {
    document.getElementById('discountbutton').value="Applying code, wait please...";
}

function ProcessDiscount (ajaxIndex, lang) {
   var discount = ajaxObjects[ajaxIndex].response;
   document.getElementById('discountlevel').value=discount;
   if (discount == -5) {
        alert ("Applying $5 credit for your previous purchase of our color samples.");
    }
   if (discount == 0) {
			    if (lang=='ENG') alert ("This code is not valid. Please check if you typed it correctly and try again.");
			    if (lang=='ESP') alert ("Este código es inválido. Compruebe por favor si lo escribio correctamente e intente otra vez.");
	}
    if (discount == 5) {
		    if (lang=='ENG') alert ("This code is valid, but also expired. We can give you 5% discount.");
		    if (lang=='ESP') alert ("Este código es válido, pero también está expirado. Podemos darle un descuento del 5%.");
	}
    if(discount > 5) {
		    if (lang=='ENG') alert ("Thank you! We have applied your code and you have received a " + discount + "% discount!");
		    if (lang=='ESP') alert ("Gracias! Hemos aplicado su codigo unico y ha recibido un descuento de " + discount + "%!");
	 }
   if (discount != 0) {document.getElementById('OrderForm').applydiscount.disabled=true;} else {document.getElementById('OrderForm').applydiscount.disabled=false; }
   SetItemAndAmount(document.getElementById('OrderForm'), false, false, false);
}

function CheckFinishing(aF, verbose) {
	var finish = "";
	var layout = aF.layout.value;
	for (var i=0; i < aF.Finishing.length; i++)
   	if (aF.Finishing[i].checked)
      	finish = aF.Finishing[i].value;
    if (aF.embroidery.value != "No") document.getElementById('embroiderySpan').style.display = "inline"; else document.getElementById('embroiderySpan').style.display = "none";
    if (aF.product.value != "reship" && aF.product.value != "samples") {
        document.getElementById('FinColorQuad').style.display="none"; 
        document.getElementById('FinColorStripes').style.display="none"; 
        document.getElementById('FinColorPiping').style.display="none"; 
        document.getElementById('FinColorRacing').style.display="none"; 
        document.getElementById('FinColorCustom').style.display="none"; 
        document.getElementById('LayoutType').style.display="inline";         
        aF.FinishingColorQuad.disabled = true;
	    aF.FinishingColorStripes.disabled = true;
	    aF.FinishingColorPiping.disabled = true;
        aF.FinishingColorRacing.disabled = true;
        aF.FinishingColorCustom.disabled = true;
        if (finish == "QUADRUPLE") {
            document.getElementById('FinColorQuad').style.display="inline"; 
		    aF.FinishingColorQuad.disabled = false;
		    if ( (aF.FinishingColorQuad.value == "none") && (verbose == false) )
		        alert ("Please tell us what color of OUTSIDE THREADS would you like. The primary thread color will determine the threading placed on the inside - closer to the seam!");
	    }
	    if (finish == "STRIPES") {
            document.getElementById('FinColorStripes').style.display="inline"; 
		    aF.FinishingColorStripes.disabled = false;
    		if ( (aF.FinishingColorStripes.value == "none") && (verbose == false) )
		        alert ("Please make sure to pick the color to be used as the color of the decorative stripes!");
	    }
	    if (finish == "PIPING") {
            document.getElementById('FinColorPiping').style.display="inline"; 
    		aF.FinishingColorPiping.disabled = false;
		    if ( (aF.FinishingColorPiping.value == "none") && (verbose == false) )
    		    alert ("Please make sure to pick the color to be used as the color of the piping!");
	    }
	    if (finish == "RACING") {
            document.getElementById('FinColorRacing').style.display="inline"; 
            document.getElementById('LayoutType').style.display="none";         
    		aF.FinishingColorRacing.disabled = false;
		    if ( (aF.FinishingColorRacing.value == "none") && (verbose == false) )
    		    alert ("Please make sure to pick the color to be used as the color of the racing stripes!");
	    }
	    if (finish == "CUSTOM") {
            document.getElementById('FinColorCustom').style.display="inline"; 
            document.getElementById('LayoutType').style.display="none";         
    		aF.FinishingColorCustom.disabled = false;
		    if ( (aF.FinishingColorCustom.value == "0") && (verbose == false) )
    		    alert ("Please make sure to pick the custom finishing style!");
	    }
    }
    if (aF.product.value=="Pads2" || aF.product.value=="Pads4" ||aF.product.value=="Pads2E" ||aF.product.value=="Pads4E")
	document.getElementById('LayoutType').style.display="none";   
	return finish;
}

function clrchart()
{ popup = window.open("clrchart.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function colormatch()
{ popup = window.open("clrmatch.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function twotone()
{ popup = window.open("TwoTone.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function quadruple()
{ popup = window.open("Quadruple.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function padding()
{ popup = window.open("Padding.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function stripes()
{ popup = window.open("Stripes.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function racing()
{ popup = window.open("StripesRacing.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function piping()
{ popup = window.open("Piping.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function custom()
{ popup = window.open("CustomFinishing.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function shortboot()
{ popup = window.open("ShortShiftBoot.php?frames=N","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function special()
{ popup = window.open("special.php","popupp","height=200,width=600,scrollbars=no,resize=no");
}
function multipleENG()
{ popup = window.open("multipleENG.php","popupp","height=300,width=800,scrollbars=yes,resize=no");
}
function bracketENG()
{ popup = window.open("bracketENG.php","popupp","height=300,width=800,scrollbars=yes,resize=no");
}
function securityENG()
{ popup = window.open("securityENG.php","popupp","height=330,width=800,scrollbars=yes,resize=no");
}
function moneybackENG()
{ popup = window.open("moneybackENG.php","popupp","height=600,width=800,scrollbars=yes,resize=no");
}
function bridelogo()
{ popup = window.open("bridelogo.php","popupp","height=700,width=800,scrollbars=yes,resize=no");
}
function layout()
{ popup = window.open("layout.php","popupp","height=700,width=800,scrollbars=yes,resize=no");
}
function securityDEU()
{ popup = window.open("securityDEU.php","popupp","height=370,width=800,scrollbars=yes,resize=no");
}
function moneybackDEU()
{ popup = window.open("moneybackDEU.php","popupp","height=280,width=800,scrollbars=yes,resize=no");
}
function bracketESP()
{ popup = window.open("bracketESP.php","popupp","height=300,width=800,scrollbars=yes,resize=no");
}
function multipleESP()
{ popup = window.open("multipleESP.php","popupp","height=300,width=800,scrollbars=yes,resize=no");
}
function securityESP()
{ popup = window.open("securityESP.php","popupp","height=330,width=800,scrollbars=yes,resize=no");
}
function moneybackESP()
{ popup = window.open("moneybackESP.php","popupp","height=280,width=800,scrollbars=yes,resize=no");
}
function bracketENG()
{ popup = window.open("bracketENG.php","popupp","height=300,width=800,scrollbars=yes,resize=no");
}
function embroidery()
{ popup = window.open("Embroidery.php?frames=N","popupp","height=600,width=840,scrollbars=yes,resize=no");
}
function seatbeltpads()
{ popup = window.open("SeatBeltPads.php?frames=N","popupp","height=600,width=840,scrollbars=yes,resize=no");
}
