//
//  Culinary Classics Personal JavaScript Library
//

//
//
// These are the arrays setup to make checking options easier. All of the arrays are based on option
// types like cuffs, collars, fabrics, etc. Any new group additions to the system must be added to this
// list or the option will not show up on the webpage, and will not be checked for validity or availability.
//
//

var divtricolorfabrics1 = new Array("divTriColor_Egyptian_Fabrics_1","divTriColor_Fine_Line_Fabrics_1","divTriColor_Maxima_Poplin_Fabrics_1",
				"divTriColor_Mid_Weight_Fabrics_1","divTriColor_Spun_Poly_Fabrics_1","divTriColor_Denim_Fabrics_1",
				"divTriColor_Soil_Release_Fabrics_1","divTriColor_Organic_Fabrics_1",
				"divTriColor_Industrial_Fabrics_1","divTriColor_Twill_Fabrics_1",
				"divTriColor_Supima_Fabrics_1","divTriColor_Waffle_Fabrics_1");

var divtricolorfabrics2 = new Array("divTriColor_Egyptian_Fabrics_2","divTriColor_Fine_Line_Fabrics_2","divTriColor_Maxima_Poplin_Fabrics_2",
				"divTriColor_Mid_Weight_Fabrics_2","divTriColor_Spun_Poly_Fabrics_2","divTriColor_Denim_Fabrics_2",
				"divTriColor_Soil_Release_Fabrics_2","divTriColor_Organic_Fabrics_2",
				"divTriColor_Industrial_Fabrics_2","divTriColor_Twill_Fabrics_2",
				"divTriColor_Supima_Fabrics_2","divTriColor_Waffle_Fabrics_2");

var divtricolorfabrics3 = new Array("divTriColor_Egyptian_Fabrics_3","divTriColor_Fine_Line_Fabrics_3","divTriColor_Maxima_Poplin_Fabrics_3",
				"divTriColor_Mid_Weight_Fabrics_3","divTriColor_Spun_Poly_Fabrics_3","divTriColor_Denim_Fabrics_3",
				"divTriColor_Soil_Release_Fabrics_3","divTriColor_Organic_Fabrics_3",
				"divTriColor_Industrial_Fabrics_3","divTriColor_Twill_Fabrics_3",
				"divTriColor_Supima_Fabrics_3","divTriColor_Waffle_Fabrics_3");

var divhatbandfabrics = new Array("divHatband_Egyptian_Fabrics","divHatband_Fine_Line_Fabrics","divHatband_Maxima_Poplin_Fabrics",
				"divHatband_Mid_Weight_Fabrics","divHatband_Spun_Poly_Fabrics","divHatband_Denim_Fabrics",
				"divHatband_Soil_Release_Fabrics","divHatband_Woven_Fabrics","divHatband_Organic_Fabrics",
				"divHatband_Industrial_Fabrics","divHatband_Twill_Fabrics","divHatband_Ultralite_Fabrics",
				"divHatband_Shirting_Fabrics","divHatband_Tuff_Twill_Fabrics","divHatband_Mikro_Fabrics",
				"divHatband_Ultima_Poplin_Fabrics","divHatband_Rayon_Blend_Fabrics",
				"divBase_Vest_Tie_Fabrics","divHatband_Supima_Fabrics","divHatband_Waffle_Fabrics","divHatband_Seasonal_Fabrics");

var divbuttonfabrics = new Array("divButton_Egyptian_Fabrics","divButton_Fine_Line_Fabrics","divButton_Maxima_Poplin_Fabrics",
				"divButton_Mid_Weight_Fabrics","divButton_Spun_Poly_Fabrics","divButton_Denim_Fabrics",
				"divButton_Soil_Release_Fabrics","divButton_Woven_Fabrics","divButton_Organic_Fabrics",
				"divButton_Industrial_Fabrics","divButton_Twill_Fabrics","divButton_Ultralite_Fabrics",
				"divButton_Shirting_Fabrics","divButton_Tuff_Twill_Fabrics","divButton_Mikro_Fabrics",
				"divButton_Ultima_Poplin_Fabrics","divButton_Rayon_Blend_Fabrics",
				"divBase_Vest_Tie_Fabrics","divButton_Supima_Fabrics","divButton_Waffle_Fabrics");

var divcufffabrics = new Array("divCuff_Egyptian_Fabrics","divCuff_Fine_Line_Fabrics","divCuff_Maxima_Poplin_Fabrics",
				"divCuff_Mid_Weight_Fabrics","divCuff_Spun_Poly_Fabrics","divCuff_Denim_Fabrics",
				"divCuff_Soil_Release_Fabrics","divCuff_Woven_Fabrics","divCuff_Organic_Fabrics",
				"divCuff_Industrial_Fabrics","divCuff_Twill_Fabrics","divCuff_Ultralite_Fabrics",
				"divCuff_Shirting_Fabrics","divCuff_Tuff_Twill_Fabrics","divCuff_Mikro_Fabrics",
				"divCuff_Ultima_Poplin_Fabrics","divCuff_Rayon_Blend_Fabrics",
				"divBase_Vest_Tie_Fabrics","divCuff_Supima_Fabrics","divCuff_Waffle_Fabrics","divCuff_Seasonal_Fabrics");

var divyokefabrics = new Array("divYoke_Egyptian_Fabrics","divYoke_Fine_Line_Fabrics","divYoke_Maxima_Poplin_Fabrics",
				"divYoke_Mid_Weight_Fabrics","divYoke_Spun_Poly_Fabrics","divYoke_Denim_Fabrics",
				"divYoke_Soil_Release_Fabrics","divYoke_Woven_Fabrics","divYoke_Organic_Fabrics",
				"divYoke_Industrial_Fabrics","divYoke_Twill_Fabrics","divYoke_Supima_Fabrics",
				"divYoke_Waffle_Fabrics");

var divshirtfabrics = new Array("divShirt2_Egyptian_Fabrics","divShirt2_Fine_Line_Fabrics","divShirt2_Maxima_Poplin_Fabrics",
				"divShirt2_Mid_Weight_Fabrics","divShirt2_Spun_Poly_Fabrics","divShirt2_Denim_Fabrics",
				"divShirt2_Soil_Release_Fabrics","divShirt2_Woven_Fabrics","divShirt2_Organic_Fabrics",
				"divShirt2_Industrial_Fabrics","divShirt2_Twill_Fabrics","divShirt2_Ultralite_Fabrics",
				"divShirt2_Shirting_Fabrics","divShirt2_Tuff_Twill_Fabrics","divShirt2_Mikro_Fabrics",
				"divShirt2_Ultima_Poplin_Fabrics","divShirt2_Rayon_Blend_Fabrics",
				"divBase_Vest_Tie_Fabrics","divShirt2_Supima_Fabrics","divShirt2_Waffle_Fabrics","divShirt2_Seasonal_Fabrics");

var divcollarfabrics = new Array("divCollar_Egyptian_Fabrics","divCollar_Fine_Line_Fabrics","divCollar_Maxima_Poplin_Fabrics",
				"divCollar_Mid_Weight_Fabrics","divCollar_Spun_Poly_Fabrics","divCollar_Denim_Fabrics",
				"divCollar_Soil_Release_Fabrics","divCollar_Woven_Fabrics","divCollar_Organic_Fabrics",
				"divCollar_Industrial_Fabrics","divCollar_Twill_Fabrics","divCollar_Ultralite_Fabrics",
				"divCollar_Shirting_Fabrics","divCollar_Tuff_Twill_Fabrics","divCollar_Mikro_Fabrics",
				"divCollar_Ultima_Poplin_Fabrics","divCollar_Rayon_Blend_Fabrics",
				"divBase_Vest_Tie_Fabrics","divCollar_Supima_Fabrics","divCollar_Waffle_Fabrics","divCollar_Seasonal_Fabrics");

var divbasefabrics = new Array("divBase_Egyptian_Fabrics","divBase_Fine_Line_Fabrics","divBase_Maxima_Poplin_Fabrics",
				"divBase_Mid_Weight_Fabrics","divBase_Spun_Poly_Fabrics","divBase_Denim_Fabrics",
				"divBase_Soil_Release_Fabrics","divBase_Woven_Fabrics","divBase_Organic_Fabrics",
				"divBase_Industrial_Fabrics","divBase_Twill_Fabrics","divBase_Ultralite_Fabrics",
				"divBase_Shirting_Fabrics","divBase_Tuff_Twill_Fabrics","divBase_Mikro_Fabrics",
				"divBase_Ultima_Poplin_Fabrics","divBase_Rayon_Blend_Fabrics",
				"divBase_Vest_Tie_Fabrics","divBase_Supima_Fabrics","divBase_Waffle_Fabrics","divBase_Seasonal_Fabrics");

var divnameembroid = new Array("divName_Embroid_Line_1","divName_Embroid_Line_2","divName_Embroid_Line_3",
				"divThread_Color","divEmbroidery_Font","divEmbroidery_Location","divHat_Embroidery_Location");

var divsizelist = new Array("divCoat_Length","divBack_Fittings","divHat_Height","divHat_Closure","divAmerican_Mens_Shoe_Sizing",
				"divAmerican_Womens_Shoe_Sizing","divDansko_Shoe_Sizing","divBirki_Shoe_Sizing",
				"divMens_Coat_Size","divMens_Standard_Coat_Size","divWomens_Coat_Size","divWomens_Standard_Coat_Size","divServer_Jacket_Size",
				"divWomens_Server_Jacket_Size","divPants_Sizing","divPants_Inseam","divPants_Hemming",
				"divShirt_Sizing","divWomens_Shirt_Sizing","divVest_Sizing","divWomens_Vest_Sizing","divTablecloth_Sizing",
				"divVest_Back_Ties");

var divneckwearfabrics = new Array("divBase_Maxima_Poplin_Fabrics","divSpecial_Vest_Tie_Fabrics","divBase_Twill_Fabrics");

var divpocketlist = new Array("divVest_Pockets","divApron_Pocket","divApron_Flap","divApron_Trim","divApron_Slit","divPants_Pocket_1",
				"divPants_Pocket_2","divCoat_Pocket_1","divCoat_Pocket_2","divCoat_Pocket_3","divCoat_Pocket_4","divShirt_Pocket");

var divcordinglist = new Array("divApron_Pocket_Cording","divApron_Flap_Cording","divCuff_Cording","divFront_Cording","divUpper_Collar_Cording",
				"divLower_Collar_Cording","divShirt_Cording","divHat_Cording","divCording_Package");

var divfablist = new Array("divHat_Fabric","divCoat_Fabric","divShirt_Fabric","divServer_Jacket_Fabric","divVest_Fabric",
				"divApron_Fabric","divNeckwear_Fabric","divTablecloth_Fabric","divPants_Fabric","divHat_Conversion",
				"divShirt_Conversion_Fabric","divCoat_TriColor_Fabric_1","divCoat_TriColor_Fabric_2","divCoat_TriColor_Fabric_3",
				"divStandard_Apron_Fabric", "divBack_Yoke_Conversion", "divStandard_Fabric", 
				"divBaseball_Cap_Fabric", "divStandard_Hat_Fabric");

var divembroidlist = new Array("divFlag_Embroidery","divName_Embroidery","divLogo_Embroidery");

var divcollarlist = new Array("divTriColor_Ribbon","divTriSplit_Collar","divCollar_Conversion");

var divotherlist = new Array("divPants_Zipper","divPants_Waistband");

var divcufflist = new Array("divCuff_Cording","divCuff_Conversion","divCuff_Type");

var divbuttonlist = new Array("divServer_Jacket_Placket","divServer_Jacket_Buttons","divCoat_Buttons","divShirt_Placket");

var divsleevelist = new Array("divServer_Jacket_Sleeves","divCoat_Sleeves","divShirt_Sleeves");

//
// this is used to show and hide details on the orders list in the admin section
//

function showrow(oid){
	var rowname = "rowhide["+oid+"]";
	obj = document.getElementById(rowname);
	if (obj.style.display == 'block'){
		obj.style.display = 'none';
	}else{
		obj.style.display = 'block';
	}
}

//
// these three functions are used to facilitate the reloading of a base page once a user has logged out
//

var cursorXY = new Object();

function gologout(){
	document.getElementById('headlogout').submit();
	return true;
}

function switchpage(){
	window.location = "home.php";
}

//
// this function is used to change pages on the member admin section of my account
//

function changePages(totpgs, toopen){
	for (i=1;i<=totpgs;i++){
		page = 'ordpage'+i;
		tmpobj = document.getElementById(page);
		tmpobj.style.display = 'None';
	}
	obj = document.getElementById(toopen);
	obj.style.display = 'Block';
}
//
// these functions are used to get the class name of a style to alter
//

function getstyle(selname){
	var rule = null;
	var sheets = document.styleSheets;
	for (i=0; i<sheets.length && rule == null; i++)	{
		var rules = sheets[i].cssRules
		for (j=0; j<rules.length && rule == null; j++)	{
			if (rules[j].selectorText == selname)	{
				rule = rules[j]; 
			}
		}
	} 
	return rule;
}

function showopts() {
	var mystyle = getstyle('.optionvals');
	if (mystyle.style.display == 'none'){
		mystyle.style.display = 'block';
	}else{
		mystyle.style.display = 'none';
	}
}


//
// These are used for product navigation inside product details (backend)
//

function gotoprev(pid){
	alert("prev :"+pid);
}

function gotonext(pid){
	alert("next :"+pid);
}

//
// these two functions are used to correctly place the hover information about product options
// in the correct place. It looks at how big the screen is and then calculates where the mouse is
// located and places the hover directly to the left at the current height of the mouse
//

function getCursPosition(e) {
	e = e || window.event;
	if (e.pageX || e.pageY) {
		cursorXY.x = e.pageX;
		cursorXY.y = e.pageY;
	} 
	else {
		var de = document.documentElement;
		var b = document.body;
		cursorXY.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
		cursorXY.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
	}
}

function optinit() {
	cursorXY.x = 0;
	cursorXY.y = 0;
	//if (window.Event) {
	//	    document.captureEvents(Event.MOUSEMOVE);
	//}
	document.onmousemove = getCursPosition;

}

//
// This starts the timer for the multi-link picture placement on the left bar. Currently operating 
// facebook, twitter, and the GSA flag and info. You can change the speed by altering the setInterval line
// to a different value (roughly 1000 = 1 sec) currently set to 7 secs for each picture. The second function
// sets the innerhtml for the image and the link. And jumper opens the page in a new window.
//

function startTimerObj(){
	Img1 = new Image();
	Img1.src = "/skin1/images/custom/leftflag.jpg";
	Img2 = new Image();
	Img2.src = "/skin1/images/custom/leftfacebook.jpg";
	Img3 = new Image();
	Img3.src = "/skin1/images/custom/lefttwit.jpg";
	setInterval ("imgswitcher()", 7000 );
}

function imgswitcher(){
	imgObj = document.getElementById('scrollerimg');
	divObj = document.getElementById('scrollimg');
	if (imgObj.name == "flagimg"){
		divObj.innerHTML = "<img src=\"\/skin1\/images\/custom\/leftfacebook.jpg\" name=\"facebookimg\" id=\"scrollerimg\" onclick=\"jumper();\" alt=\"\"\/>"
	}else if (imgObj.name == "facebookimg"){
		divObj.innerHTML = "<img src=\"\/skin1\/images\/custom\/lefttwit.jpg\" name=\"twitimg\" id=\"scrollerimg\" onclick=\"jumper();\" alt=\"\"\/>"
	}else if (imgObj.name == "twitimg"){
		divObj.innerHTML = "<img src=\"\/skin1\/images\/custom\/leftflag.jpg\" name=\"flagimg\" id=\"scrollerimg\" onclick=\"jumper();\" alt=\"\"\/>"
	}
}
	
function jumper(){
	imgObj = document.getElementById('scrollerimg');
	if (imgObj.name == "flagimg"){
		window.location = "home.php";
	}else if (imgObj.name == "facebookimg"){
		window.open ("http://www.facebook.com/culinaryclassics","facewin");
	}else if (imgObj.name == "twitimg"){
		window.open ("http://www.twitter.com/culinaryclassic","twitwin");
	}
}

//
// This function is used to track a shipment on the 3 shippers we currently use, Fedex, UPS, and USPS.
// the shipcode is taken from the customer and added to the link for checking shipments. This will move the customer off
// our site in a new window to the shippers site.
//

function trackmyshipment(){
	tracknum = document.getElementById('tracknum').value;
	fedexstr = "http://www.fedex.com/Tracking?action=track&tracknumbers="+tracknum;
	upsstr = "http://wwwapps.ups.com/WebTracking/processRequest?HTMLVersion=5.0&Requester=NES&AgreeToTermsAndConditions=yes&loc=en_US&tracknum="+tracknum;
	uspsstr = "http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum="+tracknum;
	shipper = document.getElementById('carrierselect').selectedIndex;
	selectedshipper = document.getElementById('carrierselect').options[shipper].value;
	if (selectedshipper == 1) {
		window.open (upsstr,"upswindow");
	}else if (selectedshipper == 2){
		window.open (fedexstr,"fedexwindow");
	}else{
		window.open (uspsstr,"uspswindow");
	}
}

//
// This function turns on and off the login and newsletter section at the top of the page
// it just determines what was clicked and what is open and then opens and closes accordingly
//

function chkHeadLineVis(num){
	objL = document.getElementById('login_myacct');	
	objN = document.getElementById('sub_newsletter');
	objLF = document.getElementById('ccloginform');
	objNF = document.getElementById('ccsubscribeform');
	if (num == 1){
		if (objN.style.display == 'block'){
			objN.style.display = 'none';
			objL.style.display = 'block';
			objLF.username.focus();
		}else if (objL.style.display == 'block'){
			objL.style.display = 'none';
		}else{
			objL.style.display = 'block';
			objLF.username.focus();
		}
	}
	if (num == 2){
		if (objL.style.display == 'block'){
			objL.style.display = 'none';
			objN.style.display = 'block';
			objNF.newsemail.focus();
		}else if (objN.style.display == 'block'){
			objN.style.display = 'none';
		}else{
			objN.style.display = 'block';
			objNF.newsemail.focus();
		}
	}
}

//
// This function toggles on/off the menus on the left side of the website. It determines
// whether it is open or closed and does the opposite.
//

function togglecat(div,itsopen,itsclosed){
	objdiv = document.getElementById(div);
	objopen = document.getElementById(itsopen);
	objclosed = document.getElementById(itsclosed);
	if ((objdiv.style.display == '') || (objdiv.style.display == 'none')){
		objdiv.style.display = 'block';
		objopen.style.display = 'block';
		objclosed.style.display = 'none';
	}else if (objdiv.style.display == 'block'){
		objdiv.style.display = 'none';
		objopen.style.display = 'none';
		objclosed.style.display = 'block';
	}
}

//
// This function toggles on/off the menus on the left side of the website. It determines
// whether it is open or closed and does the opposite.
//

function showhide(option){
	var obj = document.getElementById(option);
	if (obj.style.display == 'none') {
		obj.style.display = 'block';
	}else{
		obj.style.display = 'none';
	}
}

//
// These functions are for the running total of a product that is being configured
//

var runningtot = 0;
var pricestore = new Array();
var remnum = -1;
var intprice = 0;

function setinitprice() {
	runningtot = document.getElementById('updatedprice').innerHTML;
}

function settotprice(mathtype, amount) {
	if (mathtype == "add"){
		runningtot = parseFloat(runningtot) + amount;
	}else{
		runningtot = runningtot - amount;
	}
	runningtot =  runningtot.toFixed(2);
	document.getElementById('updatedprice').innerHTML = runningtot;
}

function addinitprice(option,amt) {
	pricestore.push(option+":"+amt);
}

function chkprice(option) {
	var Index = document.getElementById(option).selectedIndex;
	var chosen = document.getElementById(option).options[Index].text;
	chosen = chosen.replace(/[^\(\+\$\d.\)]+/g,"");
	var idxval = chosen.indexOf("(");
	if (idxval != -1){
		chosen = chosen.substr(idxval);
		chosen = chosen.replace(/[\(\+\$\)]+/g,"");
		intprice = parseFloat(chosen);
	}
	for (i=0;i<pricestore.length;i++){
		if (pricestore[i].indexOf(option)!= -1){
			subval = pricestore[i].substr((pricestore[i].indexOf(":"))+1);
			settotprice('sub',parseFloat(subval));
			remnum = i;
		}
	}
	if (remnum >= 0){
		pricestore.splice(remnum,1);
		remnum = -1;
	}
	if (intprice > 0){
		pricestore.push(option+":"+intprice);
		settotprice('add',intprice);
		intprice = 0;
	}
}

//
// This function switches on and off the different sections on a product page, description, options, sizing info.
// It determines what is open and closed and swithes accordingly. It also uses the information on the current category
// to determine which option tab to open on initial viewing. The closeAllOption function closes and hides all product options
// so that it is a clean page to work with. This function is used anytime a tab is switched inside the options groups.
//

function switchtab(selecttab,currcat){
	objBox1 = document.getElementById('prodinfo');
	objBox2 = document.getElementById('prodsizing');
	objBox3 = document.getElementById('prodoptions');
	if (selecttab == 1){
		objBox1.style.display = 'block';
		objBox2.style.display = 'none';
		objBox3.style.display = 'none';
	}else if (selecttab == 2){
		objBox1.style.display = 'none';
		objBox2.style.display = 'block';
		objBox3.style.display = 'none';
	}else{
		closeAllOption();
		objBox1.style.display = 'none';
		objBox2.style.display = 'none';
		objBox3.style.display = 'block';
		if (currcat.indexOf("Shoe") != -1){
			optTabOpen("size");
			document.getElementById('sizetab').src = 'skin1/images/custom/sizetabovr.gif';
		}else{
			optTabOpen("fab");
			document.getElementById('fabtab').src = 'skin1/images/custom/fabtabovr.gif';
		}
	}
}

//
// This function opens the hover boxes next to the product options. It recieves the text from the 
// function call and the places that text into the div (located in home.tpl) and then figures out where
// to hover the object by using the functions discussed earlier, and then makes it visible. closeNote() 
// just closes the hover from view.
//

function openNote(opttext){
	testtxt = unescape(opttext);
	hoverObj = document.getElementById("opt_text");
	hoverObj.innerHTML = testtxt;
	hoverObj.style.top = '150px';
	hoverObj.style.left = '50px';
	hoverObj.style.display = "block";
}

function closeNote(){
	hoverObj = document.getElementById("opt_text");
	hoverObj.style.display = "none";
}

function openNote2(opttext){
	testtxt = unescape(opttext);
	hoverObj = document.getElementById("rush_text");
	hoverObj.innerHTML = testtxt;
	hoverObj.style.top = '500px';
	hoverObj.style.left = '200px';
	hoverObj.style.display = "block";
}

function closeNote2(){
	hoverObj = document.getElementById("rush_text");
	hoverObj.style.display = "none";
}

function openNote3(opttext){
	testtxt = unescape(opttext);
	hoverObj = document.getElementById("opt_text");
	hoverObj.innerHTML = testtxt;
	hoverObj.style.top = "750px";
	hoverObj.style.left = "0px";
	hoverObj.style.display = "block";
}


//
// This function is used to manage any of the options that needs a link to better describe its function
//

function chkLink(optname){
	optname = optname.toLowerCase();
	//alert(optname);
}

//
// This is a general function to eliminate duplicate use throughout the file since it is used often
// its function is to determine what type of fabric colors to show depending on what type of 
// fabric was chosen. chosen is the option text from the current option being checked, this is scanned to 
// determine if a particular word is in the text, then it takes the second input 'option' and substitutes 
// that into the display call to properly determine which colors to open. The Num variable is optional and only has uses
// for the tricolor coats for now. Since it is scanning words you must make 
//

function fabOpen(chosen,option,num) {
	if (chosen.indexOf("Egyptian") != -1){
		document.getElementById('div'+option+'_Egyptian_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Fine") != -1){
		document.getElementById('div'+option+'_Fine_Line_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Waffle") != -1){
		document.getElementById('div'+option+'_Waffle_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Maxima") != -1){
		document.getElementById('div'+option+'_Maxima_Poplin_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Weight") != -1){
		document.getElementById('div'+option+'_Mid_Weight_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Spun") != -1){
		document.getElementById('div'+option+'_Spun_Poly_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Denim") != -1){
		document.getElementById('div'+option+'_Denim_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Soil") != -1){
		document.getElementById('div'+option+'_Soil_Release_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Woven") != -1){
		document.getElementById('div'+option+'_Woven_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Organic") != -1){
		document.getElementById('div'+option+'_Organic_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Industrial") != -1){
		document.getElementById('div'+option+'_Industrial_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Tuff") != -1){
		document.getElementById('div'+option+'_Tuff_Twill_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Ultima") != -1){
		document.getElementById('div'+option+'_Ultima_Poplin_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Ultralite") != -1){
		document.getElementById('div'+option+'_Ultralite_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Mikro") != -1){
		document.getElementById('div'+option+'_Mikro_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Rayon") != -1){
		document.getElementById('div'+option+'_Rayon_Blend_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Twill") != -1){
		document.getElementById('div'+option+'_Twill_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Shirting") != -1){
		document.getElementById('div'+option+'_Shirting_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Decorative") != -1){
		document.getElementById('divBase_Vest_Tie_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Supima") != -1){
		document.getElementById('div'+option+'_Supima_Fabrics'+num).style.display = "block";
	}else if(chosen.indexOf("Standard Apron") != -1){
		document.getElementById('divStandard_Apron_Color'+num).style.display = "block";
	}else if((chosen.indexOf("Seasonal") != -1) || (chosen.indexOf("Limited") != -1)){
		document.getElementById('div'+option+'_Seasonal_Fabrics'+num).style.display = "block";
	}
}

//
// These two functions determine what needs to be visible when the customer selects a particular 
// option tab. First it hides everything, then it opens the correct section, from there it determines 
// what options are always visible under that tab and which ones may or may not be visible. It uses the 
// arrays at the top to determine what options are available with each section and which ones are 
// standard or variable. It then loops thru turning on the correct options.
//

function optTabOpen(choice) {
	document.getElementById('prodoptdiv').style.display = "block";
	open1stOption(choice);
}

function open1stOption(section){
	switch(section){
		case "fab":
			for (i=0;i<divfablist.length;i++){
				if (document.getElementById(divfablist[i])){
					document.getElementById(divfablist[i]).style.display = "block";
					var current = divfablist[i].replace("div", "po");
					var Index = document.getElementById(current).selectedIndex;
					var chosen = document.getElementById(current).options[Index].text;
					if (divfablist[i].indexOf("Conversion") != -1) {
						if (divfablist[i].indexOf("Hat") != -1) {
							if (chosen.indexOf("Yes") != -1) {
								document.getElementById('divHatband_Fabric').style.display = "block";
								var current2 = "poHatband_Fabric";
								var Index2 = document.getElementById(current2).selectedIndex;
								var chosen2 = document.getElementById(current2).options[Index2].text;
								fabOpen(chosen2,'Hatband','');
							}
						}else if (divfablist[i].indexOf("Shirt") != -1) {
							fabOpen(chosen,'Shirt2','');
						}else if (divfablist[i].indexOf("Yoke") != -1) {
							if (chosen.indexOf("Yes") != -1) {
								document.getElementById('divBack_Yoke_Conversion_Fabric').style.display = "block";
								var current2 = "poBack_Yoke_Conversion_Fabric";
								var Index2 = document.getElementById(current2).selectedIndex;
								var chosen2 = document.getElementById(current2).options[Index2].text;
								fabOpen(chosen2,'Yoke','');
							}
						}
					}else if (divfablist[i].indexOf("TriColor") != -1) {
						if (divfablist[i].indexOf("1") != -1) {
							fabOpen(chosen,'TriColor','_1');
						}else if (divfablist[i].indexOf("2") != -1) {
							fabOpen(chosen,'TriColor','_2');
						}else if (divfablist[i].indexOf("3") != -1) {
							fabOpen(chosen,'TriColor','_3');
						}
					}else{
						fabOpen(chosen,'Base','');
					}
				}
			}
			break;
		case "size":
			for (i=0;i<divsizelist.length;i++){
				if (document.getElementById(divsizelist[i])){
					document.getElementById(divsizelist[i]).style.display = "block";
				}
			}
			break;
		case "cord":
			for (i=0;i<divcordinglist.length;i++){
				if (document.getElementById(divcordinglist[i])){
					document.getElementById(divcordinglist[i]).style.display = "block";
					var current = divcordinglist[i].replace("div", "po");
					var Index = document.getElementById(current).selectedIndex;
					var chosen = document.getElementById(current).options[Index].text;
					if (Index != 0) {
						if (current.indexOf("Apron_Flap") != -1) {
							document.getElementById('divApron_Flap_Cording_Color').style.display = "block";
						}else if (current.indexOf("Apron_Pocket") != -1) {
							document.getElementById('divApron_Pocket_Cording_Color').style.display = "block";
						}else if (current.indexOf("Cuff_Cording") != -1) {
							for (var j=1;j<=Index;j++) {
								document.getElementById('divCuff_Cording_Color_'+j).style.display = "block";
							}
						}else if (current.indexOf("Front_Cording") != -1) {
							for (var k=1;k<=Index;k++) {
								document.getElementById('divFront_Cording_Color_'+k).style.display = "block";
							}
						}else if (current.indexOf("Upper_Collar") != -1) {
							for (var l=1;l<=Index;l++) {
								document.getElementById('divUpper_Collar_Cording_Color_'+l).style.display = "block";
							}
						}else if (current.indexOf("Lower_Collar") != -1) {
							for (var m=1;m<=Index;m++) {
								document.getElementById('divLower_Collar_Cording_Color_'+m).style.display = "block";
							}
						}else if (current.indexOf("Shirt") != -1) {
							document.getElementById('divShirt_Cording_Color').style.display = "block";
						}else if (current.indexOf("Hat") != -1) {
							document.getElementById('divHat_Cording_Color').style.display = "block";
						}else if (current.indexOf("Package") != -1) {
							document.getElementById('divCording_Package_Color').style.display = "block";
						}
					}
				}
			}
			break;
		case "pocket":
			for (i=0;i<divpocketlist.length;i++){
				if (document.getElementById(divpocketlist[i])){
					document.getElementById(divpocketlist[i]).style.display = "block";
					var current = divpocketlist[i].replace("div", "po");
					var Index = document.getElementById(current).selectedIndex;
					var chosen = document.getElementById(current).options[Index].text;
					if (current.indexOf("Coat") != -1) {
						if (chosen.indexOf("Corded") != -1) {
							var num = current.substr(14);
							document.getElementById('divPocket_'+num+'_Cording_Color').style.display = "block";
						}
					}
				}
			}
			break;
		case "sleeve":
			for (i=0;i<divsleevelist.length;i++){
				if (document.getElementById(divsleevelist[i])){
					document.getElementById(divsleevelist[i]).style.display = "block";
				}
			}
			break;
		case "button":
			for (i=0;i<divbuttonlist.length;i++){
				if (document.getElementById(divbuttonlist[i])){
					document.getElementById(divbuttonlist[i]).style.display = "block";
					var current = divbuttonlist[i].replace("div", "po");
					var Index = document.getElementById(current).selectedIndex;
					var chosen = document.getElementById(current).options[Index].text;
					if ((current.indexOf("Coat_Buttons") != -1) || (current.indexOf("Server_Jacket_Buttons") != -1)) {
						if ((chosen.indexOf("Hand-Rolled") != -1) || (chosen.indexOf("Hand-Crafted") != -1)){
							document.getElementById('divButton_Conversion_Fabric').style.display = "block";
							var btncurrent = 'poButton_Conversion_Fabric';
							var btnIndex = document.getElementById(btncurrent).selectedIndex;
							var btnchosen = document.getElementById(btncurrent).options[btnIndex].text;
							fabOpen(btnchosen,'Button','');
						}
					}
				}
			}
			break;
		case "cuff":
			for (i=0;i<divcufflist.length;i++){
				if (document.getElementById(divcufflist[i])){
					document.getElementById(divcufflist[i]).style.display = "block";
					var current = divcufflist[i].replace("div", "po");
					var Index = document.getElementById(current).selectedIndex;
					var chosen = document.getElementById(current).options[Index].text;
					if (current.indexOf("Cuff_Conversion") != -1) {
						if (chosen.indexOf("Yes") != -1) {
							document.getElementById('divCuff_Conversion_Fabric').style.display = "block";
							var cuffcurrent = 'poCuff_Conversion_Fabric';
							var cuffIndex = document.getElementById(cuffcurrent).selectedIndex;
							var cuffchosen = document.getElementById(cuffcurrent).options[cuffIndex].text;
							fabOpen(cuffchosen,'Cuff','');
						}
					}
					if (current.indexOf("Cuff_Cording") != -1) {
						if (Index != 0) {
							for (var j=1;j<=Index;j++) {
								document.getElementById('divCuff_Cording_Color_'+j).style.display = "block";
							}
						}
					}
				}
			}
			break;
		case "embroid":
			for (i=0;i<divembroidlist.length;i++){
				if (document.getElementById(divembroidlist[i])){
					document.getElementById(divembroidlist[i]).style.display = "block";
					var current = divembroidlist[i].replace("div", "po");
					var Index = document.getElementById(current).selectedIndex;
					var chosen = document.getElementById(current).options[Index].text;
					if (Index != 0) {
						if (current.indexOf("Flag") != -1) {
							if (document.getElementById('divFlag_Location')){
								document.getElementById('divFlag_Location').style.display = "block";
							}else if (document.getElementById('divHat_Flag_Location')){
								document.getElementById('divHat_Flag_Location').style.display = "block";
							}
						}else if (current.indexOf("Name") != -1) {
							if (chosen.indexOf("1 Line") != -1){
								document.getElementById('divName_Embroid_Line_1').style.display = "block";
								document.getElementById('poName_Embroid_Line_2').value = "";
								document.getElementById('poName_Embroid_Line_3').value = "";
								document.getElementById('divThread_Color').style.display = "block";
								document.getElementById('divEmbroidery_Font').style.display = "block";
								if (document.getElementById('divEmbroidery_Location')){
									document.getElementById('divEmbroidery_Location').style.display = "block";
								}else if (document.getElementById('divHat_Embroidery_Location')){
									document.getElementById('divHat_Embroidery_Location').style.display = "block";
								}
							}else if (chosen.indexOf("2 Line") != -1){
								document.getElementById('divName_Embroid_Line_1').style.display = "block";
								document.getElementById('divName_Embroid_Line_2').style.display = "block";
								document.getElementById('poName_Embroid_Line_3').value = "";
								document.getElementById('divThread_Color').style.display = "block";
								document.getElementById('divEmbroidery_Font').style.display = "block";
								if (document.getElementById('divEmbroidery_Location')){
									document.getElementById('divEmbroidery_Location').style.display = "block";
								}else if (document.getElementById('divHat_Embroidery_Location')){
									document.getElementById('divHat_Embroidery_Location').style.display = "block";
								}
							}else if (chosen.indexOf("3 Line") != -1){
								document.getElementById('divName_Embroid_Line_1').style.display = "block";
								document.getElementById('divName_Embroid_Line_2').style.display = "block";
								document.getElementById('divName_Embroid_Line_3').style.display = "block";
								document.getElementById('divThread_Color').style.display = "block";
								document.getElementById('divEmbroidery_Font').style.display = "block";
								if (document.getElementById('divEmbroidery_Location')){
									document.getElementById('divEmbroidery_Location').style.display = "block";
								}else if (document.getElementById('divHat_Embroidery_Location')){
									document.getElementById('divHat_Embroidery_Location').style.display = "block";
								}
							}else if (chosen.indexOf("None") != -1){
								document.getElementById('poName_Embroid_Line_1').value = "";
								document.getElementById('poName_Embroid_Line_2').value = "";
								document.getElementById('poName_Embroid_Line_3').value = "";
								document.getElementById('poThread_Color').selectedIndex = 0;
								document.getElementById('poEmbroidery_Font').selectedIndex = 0;
								if (document.getElementById('divEmbroidery_Location')){
									document.getElementById('poEmbroidery_Location').selectedIndex = 0;
								}else if (document.getElementById('divHat_Embroidery_Location')){
									document.getElementById('poHat_Embroidery_Location').selectedIndex = 0;
								}
							}
						}
					}
				}
			}
			break;
		case "collar":
			for (i=0;i<divcollarlist.length;i++){
				if (document.getElementById(divcollarlist[i])){
					document.getElementById(divcollarlist[i]).style.display = "block";
					var current = divcollarlist[i].replace("div", "po");
					var Index = document.getElementById(current).selectedIndex;
					var chosen = document.getElementById(current).options[Index].text;
					if (current.indexOf("Collar_Conversion") != -1) {
						if (chosen.indexOf("Yes") != -1) {
							document.getElementById('divCollar_Conversion_Fabric').style.display = "block";
							var collarcurrent = 'poCollar_Conversion_Fabric';
							var collarIndex = document.getElementById(collarcurrent).selectedIndex;
							var collarchosen = document.getElementById(collarcurrent).options[collarIndex].text;
							fabOpen(collarchosen,'Collar','');
						}
					}
					if (current.indexOf("TriSplit") != -1) {
						if (chosen.indexOf("Yes") != -1) {
							for (var i=1;i<=3;i++) {
								document.getElementById('divTriSplit_Color_'+i).style.display = "block";
							}
						}
					}
				}
			}
			break;
		case "other":
			for (i=0;i<divotherlist.length;i++){
				if (document.getElementById(divotherlist[i])){
					document.getElementById(divotherlist[i]).style.display = "block";
				}
			}
			break;
		default:
			break;
	}
	
}

//
// This is the main function for determining what happens when a customer chooses a particular option
// variables handed in consist of 'option' which is the id of the select box or text box for a particular option
// 'optname' which is the clean variable name for the option itself, and optimg which is the fixed name of the option
// the fixedname is just the id without 'po' on the front. This is used in determining which images to turn on and off with the options
// All variables are checked for existence before functions are run. Some assumptions for the existence of options is made
// and if products are not setup correctly this javascript can break and cause errors in the choice of options and validation
// of current choices. These assumptions are things like if the availability of cording is there, then the options for cording color are
// available. These options are not checked for existence prior to use since the option is not functional without them. Options that
// need no checking or are not based on any other option or do not have more that one stage of choices simply run through without incident
// Many of these options are very similar since they are all similar options on different products. Be sure you are editing the correct ones
// you can tell which option is being manipulated on the if statement line. Each statement handles different options.
// Some of them are combined if they are linked together in choice selection such as mens and womens sizes, since you cannot have both
// they are checked and maniulated in the same statements
//


function showOption(option,optname,optimg){
	chkprice(option);
	if (optname == "Cording Package"){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		var chkval = 0;
		if (Index !=0){
			document.getElementById('divCording_Package_Color').style.display = 'block';
			var cordarr = new Array("Front_Cording","Cuff_Cording","Upper_Collar_Cording","Lower_Collar_Cording");
			for (var i=0;i<=3;i++){
				document.getElementById('po'+cordarr[i]+'_Color_1').selectedIndex = 0;
				document.getElementById('img'+cordarr[i]+'_Color_1').src = "../skin1/images/spacer.gif";
				document.getElementById('div'+cordarr[i]+'_Color_1').style.display = 'none';
				document.getElementById('po'+cordarr[i]+'_Color_2').selectedIndex = 0;
				document.getElementById('img'+cordarr[i]+'_Color_2').src = "../skin1/images/spacer.gif";
				document.getElementById('div'+cordarr[i]+'_Color_2').style.display = 'none';
				document.getElementById('po'+cordarr[i]+'_Color_3').selectedIndex = 0;
				document.getElementById('img'+cordarr[i]+'_Color_3').src = "../skin1/images/spacer.gif";
				document.getElementById('div'+cordarr[i]+'_Color_3').style.display = 'none';
			}
			document.getElementById('poFront_Cording').selectedIndex = 0;
			chkprice('poFront_Cording');
			document.getElementById('poCuff_Cording').selectedIndex = 0;
			chkprice('poCuff_Cording');
			document.getElementById('poUpper_Collar_Cording').selectedIndex = 0;
			chkprice('poUpper_Collar_Cording');
			document.getElementById('poLower_Collar_Cording').selectedIndex = 0;
			chkprice('poLower_Collar_Cording');
		}
	}else if ((optname == "Cuff Cording") || (optname == "Front Cording") || (optname == "Upper Collar Cording") || (optname == "Lower Collar Cording")){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		var chkval = 0;
		if (Index !=0){
			if(document.getElementById('poCording_Package')){
				document.getElementById('poCording_Package').selectedIndex = 0;
				document.getElementById('poCording_Package_Color').selectedIndex = 0;
				document.getElementById('divCording_Package_Color').style.display = 'none';
				document.getElementById('imgCording_Package_Color').src = "../skin1/images/spacer.gif";
				chkprice('poCording_Package');
				chkprice('poCording_Package_Color');
			}
			if (optname == "Cuff Cording"){
				for (i=0;i<divsleevelist.length;i++){
					if (document.getElementById(divsleevelist[i])){
						var poname = divsleevelist[i].replace("div","po");
						var sIndex = document.getElementById(poname).selectedIndex;
						var schosen = document.getElementById(poname).options[sIndex].text;
						if ((schosen.indexOf("w/o") != -1)|| (schosen.indexOf("Short") != -1)){
							alert("You have chosen a Sleeve without a Cuff, please change this to add Cuffs.");
							document.getElementById(option).selectedIndex = 0;
							chkprice(option);
							chkval=1;
						}
					}
				}
				if (document.getElementById('poCuff_Type').selectedIndex == '0'){
					document.getElementById('poCuff_Type').selectedIndex = 1;
				}
			}
			if (chkval == 0) {
				for (var i=1;i<=Index;i++){
					document.getElementById('div'+optimg+'_Color_'+i).style.display = 'block';
					if (Index == 1){
						document.getElementById('div'+optimg+'_Color_'+2).style.display = 'none';
						document.getElementById('po'+optimg+'_Color_'+2).selectedIndex = 0;
						document.getElementById('img'+optimg+'_Color_'+2).src = "../skin1/images/spacer.gif";
						document.getElementById('div'+optimg+'_Color_'+3).style.display = 'none';
						document.getElementById('po'+optimg+'_Color_'+3).selectedIndex = 0;
						document.getElementById('img'+optimg+'_Color_'+3).src = "../skin1/images/spacer.gif";
					}
					if (Index == 2){
						document.getElementById('div'+optimg+'_Color_'+3).style.display = 'none';
						document.getElementById('po'+optimg+'_Color_'+3).selectedIndex = 0;
						document.getElementById('img'+optimg+'_Color_'+3).src = "../skin1/images/spacer.gif";
					}
				}
			}
		}else{
			for (var i=1;i<=3;i++){
				document.getElementById('po'+optimg+'_Color_'+i).selectedIndex = 0;
				document.getElementById('img'+optimg+'_Color_'+i).src = "../skin1/images/spacer.gif";
				document.getElementById('div'+optimg+'_Color_'+i).style.display = 'none';
			}
		}
	}else if (optname == "Back Yoke Conversion"){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			document.getElementById('divBack_Yoke_Conversion_Fabric').style.display = "block";
		}else{
			document.getElementById('poBack_Yoke_Conversion_Fabric').selectedIndex = 0;
			document.getElementById('divBack_Yoke_Conversion_Fabric').style.display = "none";
			for (i=0;i<divyokefabrics.length;i++){
				if (document.getElementById(divyokefabrics[i])){
					document.getElementById(divyokefabrics[i]).style.display = "none";
					var poname = divyokefabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divyokefabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
		}
	}else if (optname == "Back Yoke Conversion Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divyokefabrics.length;i++){
			if (document.getElementById(divyokefabrics[i])){
				document.getElementById(divyokefabrics[i]).style.display = "none";
				var poname = divyokefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divyokefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Yoke','');
	}else if (optname == "Hat Cording"){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			document.getElementById('divHat_Cording_Color').style.display = "block";
		}else{
			document.getElementById('poHat_Cording_Color').selectedIndex = 0;
			document.getElementById('divHat_Cording_Color').style.display = "none";
		}
	}else if (optname == "Standard Apron Fabric"){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		chosen = chosen.toLowerCase();
		chosen = chosen.replace(" ","");
		chosen = chosen.replace(/\W/g,"");
		var prodcode = chosen.match(/\d+/);
		document.getElementById('img'+optimg).src = "../files/image/fabrics/" + prodcode + ".gif";
		document.getElementById('img'+optimg).height = "50";				
	}else if ((optname == "Coat Sleeves") || (optname == "Shirt Sleeves") || (optname == "Server Jacket Sleeves")){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("w/o Cuff") != -1){
			document.getElementById('poCuff_Type').selectedIndex = 0;
			chkprice('poCuff_Type');
			document.getElementById('poCuff_Conversion').selectedIndex = 0;
			chkprice('poCuff_Conversion');
			document.getElementById('poCuff_Conversion_Fabric').selectedIndex = 0;
			for (i=0;i<divcufffabrics.length;i++){
				if (document.getElementById(divcufffabrics[i])){
					document.getElementById(divcufffabrics[i]).style.display = "none";
					var poname = divcufffabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divcufffabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
			document.getElementById('poCuff_Cording').selectedIndex = 0;
			chkprice('poCuff_Cording');
			for (var i=1;i<=3;i++){
				document.getElementById('poCuff_Cording_Color_'+i).selectedIndex = 0;
				document.getElementById('imgCuff_Cording_Color_'+i).src = "../skin1/images/spacer.gif";
				document.getElementById('divCuff_Cording_Color_'+i).style.display = 'none';
			}
		}
	}else if ((optname == "Coat Pocket 1") || (optname == "Coat Pocket 2") || (optname == "Coat Pocket 3") || (optname == "Coat Pocket 4")){
		var num = optname.substr(12);
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Corded") != -1){
			document.getElementById('divPocket_'+num+'_Cording_Color').style.display = "block";
		}else{
			document.getElementById('poPocket_'+num+'_Cording_Color').selectedIndex = 0;
			document.getElementById('imgPocket_'+num+'_Cording_Color').src = "../skin1/images/spacer.gif";
			document.getElementById('divPocket_'+num+'_Cording_Color').style.display = "none";
		}		
	}else if (optname == "Apron Flap") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") != -1){
			if (document.getElementById('poApron_Flap_Cording').selectedIndex != 0) {
				document.getElementById('poApron_Flap_Cording').selectedIndex = 0;
				document.getElementById('poApron_Flap_Cording_Color').selectedIndex = 0;
				document.getElementById('divApron_Flap_Cording_Color').style.display = "none";
			}
		}
	}else if (optname == "Apron Pocket") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") != -1){
			if (document.getElementById('poApron_Pocket_Cording').selectedIndex != 0) {
				document.getElementById('poApron_Pocket_Cording').selectedIndex = 0;
				document.getElementById('poApron_Pocket_Cording_Color').selectedIndex = 0;
				document.getElementById('divApron_Pocket_Cording_Color').style.display = "none";
			}
		}
	}else if (optname == "Apron Pocket Cording") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			if (document.getElementById('poApron_Pocket').selectedIndex == 0) {
				alert("You need to select a pocket type before you can add cording");
				document.getElementById('poApron_Pocket_Cording').selectedIndex = 0;
			}else{
				document.getElementById('divApron_Pocket_Cording_Color').style.display = "block";
			}
		}else{
			document.getElementById('poApron_Pocket_Cording_Color').selectedIndex = 0;
			document.getElementById('divApron_Pocket_Cording_Color').style.display = "none";
		}
	}else if (optname == "Apron Flap Cording") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			if (document.getElementById('poApron_Flap').selectedIndex == 0) {
				alert("You need to select a flap type before you can add cording");
				document.getElementById('poApron_Flap_Cording').selectedIndex = 0;
			}else{
				document.getElementById('divApron_Flap_Cording_Color').style.display = "block";
			}
		}else{
			document.getElementById('poApron_Flap_Cording_Color').selectedIndex = 0;
			document.getElementById('divApron_Flap_Cording_Color').style.display = "none";
		}		
	}else if (optname == "Apron Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbasefabrics.length;i++){
			if (document.getElementById(divbasefabrics[i])){
				document.getElementById(divbasefabrics[i]).style.display = "none";
				var poname = divbasefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divbasefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Base','');
	}else if (optname == "Coat TriColor Fabric 1") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divtricolorfabrics1.length;i++){
			if (document.getElementById(divtricolorfabrics1[i])){
				document.getElementById(divtricolorfabrics1[i]).style.display = "none";
				var poname = divtricolorfabrics1[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divtricolorfabrics1[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'TriColor','_1');
	}else if (optname == "Coat TriColor Fabric 2") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divtricolorfabrics2.length;i++){
			if (document.getElementById(divtricolorfabrics2[i])){
				document.getElementById(divtricolorfabrics2[i]).style.display = "none";
				var poname = divtricolorfabrics2[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divtricolorfabrics2[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'TriColor','_2');
	}else if (optname == "Coat TriColor Fabric 3") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divtricolorfabrics3.length;i++){
			if (document.getElementById(divtricolorfabrics3[i])){
				document.getElementById(divtricolorfabrics3[i]).style.display = "none";
				var poname = divtricolorfabrics3[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divtricolorfabrics3[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'TriColor','_3');
	}else if (optname == "Coat Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbasefabrics.length;i++){
			if (document.getElementById(divbasefabrics[i])){
				document.getElementById(divbasefabrics[i]).style.display = "none";
				var poname = divbasefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divbasefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Base','');
		if ((chosen.indexOf('Industrial') == -1) && (chosen.indexOf('Spun Poly') == -1) && (chosen.indexOf('Poplin') == -1) && (chosen.indexOf('Twill') == -1)){
			var BIndex = document.getElementById('poCoat_Buttons').selectedIndex;
			var Bchosen = document.getElementById('poCoat_Buttons').options[BIndex].text;	
			if (Bchosen.indexOf("Snap Button") != -1) {
				alert("You currently have Snap Buttons selected. Those buttons only work with Industrial, Spun Poly, Twill, and Poplin fabrics. Your buttons will be changed.");
				document.getElementById('poCoat_Buttons').selectedIndex = 0;
				chkprice('poCoat_Buttons');
			}
		}
	}else if (optname == "Shirt Cording") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			document.getElementById('divShirt_Cording_Color').style.display = "block";
		}else{
			document.getElementById('poShirt_Cording_Color').selectedIndex = 0;
			document.getElementById('divShirt_Cording_Color').style.display = "none";
			document.getElementById('imgShirt_Cording_Color').src = "../skin1/images/spacer.gif";
		}		
	}else if (optname == "Shirt Conversion Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divshirtfabrics.length;i++){
			if (document.getElementById(divshirtfabrics[i])){
				document.getElementById(divshirtfabrics[i]).style.display = "none";
				var poname = divshirtfabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divshirtfabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Shirt2','');
	}else if (optname == "Cuff Conversion Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divcufffabrics.length;i++){
			if (document.getElementById(divcufffabrics[i])){
				document.getElementById(divcufffabrics[i]).style.display = "none";
				var poname = divcufffabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divcufffabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Cuff','');
	}else if (optname == "Collar Conversion Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divcollarfabrics.length;i++){
			if (document.getElementById(divcollarfabrics[i])){
				document.getElementById(divcollarfabrics[i]).style.display = "none";
				var poname = divcollarfabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divcollarfabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Collar','');
	}else if (optname == "Button Conversion Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbuttonfabrics.length;i++){
			if (document.getElementById(divbuttonfabrics[i])){
				document.getElementById(divbuttonfabrics[i]).style.display = "none";
				var poname = divbuttonfabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divbuttonfabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Button','');
	}else if (optname == "Server Jacket Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbasefabrics.length;i++){
			if (document.getElementById(divbasefabrics[i])){
				document.getElementById(divbasefabrics[i]).style.display = "none";
				var poname = divbasefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divbasefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		if ((chosen.indexOf('Industrial') == -1) && (chosen.indexOf('Spun Poly') == -1) && (chosen.indexOf('Poplin') == -1) && (chosen.indexOf('Twill') == -1)){
			var BIndex = document.getElementById('poServer_Jacket_Buttons').selectedIndex;
			var Bchosen = document.getElementById('poServer_Jacket_Buttons').options[BIndex].text;	
			if (Bchosen.indexOf("Snap Button") != -1) {
				alert("You currently have Snap Buttons selected. Those buttons only work with Industrial, Spun Poly, Twill, and Poplin fabrics. Your buttons will be changed.");
				document.getElementById('poServer_Jacket_Buttons').selectedIndex = 0;
				chkprice('poServer_Jacket_Buttons');
			}
		}
	}else if (optname == "Shirt Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbasefabrics.length;i++){
			if (document.getElementById(divbasefabrics[i])){
				document.getElementById(divbasefabrics[i]).style.display = "none";
				var poname = divbasefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divbasefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Base','');
	}else if (optname == "Pants Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbasefabrics.length;i++){
			if (document.getElementById(divbasefabrics[i])){
				document.getElementById(divbasefabrics[i]).style.display = "none";
				var poname = divbasefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divbasefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Base','');
	}else if ((optname == "Pants Pocket 1") || (optname == "Pants Pocket 2")){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (((document.getElementById('poPants_Pocket_1').selectedIndex) == (document.getElementById('poPants_Pocket_2').selectedIndex)) && (document.getElementById('poPants_Pocket_1').selectedIndex != 0)) {
			alert("You already have that selection on the other pocket. Please choose another option.");
			var thisopt = optname.replace(/ /g,"_");
			document.getElementById('po'+thisopt).selectedIndex = 0;
		}
	}else if ((optname == "Pants Waistband") && (document.getElementById('poPants_Zipper').selectedIndex != 0)){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("2 inch") != -1) {
			document.getElementById('poPants_Zipper').selectedIndex = 1;
		}else if (chosen.indexOf("3 inch") != -1) {
			document.getElementById('poPants_Zipper').selectedIndex = 2;
		}
	}else if (optname == "Pants Zipper") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("2 inch") != -1) {
			document.getElementById('poPants_Waistband').selectedIndex = 0;
		}else if (chosen.indexOf("3 inch") != -1) {
			document.getElementById('poPants_Waistband').selectedIndex = 1;
		}
	}else if (optname == "Neckwear Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divneckwearfabrics.length;i++){
			if (document.getElementById(divneckwearfabrics[i])){
				document.getElementById(divneckwearfabrics[i]).style.display = "none";
				var poname = divneckwearfabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divneckwearfabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Base','');
	}else if (optname == "Vest Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbasefabrics.length;i++){
			if (document.getElementById(divbasefabrics[i])){
				document.getElementById(divbasefabrics[i]).style.display = "none";
				var poname = divbasefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = 0;
				var imgname = divbasefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Base','');
	}else if (optname == "Vest Sizing") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poWomens_Vest_Sizing')){document.getElementById('poWomens_Vest_Sizing').selectedIndex = 0;}
		}
	}else if (optname == "Womens Vest Sizing") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poVest_Sizing')){document.getElementById('poVest_Sizing').selectedIndex = 0;}
		}
	}else if (optname == "Shirt Sizing") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poWomens_Shirt_Sizing')){document.getElementById('poWomens_Shirt_Sizing').selectedIndex = 0;}
		}
	}else if (optname == "Womens Shirt Sizing") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poShirt_Sizing')){document.getElementById('poShirt_Sizing').selectedIndex = 0;}
		}
	}else if (optname == "Mens Standard Coat Size") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poWomens_Standard_Coat_Size')){document.getElementById('poWomens_Standard_Coat_Size').selectedIndex = 0;}
		}
	}else if (optname == "Womens Standard Coat Size") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poMens_Standard_Coat_Size')){document.getElementById('poMens_Standard_Coat_Size').selectedIndex = 0;}
		}
	}else if (optname == "Mens Coat Size") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poWomens_Coat_Size')){document.getElementById('poWomens_Coat_Size').selectedIndex = 0;}
		}
	}else if (optname == "Womens Coat Size") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poMens_Coat_Size')){document.getElementById('poMens_Coat_Size').selectedIndex = 0;}
		}
	}else if (optname == "Server Jacket Size") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poWomens_Server_Jacket_Size')){document.getElementById('poWomens_Server_Jacket_Size').selectedIndex = 0;}
		}
	}else if (optname == "Womens Server Jacket Size") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poServer_Jacket_Size')){document.getElementById('poServer_Jacket_Size').selectedIndex = 0;}
		}
	}else if (optname == "American Womens Shoe Sizing") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poAmerican_Mens_Shoe_Sizing')){document.getElementById('poAmerican_Mens_Shoe_Sizing').selectedIndex = 0;}
		}
	}else if (optname == "American Mens Shoe Sizing") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			if (document.getElementById('poAmerican_Womens_Shoe_Sizing')){document.getElementById('poAmerican_Womens_Shoe_Sizing').selectedIndex = 0;}
		}
	}else if (optname == "Flag Embroidery"){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1){
			if (document.getElementById('divFlag_Location')){
				document.getElementById('divFlag_Location').style.display = "block";
			}else if (document.getElementById('divHat_Flag_Location')){
				document.getElementById('divHat_Flag_Location').style.display = "block";
			}
			chosen = chosen.toLowerCase();
			chosen = chosen.replace(" ","");
			chosen = chosen.replace(/\W/g,"");
			chosen = chosen.replace(/\d/g,"");
			document.getElementById('img'+optimg).src = "../files/image/flags/" + chosen + ".gif";
			document.getElementById('img'+optimg).width = "32";
			document.getElementById('img'+optimg).height = "20";
		}else{
			if (document.getElementById('divFlag_Location')){
				document.getElementById('poFlag_Location').selectedIndex = 0;
				chkprice('poFlag_Location');
				document.getElementById('divFlag_Location').style.display = "none";
				document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
			}else if (document.getElementById('divHat_Flag_Location')){
				document.getElementById('poHat_Flag_Location').selectedIndex = 0;
				chkprice('poHat_Flag_Location');
				document.getElementById('divHat_Flag_Location').style.display = "none";
				document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
			}
		}
	}else if (optname == "Name Embroidery"){
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divnameembroid.length;i++){
			if (document.getElementById(divnameembroid[i])){
				document.getElementById(divnameembroid[i]).style.display = "none";
			}
		}
		if (chosen.indexOf("1 Line") != -1){
			document.getElementById('divName_Embroid_Line_1').style.display = "block";
			document.getElementById('poName_Embroid_Line_2').value = "";
			document.getElementById('poName_Embroid_Line_3').value = "";
			document.getElementById('divThread_Color').style.display = "block";
			document.getElementById('divEmbroidery_Font').style.display = "block";
			if (document.getElementById('divEmbroidery_Location')){
				document.getElementById('divEmbroidery_Location').style.display = "block";
			}else if (document.getElementById('divHat_Embroidery_Location')){
				document.getElementById('divHat_Embroidery_Location').style.display = "block";
			}
		}else if (chosen.indexOf("2 Line") != -1){
			document.getElementById('divName_Embroid_Line_1').style.display = "block";
			document.getElementById('divName_Embroid_Line_2').style.display = "block";
			document.getElementById('poName_Embroid_Line_3').value = "";
			document.getElementById('divThread_Color').style.display = "block";
			document.getElementById('divEmbroidery_Font').style.display = "block";
			if (document.getElementById('divEmbroidery_Location')){
				document.getElementById('divEmbroidery_Location').style.display = "block";
			}else if (document.getElementById('divHat_Embroidery_Location')){
				document.getElementById('divHat_Embroidery_Location').style.display = "block";
			}
		}else if (chosen.indexOf("3 Line") != -1){
			document.getElementById('divName_Embroid_Line_1').style.display = "block";
			document.getElementById('divName_Embroid_Line_2').style.display = "block";
			document.getElementById('divName_Embroid_Line_3').style.display = "block";
			document.getElementById('divThread_Color').style.display = "block";
			document.getElementById('divEmbroidery_Font').style.display = "block";
			if (document.getElementById('divEmbroidery_Location')){
				document.getElementById('divEmbroidery_Location').style.display = "block";
			}else if (document.getElementById('divHat_Embroidery_Location')){
				document.getElementById('divHat_Embroidery_Location').style.display = "block";
			}
		}else if (chosen.indexOf("None") != -1){
			document.getElementById('poName_Embroid_Line_1').value = "";
			document.getElementById('poName_Embroid_Line_2').value = "";
			document.getElementById('poName_Embroid_Line_3').value = "";
			document.getElementById('poThread_Color').selectedIndex = 0;
			document.getElementById('imgThread_Color').src = "../skin1/images/spacer.gif";
			document.getElementById('poEmbroidery_Font').selectedIndex = 0;
			document.getElementById('imgEmbroidery_Font').src = "../skin1/images/spacer.gif";
			if (document.getElementById('divEmbroidery_Location')){
				document.getElementById('poEmbroidery_Location').selectedIndex = 0;
			}else if (document.getElementById('divHat_Embroidery_Location')){
				document.getElementById('poHat_Embroidery_Location').selectedIndex = 0;
			}
		}
	}else if (optname == "Cuff Type") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (Index != 0) {
			for (i=0;i<divsleevelist.length;i++){
				if (document.getElementById(divsleevelist[i])){
					var poname = divsleevelist[i].replace("div","po");
					var sIndex = document.getElementById(poname).selectedIndex;
					var schosen = document.getElementById(poname).options[sIndex].text;
					if ((schosen.indexOf("w/o") != -1)|| (schosen.indexOf("Short") != -1)){
						alert("You have chosen a Sleeve without a Cuff, please change this to add Cuffs.");
						document.getElementById(option).selectedIndex = 0;
						chkprice(option);
					}
				}
			}
		}else{
			document.getElementById('poCuff_Conversion').selectedIndex = 0;
			chkprice('poCuff_Conversion');
			document.getElementById('divCuff_Conversion_Fabric').style.display = "none";
			document.getElementById('poCuff_Conversion_Fabric').selectedIndex = 0;
			for (i=0;i<divcufffabrics.length;i++){
				if (document.getElementById(divcufffabrics[i])){
					document.getElementById(divcufffabrics[i]).style.display = "none";
					var poname = divcufffabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divcufffabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
		}
	}else if (optname == "Cuff Conversion") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			for (i=0;i<divsleevelist.length;i++){
				if (document.getElementById(divsleevelist[i])){
					var poname = divsleevelist[i].replace("div","po");
					var sIndex = document.getElementById(poname).selectedIndex;
					var schosen = document.getElementById(poname).options[sIndex].text;
					if ((schosen.indexOf("w/o") != -1)|| (schosen.indexOf("Short") != -1)){
						alert("You have chosen a Sleeve without a Cuff, please change this to have cuffs if you wish to convert them.");
						document.getElementById(option).selectedIndex = 0;
						chkprice(option);
					}else{
						if (document.getElementById('poCuff_Type').selectedIndex == 0){
							document.getElementById('poCuff_Type').selectedIndex = 1;
						}
						document.getElementById('divCuff_Conversion_Fabric').style.display = "block";
					}
				}
			}
		}else{
			document.getElementById('divCuff_Conversion_Fabric').style.display = "none";
			document.getElementById('poCuff_Conversion_Fabric').selectedIndex = 0;
			for (i=0;i<divcufffabrics.length;i++){
				if (document.getElementById(divcufffabrics[i])){
					document.getElementById(divcufffabrics[i]).style.display = "none";
					var poname = divcufffabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divcufffabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
		}
	}else if (optname == "Collar Conversion") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			document.getElementById('divCollar_Conversion_Fabric').style.display = "block";
			document.getElementById('poTriColor_Ribbon').selectedIndex = 0;
			chkprice('poTriColor_Ribbon');
			document.getElementById('poTriSplit_Collar').selectedIndex = 0;
			chkprice('poTriSplit_Collar');
			for (var i=1;i<=3;i++) {
				document.getElementById('poTriSplit_Color_'+i).selectedIndex = 0;
				document.getElementById('imgTriSplit_Color_'+i).src = "../skin1/images/spacer.gif";
				document.getElementById('divTriSplit_Color_'+i).style.display = "none";
			}
		}else{
			document.getElementById('divCollar_Conversion_Fabric').style.display = "none";
			document.getElementById('poCollar_Conversion_Fabric').selectedIndex = 0;
			for (i=0;i<divcollarfabrics.length;i++){
				if (document.getElementById(divcollarfabrics[i])){
					document.getElementById(divcollarfabrics[i]).style.display = "none";
					var poname = divcollarfabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divcollarfabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
		}
	}else if ((optname == "Coat Buttons") || (optname == "Server Jacket Buttons")) {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if ((chosen.indexOf("Hand-Crafted") != -1) || (chosen.indexOf("Hand-Rolled Cloth Buttons") != -1)){
			document.getElementById('divButton_Conversion_Fabric').style.display = "block";
		}else if (chosen.indexOf("Snap") != -1){
			if (document.getElementById('poCoat_Fabric')) {
				var CIndex = document.getElementById('poCoat_Fabric').selectedIndex;
				var Cchosen = document.getElementById('poCoat_Fabric').options[CIndex].text;
				if ((Cchosen.indexOf("Industrial") == -1)&&(Cchosen.indexOf("Spun Poly") == -1)&&(Cchosen.indexOf("Poplin") == -1)&&(Cchosen.indexOf("Twill") == -1)){
					alert("Snap Buttons will only work with Twills, Poplins, Spun Poly and Industrial Fabrics. Please change your fabric if you want to use Snaps.");
					document.getElementById(option).selectedIndex = 0;
				}
			}else if (document.getElementById('poServer_Jacket_Fabric')) {
				var SIndex = document.getElementById('poServer_Jacket_Fabric').selectedIndex;
				var Schosen = document.getElementById('poServer_Jacket_Fabric').options[SIndex].text;
				if ((Schosen.indexOf("Industrial") == -1)&&(Schosen.indexOf("Spun Poly") == -1)&&(Schosen.indexOf("Poplin") == -1)&&(Schosen.indexOf("Twill") == -1)){
					alert("Snap Buttons will only work with Twills, Poplins, Spun Poly and Industrial Fabrics. Please change your fabric if you want to use Snaps.");
					document.getElementById(option).selectedIndex = 0;
				}
			}
			document.getElementById('divButton_Conversion_Fabric').style.display = "none";
			document.getElementById('poButton_Conversion_Fabric').selectedIndex = 0;
			for (i=0;i<divbuttonfabrics.length;i++){
				if (document.getElementById(divbuttonfabrics[i])){
					document.getElementById(divbuttonfabrics[i]).style.display = "none";
					var poname = divbuttonfabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divbuttonfabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
		}else{
			document.getElementById('divButton_Conversion_Fabric').style.display = "none";
			document.getElementById('poButton_Conversion_Fabric').selectedIndex = 0;
			for (i=0;i<divbuttonfabrics.length;i++){
				if (document.getElementById(divbuttonfabrics[i])){
					document.getElementById(divbuttonfabrics[i]).style.display = "none";
					var poname = divbuttonfabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divbuttonfabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
		}
	}else if (optname == "Hat Conversion") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("Yes") != -1){
			document.getElementById('divHatband_Fabric').style.display = "block";
		}else{
			for (i=0;i<divhatbandfabrics.length;i++){
				if (document.getElementById(divhatbandfabrics[i])){
					document.getElementById(divhatbandfabrics[i]).style.display = "none";
					var poname = divhatbandfabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divhatbandfabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
			document.getElementById('poHatband_Fabric').selectedIndex = 0;
			document.getElementById('divHatband_Fabric').style.display = "none";
		}
	}else if (optname == "Hat Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divbasefabrics.length;i++){
			if (document.getElementById(divbasefabrics[i])){
				document.getElementById(divbasefabrics[i]).style.display = "none";
				var poname = divbasefabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = "0";
				var imgname = divbasefabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Base','');
	}else if (optname == "Hatband Fabric") {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		for (i=0;i<divhatbandfabrics.length;i++){
			if (document.getElementById(divhatbandfabrics[i])){
				document.getElementById(divhatbandfabrics[i]).style.display = "none";
				var poname = divhatbandfabrics[i].replace("div","po");
				document.getElementById(poname).selectedIndex = "0";
				var imgname = divhatbandfabrics[i].replace("div","img");
				document.getElementById(imgname).src = "../skin1/images/spacer.gif";
			}
		}
		fabOpen(chosen,'Hatband','');
	}else if (optname.indexOf("TriSplit Collar") != -1) {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") == -1) {
			document.getElementById('divCollar_Conversion_Fabric').style.display = "none";
			document.getElementById('poCollar_Conversion_Fabric').selectedIndex = 0;
			document.getElementById('poCollar_Conversion').selectedIndex = 0;
			chkprice('poCollar_Conversion');
			document.getElementById('poTriColor_Ribbon').selectedIndex = 0;
			chkprice('poTriColor_Ribbon');
			for (i=0;i<divcollarfabrics.length;i++){
				if (document.getElementById(divcollarfabrics[i])){
					document.getElementById(divcollarfabrics[i]).style.display = "none";
					var poname = divcollarfabrics[i].replace("div","po");
					document.getElementById(poname).selectedIndex = 0;
					var imgname = divcollarfabrics[i].replace("div","img");
					document.getElementById(imgname).src = "../skin1/images/spacer.gif";
				}
			}
			for (var i=1;i<=3;i++) {
				document.getElementById('divTriSplit_Color_'+i).style.display = "block";
			}
		}else{
			for (var i=1;i<=3;i++) {
				document.getElementById('divTriSplit_Color_'+i).style.display = "none";
				document.getElementById('poTriSplit_Color_'+i).selectedIndex = 0;
				document.getElementById('imgTriSplit_Color_'+i).src = "../skin1/images/spacer.gif";
			}
		}
	}else if (optname.indexOf("Color") != -1) {
		if (optname.indexOf("Thread") != -1) {
			var Index = document.getElementById(option).selectedIndex;
			var chosen = document.getElementById(option).options[Index].text;
			if (chosen.indexOf("None") != -1) {
				document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
			}else{
				chosen = chosen.toLowerCase();
				chosen = chosen.replace(" ","");
				chosen = chosen.replace(/\W/g,"");
				chosen = chosen.replace(/\d/g,"");
				document.getElementById('img'+optimg).src = "../files/image/threads/" + chosen + ".gif";
			}
		}else if (optname.indexOf("Ribbon") != -1) {
			var Index = document.getElementById(option).selectedIndex;
			var chosen = document.getElementById(option).options[Index].text;
			if (chosen.indexOf("None") == -1) {
				document.getElementById('divCollar_Conversion_Fabric').style.display = "none";
				document.getElementById('poCollar_Conversion_Fabric').selectedIndex = 0;
				document.getElementById('poCollar_Conversion').selectedIndex = 0;
				chkprice('poCollar_Conversion');
				for (i=0;i<divcollarfabrics.length;i++){
					if (document.getElementById(divcollarfabrics[i])){
						document.getElementById(divcollarfabrics[i]).style.display = "none";
						var poname = divcollarfabrics[i].replace("div","po");
						document.getElementById(poname).selectedIndex = 0;
						var imgname = divcollarfabrics[i].replace("div","img");
						document.getElementById(imgname).src = "../skin1/images/spacer.gif";
					}
				}
				document.getElementById('poTriSplit_Collar').selectedIndex = 0;
				chkprice('poTriSplit_Collar');
				for (var i=1;i<=3;i++) {
					document.getElementById('poTriSplit_Color_'+i).selectedIndex = 0;
					document.getElementById('imgTriSplit_Color_'+i).src = "../skin1/images/spacer.gif";
					document.getElementById('divTriSplit_Color_'+i).style.display = "none";
				}
			}
		}else if (optname.indexOf("TriSplit") != -1) {
			var Index = document.getElementById(option).selectedIndex;
			var chosen = document.getElementById(option).options[Index].text;
			if (chosen.indexOf("None") != -1) {
				document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
			}else{
				chosen = chosen.toLowerCase();
				chosen = chosen.replace(" ","");
				chosen = chosen.replace(/\W/g,"");
				var prodcode = chosen.match(/\d+/);
				document.getElementById('img'+optimg).src = "../files/image/fabrics/" + prodcode + ".gif";
				document.getElementById('img'+optimg).height = "50";				
			}
		}else if (optname.indexOf("TriColor") != -1) {
			var Index = document.getElementById(option).selectedIndex;
			var chosen = document.getElementById(option).options[Index].text;
			if (chosen.indexOf("None") != -1) {
				document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
			}else{
				chosen = chosen.toLowerCase();
				if (chosen.indexOf ("(+") != -1) {
					chosen = chosen.slice(0,(chosen.indexOf ("(")));
					var prodcode = chosen.match(/\d+/);
				}else{
					chosen = chosen.replace(" ","");
					chosen = chosen.replace(/\W/g,"");
					var prodcode = chosen.match(/\d+/);
				}
				document.getElementById('img'+optimg).src = "../files/image/fabrics/" + prodcode + ".gif";
				document.getElementById('img'+optimg).height = "50";				
			}
		}else{
			var Index = document.getElementById(option).selectedIndex;
			var chosen = document.getElementById(option).options[Index].text;
			if (chosen.indexOf("None") != -1) {
				document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
			}else{
				chosen = chosen.toLowerCase();
				chosen = chosen.replace(" ","");
				chosen = chosen.replace(/\W/g,"");
				chosen = chosen.replace(/\d/g,"");
				document.getElementById('img'+optimg).src = "../files/image/cording/" + chosen + ".gif";
				document.getElementById('img'+optimg).height = "20";				
			}
		}
	}else if (optname.indexOf("Fabrics") != -1) {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") != -1) {
			document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
		}else{
			chosen = chosen.toLowerCase();
			if (chosen.indexOf ("(+") != -1) {
				chosen = chosen.slice(0,(chosen.indexOf ("(")));
				var prodcode = chosen.match(/\d+/);
			}else{
				chosen = chosen.replace(" ","");
				chosen = chosen.replace(/\W/g,"");
				var prodcode = chosen.match(/\d+/);
			}
			document.getElementById('img'+optimg).src = "../files/image/fabrics/" + prodcode + ".gif";
			document.getElementById('img'+optimg).height = "50";
		}
	}else if (optname.indexOf("Font") != -1) {
		var Index = document.getElementById(option).selectedIndex;
		var chosen = document.getElementById(option).options[Index].text;
		if (chosen.indexOf("None") != -1) {
			document.getElementById('img'+optimg).src = "../skin1/images/spacer.gif";
		}else{
			chosen = chosen.toLowerCase();
			chosen = chosen.replace(" ","");
			chosen = chosen.replace(/\W/g,"");
			var prodcode = chosen.match(/\d+/);
			document.getElementById('img'+optimg).src = "../files/image/fonts/" + prodcode + ".gif";
			document.getElementById('img'+optimg).width = "120";
		}
	}
	if (optname.indexOf("Siz") != -1) {
		var Index = document.getElementById(option).selectedIndex;
		document.getElementById('mainsizingopt').selectedIndex = Index;
	}
}

//
// This function is used in the validation routine to determine which fabric was chosen
// so that the validation can know which color option to check to ensure that a color was chosen
// it returns a chunk of text that is then concatated to create the right option to check
//

function determineFabric(txt) {
	if (txt.indexOf("Egyptian") != -1){
		return "Egyptian";
	}else if(txt.indexOf("Fine") != -1){
		return "Fine_Line";
	}else if(txt.indexOf("Maxima") != -1){
		return "Maxima_Poplin";
	}else if(txt.indexOf("Weight") != -1){
		return "Mid_Weight";
	}else if(txt.indexOf("Spun") != -1){
		return "Spun_Poly";
	}else if(txt.indexOf("Denim") != -1){
		return "Denim";
	}else if(txt.indexOf("Soil") != -1){
		return "Soil_Release";
	}else if(txt.indexOf("Woven") != -1){
		return "Woven";
	}else if(txt.indexOf("Organic") != -1){
		return "Organic";
	}else if(txt.indexOf("Industrial") != -1){
		return "Industrial";
	}else if(txt.indexOf("Tuff") != -1){
		return "Tuff_Twill";
	}else if(txt.indexOf("Ultima") != -1){
		return "Ultima_Poplin";
	}else if(txt.indexOf("Ultralite") != -1){
		return "Ultralite";
	}else if(txt.indexOf("Mikro") != -1){
		return "Mikro";
	}else if(txt.indexOf("Rayon") != -1){
		return "Rayon_Blend";
	}else if(txt.indexOf("Twill") != -1){
		return "Twill";
	}else if(txt.indexOf("Shirting") != -1){
		return "Shirting";
	}else if(txt.indexOf("Decorative") != -1){
		return "Vest_Tie";
	}else if(txt.indexOf("Supima") != -1){
		return "Supima";
	}else if(txt.indexOf("Waffle") != -1){
		return "Waffle";
	}else if(txt.indexOf("Seasonal") != -1){
		return "Seasonal";
	}else if(txt.indexOf("Limited") != -1){
		return "Seasonal";
	}else if(txt.indexOf("Standard Fabrics") != -1){
		return "Standard";
	}
}

//
//
// This is the validation routine for the product options after a customer clicks
// add to cart this routine runs to check if there arte any options missing that need to be 
// applied, and informs the customer with a popup box. They cannot continue to the cart
// page without making it through this javascript. It is divided into sections for each type
// of clothing. cat is the input variable that describes the first option and from this we determine
// the product category. loccode tells the script if it is being called from the product page a 0, or 
// the cart a 1, this is needed to submit the form correctly (last step). Each option is 
// checked for existence before they are checked for correctness this prevents failure of the script
// if an option is not there. For options not currently installed they will not be checked and 
// validation will not happen on those items.
//
//

function ccValidation(cat,loccode) {
	var formok = true;
	cat = cat.toLowerCase();
	if (cat.indexOf("coat") != -1){
		if (document.getElementById('divCoat_Fabric')){
			var CF = "poCoat_Fabric";
			var CFIndex = document.getElementById(CF).selectedIndex;
			var CFChosen = document.getElementById(CF).options[CFIndex].text;
			var fab = determineFabric(CFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Color for your Coat.");
				formok = false;
			}
		}
		if (document.getElementById('divCoat_TriColor_Fabric_1')){
			var TCF1 = "poCoat_TriColor_Fabric_1";
			var TCF1Index = document.getElementById(TCF1).selectedIndex;
			var TCF1Chosen = document.getElementById(TCF1).options[TCF1Index].text;
			var fab = determineFabric(TCF1Chosen);
			if (document.getElementById('poTriColor_'+fab+'_Fabrics_1').selectedIndex == 0) { 
				alert("You need to select a Right Side Color for your Coat.");
				formok = false;
			}
		}
		if (document.getElementById('divCoat_TriColor_Fabric_2')){
			var TCF2 = "poCoat_TriColor_Fabric_2";
			var TCF2Index = document.getElementById(TCF2).selectedIndex;
			var TCF2Chosen = document.getElementById(TCF2).options[TCF2Index].text;
			var fab = determineFabric(TCF2Chosen);
			if (document.getElementById('poTriColor_'+fab+'_Fabrics_2').selectedIndex == 0) { 
				alert("You need to select a Left Side Color for your Coat.");
				formok = false;
			}
		}
		if (document.getElementById('divCoat_TriColor_Fabric_3')){
			var TCF3 = "poCoat_TriColor_Fabric_3";
			var TCF3Index = document.getElementById(TCF3).selectedIndex;
			var TCF3Chosen = document.getElementById(TCF3).options[TCF3Index].text;
			var fab = determineFabric(TCF3Chosen);
			if (document.getElementById('poTriColor_'+fab+'_Fabrics_3').selectedIndex == 0) { 
				alert("You need to select a Upper Left Side Color for your Coat.");
				formok = false;
			}
		}
		if (document.getElementById('divMens_Coat_Size')){
			var CSM = "poMens_Coat_Size";
			var CSMIndex = document.getElementById(CSM).selectedIndex;
			var CSMChosen = document.getElementById(CSM).options[CSMIndex].text;
			if (CSMChosen == "None"){
				alert("You need to select a Size for your Coat.");
				formok = false;
			}			
		}else if (document.getElementById('divMens_Standard_Coat_Size')){
			var CSM = "poMens_Standard_Coat_Size";
			var CSMIndex = document.getElementById(CSM).selectedIndex;
			var CSMChosen = document.getElementById(CSM).options[CSMIndex].text;			
			if (CSMChosen == "None"){
				alert("You need to select a Size for your Coat.");
				formok = false;
			}
		}
		if (document.getElementById('divWomens_Coat_Size')){
			var CSW = "poWomens_Coat_Size";
			var CSWIndex = document.getElementById(CSW).selectedIndex;
			var CSWChosen = document.getElementById(CSW).options[CSWIndex].text;
			if (CSWChosen == "None"){
				alert("You need to select a Size for your Coat.");
				formok = false;
			}
		}else if (document.getElementById('divWomens_Standard_Coat_Size')){
			var CSW = "poWomens_Standard_Coat_Size";
			var CSWIndex = document.getElementById(CSW).selectedIndex;
			var CSWChosen = document.getElementById(CSW).options[CSWIndex].text;
			if (CSWChosen == "None"){
				alert("You need to select a Size for your Coat.");
				formok = false;
			}
		}
		if (document.getElementById('divCuff_Cording')){
			if (document.getElementById('poCuff_Cording').selectedIndex != 0) {
				var CCIndex = document.getElementById('poCuff_Cording').selectedIndex;
				switch (CCIndex) {
					case 1:
						if (document.getElementById('poCuff_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Cuff Cording");
							formok = false;
						}
						break;
					case 2:
						if (document.getElementById('poCuff_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Cuff Cording");
							formok = false;
						}else if (document.getElementById('poCuff_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Cuff Cording");
							formok = false;
						}
						break;
					case 3:
						if (document.getElementById('poCuff_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Cuff Cording");
							formok = false;
						}else if (document.getElementById('poCuff_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Cuff Cording");
							formok = false;
						}else if (document.getElementById('poCuff_Cording_Color_3').selectedIndex == 0) {
							alert("You need to select a Color for your 3rd row of Cuff Cording");
							formok = false;
						}
						break;
				}
			}
		}
		if (document.getElementById('divBack_Yoke_Conversion')){
			if (document.getElementById('poBack_Yoke_Conversion').selectedIndex != 0) {
				if (document.getElementById('poBack_Yoke_Conversion_Fabric').selectedIndex == 0) {
					alert("You need to select a Fabric for your Yoke Conversion");
					formok = false;
				}else{
					var BYF = "poBack_Yoke_Conversion_Fabric";
					var BYFIndex = document.getElementById(BYF).selectedIndex;
					var BYFChosen = document.getElementById(BYF).options[BYFIndex].text;
					var yokefab = determineFabric(BYFChosen);
					if (document.getElementById('poYoke_'+yokefab+'_Fabrics').selectedIndex == 0) { 
						alert("You need to select a Color for your Yoke Fabric.");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divCuff_Conversion')){
			if (document.getElementById('poCuff_Conversion').selectedIndex != 0) {
				if (document.getElementById('poCuff_Conversion_Fabric').selectedIndex == 0) {
					alert("You need to select a Fabric for your Cuff Conversion");
					formok = false;
				}else{
					var CCF = "poCuff_Conversion_Fabric";
					var CCFIndex = document.getElementById(CCF).selectedIndex;
					var CCFChosen = document.getElementById(CCF).options[CCFIndex].text;
					var cufffab = determineFabric(CCFChosen);
					if (document.getElementById('poCuff_'+cufffab+'_Fabrics').selectedIndex == 0) { 
						alert("You need to select a Color for your Cuff Fabric.");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divCollar_Conversion')){
			if (document.getElementById('poCollar_Conversion').selectedIndex != 0) {
				if (document.getElementById('poCollar_Conversion_Fabric').selectedIndex == 0) {
					alert("You need to select a Fabric for your Collar Conversion");
					formok = false;
				}else{
					var CCF = "poCollar_Conversion_Fabric";
					var CCFIndex = document.getElementById(CCF).selectedIndex;
					var CCFChosen = document.getElementById(CCF).options[CCFIndex].text;
					var colfab = determineFabric(CCFChosen);
					if (document.getElementById('poCollar_'+colfab+'_Fabrics').selectedIndex == 0) { 
						alert("You need to select a Color for your Collar Fabric.");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divTriSplit_Collar')){
			if (document.getElementById('poTriSplit_Collar').selectedIndex != 0) {
				if ((document.getElementById('poTriSplit_Color_1').selectedIndex == 0) || (document.getElementById('poTriSplit_Color_2').selectedIndex == 0) || (document.getElementById('poTriSplit_Color_3').selectedIndex == 0)) {
					alert("You need to select 3 Colors for your Tri-Split Collar");
					formok = false;
				}
			}
		}
		if (document.getElementById('divCoat_Buttons')){
			var Btn = "poCoat_Buttons";
			var BtnIndex = document.getElementById(Btn).selectedIndex;
			var BtnChosen = document.getElementById(Btn).options[BtnIndex].text;
			if ((BtnChosen.indexOf("Hand-Rolled") != -1) || (BtnChosen.indexOf("Hand-Crafted") != -1)) {
				if (document.getElementById('poButton_Conversion_Fabric').selectedIndex == 0) {
					alert("You need to select a Fabric for your Buttons");
					formok = false;
				}else{
					var BCF = "poButton_Conversion_Fabric";
					var BCFIndex = document.getElementById(BCF).selectedIndex;
					var BCFChosen = document.getElementById(BCF).options[BCFIndex].text;
					var btnfab = determineFabric(BCFChosen);
					if (document.getElementById('poButton_'+btnfab+'_Fabrics').selectedIndex == 0) { 
						alert("You need to select a Color for your Button Fabric.");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divFront_Cording')){
			if (document.getElementById('poFront_Cording').selectedIndex != 0) {
				var FCIndex = document.getElementById('poFront_Cording').selectedIndex;
				switch (FCIndex) {
					case 1:
						if (document.getElementById('poFront_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Front Cording");
							formok = false;
						}
						break;
					case 2:
						if (document.getElementById('poFront_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Front Cording");
							formok = false;
						}else if (document.getElementById('poFront_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Front Cording");
							formok = false;
						}
						break;
					case 3:
						if (document.getElementById('poFront_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Front Cording");
							formok = false;
						}else if (document.getElementById('poFront_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Front Cording");
							formok = false;
						}else if (document.getElementById('poFront_Cording_Color_3').selectedIndex == 0) {
							alert("You need to select a Color for your 3rd row of Front Cording");
							formok = false;
						}
						break;
				}
			}
		}
		if (document.getElementById('divUpper_Collar_Cording')){
			if (document.getElementById('poUpper_Collar_Cording').selectedIndex != 0) {
				var UCCIndex = document.getElementById('poUpper_Collar_Cording').selectedIndex;
				switch (UCCIndex) {
					case 1:
						if (document.getElementById('poUpper_Collar_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Upper Collar Cording");
							formok = false;
						}
						break;
					case 2:
						if (document.getElementById('poUpper_Collar_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Upper Collar Cording");
							formok = false;
						}else if (document.getElementById('poUpper_Collar_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Upper Collar Cording");
							formok = false;
						}
						break;
					case 3:
						if (document.getElementById('poUpper_Collar_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Upper Collar Cording");
							formok = false;
						}else if (document.getElementById('poUpper_Collar_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Upper Collar Cording");
							formok = false;
						}else if (document.getElementById('poUpper_Collar_Cording_Color_3').selectedIndex == 0) {
							alert("You need to select a Color for your 3rd row of Upper Collar Cording");
							formok = false;
						}
						break;
				}
			}
		}
		if (document.getElementById('divLower_Collar_Cording')){
			if (document.getElementById('poLower_Collar_Cording').selectedIndex != 0) {
				var LCCIndex = document.getElementById('poLower_Collar_Cording').selectedIndex;
				switch (LCCIndex) {
					case 1:
						if (document.getElementById('poLower_Collar_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Lower Collar Cording");
							formok = false;
						}
						break;
					case 2:
						if (document.getElementById('poLower_Collar_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Lower Collar Cording");
							formok = false;
						}else if (document.getElementById('poLower_Collar_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Lower Collar Cording");
							formok = false;
						}
						break;
					case 3:
						if (document.getElementById('poLower_Collar_Cording_Color_1').selectedIndex == 0) {
							alert("You need to select a Color for your 1st row of Lower Collar Cording");
							formok = false;
						}else if (document.getElementById('poLower_Collar_Cording_Color_2').selectedIndex == 0) {
							alert("You need to select a Color for your 2nd row of Lower Collar Cording");
							formok = false;
						}else if (document.getElementById('poLower_Collar_Cording_Color_3').selectedIndex == 0) {
							alert("You need to select a Color for your 3rd row of Lower Collar Cording");
							formok = false;
						}
						break;
				}
			}
		}
		if (document.getElementById('divCoat_Pocket_1')){
			for (var pocknum=1;pocknum<=4;pocknum++){
				var Pock = "poCoat_Pocket_"+pocknum;
				var PockIndex = document.getElementById(Pock).selectedIndex;
				var PockChosen = document.getElementById(Pock).options[PockIndex].text;
				if (PockChosen.indexOf("Corded") != -1) {
					if (document.getElementById('poPocket_'+pocknum+'_Cording_Color').selectedIndex == 0) {
						alert("You need to select a Cording Color for Pocket #"+pocknum);
						formok = false;
					}
				}
			}
			var Pock1 = "poCoat_Pocket_1";
			var PockIndex1 = document.getElementById(Pock1).selectedIndex;
			var PockChosen1 = document.getElementById(Pock1).options[PockIndex1].text;
			var Pock2 = "poCoat_Pocket_2";
			var PockIndex2 = document.getElementById(Pock2).selectedIndex;
			var PockChosen2 = document.getElementById(Pock2).options[PockIndex2].text;
			var Pock3 = "poCoat_Pocket_3";
			var PockIndex3 = document.getElementById(Pock3).selectedIndex;
			var PockChosen3 = document.getElementById(Pock3).options[PockIndex3].text;
			var Pock4 = "poCoat_Pocket_4";
			var PockIndex4 = document.getElementById(Pock4).selectedIndex;
			var PockChosen4 = document.getElementById(Pock4).options[PockIndex4].text;
			var tstpock = 0;
			if (PockChosen1 != "None") {
				if ((PockChosen1 == PockChosen2) || (PockChosen1 == PockChosen3) || (PockChosen1 == PockChosen4)){
					tstpock = 1;
				}
			}
			if (PockChosen2 != "None") {
				if ((PockChosen2 == PockChosen1) || (PockChosen2 == PockChosen3) || (PockChosen2 == PockChosen4)){
					tstpock = 1;
				}
			}
			if (PockChosen3 != "None") {
				if ((PockChosen3 == PockChosen1) || (PockChosen3 == PockChosen2) || (PockChosen3 == PockChosen4)){
					tstpock = 1;
				}
			}
			if (PockChosen4 != "None") {
				if ((PockChosen4 == PockChosen1) || (PockChosen4 == PockChosen2) || (PockChosen4 == PockChosen3)){
					tstpock = 1;
				}
			}
			if (tstpock > 0) {
				alert("All pockets need to be in different placements");
				formok= false;
				tstpock = 0;
			}
		}
		if (document.getElementById('divFlag_Embroidery')){
			if (document.getElementById('poFlag_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poFlag_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Flag Embroidery");
					formok = false;
				}
			}
		}
		if (document.getElementById('divName_Embroidery')){
			if (document.getElementById('poName_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poEmbroidery_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poEmbroidery_Font').selectedIndex == 0) {
					alert("You need to select a Font for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poThread_Color').selectedIndex == 0) {
					alert("You need to select a Thread Color for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 1) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 2) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 3) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_3').value == "") {
						alert("You need to Enter your 3rd Line of Embroidery Text");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divCuff_Type')){
			if (document.getElementById('poCuff_Type').selectedIndex == 0) {
				var CTIndex = document.getElementById('poCoat_Sleeves').selectedIndex;
				var CTChosen = document.getElementById('poCoat_Sleeves').options[CTIndex].text;
				if (CTChosen.indexOf("w/o") == -1) {
					alert("You have selected a Sleeve Type with Cuffs, but your Cuff Type is None please change your Cuff or Sleeve Type");
					formok = false;
				}
			}
		}
		
	}else if (cat.indexOf("apron") != -1){
		if (document.getElementById('divApron_Fabric')){
			var AF = "poApron_Fabric";
			var AFIndex = document.getElementById(AF).selectedIndex;
			var AFChosen = document.getElementById(AF).options[AFIndex].text;
			var fab = determineFabric(AFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Pattern/Color for your Apron.");
				formok = false;
			}
		}
		if (document.getElementById('divApron_Pocket_Cording')){
			if (document.getElementById('poApron_Pocket_Cording').selectedIndex != 0) {
				if (document.getElementById('poApron_Pocket_Cording_Color').selectedIndex == 0){
					alert("You need to select a Color for your Pocket Cording");
					formok = false;
				}
			}
		}
		if (document.getElementById('divApron_Flap_Cording')){
			if (document.getElementById('poApron_Flap_Cording').selectedIndex != 0) {
				if (document.getElementById('poApron_Flap_Cording_Color').selectedIndex == 0){
					alert("You need to select a Color for your Apron Flap Cording");
					formok = false;
				}
			}
		}
		if (document.getElementById('divFlag_Embroidery')){
			if (document.getElementById('poFlag_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poFlag_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Flag Embroidery");
					formok = false;
				}
			}
		}
		if (document.getElementById('divName_Embroidery')){
			if (document.getElementById('poName_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poEmbroidery_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poEmbroidery_Font').selectedIndex == 0) {
					alert("You need to select a Font for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poThread_Color').selectedIndex == 0) {
					alert("You need to select a Thread Color for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 1) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 2) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 3) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_3').value == "") {
						alert("You need to Enter your 3rd Line of Embroidery Text");
						formok = false;
					}
				}
			}
		}
	}else if (cat.indexOf("hat") != -1){
		if (document.getElementById('divHat_Fabric')){
			var HF = "poHat_Fabric";
			var HFIndex = document.getElementById(HF).selectedIndex;
			var HFChosen = document.getElementById(HF).options[HFIndex].text;
			var fab = determineFabric(HFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Pattern/Color for your Hat.");
				formok = false;
			}
		}
		if (document.getElementById('divHat_Cording')){
			if (document.getElementById('poHat_Cording').selectedIndex != 0) {
				if (document.getElementById('poHat_Cording_Color').selectedIndex == 0) {
					alert("You need to select a Cording Color for your Hat");
					formok = false;
				}
			}
		}
		if (document.getElementById('divHat_Conversion')){
			if (document.getElementById('poHat_Conversion').selectedIndex != 0) {
				if (document.getElementById('poHatband_Fabric').selectedIndex == 0) {
					alert("You need to select a Fabric for your Hat Conversion");
					formok = false;
				}else{
					var HCF = "poHatband_Fabric";
					var HCFIndex = document.getElementById(HCF).selectedIndex;
					var HCFChosen = document.getElementById(HCF).options[HCFIndex].text;
					var hatfab = determineFabric(HCFChosen);
					if (document.getElementById('poHatband_'+hatfab+'_Fabrics').selectedIndex == 0) { 
						alert("You need to select a Color for your Hatband Fabric.");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divFlag_Embroidery')){
			if (document.getElementById('poFlag_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poHat_Flag_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Flag Embroidery");
					formok = false;
				}
			}
		}
		if (document.getElementById('divName_Embroidery')){
			if (document.getElementById('poName_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poHat_Embroidery_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poEmbroidery_Font').selectedIndex == 0) {
					alert("You need to select a Font for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poThread_Color').selectedIndex == 0) {
					alert("You need to select a Thread Color for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 1) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 2) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 3) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_3').value == "") {
						alert("You need to Enter your 3rd Line of Embroidery Text");
						formok = false;
					}
				}
			}
		}
	}else if (cat.indexOf("pant") != -1){
		if (document.getElementById('divPants_Sizing')){
			var PS = "poPants_Sizing";
			var PSIndex = document.getElementById(PS).selectedIndex;
			var PSChosen = document.getElementById(PS).options[PSIndex].text;
			if (PSChosen == "None"){
				alert("You need to select a Size for your Pants.");
				formok = false;
			}
		}
		if (document.getElementById('divPants_Fabric')){
			var PF = "poPants_Fabric";
			var PFIndex = document.getElementById(PF).selectedIndex;
			var PFChosen = document.getElementById(PF).options[PFIndex].text;
			var fab = determineFabric(PFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Pattern/Color for your Pants.");
				formok = false;
			}
		}
		if (document.getElementById('divFlag_Embroidery')){
			if (document.getElementById('poFlag_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poFlag_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Flag Embroidery");
					formok = false;
				}
			}
		}
		if (document.getElementById('divName_Embroidery')){
			if (document.getElementById('poName_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poEmbroidery_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poEmbroidery_Font').selectedIndex == 0) {
					alert("You need to select a Font for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poThread_Color').selectedIndex == 0) {
					alert("You need to select a Thread Color for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 1) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 2) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 3) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_3').value == "") {
						alert("You need to Enter your 3rd Line of Embroidery Text");
						formok = false;
					}
				}
			}
		}
	}else if (cat.indexOf("shirt") != -1){
		if (document.getElementById('divShirt_Fabric')){
			var SF = "poShirt_Fabric";
			var SFIndex = document.getElementById(SF).selectedIndex;
			var SFChosen = document.getElementById(SF).options[SFIndex].text;
			var fab = determineFabric(SFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Pattern/Color for your Shirt.");
				formok = false;
			}
		}
		if (document.getElementById('divShirt_Sizing')){
			var SSM = "poShirt_Sizing";
			var SSMIndex = document.getElementById(SSM).selectedIndex;
			var SSMChosen = document.getElementById(SSM).options[SSMIndex].text;
			var SSW = "poWomens_Shirt_Sizing";
			var SSWIndex = document.getElementById(SSW).selectedIndex;
			var SSWChosen = document.getElementById(SSW).options[SSWIndex].text;
			if (SSMChosen == "None" && SSWChosen == "None"){
				alert("You need to select a Size for your Shirt.");
				formok = false;
			}
		}
		if (document.getElementById('divShirt_Cording')){
			if (document.getElementById('poShirt_Cording').selectedIndex != 0) {
				if (document.getElementById('poShirt_Cording_Color').selectedIndex == 0){
					alert("You need to select a Color for your Shirt Cording");
					formok = false;
				}
			}
		}
		if (document.getElementById('divFlag_Embroidery')){
			if (document.getElementById('poFlag_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poFlag_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Flag Embroidery");
					formok = false;
				}
			}
		}
		if (document.getElementById('divName_Embroidery')){
			if (document.getElementById('poName_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poEmbroidery_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poEmbroidery_Font').selectedIndex == 0) {
					alert("You need to select a Font for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poThread_Color').selectedIndex == 0) {
					alert("You need to select a Thread Color for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 1) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 2) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 3) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_3').value == "") {
						alert("You need to Enter your 3rd Line of Embroidery Text");
						formok = false;
					}
				}
			}
		}
	}else if (cat.indexOf("vest") != -1){
		if (document.getElementById('divVest_Fabric')){
			var VF = "poVest_Fabric";
			var VFIndex = document.getElementById(VF).selectedIndex;
			var VFChosen = document.getElementById(VF).options[VFIndex].text;
			var fab = determineFabric(VFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Pattern/Color for your Vest.");
				formok = false;
			}
		}
		if (document.getElementById('divVest_Sizing')){
			var VSM = "poVest_Sizing";
			var VSMIndex = document.getElementById(VSM).selectedIndex;
			var VSMChosen = document.getElementById(VSM).options[VSMIndex].text;
			var VSW = "poWomens_Vest_Sizing";
			var VSWIndex = document.getElementById(VSW).selectedIndex;
			var VSWChosen = document.getElementById(VSW).options[VSWIndex].text;
			if (VSMChosen == "None" && VSWChosen == "None"){
				alert("You need to select a Size for your Vest.");
				formok = false;
			}
		}
		if (document.getElementById('divFlag_Embroidery')){
			if (document.getElementById('poFlag_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poFlag_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Flag Embroidery");
					formok = false;
				}
			}
		}
		if (document.getElementById('divName_Embroidery')){
			if (document.getElementById('poName_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poEmbroidery_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poEmbroidery_Font').selectedIndex == 0) {
					alert("You need to select a Font for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poThread_Color').selectedIndex == 0) {
					alert("You need to select a Thread Color for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 1) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 2) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 3) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_3').value == "") {
						alert("You need to Enter your 3rd Line of Embroidery Text");
						formok = false;
					}
				}
			}
		}
	}else if (cat.indexOf("shoe") != -1){
		if (document.getElementById('divAmerican_Mens_Shoe_Sizing')){
			var SSM = "poAmerican_Mens_Shoe_Sizing";
			var SSMIndex = document.getElementById(SSM).selectedIndex;
			var SSMChosen = document.getElementById(SSM).options[SSMIndex].text;
			var SSW = "poAmerican_Womens_Shoe_Sizing";
			var SSWIndex = document.getElementById(SSW).selectedIndex;
			var SSWChosen = document.getElementById(SSW).options[SSWIndex].text;
			if (SSMChosen == "None" && SSWChosen == "None"){
				alert("You need to select a Size for your Shoes.");
				formok = false;
			}
		}else if (document.getElementById('divDansko_Shoe_Sizing')){
			var SSM = "poDansko_Shoe_Sizing";
			var SSMIndex = document.getElementById(SSM).selectedIndex;
			var SSMChosen = document.getElementById(SSM).options[SSMIndex].text;			
			if (SSMChosen == "None"){
				alert("You need to select a Size for your Shoes.");
				formok = false;
			}
		}else if (document.getElementById('divBirki_Shoe_Sizing')){
			var SSM = "poBirki_Shoe_Sizing";
			var SSMIndex = document.getElementById(SSM).selectedIndex;
			var SSMChosen = document.getElementById(SSM).options[SSMIndex].text;			
			if (SSMChosen == "None"){
				alert("You need to select a Size for your Shoes.");
				formok = false;
			}
		}
	}else if (cat.indexOf("jacket") != -1){
		if (document.getElementById('divServer_Jacket_Fabric')){
			var JF = "poServer_Jacket_Fabric";
			var JFIndex = document.getElementById(JF).selectedIndex;
			var JFChosen = document.getElementById(JF).options[JFIndex].text;
			var fab = determineFabric(JFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Pattern/Color for your Server Jacket.");
				formok = false;
			}
		}
		if (document.getElementById('divServer_Jacket_Size')){
			var JSM = "poServer_Jacket_Size";
			var JSMIndex = document.getElementById(JSM).selectedIndex;
			var JSMChosen = document.getElementById(JSM).options[JSMIndex].text;
			var JSW = "poWomens_Server_Jacket_Size";
			var JSWIndex = document.getElementById(JSW).selectedIndex;
			var JSWChosen = document.getElementById(JSW).options[JSWIndex].text;
			if (JSMChosen == "None" && CSWChosen == "None"){
				alert("You need to select a Size for your Server Jacket.");
				formok = false;
			}
		}
		if (document.getElementById('divServer_Jacket_Buttons')){
			var Btn = "poServer_Jacket_Buttons";
			var BtnIndex = document.getElementById(Btn).selectedIndex;
			var BtnChosen = document.getElementById(Btn).options[BtnIndex].text;
			if ((BtnChosen.indexOf("Hand-Rolled") != -1) || (BtnChosen.indexOf("Hand-Crafted") != -1)) {
				if (document.getElementById('poButton_Conversion_Fabric').selectedIndex == 0) {
					alert("You need to select a Fabric for your Buttons");
					formok = false;
				}else{
					var BCF = "poButton_Conversion_Fabric";
					var BCFIndex = document.getElementById(BCF).selectedIndex;
					var BCFChosen = document.getElementById(BCF).options[BCFIndex].text;
					var btnfab = determineFabric(BCFChosen);
					if (document.getElementById('poButton_'+btnfab+'_Fabrics').selectedIndex == 0) { 
						alert("You need to select a Color for your Button Fabric.");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divCuff_Conversion')){
			if (document.getElementById('poCuff_Conversion').selectedIndex != 0) {
				if (document.getElementById('poCuff_Conversion_Fabric').selectedIndex == 0) {
					alert("You need to select a Fabric for your Cuff Conversion");
					formok = false;
				}else{
					var JCF = "poCuff_Conversion_Fabric";
					var JCFIndex = document.getElementById(JCF).selectedIndex;
					var JCFChosen = document.getElementById(JCF).options[JCFIndex].text;
					var cufffab = determineFabric(JCFChosen);
					if (document.getElementById('poCuff_'+cufffab+'_Fabrics').selectedIndex == 0) { 
						alert("You need to select a Color for your Cuff Fabric.");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('divFlag_Embroidery')){
			if (document.getElementById('poFlag_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poFlag_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Flag Embroidery");
					formok = false;
				}
			}
		}
		if (document.getElementById('divName_Embroidery')){
			if (document.getElementById('poName_Embroidery').selectedIndex != 0) {
				if (document.getElementById('poEmbroidery_Location').selectedIndex == 0) {
					alert("You need to select a Location for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poEmbroidery_Font').selectedIndex == 0) {
					alert("You need to select a Font for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poThread_Color').selectedIndex == 0) {
					alert("You need to select a Thread Color for your Embroidery");
					formok = false;
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 1) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 2) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}
				}
				if (document.getElementById('poName_Embroidery').selectedIndex == 3) {
					if (document.getElementById('poName_Embroid_Line_1').value == "") {
						alert("You need to Enter your 1st Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_2').value == "") {
						alert("You need to Enter your 2nd Line of Embroidery Text");
						formok = false;
					}else if (document.getElementById('poName_Embroid_Line_3').value == "") {
						alert("You need to Enter your 3rd Line of Embroidery Text");
						formok = false;
					}
				}
			}
		}
		if (document.getElementById('poCuff_Type')) {
			if (document.getElementById('poCuff_Type').selectedIndex == 0) {
				var CTIndex = document.getElementById('poServer_Jacket_Sleeves').selectedIndex;
				var CTChosen = document.getElementById('poServer_Jacket_Sleeves').options[CTIndex].text;
				if (CTChosen.indexOf("w/o") == -1) {
					alert("You have selected a Sleeve Type with Cuffs, but your Cuff Type is None please change your Cuff or Sleeve Type");
					formok = false;
				}
			}
		}
	}else if (cat.indexOf("neckwear") != -1){
		if (document.getElementById('divNeckwear_Fabric')){
			var TF = "poNeckwear_Fabric";
			var TFIndex = document.getElementById(TF).selectedIndex;
			var TFChosen = document.getElementById(TF).options[TFIndex].text;
			var fab = determineFabric(TFChosen);
			if (document.getElementById('poBase_'+fab+'_Fabrics').selectedIndex == 0) { 
				alert("You need to select a Pattern/Color for your Tie.");
				formok = false;
			}
		}
	}else{
		alert("Somethings wrong in validation product picking");
		formok=false;
	}
	if (formok) {
		if (loccode == 0){
			document.orderform.submit();
		}else{
			return formok;
		}
	}else{
		return formok;
	}
}

function listSel(fld,id) {
	var opt = fld.selectedIndex;
	document.getElementById(id).selectedIndex = opt;
	chkprice(id);
}