var counter=0;function moreFields(){counter++;if(document.quoterequest.shirtstyle.value=="Sample Style Line"){document.quoterequest.sampledelete.parentNode.parentNode.removeChild(document.quoterequest.sampledelete.parentNode);}
var style=document.quoterequest.shirtstyleselect.value
if(style.charAt(0)==5){var newFields=document.getElementById('s-xxl').cloneNode(true);}
else if(style.charAt(0)==4){var newFields=document.getElementById('s-xl').cloneNode(true);}
else if(style.charAt(0)==3){var newFields=document.getElementById('s-l').cloneNode(true);}
else{alert('you have to pick a style before you can add it!');var newFields=""}
if(newFields!=""){newFields.id='';newFields.style.display='block';var newField=newFields.childNodes;for(var i=0;i<newField.length;i++){var theName=newField[i].name
if(theName=='shirtstyle'){newField[i].value=style.substr(2,style.length-2);}
if(theName){newField[i].name=theName+ counter;}}
var insertHere=document.getElementById('writeroot');insertHere.parentNode.insertBefore(newFields,insertHere);document.quoterequest.counter.value=counter;document.quoterequest.stylecheck.value=1;}}
function moreFieldsCS(){counter++;var newFields=document.getElementById('s-xxl').cloneNode(true);newFields.id='';newFields.style.display='block';var newField=newFields.childNodes;for(var i=0;i<newField.length;i++){var theName=newField[i].name
if(theName){newField[i].name=theName+ counter;}
var insertHere=document.getElementById('writeroot');insertHere.parentNode.insertBefore(newFields,insertHere);document.quoterequest.counter.value=counter;}}
function CSformopen(){moreFieldsCS();fillContact();}
function validatestyle(){document.quoterequest.stylecheck.value=1;Validation.validate(document.quoterequest.stylecheck);}
var CFStyles=new Array();CFStyles[0]="5 CF1000 Adult T";CFStyles[1]="5 CFOSL Adult L/S T";CFStyles[2]="4 CF2100 Ladies T";CFStyles[3]="3 CF3000 Youth T";var CCStyles=new Array();CCStyles[0]="5 CotC1000 Adult T";var AAStyles=new Array();AAStyles[0]="5 AA2001org Adult T";AAStyles[1]="4 AA2102org Ladies T";AAStyles[2]="4 AA4305org Ladies Rib T";AAStyles[3]="3 AA2201org Youth T";AAStyles[4]="3 AA2105org Toddler T";AAStyles[5]="3 AA4000org Infant T";AAStyles[6]="3 AA4001org Infant Onesie";function addStyles(){for(var i=0;i<document.quoterequest.shirttype.length;i++)
{if(document.quoterequest.shirttype[i].checked)
var shirtbrand=document.quoterequest.shirttype[i].value;}
if(shirtbrand=="Clothing Facts"){var stylearray=CFStyles}
else if(shirtbrand=="Cotton of the Carolinas"){var stylearray=CCStyles}
else if(shirtbrand=="American Apparel"){var stylearray=AAStyles}
var Sel=document.quoterequest.shirtstyleselect;for(i=Sel.options.length-1;i>=0;i--)
{Sel.remove(i);}
for(var x=0;x<stylearray.length;x++){var OptNew=document.createElement('option');OptNew.text=stylearray[x].substr(2,stylearray[x].length-2);OptNew.value=stylearray[x];try{Sel.add(OptNew,null);}
catch(ex){Sel.add(OptNew);}}}
function contactcookies(){document.cookie='contactname='+ document.quoterequest.contactname.value+'; path=/'
document.cookie='companyname='+ document.quoterequest.companyname.value+'; path=/'
document.cookie='phonenumber='+ document.quoterequest.phonenumber.value+'; path=/'
document.cookie='emailaddress='+ document.quoterequest.emailaddress.value+'; path=/'
pageTracker._trackPageview('/quoterequest/form-submit');}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function reportCookie(){var x=readCookie('contactname')
if(x){alert(x);}}
function fillContact(){var contactname=readCookie('contactname')
var companyname=readCookie('companyname')
var phonenumber=readCookie('phonenumber')
var emailaddress=readCookie('emailaddress')
if(contactname){document.quoterequest.contactname.value=contactname;}
if(companyname){document.quoterequest.companyname.value=companyname;}
if(phonenumber){document.quoterequest.phonenumber.value=phonenumber;}
if(emailaddress){document.quoterequest.emailaddress.value=emailaddress;}
jQuery('.date').datepicker();jQuery('#quoterequest').validate({submitHandler:function(form){jQuery("#light").show();jQuery("#fade").show();jQuery("#wrapper").show();form.submit();}});}
function reportCookieTest(){alert(document.cookie);}
function addresssame(){if(document.quoterequest.billingsameasshipping.checked==true){document.quoterequest.billingaddress.disabled=true;document.quoterequest.billingcity.disabled=true;document.quoterequest.billingstate.disabled=true;document.quoterequest.billingzip.disabled=true;document.quoterequest.billingcountry.disabled=true;document.quoterequest.billingaddress.value=document.quoterequest.shippingaddress.value;document.quoterequest.billingcity.value=document.quoterequest.shippingcity.value;document.quoterequest.billingstate.value=document.quoterequest.shippingstate.value;document.quoterequest.billingzip.value=document.quoterequest.shippingzip.value;document.quoterequest.billingcountry.value=document.quoterequest.shippingcountry.value;}
else{document.quoterequest.billingaddress.disabled=false;document.quoterequest.billingcity.disabled=false;document.quoterequest.billingstate.disabled=false;document.quoterequest.billingzip.disabled=false;document.quoterequest.billingcountry.disabled=false;}}
function imageselected(){document.quoterequest.imagecheck.value=document.quoterequest.frontart.value+ document.quoterequest.backart.value;}
function locationselected(){document.quoterequest.locationcheck.value=document.quoterequest.front.value+ document.quoterequest.back.value+ document.quoterequest.leftsleeve.value+ document.quoterequest.rightsleeve.value;Validation.validate(document.quoterequest.locationcheck);}
function locationselectedshort(){document.quoterequest.locationcheck.value=document.quoterequest.front.value+ document.quoterequest.back.value;Validation.validate(document.quoterequest.locationcheck);}
function showStyle(){if(document.quoterequest.shirtstyleselect.value=="5 CF1000 Adult T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/CF1000.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="5 CFOSL Adult L/S T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/CFOSL.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="4 CF2100 Ladies T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/CF2100.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="3 CF3000 Youth T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/CF3000.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="5 CotC1000 Adult T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/CF1000.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="5 AA2001org Adult T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/AA2001.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="4 AA2102org Ladies T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/AA2102.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="4 AA4305org Ladies Rib T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/AA4305.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="3 AA2201org Youth T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/AA2201.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="3 AA2105org Toddler T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/AA2105.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="3 AA4000org Infant T"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/AA4000.png"/></td></tr></table>');}
else if(document.quoterequest.shirtstyleselect.value=="3 AA4001org Infant Onesie"){Tip('<table height=350 width=350 cellpadding=0 cellspacing=0><tr><td><img src="http://www.tsdesigns.com/images/shirtstyles/transparent/AA4001.png"/></td></tr></table>');}}
function validateJS(){document.quoterequest.validateJS.value="1";fillContact();}
function assesschoices(){jQuery('#minimum').html('72');if(jQuery('input:radio[name=ShirtType]:checked').val()=='Good'){jQuery('#Deluxe').removeAttr("checked");jQuery('#Deluxe').attr('disabled',true);jQuery('#DeluxeLabel').addClass('strikethrough');jQuery('#MidRange').removeAttr('disabled');jQuery('#MidRangeLabel').removeClass('strikethrough');}
else if(jQuery('input:radio[name=ShirtType]:checked').val()=='Better'){jQuery('#Deluxe').removeAttr('disabled');jQuery('#MidRange').removeAttr('disabled');jQuery('#DeluxeLabel').removeClass('strikethrough');jQuery('#MidRangeLabel').removeClass('strikethrough');}
else if(jQuery('input:radio[name=ShirtType]:checked').val()=='Best'){jQuery('#MidRange').removeAttr("checked");jQuery('#MidRange').attr('disabled',true);jQuery('#MidRangeLabel').addClass('strikethrough');jQuery('#Deluxe').removeAttr('disabled');jQuery('#DeluxeLabel').removeClass('strikethrough');}
if(jQuery('input:radio[name=ShirtType]:checked').val()&&jQuery('input:radio[name=PrintType]:checked').val()){jQuery('.general').show();jQuery('.dyed,.undyed').hide();jQuery('#stylecheck').removeClass('required');jQuery('#shirtcolor').removeClass('required');jQuery('#quotetype').val('Anvil');var pricelow=parseInt(jQuery('input:radio[name=ShirtType]:checked').attr('price'))+ parseInt(jQuery('input:radio[name=PrintType]:checked').attr('low'));var pricehigh=parseInt(jQuery('input:radio[name=ShirtType]:checked').attr('price'))+ parseInt(jQuery('input:radio[name=PrintType]:checked').attr('high'));jQuery('#pricerange').html('$'+ pricelow+' - '+'$'+ pricehigh);}
else{jQuery('.general,.dyed,.undyed').hide();jQuery('#pricerange').html('$ - $');}
if(jQuery('input:radio[name=PrintType]:checked').val()=='Deluxe'){jQuery('.anvildyed').show();jQuery('#shirtcolor').addClass('required');jQuery('#minimum').html('200');}
if(jQuery('input:radio[name=ShirtType]:checked').val()=='Best'){jQuery('#stylecheck').addClass('required');if(jQuery('input:radio[name=PrintType]:checked').val()=='Economy'){jQuery('.dyed').hide();jQuery('.undyed').show();jQuery('#quotetype').val('TSD UnDyed');}
else if(jQuery('input:radio[name=PrintType]:checked').val()=='Deluxe'){jQuery('.undyed').hide();jQuery('#quotetype').val('TSD Dyed');jQuery('.dyed').show();}}}
