

//
//  Culinary Classics Personal JQuery Library
//

$jQ().ready(function(){
	var phplive_e_1328066232 = document.createElement("script"); 
	phplive_e_1328066232.type = "text/javascript"; 
	phplive_e_1328066232.async = true; 
	phplive_e_1328066232.src = "//www.culinaryclassics.com/phpchat/js/phplive_v2.js.php?q=1|1328066232|0|"; 
	document.body.appendChild(phplive_e_1328066232); 

	//Load Variables for all jquery startups
	var imageWidth = $jQ(".scroller").width();
	var imageSum = $jQ(".image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	var defsrc = "./skin1/images/custom/imagedot.png";
	var onsrc = "./skin1/images/custom/imagedot_on.png";
	var oversrc = "./skin1/images/custom/imagedot_over.png";
	var currsrc = "";
	var show_div = 0;
	/*featuredcontentglider.init({
		gliderid: "featured_glider", //ID of main glider container
		contentclass: "glidecontent", //Shared CSS class name of each glider content
		togglerid: "p-select", //ID of toggler container
		remotecontent: "", //Get gliding contents from external file on server? "filename" or "" to disable
		selected: 0, //Default selected content index (0=1st)
		persiststate: false, //Remember last content shown within browser session (true/false)?
		speed: 1000, //Glide animation duration (in milliseconds)
		direction: "rightleft", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
		autorotate: true, //Auto rotate contents (true/false)?
		autorotateconfig: [3000, 10] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
	})*/
	
	// Setup page tabs
	$jQ('#bottom_tabs').tabs();
	$jQ('#product_tabs').tabs();
	
	//Show Required Objects for pages and set Start Up Values
	$jQ(".leftnav").show();
	$jQ(".leftnav img:first").addClass("active");
	$jQ(".image_reel").css({'width' : imageReelWidth});
	
	// Rotation and Timing Events for Left scroller
	rotate = function(){
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide
		$jQ(".leftnav img").removeClass('active'); //Remove all active class
		$jQ(".leftnav img").attr('src', defsrc); //Replace off images
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		$active.attr('src', onsrc); //Add on image
		$jQ(".image_reel").animate({left: -image_reelPosition}, 500 );  //Slider Animation
	}; 
	rotateSwitch = function(){
		play = setInterval(function(){
			$active = $jQ('.leftnav img.active').next(); //Move to the next paging
			if ( $active.length === 0) { //If paging reaches the end...
		  		$active = $jQ('.leftnav img:first'); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, 7000); //Timer speed in milliseconds (7 seconds)
	};
	
	//On Hover Commands
	$jQ(".image_reel a").hover(function() {
	    	clearInterval(play);}, function() {rotateSwitch();
	});	
	$jQ(".leftnav img").hover(function() {
		currsrc = $jQ(this).attr('src');
		$jQ(this).attr('src', oversrc);}, function() {$jQ(this).attr('src', currsrc);
	});	
	$jQ('.s_over').live('mouseover',function(){$jQ('#ajaxsearch_rslt').show();});
	$jQ('.s_over').live('mouseout',function(){$jQ('#ajaxsearch_rslt').hide();});
	$jQ('.ajaxSearch').live('mouseover',function(){$jQ(this).addClass('on_row'); show_div = 1;});
	$jQ('.ajaxSearch').live('mouseout',function(){$jQ(this).removeClass('on_row');});
	$jQ('.options_off').live('click',function(){
		var val = $jQ(this).attr('data-id');
		$jQ(this).hide();
		$jQ('#'+val).show();
	});
	$jQ('.options_on').live('click',function(){
		var val = $jQ(this).attr('data-id');
		$jQ(this).hide();
		$jQ('#'+val).show();
	});
	//On Click Commands
	$jQ(".leftnav img").click(function() {
		$jQ(this).attr('src', onsrc);
		currsrc = $jQ(this).attr('src');
		$active = $jQ(this); //Activate the clicked paging
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		rotateSwitch(); // Resume rotation timer
		return false; //Prevent browser jump to link anchor
	});
	$jQ(".linkbtn").click(function() {
		var locate = $jQ(this).attr('data-id');
		window.location=locate;
	});
	$jQ(".searchlinkbtn").click(function() {
		var locate = $jQ(this).attr('data-id');
		var val = $jQ('#searchstring').val();
		window.location=locate+val;
	});
	$jQ(".nwsltrinfo").click(function(){
		var successMsg = "Thank You! You have been added to our mailing list!";
		var existMsg = "Your already on our mailing list, thanks";
		var errorMsg = "Sorry, please contact site administrator";
		var bademailMsg = "Email format is incorrect";
		var email = $jQ("#mailcap_email").val();
		if (email === "" || email.indexOf("@") === -1){
			$jQ("#mailcap_thanks").show();
			$jQ("#mailcap_thanks").text(bademailMsg);
			setTimeout('$jQ("#mailcap_thanks").hide("slow")', 4000);
			return false;
		}
		$jQ("#mailspin").show();
		var query = '&email='+email;
		$jQ.ajax({
			url: 'skin1/customer/submit_email.php',
			cache: false,
			data: query,
			error: function(req,status,err){
				alert('Error: '+status+' '+err);
				$jQ('#mailspin').hide();
				$jQ("#mailcap_thanks").show();
				$jQ("#mailcap_thanks").text(errorMsg);
				setTimeout('$jQ("#mailcap_thanks").hide("slow")', 4000);
				$jQ("#mailcap_email").val('');
			},
			success: function(data) {
				$jQ('#mailspin').hide();
				$jQ("#mailcap_thanks").show();
				if(data === 'Exists'){$jQ("#mailcap_thanks").text(existMsg);}
				else{$jQ("#mailcap_thanks").text(successMsg);}
				setTimeout('$jQ("#mailcap_thanks").hide("slow")', 4000);
				$jQ("#mailcap_email").val('');
			}
		});
	});
	/*$jQ('#prevprodtag').live('mouseover',function(){
		var val=$jQ(this).attr('data-id');
		$jQ('#prodnametag').text(val);
	});
	$jQ('#prevprodtag').live('mouseout',function(){
		$jQ('#prodnametag').text('');
	});
	$jQ('#nextprodtag').live('mouseover',function(){
		var val=$jQ(this).attr('data-id');
		$jQ('#prodnametag').text(val);
	});
	$jQ('#nextprodtag').live('mouseout',function(){
		$jQ('#prodnametag').text('');
	});*/
	$jQ('#poLogo_Embroidery').live('change',function(){
		var tmpval = $jQ(':selected',this).text();
		if(tmpval.indexOf('Yes') !== -1){
			var tmptxt = "To add a logo onto your internet ordered apparel item, you will need to speak to a Design Consultant ";
			tmptxt += "for assistance. You cannot add the logo from the website. A Design Consultant will call you the next business ";
			tmptxt += "day to discuss your logo set up, or details of the logo you want embroidered onto your garment. The logo will be ";
			tmptxt += "billed separately from the internet order. If you have any questions please call a Design Consultant at 773.378.4855.";
			$jQ(this).parent().next().html(tmptxt);
		}else{$jQ(this).parent().next().html('<img src="skin1/images/spacer.gif" width="55" height="20" alt="" id="imgLogo_Embroidery">');}
	});
	//Start all commands and functions that need to be run after loads are made
	rotateSwitch(); //Start left scroller
	optinit();
});



//
//  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 divsidefabrics = new Array("divSide_Egyptian_Fabrics","divSide_Fine_Line_Fabrics","divSide_Maxima_Poplin_Fabrics",
				"divSide_Mid_Weight_Fabrics","divSide_Spun_Poly_Fabrics","divSide_Denim_Fabrics",
				"divSide_Soil_Release_Fabrics","divSide_Woven_Fabrics","divSide_Organic_Fabrics",
				"divSide_Industrial_Fabrics","divSide_Twill_Fabrics","divSide_Supima_Fabrics",
				"divSide_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_Inseam_Size",
				"divShirt_Sizing","divWomens_Shirt_Sizing","divVest_Sizing","divWomens_Vest_Sizing","divTablecloth_Sizing",
				"divVest_Back_Ties","divStandard_Sizing","divKids_Sizing");

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", "divSide_Panel_Conversion");

var divembroidlist = new Array("divFlag_Embroidery","divName_Embroidery","divLogo_Embroidery");

var divcollarlist = new Array("divTriColor_Ribbon","divTriSplit_Collar","divCollar_Conversion","divConversion_Package");

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");

var embroidtop = new Array("divFlag_Embroidery_top","divName_Embroidery_top","divLogo_Embroidery_top","divName_Embroid_Line_1_top","divName_Embroid_Line_2_top","divName_Embroid_Line_3_top",
				"divThread_Color_top","divEmbroidery_Font_top","divEmbroidery_Location_top","divHat_Embroidery_Location_top");

var divsizetop = new Array("divCoat_Length_top","divBack_Fittings_top","divHat_Height_top","divHat_Closure_top","divAmerican_Mens_Shoe_Sizing_top",
				"divAmerican_Womens_Shoe_Sizing_top","divDansko_Shoe_Sizing_top","divBirki_Shoe_Sizing_top",
				"divMens_Coat_Size_top","divMens_Standard_Coat_Size_top","divWomens_Coat_Size_top","divWomens_Standard_Coat_Size_top","divServer_Jacket_Size_top",
				"divWomens_Server_Jacket_Size_top","divPants_Sizing_top","divPants_Inseam_top","divPants_Inseam_Size_top",
				"divShirt_Sizing_top","divWomens_Shirt_Sizing_top","divVest_Sizing_top","divWomens_Vest_Sizing_top","divTablecloth_Sizing_top",
				"divVest_Back_Ties_top","divKids_sizing");
				
var cursorXY = new Object();
var is_custom_order = 'N';

function updateCartItem(id, frm) {
	var quantity = document.cartform.elements.namedItem('productindexes[' + id + ']');
	if (quantity === -1) {return false;}
	var url = 'cart.php?action=update&productindexes[' + id + ']=' + quantity.value;
	if ($jQ.browser.msie) {setTimeout(function(){self.location = url;},200);}
	else {self.location = url;}
	return false;
}

/*****************  AJAX/AHAH Functionality Code  ********************/
function getAJAXRequest(){
	try{
		req = new XMLHttpRequest();
	}catch(err1){
		try{
			req = new ActiveXObject("Msxm12.XMLHTTP");
		}catch (err2){
			try{
				req = new ActiveXObject("Microspft.XMLHTTP");
			}catch(err3){
				req = false;
			}
		}
	}
	return req;
}
function requestGET(url, query, req){
	var myRand = parseInt(Math.random()*9999999999999999);
	var modURL = url+"?"+query+"rand="+myRand;
	req.open("GET", modURL, true);
	req.send(null);
}
function requestPOST(url, query, req){
	req.open("POST", url, true);
	req.setRequestHeader('Content-Type', 'application/x-www-form-urlenconded');
	req.send(query);
}
function doCallback (callback, item) {
	eval(callback + '(item)');
}
function doAJAX(url,messageFrom,callback,reqtype,getxml,query){
	if (reqtype == null){
		reqtype = 'GET';
	}
	if (query == null){
		query = '';
	}else{
		query = query + '&';
	}
	if (getxml == null){
		getxml = 0;
	}
	var http = getAJAXRequest();
	http.onreadystatechange = function () {
		if (http.readyState == 4) {
			if (http.status == 200){
				var item = http.responseText;
				if (getxml == 1) {
					item = http.responseXML;
				}
				doCallback(callback, item);
			}
		}else{
			ajaxspinner(messageFrom);
		}
	}
	if (reqtype =='post'){
		requestPOST(url,query,http);
	}else{
		requestGET(url,query,http);
	}
}

//
// This function handles the AJAX search on the left side of screen
//
var searchtimeout = null;
var searchresult = [];
function Result() {
	this.add_result = function(dataObj){
		for (var key in dataObj){
			this[key] = dataObj[key];
		}
	};
}
function LoadSearchAjax(force) {
	var searchval = $jQ('#searchstring').val();
	var query = '&searchval=' + searchval;
	var txt = '';
	$jQ.ajax({
		url: 'ajax_search.php',
		cache: false,
		data: query,
		error: function(req,status,err){
			alert('Error: '+status+' '+err);
		},
		success: function(data) {
			if (data === 'No Results'){
				//alert('No Results Found');
			}else{
				var obj = JSON.parse(data);
				for(var x=0; x < obj.length; x++) {
					var tempObj = new Result();
					tempObj.add_result(obj[x]);
					searchresult.push(tempObj);
				}
				var rsltval='<table class="search_rslt_tbl s_over">';
				for (var i=0;i<obj.length;i++){
					rsltval += '<tr class="ajaxSearch s_over"><td nowrap class="s_over" onclick="self.location=\''+searchresult[i]['link']+'\';">'+searchresult[i]['product']+'</td></tr>';
				}
				if (searchresult.length > 20){rsltval += '<tr class="ajaxSearch s_over"><td class="s_over" onclick="self.location=\'search.php?substring='+searchval+'\';">More results...</td></tr></table>';}
				else{rsltval += '</table>';}
				$jQ('#ajaxsearch_rslt').html(rsltval);
				$jQ('#ajaxsearch_rslt').show();
			}
		}
	});
}
function doLoadSearch() {
	if ($jQ('#substring_id').val() !== '') {
		if (searchtimeout){clearTimeout(searchtimeout);}
		searchtimeout = setTimeout(LoadSearchAjax, 200);
	}
}
//
// 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){$jQ('#'+option).toggle();}
//
// this is used to show and hide details on the orders list in the admin section
//
function showrow(oid){$jQ('#rowhide-'+oid).toggle();}
//
// these three functions are used to facilitate the reloading of a base page once a user has logged out
//
function gologout(){document.getElementById('headlogout').submit(); return true;}
function switchpage(){window.location = "home.php";}
function gotoPage(page){window.location = page;}
//
// 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++){$jQ('#ordpage'+i).css('display','none');}
	$jQ('#'+toopen).css('display','block');
}
//
// these functions are used to get the class name of a style to alter
//
function showopts() {$jQ('.optionvals').toggle();}
function cartcheck() {window.location='cart.php?mode=checkout';}
//
// These are used for product navigation inside product details (backend)
//
function gotoprev(pid,geid){
	pagestr = "prodid=" + pid + "&dir=prev&geid=" + geid;
	doAJAX('../getprodid.php','product_modify','setnextprev','GET',0,pagestr);
}
function gotonext(pid,geid){
	pagestr = "prodid=" + pid + "&dir=next&geid=" + geid;
	doAJAX('../getprodid.php','product_modify','setnextprev','GET',0,pagestr);
}
function ajaxspinner(text){wherefrom = text;}
function setnextprev(text) {
	answer = text;	
	if (answer.indexOf("Error") != -1){alert(text);}
	else{var address = "product_modify.php?productid=" + text; window.location = address;}
}
//
// 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 openLogin(){$jQ('#loginbox').toggle();}
//
// This function turns on and off the text inside the login/password input fields
//
function chkfull(obj){ 
	if (obj.value !== 'User Name'){return;}
	else{obj.value = '';}
}
function chkblank(obj){ 
	if (obj.value !== ''){return;}
	else{obj.value = 'User Name';}
}
//
// 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;
	document.onmousemove = getCursPosition;
}
//
// 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(){
	var tracknum, fedexstr, upsstr, shipper, usps;
	tracknum = $jQ('#tracknum').val();
	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 = $jQ('#carrierselect option:selected').val();
	if (shipper == 1) {window.open (upsstr,"upswindow");}
	else if (shipper == 2){window.open (fedexstr,"fedexwindow");}
	else{window.open (uspsstr,"uspswindow");}
}


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';
	}
}
//
// 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 listSel(fld,id) {
	var opt = fld.selectedIndex;
	document.getElementById(id).selectedIndex = opt;
	chkprice(id);
}
function setinitprice(val) {
	runningtot = val;
}
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);
		//alert(intprice);
	}
	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){
	if (selecttab == 1){
		document.getElementById('detl').setAttribute("class", "prod-button-l2");
		document.getElementById('detr').setAttribute("class", "prod-button-r2");
		objBox1.style.display = 'block';
		objBox2.style.display = 'none';
		objBox3.style.display = 'none';
	}else if (selecttab == 2){
		document.getElementById('sizel').setAttribute("class", "prod-button-l2");
		document.getElementById('sizer').setAttribute("class", "prod-button-r2");
		objBox1.style.display = 'none';
		objBox2.style.display = 'block';
		objBox3.style.display = 'none';
	}else{
		closeAllOption();
		optTabOpen("start");
	}
}
//
// 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){$jQ("#opt_text").html(unescape(opttext)).css('top','150px').css('left','50px').css('display','block');}
function closeNote(){$jQ("#opt_text").css('display','none');}
function openNote2(opttext){$jQ("#rush_text").html(unescape(opttext)).css('top','10px').css('right','20px').css('display','block');}
function closeNote2(){$jQ("#rush_text").css('display','none');}
function openNote3(opttext){$jQ("#membership_text").html(unescape(opttext)).css('top','0px').css('left','0px').css('display','block');}
function closeNote3(){$jQ("#membership_text").css('display','none');}
//
// 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();}
//
// 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){
		$jQ('#div'+option+'_Egyptian_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Fine") != -1){
		$jQ('#div'+option+'_Fine_Line_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Waffle") != -1){
		$jQ('#div'+option+'_Waffle_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Maxima") != -1){
		$jQ('#div'+option+'_Maxima_Poplin_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Weight") != -1){
		$jQ('#div'+option+'_Mid_Weight_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Spun") != -1){
		$jQ('#div'+option+'_Spun_Poly_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Denim") != -1){
		$jQ('#div'+option+'_Denim_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Soil") != -1){
		$jQ('#div'+option+'_Soil_Release_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Woven") != -1){
		$jQ('#div'+option+'_Woven_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Organic") != -1){
		$jQ('#div'+option+'_Organic_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Industrial") != -1){
		$jQ('#div'+option+'_Industrial_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Tuff") != -1){
		$jQ('#div'+option+'_Tuff_Twill_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Ultima") != -1){
		$jQ('#div'+option+'_Ultima_Poplin_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Ultralite") != -1){
		$jQ('#div'+option+'_Ultralite_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Mikro") != -1){
		$jQ('#div'+option+'_Mikro_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Rayon") != -1){
		$jQ('#div'+option+'_Rayon_Blend_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Twill") != -1){
		$jQ('#div'+option+'_Twill_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Shirting") != -1){
		$jQ('#div'+option+'_Shirting_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Decorative") != -1){
		$jQ('#divBase_Vest_Tie_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Supima") != -1){
		$jQ('#div'+option+'_Supima_Fabrics'+num).css('display','block');
	}else if(chosen.indexOf("Standard Apron") != -1){
		$jQ('#divStandard_Apron_Color'+num).css('display','block');
	}else if((chosen.indexOf("Seasonal") != -1) || (chosen.indexOf("Limited") != -1)){
		$jQ('#div'+option+'_Seasonal_Fabrics'+num).css('display','block');
	}
}
function fabClose(option){
	if ($jQ('#'+option).length){
		$jQ('#'+option).css('display','none');
		poname = option.replace("div","po");
		$jQ('#'+poname).attr('selectedIndex', 0);
		imgname = option.replace("div","img");
		$jQ('#'+imgname).attr('src', 'skin1/images/spacer.gif');
	}
}
function getProdCode(option){
	option = option.toLowerCase();
	if (option.indexOf ("(+") !== -1) {
		option = option.slice(0,(option.indexOf ('(')));
		return option.match(/\d+/);
	}else{
		option = option.replace(" ","");
		option = option.replace(/\W/g,"");
		return option.match(/\d+/);
	}
}
function getProdName(option){
	option = option.toLowerCase();
	option = option.replace(" ","");
	option = option.replace(/\W/g,"");
	option = option.replace(/\d/g,"");
	return option;
}
//
// 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) {
	$jQ('#prodoptdiv').css('display', 'block');
	open1stOption(choice);
}
function open1stOption(section){
	var Index, i, j, current, chosen;
	switch(section){
		case "start":
			for (i=0;i<divsizelist.length;i++){
				if ($jQ('#'+divsizelist[i]).length){
					$jQ('#'+divsizelist[i]).css('display','block');
				}
				if ($jQ('#divPants_Inseam_Size').length){
					if ($jQ('#divPants_Inseam option:selected').text().indexOf('Normal') !== -1){
						$jQ('#divPants_Inseam_Size').css('display','none');
					}else{
						$jQ('#divPants_Inseam_Size').css('display','block');
					}
				}
			}
			for (i=0;i<divfablist.length;i++){
				if ($jQ('#'+divfablist[i]).length){
					$jQ('#'+divfablist[i]).css('display','block');
					current = divfablist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if (divfablist[i].indexOf("Conversion") !== -1) {
						if (divfablist[i].indexOf("Hat") !== -1) {
							if (chosen.indexOf("Yes") !== -1) {
								$jQ('#divHatband_Fabric').css('display','block');
								fabOpen($jQ('#poHatband_Fabric option:selected').text(),'Hatband','');
							}
						}else if (divfablist[i].indexOf("Shirt") !== -1) {
							fabOpen(chosen,'Shirt2','');
						}else if (divfablist[i].indexOf("Yoke") !== -1) {
							if (chosen.indexOf("Yes") !== -1) {
								$jQ('#divBack_Yoke_Conversion_Fabric').css('display','block');
								fabOpen($jQ('#poBack_Yoke_Conversion_Fabric option:selected').text(),'Yoke','');
							}
						}else if (divfablist[i].indexOf("Side") !== -1) {
							if (chosen.indexOf("Yes") !== -1) {
								$jQ('#divSide_Panel_Conversion_Fabric').css('display','block');
								fabOpen($jQ('#poSide_Panel_Conversion_Fabric option:selected').text(),'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 "fab":
			for (i=0;i<divfablist.length;i++){
				if ($jQ('#'+divfablist[i]).length){
					$jQ('#'+divfablist[i]).css('display','block');
					current = divfablist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if (divfablist[i].indexOf("Conversion") !== -1) {
						if (divfablist[i].indexOf("Hat") !== -1) {
							if (chosen.indexOf("Yes") !== -1) {
								$jQ('#divHatband_Fabric').css('display','block');
								fabOpen($jQ('#poHatband_Fabric option:selected').text(),'Hatband','');
							}
						}else if (divfablist[i].indexOf("Shirt") !== -1) {
							fabOpen(chosen,'Shirt2','');
						}else if (divfablist[i].indexOf("Yoke") !== -1) {
							if (chosen.indexOf("Yes") !== -1) {
								$jQ('#divBack_Yoke_Conversion_Fabric').css('display','block');
								fabOpen($jQ('#poBack_Yoke_Conversion_Fabric option:selected').text(),'Yoke','');
							}
						}else if (divfablist[i].indexOf("Side") !== -1) {
							if (chosen.indexOf("Yes") !== -1) {
								$jQ('#divSide_Panel_Conversion_Fabric').css('display','block');
								fabOpen($jQ('#poSide_Panel_Conversion_Fabric option:selected').text(),'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 ($jQ('#'+divsizelist[i]).length){
					$jQ('#'+divsizelist[i]).css('display','block');
				}
				if ($jQ('#divPants_Inseam_Size').length){
					if ($jQ('#divPants_Inseam option:selected').text().indexOf('Normal') !== -1){
						$jQ('#divPants_Inseam_Size').css('display','none');
					}else{
						$jQ('#divPants_Inseam_Size').css('display','block');
					}
				}
			}
			break;
		case "cord":
			Index = 0;
			for (i=0;i<divcordinglist.length;i++){
				if ($jQ('#'+divcordinglist[i]).length){
					$jQ('#'+divcordinglist[i]).css('display','block');
					current = divcordinglist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if (chosen.indexOf('Single') !== -1){Index = 1;}
					if (chosen.indexOf('Double') !== -1){Index = 2;}						
					if (chosen.indexOf('Triple') !== -1){Index = 3;}					 
					if (chosen.indexOf('None') === -1) {
						if (current.indexOf("Apron_Flap") !== -1) {
							$jQ('#divApron_Flap_Cording_Color').css('display','block');
						}else if (current.indexOf("Apron_Pocket") !== -1) {
							$jQ('#divApron_Pocket_Cording_Color').css('display','block');
						}else if (current.indexOf("Cuff_Cording") !== -1) {
							for (j=1;j<=Index;j++) {
								$jQ('#divCuff_Cording_Color_'+j).css('display','block');
							}
						}else if (current.indexOf("Front_Cording") !== -1) {
							for (j=1;j<=Index;j++) {
								$jQ('#divFront_Cording_Color_'+j).css('display','block');
							}
						}else if (current.indexOf("Upper_Collar") !== -1) {
							for (j=1;j<=Index;j++) {
								$jQ('#divUpper_Collar_Cording_Color_'+j).css('display','block');
							}
						}else if (current.indexOf("Lower_Collar") !== -1) {
							for (j=1;j<=Index;j++) {
								$jQ('#divLower_Collar_Cording_Color_'+j).css('display','block');
							}
						}else if (current.indexOf("Shirt") !== -1) {
							$jQ('#divShirt_Cording_Color').css('display','block');
						}else if (current.indexOf("Hat") !== -1) {
							$jQ('#divHat_Cording_Color').css('display','block');
						}else if (current.indexOf("Package") !== -1) {
							$jQ('#divCording_Package_Color').css('display','block');
						}
					}
				}
			}
			break;
		case "pocket":
			for (i=0;i<divpocketlist.length;i++){
				if ($jQ('#'+divpocketlist[i]).length){
					$jQ('#'+divpocketlist[i]).css('display','block');
					current = divpocketlist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if (current.indexOf("Coat") !== -1) {
						if (chosen.indexOf("Corded") !== -1) {
							$jQ('#divPocket_'+current.substr(14)+'_Cording_Color').css('display','block');
						}
					}
				}
			}
			break;
		case "sleeve":
			for (i=0;i<divsleevelist.length;i++){
				if ($jQ('#'+divsleevelist[i]).length){
					$jQ('#'+divsleevelist[i]).css('display','block');
				}
			}
			break;
		case "button":
			for (i=0;i<divbuttonlist.length;i++){
				if ($jQ('#'+divbuttonlist[i]).length){
					$jQ('#'+divbuttonlist[i]).css('display','block');
					current = divbuttonlist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if ((current.indexOf("Coat_Buttons") !== -1) || (current.indexOf("Server_Jacket_Buttons") !== -1)) {
						if ((chosen.indexOf("Hand-Rolled") !== -1) || (chosen.indexOf("Hand-Crafted") !== -1)){
							$jQ('#divButton_Conversion_Fabric').css('display','block');
							fabOpen($jQ('#poButton_Conversion_Fabric option:selected').text(),'Button','');
						}
					}
				}
			}
			break;
		case "cuff":
			Index = 0;
			for (i=0;i<divcufflist.length;i++){
				if ($jQ('#'+divcufflist[i]).length){
					$jQ('#'+divcufflist[i]).css('display','block');
					current = divcufflist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if (chosen.indexOf('Single') !== -1){Index = 1;}
					if (chosen.indexOf('Double') !== -1){Index = 2;}						
					if (chosen.indexOf('Triple') !== -1){Index = 3;}					 
					if (current.indexOf("Cuff_Conversion") != -1) {
						if (chosen.indexOf("Yes") !== -1) {
							$jQ('#divCuff_Conversion_Fabric').css('display','block');
							fabOpen($jQ('#poCuff_Conversion_Fabric option:selected').text(),'Cuff','');
						}
					}
					if (current.indexOf("Cuff_Cording") !== -1) {
						for (j=1;j<=Index;j++) {
							$jQ('#divCuff_Cording_Color_'+j).css('display','block');
						}
					}
				}
			}
			break;
		case "collar":
			for (i=0;i<divcollarlist.length;i++){
				if ($jQ('#'+divcollarlist[i]).length){
					$jQ('#'+divcollarlist[i]).css('display','block');
					current = divcollarlist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if (current.indexOf("Collar_Conversion") !== -1) {
						if (chosen.indexOf("Yes") !== -1) {
							$jQ('#divCollar_Conversion_Fabric').css('display','block');
							fabOpen($jQ('#poCollar_Conversion_Fabric option:selected').text(),'Collar','');
						}
					}
					if (current.indexOf("Conversion_Package") !== -1) {
						if (chosen.indexOf("Yes") !== -1) {
							$jQ('#divConversion_Package_Fabric').css('display','block');
							fabOpen($jQ('#poConversion_Package_Fabric option:selected').text(),'Collar','');
						}
					}
					if (current.indexOf("TriSplit") !== -1) {
						if (chosen.indexOf("Yes") !== -1) {
							for (var j=1;j<=3;j++) {
								$jQ('#divTriSplit_Color_'+j).css('display','block');
							}
						}
					}
				}
			}
			break;
		case "embroid":
			for (i=0;i<divembroidlist.length;i++){
				if ($jQ('#'+divembroidlist[i]).length){
					$jQ('#'+divembroidlist[i]).css('display','block');
					current = divembroidlist[i].replace("div", "po");
					chosen = $jQ('#'+current+' option:selected').text();
					if ((current.indexOf("Flag") !== -1) && (chosen.indexOf("None") === -1)) {
						if ($jQ('#divFlag_Location').length){
							$jQ('#divFlag_Location').css('display','block');
						}else if ($jQ('#divHat_Flag_Location').length){
							$jQ('#divHat_Flag_Location').css('display','block');
						}
					}else if ((current.indexOf("Name") !== -1) && (chosen.indexOf("None") === -1)) {
						if (chosen.indexOf("1 Line") !== -1){
							$jQ('#divName_Embroid_Line_1').css('display','block');
							if ($jQ('#divName_Embroid_Line_2').length){
								$jQ('#poName_Embroid_Line_2').val('');
							}							
							if ($jQ('#divName_Embroid_Line_3').length){
								$jQ('#poName_Embroid_Line_3').val('');
							}							
							if ($jQ('#poThread_Color').length){
								$jQ('#divThread_Color').css('display','block');
							}							
							if ($jQ('#poEmbroidery_Font').length){
								$jQ('#divEmbroidery_Font').css('display','block');
							}
							if ($jQ('#divEmbroidery_Location').length){
								$jQ('#divEmbroidery_Location').css('display','block');
							}
							if ($jQ('#divHat_Embroidery_Location').length){
								$jQ('#divHat_Embroidery_Location').css('display','block');
							}
						}else if (chosen.indexOf("2 Line") != -1){
							$jQ('#divName_Embroid_Line_1').css('display','block');
							$jQ('#divName_Embroid_Line_2').css('display','block');
							if ($jQ('#divName_Embroid_Line_3').length){
								$jQ('#poName_Embroid_Line_3').val('');
							}							
							if ($jQ('#poThread_Color').length){
								$jQ('#divThread_Color').css('display','block');
							}							
							if ($jQ('#poEmbroidery_Font').length){
								$jQ('#divEmbroidery_Font').css('display','block');
							}
							if ($jQ('#divEmbroidery_Location').length){
								$jQ('#divEmbroidery_Location').css('display','block');
							}
							if ($jQ('#divHat_Embroidery_Location').length){
								$jQ('#divHat_Embroidery_Location').css('display','block');
							}
						}else if (chosen.indexOf("3 Line") != -1){
							$jQ('#divName_Embroid_Line_1').css('display','block');
							$jQ('#divName_Embroid_Line_2').css('display','block');
							$jQ('#divName_Embroid_Line_3').css('display','block');
							if ($jQ('#poThread_Color').length){
								$jQ('#divThread_Color').css('display','block');
							}							
							if ($jQ('#poEmbroidery_Font').length){
								$jQ('#divEmbroidery_Font').css('display','block');
							}
							if ($jQ('#divEmbroidery_Location').length){
								$jQ('#divEmbroidery_Location').css('display','block');
							}
							if ($jQ('#divHat_Embroidery_Location').length){
								$jQ('#divHat_Embroidery_Location').css('display','block');
							}
						}else if (chosen.indexOf("None") != -1){
							if ($jQ('#divName_Embroid_Line_1').length){
								$jQ('#poName_Embroid_Line_1').val('');
							}							
							if ($jQ('#divName_Embroid_Line_2').length){
								$jQ('#poName_Embroid_Line_2').val('');
							}							
							if ($jQ('#divName_Embroid_Line_3').length){
								$jQ('#poName_Embroid_Line_3').val('');
							}							
							if ($jQ('#poThread_Color').length){
								$jQ('#divThread_Color').css('display','block');
							}							
							if ($jQ('#poEmbroidery_Font').length){
								$jQ('#divEmbroidery_Font').css('display','block');
							}
							if ($jQ('#divEmbroidery_Location').length){
								$jQ('#divEmbroidery_Location').css('display','block');
							}
							if ($jQ('#divHat_Embroidery_Location').length){
								$jQ('#divHat_Embroidery_Location').css('display','block');
							}
						}
					}
				}
			}
			break;
		case "other":
			for (i=0;i<divotherlist.length;i++){
				if ($jQ('#'+divotherlist[i]).length){$jQ('#'+divotherlist[i]).css('display','block');}
			}
			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){
	var Index, chosen, i, j, chkval, cordarr, poname, imgname, Cchosen, Bchosen, Schosen;
	chkprice(option);
	Index = $jQ('select#'+option).attr('selectedIndex');
	chosen = $jQ('#'+option+' option:selected').text();
	if ((optname === "Hat Fabric") || (optname === "Apron Fabric") || (optname === "Vest Fabric") || (optname === "Shirt Fabric") || (optname === "Pants Fabric")) {
		for (i=0;i<divbasefabrics.length;i++){
			fabClose(divbasefabrics[i]);
		}
		fabOpen(chosen,'Base','');
	}else if (optname === "Neckwear Fabric") {
		for (i=0;i<divneckwearfabrics.length;i++){
			fabClose(divneckwearfabrics[i]);
		}
		fabOpen(chosen,'Base','');
	}else if (optname === "Hatband Fabric") {
		for (i=0;i<divhatbandfabrics.length;i++){
			fabClose(divhatbandfabrics[i]);
		}
		fabOpen(chosen,'Hatband','');
	}else if (optname === "Back Yoke Conversion Fabric") {
		for (i=0;i<divyokefabrics.length;i++){
			fabClose(divyokefabrics[i]);
		}
		fabOpen(chosen,'Yoke','');
	}else if (optname === "Side Panel Conversion Fabric") {
		for (i=0;i<divsidefabrics.length;i++){
			fabClose(divsidefabrics[i]);
		}
		fabOpen(chosen,'Side','');
	}else if (optname === "Cuff Conversion Fabric") {
		for (i=0;i<divcufffabrics.length;i++){
			fabClose(divcufffabrics[i]);
		}
		fabOpen(chosen,'Cuff','');
	}else if (optname === "Collar Conversion Fabric") {
		for (i=0;i<divcollarfabrics.length;i++){
			fabClose(divcollarfabrics[i]);
		}
		fabOpen(chosen,'Collar','');
	}else if (optname === "Button Conversion Fabric") {
		for (i=0;i<divbuttonfabrics.length;i++){
			fabClose(divbuttonfabrics[i]);
		}
		fabOpen(chosen,'Button','');
	}else if (optname === "Coat TriColor Fabric 1") {
		for (i=0;i<divtricolorfabrics1.length;i++){
			fabClose(divtricolorfabrics1[i]);
		}
		fabOpen(chosen,'TriColor','_1');
	}else if (optname === "Coat TriColor Fabric 2") {
		for (i=0;i<divtricolorfabrics2.length;i++){
			fabClose(divtricolorfabrics2[i]);
		}
		fabOpen(chosen,'TriColor','_2');
	}else if (optname === "Coat TriColor Fabric 3") {
		for (i=0;i<divtricolorfabrics3.length;i++){
			fabClose(divtricolorfabrics3[i]);
		}
		fabOpen(chosen,'TriColor','_3');
	}else if (optname === "Shirt Conversion Fabric") {
		for (i=0;i<divshirtfabrics.length;i++){
			fabClose(divshirtfabrics[i]);
		}
		fabOpen(chosen,'Shirt2','');
	}else if (optname === "Standard Apron Fabric"){
		$jQ('#img'+optimg).attr('src','files/image/fabrics/'+getProdCode(chosen)+'.gif');
		$jQ('#img'+optimg).css('height','50px');
	}else if (optname === "Coat Fabric") {
		for (i=0;i<divbasefabrics.length;i++){
			fabClose(divbasefabrics[i]);
		}
		fabOpen(chosen,'Base','');
		if ((chosen.indexOf('Industrial') === -1) && (chosen.indexOf('Spun Poly') === -1) && (chosen.indexOf('Poplin') === -1) && (chosen.indexOf('Twill') === -1)){
			Bchosen = $jQ('#poCoat_Buttons option:selected').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.");
				$jQ('#poCoat_Buttons').attr('selectedIndex',0);
				chkprice('poCoat_Buttons');
			}
		}
	}else if (optname === "Server Jacket Fabric") {
		for (i=0;i<divbasefabrics.length;i++){
			fabClose(divbasefabrics[i]);
		}
		fabOpen(chosen,'Base','');
		if ((chosen.indexOf('Industrial') === -1) && (chosen.indexOf('Spun Poly') === -1) && (chosen.indexOf('Poplin') === -1) && (chosen.indexOf('Twill') === -1)){
			Bchosen = $jQ('#poServer_Jacket_Buttons option:selected').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.");
				$jQ('#poServer_Jacket_Buttons').attr('selectedIndex',0);
				chkprice('poServer_Jacket_Buttons');
			}
		}
	}else if ((optname === "Coat Pocket 1") || (optname === "Coat Pocket 2") || (optname === "Coat Pocket 3") || (optname === "Coat Pocket 4")){
		var num = optname.substr(12);
		if (chosen.indexOf("Corded") !== -1){
			$jQ('#divPocket_'+num+'_Cording_Color').css('display','block');
		}else{
			$jQ('#poPocket_'+num+'_Cording_Color').attr('selectedIndex',0);
			$jQ('#imgPocket_'+num+'_Cording_Color').attr('src','skin1/images/spacer.gif');
			$jQ('#divPocket_'+num+'_Cording_Color').css('display','none');
		}
	}else if (optname === "Pants Zipper") {
		if ($jQ('#poPants_Waistband').length){
			if (chosen.indexOf("2 inch") !== -1) {
				$jQ('#poPants_Waistband').attr('selectedIndex',0);
			}else if (chosen.indexOf("3 inch") !== -1) {
				$jQ('#poPants_Waistband').attr('selectedIndex',1);
			}
		}
	}else if (optname === "Pants Waistband") {
		if ($jQ('#poPants_Zipper').length){
			if ($jQ('#poPants_Zipper').attr('selectedIndex') !== 0){
				if (chosen.indexOf("2 inch") !== -1) {
					$jQ('#poPants_Zipper').attr('selectedIndex',1);
				}else if (chosen.indexOf("3 inch") !== -1) {
					$jQ('#poPants_Zipper').attr('selectedIndex',2);
				}
			}
		}
	}else if (optname === "Pants Inseam") {
		if (chosen.indexOf('Normal') !== -1){
			if ($jQ('#divPants_Inseam_Size').length){
				$jQ('#divPants_Inseam_Size').css('display','none');
				$jQ('#poPants_Inseam_Size').val('');
			}
		}else{
			if ($jQ('#divPants_Inseam_Size').length){
				$jQ('#divPants_Inseam_Size').css('display','block');
			}
		}
	}else if ((optname === "Pants Pocket 1")||(optname === "Pants Pocket 2")) {
		if (($jQ('#poPants_Pocket_1').length)&&($jQ('#poPants_Pocket_2').length)){
			if ($jQ('#poPants_Pocket_1 option:selected').text() === $jQ('#poPants_Pocket_2 option:selected').text()){
				if ($jQ('#poPants_Pocket_1 option:selected').text().indexOf('None') === -1){
					alert('Your 2 pockets are the same. Please change one of them.');
					$jQ('#'+option).attr('selectedIndex',0);
				}
			}
		}
	}else if (optname === "Apron Flap") {
		if (chosen.indexOf("None") !== -1){
			if ($jQ('#poApron_Flap_Cording').length){
				$jQ('#poApron_Flap_Cording').attr('selectedIndex',0);
			}
			if ($jQ('#poApron_Flap_Cording_Color').length) {
				$jQ('#poApron_Flap_Cording_Color').attr('selectedIndex',0);
				$jQ('#divApron_Flap_Cording_Color').css('display','none');
			}
		}
	}else if (optname === "Apron Pocket") {
		if (chosen.indexOf("None") !== -1){
			if ($jQ('#poApron_Pocket_Cording').length){
				$jQ('#poApron_Pocket_Cording').attr('selectedIndex',0);
			}
			if ($jQ('#poApron_Pocket_Cording_Color').length) {
				$jQ('#poApron_Pocket_Cording_Color').attr('selectedIndex',0);
				$jQ('#divApron_Pocket_Cording_Color').css('display','none');
			}
		}
	}else if (optname === "Apron Pocket Cording") {
		if (chosen.indexOf("Yes") !== -1){
			if ($jQ('#poApron_Pocket').length){
				if ($jQ('#poApron_Pocket').attr('selectedIndex') === 0) {
					alert("You need to select a pocket type before you can add cording");
					$jQ('#poApron_Pocket_Cording').attr('selectedIndex',0)
				}else{
					$jQ('#divApron_Pocket_Cording_Color').css('display','block');
				}
			}
		}else{
			if ($jQ('#divApron_Pocket_Cording_Color').length){
				$jQ('#poApron_Pocket_Cording_Color').attr('selectedIndex',0);
				$jQ('#divApron_Pocket_Cording_Color').css('display','none');
				$jQ('#imgApron_Pocket_Cording_Color').attr('src','skin1/images/spacer.gif');
			}
		}
	}else if (optname === "Apron Flap Cording") {
		if (chosen.indexOf("Yes") !== -1){
			if ($jQ('#poApron_Flap').length){
				if ($jQ('#poApron_Flap').attr('selectedIndex') === 0) {
					alert("You need to select a flap type before you can add cording");
					$jQ('#poApron_Flap_Cording').attr('selectedIndex',0)
				}else{
					$jQ('#divApron_Flap_Cording_Color').css('display','block');
				}
			}
		}else{
			if ($jQ('#divApron_Flap_Cording_Color').length){
				$jQ('#poApron_Flap_Cording_Color').attr('selectedIndex',0);
				$jQ('#divApron_Flap_Cording_Color').css('display','none');
				$jQ('#imgApron_Flap_Cording_Color').attr('src','skin1/images/spacer.gif');
			}
		}
	}else if (optname === "Hat Cording"){
		if (chosen.indexOf("Yes") !== -1){
			$jQ('#divHat_Cording_Color').css('display','block');
		}else{
			if ($jQ('#divHat_Cording_Color').length){
				$jQ('#poHat_Cording_Color').attr('selectedIndex', 0);
				$jQ('#divHat_Cording_Color').css('display','none');
				$jQ('#imgHat_Cording_Color').attr('src','skin1/images/spacer.gif');
			}
		}
	}else if (optname === "Shirt Cording") {
		if (chosen.indexOf("Yes") !== -1){
			$jQ('#divShirt_Cording_Color').css('display','block');
		}else{
			if ($jQ('#divShirt_Cording_Color').length){
				$jQ('#poShirt_Cording_Color').attr('selectedIndex', 0);
				$jQ('#divShirt_Cording_Color').css('display','none');
				$jQ('#imgShirt_Cording_Color').attr('src','skin1/images/spacer.gif');
			}
		}
	}else if (optname === "Cording Package"){
		if (chosen.indexOf('None') === -1){
			if ($jQ('#poCording_Package_Color').length){
				$jQ('#divCording_Package_Color').css('display','block');
			}
			var tmpcordinglist = new Array("Cuff_Cording","Front_Cording","Upper_Collar_Cording","Lower_Collar_Cording");
			for (i=0;i<=tmpcordinglist.length;i++){
				if ($jQ('#div'+tmpcordinglist[i]).length){
					$jQ('#po'+tmpcordinglist[i]).attr('selectedIndex', 0);
					chkprice('po'+tmpcordinglist[i]);
					for (var j=1;j<=3;j++){
						if ($jQ('#div'+tmpcordinglist[i]+'_Color_'+j).length){
							$jQ('#po'+tmpcordinglist[i]+'_Color_'+j).attr('selectedIndex', 0);
							$jQ('#div'+tmpcordinglist[i]+'_Color_'+j).css('display','none');
							$jQ('#img'+tmpcordinglist[i]+'_Color_'+j).attr('src','skin1/images/spacer.gif');
						}
					}
				}
			}
		}else{
			if ($jQ('#poCording_Package_Color').length){
				$jQ('#poCording_Package_Color').attr('selectedIndex',0);
				$jQ('#divCording_Package_Color').css('display','none');
				$jQ('#imgCording_Package_Color').attr('src','skin1/images/spacer.gif');
			}
		}
	}else if ((optname === "Cuff Cording") || (optname === "Front Cording") || (optname === "Upper Collar Cording") || (optname === "Lower Collar Cording")){
		chkval = 0;
		if (chosen.indexOf('None') === -1){
			if ($jQ('#poCording_Package').length){
				$jQ('#poCording_Package').attr('selectedIndex',0);
				chkprice('poCording_Package');
			}
			if ($jQ('#poCording_Package_Color').length){
				$jQ('#poCording_Package_Color').attr('selectedIndex',0);
				$jQ('#divCording_Package_Color').css('display','none');
				$jQ('#imgCording_Package_Color').attr('src','skin1/images/spacer.gif');
			}
			if (optname === "Cuff Cording"){
				for (i=0;i<divsleevelist.length;i++){
					if ($jQ('#'+divsleevelist[i])){
						poname = divsleevelist[i].replace("div","po");
						Schosen = $jQ('#'+poname+' option:selected').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.");
							$jQ('#'+option).attr('selectedIndex', 0);
							chkprice(option);
							chkval=1;
						}
					}
				}
			}
			if (chkval === 0) {
				for (i=1;i<=Index;i++){
					$jQ('#div'+optimg+'_Color_'+i).css('display','block');
					for (j=Index+1;j<4;j++){
						if ($jQ('#div'+optimg+'_Color_'+j).length){
							$jQ('#po'+optimg+'_Color_'+j).attr('selectedIndex', 0);
							$jQ('#div'+optimg+'_Color_'+j).css('display','none');
							$jQ('#img'+optimg+'_Color_'+j).attr('src','skin1/images/spacer.gif');
						}
					}
				}
			}
		}else{
			for (i=1;i<=3;i++){
				if ($jQ('#div'+optimg+'_Color_'+i).length){
					$jQ('#po'+optimg+'_Color_'+i).attr('selectedIndex', 0);
					$jQ('#div'+optimg+'_Color_'+i).css('display','none');
					$jQ('#img'+optimg+'_Color_'+i).attr('src','skin1/images/spacer.gif');
				}
			}
		}
	}else if (optname === "Flag Embroidery"){
		if (chosen.indexOf("None") === -1){
			if ($jQ('#divFlag_Location')){
				$jQ('#divFlag_Location').css('display','block');
			}else if ($jQ('#divHat_Flag_Location')){
				$jQ('#divHat_Flag_Location').css('display','block');
			}
			if ($jQ('#img'+optimg).length){
				$jQ('#img'+optimg).attr('src','files/image/flags/'+getProdName(chosen)+'.gif').css('height','20px').css('width','32px');
			}
		}else{
			if ($jQ('#divFlag_Location').length){
				$jQ('#poFlag_Location').attr('selectedIndex', 0);
				$jQ('#divFlag_Location').css('display','none');
				$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
				chkprice('poFlag_Location');
			}else if ($jQ('#divHat_Flag_Location').length){
				$jQ('#poHat_Flag_Location').attr('selectedIndex', 0);
				$jQ('#divHat_Flag_Location').css('display','none');
				$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
				chkprice('poHat_Flag_Location');
			}
		}
	}else if (optname === "Name Embroidery"){
		for (i=0;i<divnameembroid.length;i++){
			if ($jQ('#'+divnameembroid[i]).length){
				$jQ('#'+divnameembroid[i]).css('display','none');
			}
		}
		if (chosen.indexOf("None") === -1){
			if ($jQ('#divThread_Color').length){$jQ('#divThread_Color').css('display','block');}
			if ($jQ('#divThread_Color').length){$jQ('#divEmbroidery_Font').css('display','block');}
			if ($jQ('#divEmbroidery_Location')){$jQ('#divEmbroidery_Location').css('display','block');}
			else if ($jQ('#divHat_Embroidery_Location')){$jQ('#divHat_Embroidery_Location').css('display','block');}
			if (chosen.indexOf("1 Line") !== -1){
				$jQ('#divName_Embroid_Line_1').css('display','block');
				if ($jQ('#poName_Embroid_Line_2').length){$jQ('#poName_Embroid_Line_2').val('');}
				if ($jQ('#poName_Embroid_Line_3').length){$jQ('#poName_Embroid_Line_3').val('');}
			}else if (chosen.indexOf("2 Line") !== -1){
				$jQ('#divName_Embroid_Line_1').css('display','block');
				$jQ('#divName_Embroid_Line_2').css('display','block');
				if ($jQ('#poName_Embroid_Line_3').length){$jQ('#poName_Embroid_Line_3').val('');}
			}else if (chosen.indexOf("3 Line") !== -1){
				$jQ('#divName_Embroid_Line_1').css('display','block');
				$jQ('#divName_Embroid_Line_2').css('display','block');
				$jQ('#divName_Embroid_Line_3').css('display','block');
			}
		}else{
			if ($jQ('#poName_Embroid_Line_1').length){$jQ('#poName_Embroid_Line_1').val('');}
			if ($jQ('#poName_Embroid_Line_2').length){$jQ('#poName_Embroid_Line_2').val('');}
			if ($jQ('#poName_Embroid_Line_3').length){$jQ('#poName_Embroid_Line_3').val('');}
			if ($jQ('#poThread_Color').length){$jQ('#poThread_Color').attr('selectedIndex',0);}
			if ($jQ('#imgThread_Color').length){$jQ('#imgThread_Color').attr('src','skin1/images/spacer.gif');}
			if ($jQ('#poEmbroidery_Font').length){$jQ('#poEmbroidery_Font').attr('selectedIndex',0);}
			if ($jQ('#imgEmbroidery_Font').length){$jQ('#imgEmbroidery_Font').attr('src','skin1/images/spacer.gif');}
			if ($jQ('#divEmbroidery_Location')){$jQ('#poEmbroidery_Location').attr('selectedIndex',0);}
			else if ($jQ('#divHat_Embroidery_Location')){$jQ('#poHat_Embroidery_Location').attr('selectedIndex',0);}
		}
	}else if ((optname === "Coat Sleeves") || (optname === "Shirt Sleeves") || (optname === "Server Jacket Sleeves")){
		if (chosen.indexOf("w/o Cuff") !== -1){
			if ($jQ('#poCuff_Type').length){
				$jQ('#poCuff_Type').attr('selectedIndex', 0);
				chkprice('poCuff_Type');
			}
			if ($jQ('#poCuff_Conversion').length){
				$jQ('#poCuff_Conversion').attr('selectedIndex', 0);
				chkprice('poCuff_Conversion');
			}
			if ($jQ('#poCuff_Conversion_Fabric').length){
				$jQ('#poCuff_Conversion_Fabric').attr('selectedIndex', 0);
				for (i=0;i<divcufffabrics.length;i++){
					fabClose(divcufffabrics[i]);
				}
			}
			if ($jQ('#poCuff_Cording').length){
				$jQ('#poCuff_Cording').attr('selectedIndex', 0);
				chkprice('poCuff_Cording');
				for (i=1;i<=3;i++){
					if ($jQ('#poCuff_Cording_Color_'+i).length){
						$jQ('#poCuff_Cording_Color_'+i).attr('selectedIndex', 0);
						$jQ('#imgCuff_Cording_Color_'+i).attr('src','skin1/images/spacer.gif');
						$jQ('#divCuff_Cording_Color_'+i).css('display','none');
					}
				}
			}
		}
	}else if (optname === "Cuff Type") {
		if (chosen.indexOf("None") === -1) {
			for (i=0;i<divsleevelist.length;i++){
				if ($jQ('#'+divsleevelist[i]).length){
					poname = divsleevelist[i].replace("div","po");
					Schosen = $jQ('#'+poname+' option:selected').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.");
						$jQ('#'+option).attr('selectedIndex',0);
						chkprice(option);
					}
				}
			}
		}else{
			if ($jQ('#poCuff_Conversion').length){
				$jQ('#poCuff_Conversion').attr('selectedIndex',0);
				$jQ('#divCuff_Conversion_Fabric').css('display','none');
				$jQ('#poCuff_Conversion_Fabric').attr('selectedIndex',0);
				chkprice('poCuff_Conversion');
			}
			for (i=0;i<divcufffabrics.length;i++){
				fabClose(divcufffabrics[i]);
			}
		}
	}else if ((optname === "Coat Buttons") || (optname === "Server Jacket Buttons")) {
		if ((chosen.indexOf("Hand-Crafted") !== -1) || (chosen.indexOf("Hand-Rolled Cloth Buttons") !== -1)){
			$jQ('#divButton_Conversion_Fabric').css('display','block');
		}else if (chosen.indexOf("Snap") !== -1){
			if ($jQ('#poCoat_Fabric').length) {
				Cchosen = $jQ('#poCoat_Fabric option:selected').text();
			}else if ($jQ('#poServer_Jacket_Fabric').length) {
				Cchosen = $jQ('#poServer_Jacket_Fabric option:selected').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.");
				$jQ('#'+option).attr('selectedIndex',0);
			}
			if ($jQ('#divButton_Conversion_Fabric').length){
				$jQ('#divButton_Conversion_Fabric').css('display','none');
				$jQ('#poButton_Conversion_Fabric').attr('selectedIndex',0);
			}
			for (i=0;i<divbuttonfabrics.length;i++){
				fabClose(divbuttonfabrics[i]);
			}
		}else{
			if ($jQ('#divButton_Conversion_Fabric').length){
				$jQ('#divButton_Conversion_Fabric').css('display','none');
				$jQ('#poButton_Conversion_Fabric').attr('selectedIndex',0);
			}
			for (i=0;i<divbuttonfabrics.length;i++){
				fabClose(divbuttonfabrics[i]);
			}
		}
	}else if (optname === "Hat Conversion") {
		if (chosen.indexOf("Yes") !== -1){
			$jQ('#divHatband_Fabric').css('display','block');
		}else{
			$jQ('#divHatband_Fabric').css('display','none');
			$jQ('#poHatband_Fabric').attr('selectedIndex',0);
			for (i=0;i<divhatbandfabrics.length;i++){
				fabClose(divhatbandfabrics[i]);
			}
		}
	}else if (optname === "Back Yoke Conversion"){
		if (chosen.indexOf("Yes") !== -1){
			$jQ('#divBack_Yoke_Conversion_Fabric').style.display = "block";
		}else{
			$jQ('#divBack_Yoke_Conversion_Fabric').css('display','none');
			$jQ('#poBack_Yoke_Conversion_Fabric').attr('selectedIndex',0);
			for (i=0;i<divyokefabrics.length;i++){
				fabClose(divyokefabrics[i]);
			}
		}
	}else if (optname === "Side Panel Conversion"){
		if (chosen.indexOf("Yes") !== -1){
			$jQ('#divSide_Panel_Conversion_Fabric').style.display = "block";
		}else{
			$jQ('#divSide_Panel_Conversion_Fabric').css('display','none');
			$jQ('#poSide_Panel_Conversion_Fabric').attr('selectedIndex',0);
			for (i=0;i<divsidefabrics.length;i++){
				fabClose(divsidefabrics[i]);
			}
		}
	}	else if (optname === "Cuff Conversion") {
		if (chosen.indexOf("Yes") !== -1){
			$jQ('#divCuff_Conversion_Fabric').css('display','block');
			if ($jQ('#poCuff_Type option:selected').text().indexOf('None') !== -1){
				alert("You have to select a Cuff, please change this to allow conversion.");
				$jQ('#'+option).attr('selectedIndex',0);
				chkprice(option);
				$jQ('#divCuff_Conversion_Fabric').css('display','none');
			}
		}else{
			$jQ('#divCuff_Conversion_Fabric').css('display','none');
			$jQ('#poCuff_Conversion_Fabric').attr('selectedIndex',0);
			for (i=0;i<divcufffabrics.length;i++){
				fabClose(divcufffabrics[i]);
			}
		}
	}else if (optname === "Collar Conversion") {
		if (chosen.indexOf("Yes") !== -1){
			$jQ('#divCollar_Conversion_Fabric').css('display','block');
			if ($jQ('#divTriColor_Ribbon').length){
				$jQ('#poTriColor_Ribbon').attr('selectedIndex',0);
				chkprice('poTriColor_Ribbon');
			}
			if ($jQ('#divTriColor_Ribbon').length){
				$jQ('#poTriSplit_Collar').attr('selectedIndex',0);
				for (i=1;i<=3;i++) {
					$jQ('#poTriSplit_Color_'+i).attr('selectedIndex',0);
					$jQ('#imgTriSplit_Color_'+i).attr('src','skin1/images/spacer.gif');
					$jQ('#divTriSplit_Color_'+i).css('display','none');
				}
				chkprice('poTriSplit_Collar');
			}
		}else{
			$jQ('#divCollar_Conversion_Fabric').css('display','none');
			$jQ('#poCollar_Conversion_Fabric').attr('selectedIndex',0);
			for (i=0;i<divcollarfabrics.length;i++){
				fabClose(divcollarfabrics[i]);
			}
		}
	}else if (optname.indexOf("TriSplit Collar") !== -1) {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#divCollar_Conversion_Fabric').length){
				$jQ('#divCollar_Conversion_Fabric').css('display','none');
				$jQ('#poCollar_Conversion_Fabric').attr('selectedIndex',0);
				$jQ('#poCollar_Conversion').attr('selectedIndex',0);
				chkprice('poCollar_Conversion');
			}
			if ($jQ('#divTriColor_Ribbon').length){
				for (i=0;i<divcollarfabrics.length;i++){
					fabClose(divcollarfabrics[i]);
				}
				$jQ('#poTriColor_Ribbon').attr('selectedIndex',0);
				chkprice('poTriColor_Ribbon');
			}
			for (i=1;i<=3;i++) {
				$jQ('#divTriSplit_Color_'+i).css('display','block');
			}
		}else{
			for (i=1;i<=3;i++) {
				$jQ('#divTriSplit_Color_'+i).css('display','none');
				$jQ('#poTriSplit_Color_'+i).attr('selectedIndex',0);
				$jQ('#imgTriSplit_Color_'+i).attr('src','skin1/images/spacer.gif');
			}
		}
	}else if (optname.indexOf("Color") !== -1) {
		if (optname.indexOf("Thread") !== -1) {
			if (chosen.indexOf("None") !== -1) {
				$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
			}else{
				$jQ('#img'+optimg).attr('src','files/image/threads/'+getProdName(chosen)+'.gif').css('height','50px');
			}
		}else if (optname.indexOf("Ribbon") !== -1) {
			if (chosen.indexOf("None") === -1) {
				if ($jQ('#divCollar_Conversion_Fabric').length){
					$jQ('#divCollar_Conversion_Fabric').css('display','none');
					$jQ('#poCollar_Conversion_Fabric').attr('selectedIndex',0);
					$jQ('#poCollar_Conversion').attr('selectedIndex',0);
					chkprice('poCollar_Conversion');
				}
				for (i=0;i<divcollarfabrics.length;i++){
					fabClose(divcollarfabrics[i]);
				}
				$jQ('#poTriSplit_Collar').attr('selectedIndex',0);
				chkprice('poTriSplit_Collar');
				for (i=1;i<=3;i++) {
					$jQ('#poTriSplit_Color_'+i).attr('selectedIndex',0);
					$jQ('#imgTriSplit_Color_'+i).attr('src','skin1/images/spacer.gif');
					$jQ('#divTriSplit_Color_'+i).css('display','none');
				}
			}
		}else if (optname.indexOf("TriSplit") !== -1) {
			if (chosen.indexOf("None") !== -1) {
				$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
			}else{
				$jQ('#img'+optimg).attr('src','files/image/fabrics/'+getProdCode(chosen)+'.gif').css('height','50px');
			}
		}else if (optname.indexOf("TriColor") !== -1) {
			if (chosen.indexOf("None") !== -1) {
				$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
			}else{
				$jQ('#img'+optimg).attr('src','files/image/fabrics/'+getProdCode(chosen)+'.gif').css('height','50px');
			}
		}else{
			if (chosen.indexOf("None") !== -1) {
				$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
			}else{
				$jQ('#img'+optimg).attr('src','files/image/cording/'+getProdName(chosen)+'.gif').css('height','20px');
			}
		}
	}else if (optname.indexOf("Fabrics") !== -1) {
		if (chosen.indexOf("None") !== -1) {
			$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
		}else{
			$jQ('#img'+optimg).attr('src','files/image/fabrics/'+getProdCode(chosen)+'.gif').css('height','50px');
		}
	}else if (optname.indexOf("Font") !== -1) {
		if (chosen.indexOf("None") !== -1) {
			$jQ('#img'+optimg).attr('src','skin1/images/spacer.gif');
		}else{
			$jQ('#img'+optimg).attr('src','files/image/fonts/'+getProdCode(chosen)+'.gif').css('width','120px');
		}
	}else if (optname === "Vest Sizing") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poWomens_Vest_Sizing').length){$jQ('#poWomens_Vest_Sizing').attr('selectedIndex',0);}
			if ($jQ('#mainWomens_Vest_Sizing').length){$jQ('#mainWomens_Vest_Sizing').attr('selectedIndex',0);}
		}
	}else if (optname === "Womens Vest Sizing") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poVest_Sizing').length){$jQ('#poVest_Sizing').attr('selectedIndex',0);}
			if ($jQ('#mainVest_Sizing').length){$jQ('#mainVest_Sizing').attr('selectedIndex',0);}
		}
	}else if (optname === "Shirt Sizing") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poWomens_Shirt_Sizing').length){$jQ('#poWomens_Shirt_Sizing').attr('selectedIndex',0);}
			if ($jQ('#mainWomens_Shirt_Sizing').length){$jQ('#mainWomens_Shirt_Sizing').attr('selectedIndex',0);}
		}
	}else if (optname === "Womens Shirt Sizing") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poShirt_Sizing').length){$jQ('#poShirt_Sizing').attr('selectedIndex',0);}
			if ($jQ('#mainShirt_Sizing').length){$jQ('#mainShirt_Sizing').attr('selectedIndex',0);}
		}
	}else if (optname === "Mens Standard Coat Size") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poWomens_Standard_Coat_Size').length){$jQ('#poWomens_Standard_Coat_Size').attr('selectedIndex',0);}
			if ($jQ('#mainWomens_Standard_Coat_Size').length){$jQ('#mainWomens_Standard_Coat_Size').attr('selectedIndex',0);}
		}
	}else if (optname === "Womens Standard Coat Size") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poMens_Standard_Coat_Size').length){$jQ('#poMens_Standard_Coat_Size').attr('selectedIndex',0);}
			if ($jQ('#mainMens_Standard_Coat_Size').length){$jQ('#mainMens_Standard_Coat_Size').attr('selectedIndex',0);}
		}
	}else if (optname === "Mens Coat Size") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poWomens_Coat_Size').length){$jQ('#poWomens_Coat_Size').attr('selectedIndex',0);}
			if ($jQ('#mainWomens_Coat_Size').length){$jQ('#mainWomens_Coat_Size').attr('selectedIndex',0);}
		}
	}else if (optname === "Womens Coat Size") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poMens_Coat_Size').length){$jQ('#poMens_Coat_Size').attr('selectedIndex',0);}
			if ($jQ('#mainMens_Coat_Size').length){$jQ('#mainMens_Coat_Size').attr('selectedIndex',0);}
		}
	}else if (optname === "Server Jacket Size") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poWomens_Server_Jacket_Size').length){$jQ('#poWomens_Server_Jacket_Size').attr('selectedIndex',0);}
			if ($jQ('#mainWomens_Server_Jacket_Size').length){$jQ('#mainWomens_Server_Jacket_Size').attr('selectedIndex',0);}
		}
	}else if (optname === "Womens Server Jacket Size") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poServer_Jacket_Size').length){$jQ('#poServer_Jacket_Size').attr('selectedIndex',0);}
			if ($jQ('#mainServer_Jacket_Size').length){$jQ('#mainServer_Jacket_Size').attr('selectedIndex',0);}
		}
	}else if (optname === "American Womens Shoe Sizing") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poAmerican_Mens_Shoe_Sizing').length){$jQ('#poAmerican_Mens_Shoe_Sizing').attr('selectedIndex',0);}
			if ($jQ('#mainAmerican_Mens_Shoe_Sizing').length){$jQ('#mainAmerican_Mens_Shoe_Sizing').attr('selectedIndex',0);}
		}
	}else if (optname === "American Mens Shoe Sizing") {
		if (chosen.indexOf("None") === -1) {
			if ($jQ('#poAmerican_Womens_Shoe_Sizing').length){$jQ('#poAmerican_Womens_Shoe_Sizing').attr('selectedIndex',0);}
			if ($jQ('#mainAmerican_Womens_Shoe_Sizing').length){$jQ('#mainAmerican_Womens_Shoe_Sizing').attr('selectedIndex',0);}
		}
	}
	if (optname.indexOf("Siz") !== -1) {
		if (option === 'po'+optimg){$jQ('#main'+optimg).val($jQ('#po'+optimg).val());}
		if (option === 'main'+optimg){$jQ('#po'+optimg).val($jQ('#main'+optimg).val());}
	}
}

//
// 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;
	//Check to make sure cuffs are set with correct sleeve type
	if ($jQ('#divCuff_Type').length){
		if ($jQ('#poCuff_Type option:selected').text().indexOf('None') !== -1) {
			if ($jQ('#poCoat_Sleeves').length){
				if ($jQ('#poCoat_Sleeves option:selected').text().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;
				}
			}
			if ($jQ('#poServer_Jacket_Sleeves').length){
				if ($jQ('#poServer_Jacket_Sleeves option:selected').text().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;
				}
			}
		}
	}
	//Check to make sure flag location is set if flag is selected	
	if ($jQ('#divFlag_Embroidery'.length)){
		if ($jQ('#poFlag_Embroidery option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poFlag_Location option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Location for your Flag Embroidery");
				formok = false;
			}
		}
	}
	//Check to make sure choices are made for Name Embroidery if selected	
	if ($jQ('#divName_Embroidery').length){
		if ($jQ('#poName_Embroidery option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poEmbroidery_Location option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Location for your Embroidery");
				formok = false;
			}
			if ($jQ('#poEmbroidery_Font option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Font for your Embroidery");
				formok = false;
			}
			if ($jQ('#poThread_Color option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Thread Color for your Embroidery");
				formok = false;
			}
			if ($jQ('select#poName_Embroidery').attr("selectedIndex") === 1) {
				if ($jQ('#poName_Embroid_Line_1').val() === "") {
					alert("You need to Enter your 1st Line of Embroidery Text");
					formok = false;
				}
			}
			if ($jQ('select#poName_Embroidery').attr("selectedIndex") === 2) {
				if (($jQ('#poName_Embroid_Line_1').val() === "")||($jQ('#poName_Embroid_Line_2').val() === "")) {
					alert("You need to Enter your 1st & 2nd Lines of Embroidery Text");
					formok = false;
				}
			}
			if ($jQ('select#poName_Embroidery').attr("selectedIndex") === 3) {
				if (($jQ('#poName_Embroid_Line_1').val() === "")||($jQ('#poName_Embroid_Line_2').val() === "")||($jQ('#poName_Embroid_Line_3').val() === "")) {
					alert("You need to Enter your 1st, 2nd & 3rd Lines of Embroidery Text");
					formok = false;
				}
			}
		}
	}
	//Check to make sure choices are made for all pockets if selected
	if ($jQ('#divCoat_Pocket_1').length){	
		var hold = '', PockSide1 = '1', PockLoc1 = '1', PockSide2 = '2', PockSide2 = '2', PockLoc2 = '2', PockSide3 = '3', PockLoc3 = '3', PockSide4 = '4', PockLoc4 = '4';
		if ($jQ('#divCoat_Pocket_1').length){
			if ($jQ('#poCoat_Pocket_1 option:selected').text().indexOf("Corded") !== -1){
				if ($jQ('#poPocket_1_Cording_Color option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Cording Color for Pocket #1");
					formok = false;
				}
			}
			if ($jQ('#poCoat_Pocket_1 option:selected').text().indexOf('None') === -1) {
				hold = $jQ('#poCoat_Pocket_1 option:selected').text();
				if (hold.indexOf('Left')!==-1) {PockSide1='L';}else{PockSide1='R';}
				if (hold.indexOf('Sleeve')!==-1) {PockLoc1 = 'S';}
				if (hold.indexOf('Cell')!==-1) {PockLoc1 = 'C';}
				if (hold.indexOf('Breast')!==-1) {PockLoc1 = 'B';}
			}
		}
		if ($jQ('#divCoat_Pocket_2').length){
			if ($jQ('#poCoat_Pocket_2 option:selected').text().indexOf("Corded") !== -1){
				if ($jQ('#poPocket_2_Cording_Color option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Cording Color for Pocket #2");
					formok = false;
				}
			}
			if ($jQ('#poCoat_Pocket_2 option:selected').text().indexOf('None') === -1) {
				hold = $jQ('#poCoat_Pocket_2 option:selected').text();
				if (hold.indexOf('Left')!==-1) {PockSide2='L';}else{PockSide2='R';}
				if (hold.indexOf('Sleeve')!==-1) {PockLoc2 = 'S';}
				if (hold.indexOf('Cell')!==-1) {PockLoc2 = 'C';}
				if (hold.indexOf('Breast')!==-1) {PockLoc2 = 'B';}
			}
		}
		if ($jQ('#divCoat_Pocket_3').length){
			if ($jQ('#poCoat_Pocket_3 option:selected').text().indexOf("Corded") !== -1){
				if ($jQ('#poPocket_3_Cording_Color option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Cording Color for Pocket #3");
					formok = false;
				}
			}
			if ($jQ('#poCoat_Pocket_3 option:selected').text().indexOf('None') === -1) {
				hold = $jQ('#poCoat_Pocket_3 option:selected').text();
				if (hold.indexOf('Left')!==-1) {PockSide3='L';}else{PockSide3='R';}
				if (hold.indexOf('Sleeve')!==-1) {PockLoc3 = 'S';}
				if (hold.indexOf('Cell')!==-1) {PockLoc3 = 'C';}
				if (hold.indexOf('Breast')!==-1) {PockLoc3 = 'B';}
			}
		}
		if ($jQ('#divCoat_Pocket_4').length){
			if ($jQ('#poCoat_Pocket_4 option:selected').text().indexOf("Corded") !== -1){
				if ($jQ('#poPocket_4_Cording_Color option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Cording Color for Pocket #4");
					formok = false;
				}
			}
			if ($jQ('#poCoat_Pocket_4 option:selected').text().indexOf('None') === -1) {
				hold = $jQ('#poCoat_Pocket_4 option:selected').text();
				if (hold.indexOf('Left')!==-1) {PockSide4='L';}else{PockSide4='R';}
				if (hold.indexOf('Sleeve')!==-1) {PockLoc4 = 'S';}
				if (hold.indexOf('Cell')!==-1) {PockLoc4 = 'C';}
				if (hold.indexOf('Breast')!==-1) {PockLoc4 = 'B';}
			}
		}
		if (PockLoc1 === PockLoc2){
			if (PockSide1 === PockSide2){
				alert("Pockets 1 & 2 are in the same place. Please correct");
				formok = false;
			}
		}
		if (PockLoc1 === PockLoc3){
			if (PockSide1 === PockSide3){
				alert("Pockets 1 & 3 are in the same place. Please correct");
				formok = false;
			}
		}
		if (PockLoc1 === PockLoc4){
			if (PockSide1 === PockSide4){
				alert("Pockets 1 & 4 are in the same place. Please correct");
				formok = false;
			}
		}
		if (PockLoc2 === PockLoc3){
			if (PockSide2 === PockSide3){
				alert("Pockets 2 & 3 are in the same place. Please correct");
				formok = false;
			}
		}
		if (PockLoc2 === PockLoc4){
			if (PockSide2 === PockSide4){
				alert("Pockets 2 & 4 are in the same place. Please correct");
				formok = false;
			}
		}
		if (PockLoc3 === PockLoc4){
			if (PockSide3 === PockSide4){
				alert("Pockets 3 & 4 are in the same place. Please correct");
				formok = false;
			}
		}
	}
	//Check to make sure apron pocket cording color is set
	if ($jQ('#divApron_Pocket_Cording').length){
		if ($jQ('#poApron_Pocket_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poApron_Pocket_Cording_Color option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Color for your Pocket Cording");
				formok = false;
			}
		}
	}
	//Check to make sure apron flap cording color is set
	if ($jQ('#divApron_Flap_Cording').length){
		if ($jQ('#poApron_Flap_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poApron_Flap_Cording_Color option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Color for your Apron Flap Cording");
				formok = false;
			}
		}
	}
	//Check to make sure shirt cording color is set
	if ($jQ('#divShirt_Cording').length){
		if ($jQ('#poShirt_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poShirt_Cording_Color option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Color for your Shirt Cording");
				formok = false;
			}
		}
	}
	//Check to make sure hat cording color is set
	if ($jQ('#divHat_Cording').length){
		if ($jQ('#poHat_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poHat_Cording_Color option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Color for your Hat Cording");
				formok = false;
			}
		}
	}
	//Check to make sure colors are chosen for all lower collar cording if selected
	if ($jQ('#divLower_Collar_Cording').length){
		if ($jQ('#poLower_Collar_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poLower_Collar_Cording option:selected').text().indexOf('Single') !== -1){
				if ($jQ('#poLower_Collar_Cording_Color_1 option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your 1st row of Lower Collar Cording");
					formok = false;
				}
			}
			if ($jQ('#poLower_Collar_Cording option:selected').text().indexOf('Double') !== -1){
				if (($jQ('#poLower_Collar_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poLower_Collar_Cording_Color_2 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st & 2nd row of Lower Collar Cording");
					formok = false;
				}
			}
			if ($jQ('#poLower_Collar_Cording option:selected').text().indexOf('Triple') !== -1){
				if (($jQ('#poLower_Collar_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poLower_Collar_Cording_Color_2 option:selected').text().indexOf('None') !== -1) || ($jQ('#poLower_Collar_Cording_Color_3 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st, 2nd & 3rd row of Lower Collar Cording");
					formok = false;
				}
			}
		}
	}
	//Check to make sure colors are chosen for all upper collar cording if selected
	if ($jQ('#divUpper_Collar_Cording').length){
		if ($jQ('#poUpper_Collar_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poUpper_Collar_Cording option:selected').text().indexOf('Single') !== -1){
				if ($jQ('#poUpper_Collar_Cording_Color_1 option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your 1st row of Upper Collar Cording");
					formok = false;
				}
			}
			if ($jQ('#poUpper_Collar_Cording option:selected').text().indexOf('Double') !== -1){
				if (($jQ('#poUpper_Collar_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poUpper_Collar_Cording_Color_2 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st & 2nd row of Upper Collar Cording");
					formok = false;
				}
			}
			if ($jQ('#poUpper_Collar_Cording option:selected').text().indexOf('Triple') !== -1){
				if (($jQ('#poUpper_Collar_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poUpper_Collar_Cording_Color_2 option:selected').text().indexOf('None') !== -1) || ($jQ('#poUpper_Collar_Cording_Color_3 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st, 2nd & 3rd row of Upper Collar Cording");
					formok = false;
				}
			}
		}
	}
	//Check to make sure colors are chosen for all front cording if selected
	if ($jQ('#divFront_Cording').length){
		if ($jQ('#poFront_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poFront_Cording option:selected').text().indexOf('Single') !== -1){
				if ($jQ('#poFront_Cording_Color_1 option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your 1st row of Front Cording");
					formok = false;
				}
			}
			if ($jQ('#poFront_Cording option:selected').text().indexOf('Double') !== -1){
				if (($jQ('#poFront_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poFront_Cording_Color_2 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st & 2nd row of Front Cording");
					formok = false;
				}
			}
			if ($jQ('#poFront_Cording option:selected').text().indexOf('Triple') !== -1){
				if (($jQ('#poFront_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poFront_Cording_Color_2 option:selected').text().indexOf('None') !== -1) || ($jQ('#poFront_Cording_Color_3 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st, 2nd & 3rd row of Front Cording");
					formok = false;
				}
			}
		}
	}
	//Check to make sure colors are chosen for all cuff cording if selected
	if ($jQ('#divCuff_Cording').length){
		if ($jQ('#poCuff_Cording option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poCuff_Cording option:selected').text().indexOf('Single') !== -1){
				if ($jQ('#poCuff_Cording_Color_1 option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your 1st row of Cuff Cording");
					formok = false;
				}
			}
			if ($jQ('#poCuff_Cording option:selected').text().indexOf('Double') !== -1){
				if (($jQ('#poCuff_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poCuff_Cording_Color_2 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st & 2nd row of Cuff Cording");
					formok = false;
				}
			}
			if ($jQ('#poCuff_Cording option:selected').text().indexOf('Triple') !== -1){
				if (($jQ('#poCuff_Cording_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poCuff_Cording_Color_2 option:selected').text().indexOf('None') !== -1) || ($jQ('#poCuff_Cording_Color_3 option:selected').text().indexOf('None') !== -1)) {
					alert("You need to select a Color for your 1st, 2nd & 3rd row of Cuff Cording");
					formok = false;
				}
			}
		}
	}
	//Check to make sure choices are made coat buttons if selected
	if ($jQ('#divCoat_Buttons').length){
		if (($jQ('#poCoat_Buttons option:selected').text().indexOf("Hand-Rolled") !== -1) || ($jQ('#poCoat_Buttons option:selected').text().indexOf("Hand-Crafted") !== -1)) {
			if ($jQ('#poButton_Conversion_Fabric option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Fabric for your Buttons");
				formok = false;
			}else{
				var btnfab = determineFabric($jQ('#poButton_Conversion_Fabric option:selected').text());
				if ($jQ('#poButton_'+btnfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your Button Fabric.");
					formok = false;
				}
			}
		}
		if ($jQ('#poCoat_Buttons option:selected').text().indexOf("None") !== -1){
			alert("You need to select a Button type for your Coat");
			formok = false;
		}
	}
	//Check to make sure choices are made server jacket buttons if selected
	if ($jQ('#divServer_Jacket_Buttons').length){
		if (($jQ('#poServer_Jacket_Buttons option:selected').text().indexOf("Hand-Rolled") !== -1) || ($jQ('#poServer_Jacket_Buttons option:selected').text().indexOf("Hand-Crafted") !== -1)) {
			if ($jQ('#poButton_Conversion_Fabric option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Fabric for your Buttons");
				formok = false;
			}else{
				var btnfab = determineFabric($jQ('#poButton_Conversion_Fabric option:selected').text());
				if ($jQ('#poButton_'+btnfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your Button Fabric.");
					formok = false;
				}
			}
		}
		if ($jQ('#poServer_Jacket_Buttons option:selected').text().indexOf("None") !== -1){
			alert("You need to select a Button type for your Jacket");
			formok = false;
		}
	}
	//Check to make sure three colors selected if tricolor collar is selected
	if ($jQ('#divTriSplit_Collar').length){
		if ($jQ('#poTriSplit_Collar option:selected').text().indexOf('None') === -1) {
			if (($jQ('#poTriSplit_Color_1 option:selected').text().indexOf('None') !== -1) || ($jQ('#poTriSplit_Color_2 option:selected').text().indexOf('None') !== -1) || ($jQ('#poTriSplit_Color_3 option:selected').text().indexOf('None') !== -1)) {
				alert("You need to select 3 Colors for your Tri-Split Collar");
				formok = false;
			}
		}
	}
	//Check to make sure choices are made if collar conversion is selected
	if ($jQ('#divCollar_Conversion').length){
		if ($jQ('#poCollar_Conversion option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poCollar_Conversion_Fabric option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Fabric for your Collar Conversion");
				formok = false;
			}else{
				var colfab = determineFabric($jQ('#poCollar_Conversion_Fabric option:selected').text());
				if ($jQ('#poCollar_'+colfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your Collar Fabric.");
					formok = false;
				}
			}
		}
	}
	//Check to make sure choices are made if cuff conversion is selected
	if ($jQ('#divCuff_Conversion').length){
		if ($jQ('#poCuff_Conversion option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poCuff_Conversion_Fabric option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Fabric for your Cuff Conversion");
				formok = false;
			}else{
				var cufffab = determineFabric($jQ('#poCuff_Conversion_Fabric option:selected').text());
				if ($jQ('#poCuff_'+cufffab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your Cuff Fabric.");
					formok = false;
				}
			}
		}
	}
	//Check to make sure choices are made if hat conversion is selected
	if ($jQ('#divHat_Conversion').length){
		if ($jQ('#poHat_Conversion option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poHatband_Fabric option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Fabric for your Hat Conversion");
				formok = false;
			}else{
				var hatfab = determineFabric($jQ('#poHatband_Fabric option:selected').text());
				if ($jQ('#poHat_'+hatfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your Hat Fabric.");
					formok = false;
				}
			}
		}
	}
	//Check to make sure vest sizing options are set
	if (($jQ('#divVest_Sizing').length)&&($jQ('#divWomens_Vest_Sizing').length)){
		if (($jQ('#poVest_Sizing option:selected').text().indexOf('None') !== -1)&&($jQ('#poWomens_Vest_Sizing option:selected').text().indexOf('None') !== -1)) {
			alert("You need to select a Size for your Vest.");
			formok = false;
		}
	}else if ($jQ('#divVest_Sizing').length){
		if ($jQ('#poVest_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Vest.");
			formok = false;
		}
	}else if ($jQ('#divWomens_Vest_Sizing').length){
		if ($jQ('#poWomens_Vest_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Vest.");
			formok = false;
		}
	}
	//Check to make sure shirt sizing options are set
	if (($jQ('#divShirt_Sizing').length)&&($jQ('#divWomens_Shirt_Sizing').length)){
		if (($jQ('#poShirt_Sizing option:selected').text().indexOf('None') !== -1)&&($jQ('#poWomens_Shirt_Sizing option:selected').text().indexOf('None') !== -1)) {
			alert("You need to select a Size for your Shirt.");
			formok = false;
		}
	}else if ($jQ('#divShirt_Sizing').length){
		if ($jQ('#poShirt_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Shirt.");
			formok = false;
		}
	}else if ($jQ('#divWomens_Shirt_Sizing').length){
		if ($jQ('#poWomens_Shirt_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Shirt.");
			formok = false;
		}
	}
	//Check to make sure server jacket sizing options are set
	if (($jQ('#divServer_Jacket_Size').length)&&($jQ('#divWomens_Server_Jacket_Size').length)){
		if (($jQ('#poServer_Jacket_Size option:selected').text().indexOf('None') !== -1)&&($jQ('#poWomens_Server_Jacket_Size option:selected').text().indexOf('None') !== -1)) {
			alert("You need to select a Size for your Server Jacket.");
			formok = false;
		}
	}else if ($jQ('#divServer_Jacket_Size').length){
		if ($jQ('#poServer_Jacket_Size option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Server Jacket.");
			formok = false;
		}
	}else if ($jQ('#divWomens_Server_Jacket_Size').length){
		if ($jQ('#poWomens_Server_Jacket_Size option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Server Jacket.");
			formok = false;
		}
	}
	//Check to make sure american shoe sizing options are set
	if (($jQ('#divAmerican_Mens_Shoe_Sizing').length)&&($jQ('#divAmerican_Womens_Shoe_Sizing').length)){
		if (($jQ('#poAmerican_Mens_Shoe_Sizing option:selected').text().indexOf('None') !== -1)&&($jQ('#poAmerican_Womens_Shoe_Sizing option:selected').text().indexOf('None') !== -1)){
			alert("You need to select a Size for your Shoes.");
			formok = false;
		}
	}else if ($jQ('#divAmerican_Mens_Shoe_Sizing').length){
		if ($jQ('#poAmerican_Mens_Shoe_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Shoes.");
			formok = false;
		}
	}else if ($jQ('#divAmerican_Womens_Shoe_Sizing').length){
		if ($jQ('#poAmerican_Womens_Shoe_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Shoes.");
			formok = false;
		}
	}
	//Check to make sure dansko shoe sizing options are set
	if ($jQ('#divDansko_Shoe_Sizing').length){
		if ($jQ('#poDansko_Shoe_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Shoes.");
			formok = false;
		}
	}
	//Check to make sure birki shoe sizing options are set
	if ($jQ('#divBirki_Shoe_Sizing').length){
		if ($jQ('#poBirki_Shoe_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Shoes.");
			formok = false;
		}
	}
	//Check to make sure birki shoe sizing options are set
	if ($jQ('#divPants_Sizing').length){
		if ($jQ('#poPants_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Pants.");
			formok = false;
		}
	}
	//Check to make sure coat sizing options are set
	if (($jQ('#divMens_Coat_Size').length)&&($jQ('#divWomens_Coat_Size').length)){
		if (($jQ('#poMens_Coat_Size option:selected').text().indexOf('None') !== -1)&&($jQ('#poWomens_Coat_Size option:selected').text().indexOf('None') !== -1)){
			alert("You need to select a Size for your Coat.");
			formok = false;
		}
	}else if ($jQ('#divMens_Coat_Size').length){
		if ($jQ('#poMens_Coat_Size option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Coat.");
			formok = false;
		}
	}else if ($jQ('#divWomens_Coat_Size').length){
		if ($jQ('#poWomens_Coat_Size option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Coat.");
			formok = false;
		}
	}
	//Check to make sure standard coat sizing options are set
	if (($jQ('#divMens_Standard_Coat_Size').length)&&($jQ('#divWomens_Standard_Coat_Size').length)){
		if (($jQ('#poMens_Standard_Coat_Size option:selected').text().indexOf('None') !== -1)&&($jQ('#poWomens_Standard_Coat_Size option:selected').text().indexOf('None') !== -1)){
			alert("You need to select a Size for your Coat.");
			formok = false;
		}
	}else if ($jQ('#divMens_Standard_Coat_Size').length){
		if ($jQ('#poMens_Standard_Coat_Size option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Coat.");
			formok = false;
		}
	}else if ($jQ('#divWomens_Standard_Coat_Size').length){
		if ($jQ('#poWomens_Standard_Coat_Size option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Coat.");
			formok = false;
		}
	}
	//Check to make sure standard sizing options are set
	if ($jQ('#divStandard_Sizing').length){
		if ($jQ('#poStandard_Sizing option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Size for your Item.");
			formok = false;
		}
	}
	//Check to make sure color/pattern is chosen if coat fabric is selected
	if ($jQ('#divCoat_Fabric').length){
		var coatfab = determineFabric($jQ('#poCoat_Fabric option:selected').text());
		if ($jQ('#poBase_'+coatfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Color/Pattern for your Coat.");
			formok = false;
		}
	}
	//Check to make sure color/pattern is chosen if neckwear fabric is selected
	if ($jQ('#divNeckwear_Fabric').length){
		var neckfab = determineFabric($jQ('#poNeckwear_Fabric option:selected').text());
		if ($jQ('#poBase_'+neckfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Pattern/Color for your Neckwear.");
			formok = false;
		}
	}
	//Check to make sure color/pattern is chosen if coat fabric is selected
	if ($jQ('#divServer_Jacket_Fabric').length){
		var coatfab = determineFabric($jQ('#poServer_Jacket_Fabric option:selected').text());
		if ($jQ('#poBase_'+coatfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Color/Pattern for your Server Jacket.");
			formok = false;
		}
	}
	//Check to make sure color/pattern is chosen if vest fabric is selected
	if ($jQ('#divVest_Fabric').length){
		var coatfab = determineFabric($jQ('#poVest_Fabric option:selected').text());
		if ($jQ('#poBase_'+coatfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Color/Pattern for your Vest.");
			formok = false;
		}
	}
	//Check to make sure apron fabric color is set
	if ($jQ('#divApron_Fabric').length){
		var fab = determineFabric($jQ('#poApron_Fabric option:selected').text());
		if ($jQ('#poBase_'+fab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Pattern/Color for your Apron.");
			formok = false;
		}
	}
	//Check to make sure hat fabric color is set
	if ($jQ('#divHat_Fabric').length){
		var hatfab = determineFabric($jQ('#poHat_Fabric option:selected').text());
		if ($jQ('#poBase_'+hatfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Pattern/Color for your Hat.");
			formok = false;
		}
	}
	//Check to make sure shirt fabric color is set
	if ($jQ('#divShirt_Fabric').length){
		var shirtfab = determineFabric($jQ('#poShirt_Fabric option:selected').text());
		if ($jQ('#poBase_'+shirtfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Pattern/Color for your Shirt.");
			formok = false;
		}
	}
	//Check to make sure pants fabric color is set
	if ($jQ('#divPants_Fabric').length){
		var pantsfab = determineFabric($jQ('#poPants_Fabric option:selected').text());
		if ($jQ('#poBase_'+pantsfab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Pattern/Color for your Pants.");
			formok = false;
		}
	}
	//Check to make sure tri-color coat fabric 1 color is set
	if ($jQ('#divCoat_TriColor_Fabric_1').length){
		var trifab = determineFabric($jQ('#poCoat_TriColor_Fabric_1 option:selected').text());
		if ($jQ('#poTriColor_'+trifab+'_Fabrics_1 option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Right Side Color for your Coat.");
			formok = false;
		}
	}
	//Check to make sure tri-color coat fabric 2 color is set
	if ($jQ('#divCoat_TriColor_Fabric_2').length){
		var trifab = determineFabric($jQ('#poCoat_TriColor_Fabric_2 option:selected').text());
		if ($jQ('#poTriColor_'+trifab+'_Fabrics_2 option:selected').text().indexOf('None') !== -1) {
			alert("You need to select a Left Side Color for your Coat.");
			formok = false;
		}
	}
	//Check to make sure tri-color coat fabric 3 color is set
	if ($jQ('#divCoat_TriColor_Fabric_3').length){
		var trifab = determineFabric($jQ('#poCoat_TriColor_Fabric_3 option:selected').text());
		if ($jQ('#poTriColor_'+trifab+'_Fabrics_3 option:selected').text().indexOf('None') !== -1) {
			alert("You need to select an Upper Left Side Color for your Coat.");
			formok = false;
		}
	}
	//Check to make sure yoke fabric color is set
	if ($jQ('#divBack_Yoke_Conversion').length){
		if ($jQ('#poBack_Yoke_Conversion option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poBack_Yoke_Conversion_Fabric option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Fabric for your Yoke Conversion");
				formok = false;
			}else{
				var yokefab = determineFabric($jQ('#poBack_Yoke_Conversion_Fabric option:selected').text());
				if ($jQ('#poYoke_'+yokefab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your Yoke Fabric.");
					formok = false;
				}
			}
		}
	}
	//Check to make sure yoke fabric color is set
	if ($jQ('#divSide_Panel_Conversion').length){
		if ($jQ('#poSide_Panel_Conversion option:selected').text().indexOf('None') === -1) {
			if ($jQ('#poSide_Panel_Conversion_Fabric option:selected').text().indexOf('None') !== -1) {
				alert("You need to select a Fabric for your Side Panel Conversion");
				formok = false;
			}else{
				var sidefab = determineFabric($jQ('#poSide_Panel_Conversion_Fabric option:selected').text());
				if ($jQ('#poSide_'+sidefab+'_Fabrics option:selected').text().indexOf('None') !== -1) {
					alert("You need to select a Color for your Side Panel Fabric.");
					formok = false;
				}
			}
		}
	}	
	if (formok) {
		if (loccode == 0){
			document.orderform.submit();
		}else{
			return formok;
		}
	}else{
		return formok;
	}
}

