//Compressed with http://www.creativyst.com/Prod/3/ and then compressed with http://javascriptcompressor.com/ Base62 encode checked/Shrink Var NOT Checked.
/*
 * JavaScript Product Pages
 * Version 1.2 Copyright (C) Aajost Technologies, Inc 1998 - 2009.
 * This code is the sole property of Aajost Technologies, Inc.
 * Aajost Technologies, Inc gives its affiliate store owners the right to 
 * use this code only if the following criteria are met.
 * 1) They use it in its entirety without modification or alteration
 * 2) They use it only for the purpose of selling products offered for sale by one of
 *	Aajost Technologies, Inc properties.
 * 3) They use it only while they have an active account in good standing with Aajost Technologies, Inc.
 *
 * Useage of any or all of the code in this package constitutes your agreement to these terms.  
 * Aajost Technologies, Inc does not offer any waretees, gaurentees, assurances with the use of this code,
 * and may not be held liable for any damages or expenses that occur through its use.
*/
//USED ON ALL PAGE TYPES
var ES_WRITE_TITLE = 1;
var ES_WRITE_TITLE_IN_TITLE_ATTRIB = 2;
var ES_WRITE_DESCRIPTION = 4;	
var ES_WRITE_DESCRIPTION_IN_TITLE_ATTRIB = 5;
var ES_WRITE_PRODUCT_CATEGORY = 7;
var ES_ASSIGN_PRODUCT_PRICE_LOCATION = 8;
var ES_SET_BACKGROUND_COLOR_TO_PRODUCT_DEFAULT = 10;
var ES_WRITE_PRODUCT_ID_TO_ATTRIB = 11;
var ES_ATTACH_MOUSEOVER_MAGNIFY_EFFECT_TO_IMAGE = 23;
//OBSOLETED var ES_ADD_SEARCH_BOX = 31;
var ES_CREATE_HIDDEN_FORM_ELEMENTS = 24;	//REQUIRED
var ES_REGISTER_PAGE_FORMTAG = 24;	//REQUIRED
var ES_ONLOAD_IMAGE_ADJUSTMENTS = 25;
var ES_REGISTER_JAVASCRIPT_SUBS_TO_RUN_ON_COMPLETION = 100;
var ES_WRITE_SHOPPING_CART_HYPERLINK = 30;
var ES_WRITE_NUMBER_ITEMS_IN_SHOPCART = 40;
var ES_PAGE_MODE = 43;
var ES_PAGEMODE_SHOW_MY_STORE = 0;
var ES_PAGEMODE_SHOW_ALL_FREELANCE_ARTISTS = 1;
var ES_PAGEMODE_DONT_SHOW_ANY_FREELANCE_ARTISTS = 2;
var ES_PAGEMODE_DO_NOT_SHOW_PRO_DESIGNS = 0;
var ES_PAGEMODE_SHOW_PRO_DESIGNS = 1;

//USED ON PRODUCT DETAILS PAGE ONLY
var ES_WRITE_TITLE_IN_PAGE_TITLE = 3;
var ES_WRITE_DESCRIPTION_IN_PAGE_DESC = 6;
var ES_WRITE_SHOPPING_CART_BUTTON = 9;
var ES_WRITE_ALT_PRODUCT_TITLE = 12;
var ES_WRITE_ALT_PRODUCT_DESCRIPTION = 41;
var ES_WRITE_ALT_PRODUCT_HYPERLINK = 13;
var ES_WRITE_ALT_PRODUCT_IMAGE = 14;
var ES_WRITE_ALT_PRODUCT_BCK_COLOR = 44;
var ES_SETUP_MAIN_PRODUCT_IMAGE = 15;
var ES_ATTACH_ONCLICK_MAIN_IMAGE_ZOOM = 16;
var ES_ATTACH_ONCLICK_BOOKMARK_PAGE = 17;
var ES_ATTACH_ONCLICK_SWITCH_TO_FRONT_VIEW = 21;
var ES_ATTACH_ONCLICK_SWITCH_TO_BACK_VIEW = 22;
var ES_WRITE_QUANTITY_SELECTION = 26;
var ES_WRITE_APPAREL_SELECTION = 27;
var ES_WRITE_COLOR_SELECTION = 28;
var ES_WRITE_SIZE_SELECTION = 29;
var ES_WRITE_PRODUCT_SPECIFICS_AJAX = 42;

//USED ON PRODUCT LISTING PAGE ONLY
var ES_WRITE_PAGE_SELECTION_LIST = 32;
var ES_WRITE_PAGE_SORT_METHOD_SELECTION = 33;
var ES_SET_DESIGN_LIST_DETAILS = 34;	//REQUIRED
var ES_WRITE_TOTAL_DESIGNS_IN_LIST = 35;
var ES_DEFINE_DESIGN_LIST_ELEMENTS = 36;	//REQUIRED
var ES_SET_ZOOM_LIST_IMAGES = 37;
var ES_WRITE_LIST_FILTER_MENU = 38;
var ES_WRITE_ITEMS_TO_DISPLAY = 39;

var http_request = false;
var global_sPrice,global_cPrice,global_nPrice,yheight,xwidth;
var global_sGblDivID = "";
var global_sGblBkgnd = "";
var global_lrg_img = "";
var global_pid = 0;
var global_pName = "";
var global_section_id = 0;
var global_formname = "";
var global_sug_bkgnd = "#FFFFFF";
var global_sml_img_front = "";
var global_sml_img_back = "";
var global_lrg_img_front = "http://e-shirt.com/images/clear.gif";
var global_lrg_img_back = "http://e-shirt.com/images/clear.gif";
var global_detailpage_url = "http://e-shirt.com/cat_details.php";
var global_listingpage_url = "http://e-shirt.com/product_ES_list.php";
var global_page_url_GET = "?prod=";
var global_main_div_img = "detail_img";
var global_main_img = "img_0";
var global_side_display = 1;
var global_sessionid = "";
var global_search = "";
var global_default_search = "";
var global_default_category = "";
var global_cat_list = "", global_cur_cat = "";
var global_storeid = 0;
var global_token = 0;
var global_sortby = 0;
var global_cur_catid = 0;
var global_cur_cattitle = "";
var global_cur_search_keywords = "";
var global_rec_count=0, global_rec_total=0, global_rec_page=0, global_rec_pagesize=0, global_feed_version=1.0;
var global_col_per_page=4, global_items_per_page=0;
var global_shopcart_url = "http://artapart.com/e-shirt/shoppingcart.asp";
var global_submitvars = "";
var oProduct = new ProductOptions();
var global_bProductShown = false;
var global_page_type = 0;
var ES_PRODUCT_DETAIL_PAGE = 0;
var ES_PRODUCT_LIST_PAGE = 1;
var global_commands_loaded=false;
var global_XML_processed=false;
var global_list_template_parent, global_list_template_Inner_HTML, global_list_item_spacer="";
var global_list_begin_line_spacer, global_list_between_row_spacer, global_list_row_container, global_list_height=0, global_list_images_zoom=false;
var global_price = 0;
var global_es_bounceprotect = 0;
var global_buybox_content = "";
var global_pricebox_content = "";
var global_progressbar = 0;
var global_nAlt_Counter=0;
var global_togfltr=false;
var global_eshirt_pagemode=0, global_pro_pagemode=0;
var global_sPleaseWait = "<table><tr><td bgcolor='#FFFFFF'><font color='#000000' size=3><b>Please Wait...</b></font></td></tr><tr><td><font size=1>The current page is loading...<br>This box will automatically close.</font></td></tr></table>";
var global_cartMsg = "", global_cartdiffitems=0, global_carttotitems=0, global_currencyindicator="$";

var ns4, ie4, ie5, moz;
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
ie5 = (document.getElementByID && document.all)? true:false;
moz = (document.getElementById)?true:false;
var aPC = new Array();
var aPI = new Array();
var isW3 = (document.getElementById && true);

var aAttrib001_1 = new Array(0);	//Write Product Title in Tag contents ex. Register_ID(1,"dsn_title")
var aAttrib002_1 = new Array(0);	//Write Product Title in Tag Title Attribute Register_ID(2,"dsn_title")
var aAttrib003_1 = new Array(0);	//Write Product Title in Tag Title Attribute Register_ID(3,"page", "Page Prefix", "Page Postfix")
var aAttrib003_2 = new Array(0);	
var aAttrib003_3 = new Array(0);	
var aAttrib004_1 = new Array(0);	//Write Product Description in Tag contents ex. Register_ID(4,"dsn_desc")
var aAttrib005_1 = new Array(0);	//Write Product Title in Tag Title Attribute Register_ID(5,"dsn_desc")
var aAttrib006_1 = new Array(0);	//Write Product Title in Tag Title Attribute Register_ID(6,"page", "Page Prefix", "Page Postfix")
var aAttrib006_2 = new Array(0);
var aAttrib006_3 = new Array(0);
var aAttrib007_1 = new Array(0);	//Write Product Section in Tag contents Register_ID(7,"dsn_section", "ROOT CATEGORY")
var aAttrib007_2 = new Array(0);	//Contains default title if no section name exists.
var aAttrib007_3 = new Array(0);	//If true, then Section name is written with a clickable hyperlink
var aAttrib008_1 = new Array(0);	//Write current Product Price: 	Register_ID(8,"dsn_price")
var aAttrib008_2 = new Array(0);	//	Determines wether the '$' is automatically displayed or not.  By default the '$' is displayed. 2=Display, 1=Do Not Display.
var aAttrib009_1 = new Array(0);	//Write Shopping cart button if product is for sale. ex. Register_ID(9,"page", "code for button", "code for NFS image.")
var aAttrib009_2 = new Array(0);	//Shopping cart button 
var aAttrib009_3 = new Array(0);	//Not For Sale Graphic
var aAttrib010_1 = new Array(0);	//Write current background color for image.
var aAttrib011_1 = new Array(0);	//Writes current products ID to TAG attribute specified in the third parameter, the forth parameter can be specified for a prefix.
var aAttrib011_2 = new Array(0);	//Contains the ex.  Register_ID(9,"dsn_hid_pid", "title", "prefix to the paste.") or Register_ID(9,"dsn_hid_pid", "title")
var aAttrib011_3 = new Array(0);
var aAttrib012_1 = new Array(0);	//Write Alt Product Title in Tag Register_ID(12, "dsn_alt1_title", 1) Where '1' is the 1st alternate, '2' would be the second.
var aAttrib012_2 = new Array(0);	//Contains the ALT ref.
var aAttrib013_1 = new Array(0);	//Write Alt Product Ref in <a href> tag Register_ID(13, "dsn_alt1_href", 1, "Prefix") Where '1' is the 1st alternate, '2' would be the second.
var aAttrib013_2 = new Array(0);	//Contains the ALT ref.
var aAttrib013_3 = new Array(0);	//Contains the URL Prefix ex. "http://url.com/productItem.asp?prod="

var aAttrib014_1 = new Array(0);	//Write Alt Product Image in IMG SRC Register_ID(14, "dsn_alt1_img", 1) Where '1' is the 1st alternate, '2' would be the second.
var aAttrib014_2 = new Array(0);	//Contains the ALT ref.
var aAttrib014_3 = new Array(0);	//Default Image to use if an ALTERNATE does not exist.
var aAttrib015_1 = new Array(0);	//Write Main Image DIV Container ID Register_ID(15, "detail_img", "dsn_img0", "img_0", 1)	where '1' is side #1 and '2' is side #2, blank is auto switch
var aAttrib015_2 = new Array(0);	//Write Main Image to Tagged IMG SRC  (REQUIRED)
var aAttrib015_3 = new Array(0);	//Record Main Image NAME (REQUIRED)
var aAttrib015_4 = new Array(0);	//[Optional]: Contains the side to display.  Empty or blank is automatic (which ever side is available or front if both).
var aAttrib016_1 = new Array(0);	//Attach Main Image Zoom Register_ID(16, "dsn_img0")
var aAttrib017_1 = new Array(0);	//Attach Add Page Bookmark Hyperlink Register_ID(17, "bookmark1")
var aAttrib021_1 = new Array(0); //Register image button used to switch to FRONT view of Product. ex. Register_ID(21, "img_frnt") or Register_ID(21, "img_frnt", "http://myURL.com/image.gif") 
var aAttrib021_2 = new Array(0); //Used to specify optional image to use for FRONT button.
var aAttrib022_1 = new Array(0); //Register image button used to switch to BACK view of Product. Register_ID(22, "img_back") or Register_ID(22, "img_back", "http://myURL.com/image.gif")
var aAttrib022_2 = new Array(0); //Used to specify optional image to use for BACK button.
var aAttrib023_1 = new Array(0); //Add Mouseover Magnification to Any Image Register_ID(23, "dsn_alt1_img") Where '1' is the 1st alternate, '2' would be the second.
var aAttrib023_2 = new Array(0); //Background color (default #FFFFFF)
var aAttrib024_1 = new Array(0); //Register Product form name for dynamic creation of product data formvariables. ex. Register_ID(24, "tForm0")
var aAttrib025_1 = new Array(0); //Auto Adjust Image Size, Center in Container, and account for PNG transparencies. ex. Register_ID(25, "ImgID", "ContainerID", MaxX, MaxY)
var aAttrib025_2 = new Array(0);	//Contains Img Container ID
var aAttrib025_3 = new Array(0);	//Contains Maximum Width (X) size of final image.
var aAttrib025_4 = new Array(0);	//Contains Maximum Height (Y) size of final image.
var aAttrib026_1 = new Array(0);	//Contains ID reference location to write the Quantity selection.

var aAttrib027_1 = new Array(0);	//Contains ID reference Location to Write Apparel Selection. ex. Register_ID(ES_WRITE_APPAREL_SELECTION, "appSliderID")
var aAttrib027_2 = new Array(0);	//	OPTIONAL: if "dropdown" is specified, then a standard dropdown menu is provided instead of the slider.
var aAttrib028_1 = new Array(0);	//Contains ID reference Location to Write Color Selection. ex.
var aAttrib028_2 = new Array(0);	//	OPTIONAL: if "dropdown" is specified, then a standard dropdown menu is provided instead of the slider.
var aAttrib029_1 = new Array(0);	//Contains ID reference Location to Write Size Selection. ex. Register_ID(ES_WRITE_SIZE_SELECTION, "szDropMenu")
var aAttrib029_2 = new Array(0);	//	OPTIONAL: if "dropdown" is specified, then a stylized dropdown menu is provided instead of a default windows dropdown.
var aAttrib030_1 = new Array(0);	//Write Shopping Cart URL Ref in <a href> tag Register_ID(ES_WRITE_SHOPPING_CART_HYPERLINK, "Shopping_cart_link")
//var aAttrib031_1 = new Array(0);	//Contains ID of reference location to Write the Searchbox. ex. Register_ID(ES_ADD_SEARCH_BOX, "searchID", true, false, "SearchBoxLoc", "CatBoxLoc")	where the first true means to include a textual search box, and the second false means to NOT include a category selection box.
//var aAttrib031_2 = new Array(0);	//Include a Search Term search box
//var aAttrib031_3 = new Array(0);	//Include a Category Selection Dropdown.
//var aAttrib031_4 = new Array(0);	//Optional Location for Search Keywords Text box.
//var aAttrib031_5 = new Array(0);	//Optional Location for Category DropDwon.
var aAttrib032_1 = new Array(0);	//Contains ID of reference location to Write the Page List (NEXT 1,2,3,4 PREV) selection and paging hyperlinks. ex. Register_ID(ES_WRITE_PAGE_SELECTION, "pagingDiv");
var aAttrib033_1 = new Array(0);	//Contains ID of reference location to write list sort method selection menu. ex. Register_ID(ES_WRITE_PAGE_SORT_METHOD_SELECTION, "sortDiv");
var aAttrib033_2 = new Array(0);	//  Configures the sort selector output for Dropdown Combobox (set to "dropdown") or UL/LI (set to "ul") format.  Default is dropdown Combobox.
																	//	Formatting can be done by tweaking the classes "ES_sortselect" & "ES_sortselect_choice"
var aAttrib033_3 = new Array(0);	//	Sets a Default Sort Method, unset the method is NEWEST.
var aAttrib034_1 = new Array(0);	//Sets the Number of design columns Shown on Page. MAX=8, MIN=1 ex. Register_ID(ES_SET_DESIGN_LIST_DETAILS, 4, 12);
var aAttrib034_2 = new Array(0);	//Sets the maximum number of designs displayed per page (MAX=30).
var aAttrib035_1 = new Array(0);	//Write the total number of designs found in the list to the specified ID. ex. Register_ID(ES_WRITE_TOTAL_DESIGNS_IN_LIST, "totalDesignsID");

var aAttrib036_1 = new Array(0);	//Contains Parent Div ID to Replicate across all products. ex. Register_ID(ES_DEFINE_CUSTOM_LIST_ITEM, "Product_Container", 30, "Image_Container", "Title_Container", "Price_Container", "Button_Container");
var aAttrib036_2 = new Array(0);	//Contains Spacer Width between products -or- ID of div to use for spacing.
var aAttrib036_3 = new Array(0);	//Contains Div ID for the container that will contain the Design Image (and be used for background adjustments).
var aAttrib036_4 = new Array(0);	//Contains Div ID for Design Title Bar.
var aAttrib036_5 = new Array(0);	//Contains Div ID for Price
var aAttrib036_6 = new Array(0);	//Contains Div ID for Button (Click destination assigned only)
var aAttrib036_7 = new Array(0);	//Contains Div ID for the beginning of row element.
var aAttrib036_8 = new Array(0);	//Contains Div ID for the spacer between Rows.
var aAttrib036_9 = new Array(0);	//Contains Div ID for the Row Element (if Exists).

var aAttrib037_1 = new Array(0);	//Contains 'ON' or 'OFF', and toggles the Zoom effect for list images.
var aAttrib038_1 = new Array(0);	//Inserts the filter menu and capability into the page at the specified location.
var aAttrib038_2 = new Array(0);	//	OPTIONAL: Defines the Filter Menu Text.  Default is "+ filter results"
var aAttrib038_3 = new Array(0);	//	OPTIONAL: Set Default Category
var aAttrib038_4 = new Array(0);	//	OPTIONAL: Set Default Search Terms

var aAttrib039_1 = new Array(0);	//Contains ID of reference location to write number of Items to Display on LIST page (designs per page);
var aAttrib039_2 = new Array(0);	//  Configures the PerPage output for Dropdown Combobox (set to "dropdown") or UL/LI (set to "ul") format.  Default is dropdown Combobox.
																	//	Formatting can be done by tweaking the classes "ES_itemppselect" & "ES_itempp_choice"
var aAttrib040_1 = new Array(0);	//Contains the Div ID for the location to write the number of items in the shopping cart.  This is done immediately after start-up.
var aAttrib040_2 = new Array(0);	//	This is the Div ID for the location to write the number of different items in the shopping cart.
var aAttrib041_1 = new Array(0);	//Write Alt Product Description in Tag Register_ID(41, "dsn_alt1_desc", 1) Where '1' is the 1st alternate, '2' would be the second.
var aAttrib041_2 = new Array(0);	//	Contains the ALT ref.
var aAttrib042_1 = new Array(0);	//When an apparel type is selected, this function write specific information about the apparel or product to specifiec IDs.	ex. Register_ID(ES_WRITE_PRODUCT_SPECIFICS_AJAX ,"apptitle", "appdesc", "appbrand", "appmodel", "appfeatures", "appimage");
																	// If a specific items is not desired, then an empty string should be supplied for that parameter.  The first parameter is the ID of the location to place the Apparel Title.
var aAttrib042_2 = new Array(0);	//	ID of the Apparel Description
var aAttrib042_3 = new Array(0);	//	ID of where to put the BRAND LOGO Image
var aAttrib042_4 = new Array(0);	//	ID of where to place the Product Model.
var aAttrib042_5 = new Array(0);	//	ID of where to place the feature list.
var aAttrib042_6 = new Array(0);	//	ID of where to place the image in the apparel image.  A Blank image MUST be loaded in this location(DIV) so that a "ES_ONLOAD_IMAGE_ADJUSTMENTS" command can be issed on this element.
var aAttrib043_1 = new Array(0);	//Sets the Page E-Shirt Content Mode: 0=private freelance store, 1=All e-shirt designs, 2= No E-Shirt designs
var aAttrib043_2 = new Array(0);	//	Sets the Page Pro-Design Content Mode: 0=No Pro-Designs, 1=All Pro-Designs
var aAttrib044_1 = new Array(0);	//Write Alt Product Background Color in Container Register_ID(ES_WRITE_ALT_PRODUCT_BCK_COLOR, "dsn_alt1_div", 1, "#FFFFFF") Where '1' is the 1st alternate, '2' would be the second.
var aAttrib044_2 = new Array(0);	//Contains the ALT ref.
var aAttrib044_3 = new Array(0);	//Default Color to use if none available.

var aAttrib100_1 = new Array(0);  //Register functions to execute when load has completed.

$(document).ready(function(){ es_LoadFunction()});	//jQuery - Load on Page Ready.

 function makeRequest(url, parameters, handler) {
/*		Disabled on 12/04/2009 but not propagated to compressed version.
		http_request = false;
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
			 http_request = new XMLHttpRequest();
			 if (http_request.overrideMimeType) {
					http_request.overrideMimeType('text/xml');
			 }
		} else if (window.ActiveXObject) { // IE
			 try {
					http_request = new ActiveXObject("Msxml2.XMLHTTP");
			 } catch (e) {
					try {
						 http_request = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {}
			 }
		}
		if (!http_request) {
			 alert('Cannot create XMLHTTP instance');
			 return false;
		}
*/
//alert(url + parameters + "&callback=");
//		$.ajaxSetup({cache: false}); 

	$("#ES_Progressbar").progressBar(global_progressbar+10,{running_value : global_progressbar}); global_progressbar += 10;
	//$("#ES_overDiv").ajaxError(function(event, request, settings){ global_progressbar = 0; $(this).html("<li>Error requesting Designs" + settings.url + "</li>"); });
	$("#ES_overDiv").ajaxStart(function(){ $("#ES_Progressbar").progressBar(global_progressbar+10,{running_value : global_progressbar}); global_progressbar += 10; });

	$.getJSON(url + parameters + "&callback=?&", handler);

}

/*****************************************************************************************************
This is the function where all Data manipulations are performed.  By the time we get past the (http_request.status == 200), the product
Data is already available for processing.  We now take that data, and depending on the parameters 
provided by the user manipulate the page to display the data.
DETAILS:
Data is XML format and stored in: xmldoc
*****************************************************************************************************/
function alertContents(jsondata) {
	var nListCnt=0, nListDisplayed=0, nArrayObjCntr=0, nArrayLength;
	//var nAlt_Counter = 0;
	var sLocation = "";


	if (!global_commands_loaded) return false;
	global_XML_processed = true;	// Load Semaphore

	var root = jsondata.DATAFEED;		//xmldoc.getElementsByTagName('DATAFEED')[0];
	var nodeCollection = root.COLLECTION_DETAILS;		//xmldoc.getElementsByTagName('COLLECTION_DETAILS')[0];
	try {
			if (root["@attributes"].count) {	global_rec_count = root["@attributes"].count;}
			if (root["@attributes"].total) {	global_rec_total = root["@attributes"].total;}
			if (root["@attributes"].pagesize) { global_rec_page = root["@attributes"].pagesize;	}
			if (root["@attributes"].pagesize) {	global_rec_pagesize = root["@attributes"].pagesize;}
			if (root["@attributes"].version) {	global_feed_version = root["@attributes"].version;}
			if (nodeCollection && nodeCollection["@attributes"].sortby) {global_sortby = nodeCollection["@attributes"].sortby;}
			nodeCollection = null;
	}
	catch(err) { alert(err.message); }

	try {
		//Add Image adjustment to an Images OnLoad event. Put before XML parse because it should be in place by the time SRC values are changed.
		for (nI=0; nI<aAttrib025_1.length; nI++) {
			if (getObjectById(aAttrib025_1[nI]) && aAttrib025_2[nI]!=undefined && getObjectById(aAttrib025_2[nI]) && !isNaN(aAttrib025_3[nI]) && !isNaN(aAttrib025_4[nI])) {
				eval("es_addNewEvent(aAttrib025_1[nI], 'load', function () {adjIMGs('"+aAttrib025_2[nI]+"', getObjectById('"+aAttrib025_1[nI]+"'), "+ aAttrib025_3[nI] +", "+ aAttrib025_4[nI] +");})");
			}
		}
		if (aAttrib024_1.length == 0) {
			alert("HTML ERROR: Page <FORM> ("+aAttrib024_1[nI]+") not registered using ES_REGISTER_PAGE_FORMTAG.");
			throw("terminating on No-Form error.");			
		}
		for (nI=0; nI<aAttrib024_1.length; nI++) {
			if (document.forms[aAttrib024_1[nI]] ) {		//Confirm FORM exists.
				global_formname = aAttrib024_1[0];	//Record form name for other subroutines.  FYI, this does not support multiple FORMS>..
				if (global_page_type == ES_PRODUCT_DETAIL_PAGE) {
					document.forms[aAttrib024_1[nI]].onsubmit = function() {return es_FormValidator()};
					document.forms[aAttrib024_1[nI]].action = "#";	//global_shopcart_url;
					document.forms[aAttrib024_1[nI]].method = "post";
					var aFormelems	= new Array("hidApp0","hidClr0","hidSize0","cboApp0","cboClr0","id","sprice","posted","mode","hidBase0","svc","silent","cboSize0");
					var aElemtype	= new Array("hidden","hidden","hidden","hidden","hidden","hidden","hidden","hidden","hidden","hidden","hidden","hidden","hidden");
					var aElemdefault=new Array(oProduct.Type,oProduct.Color,oProduct.Size,"","",global_pid,"","1","add","0","ES","1","");
					var aForcedefault=new Array(true,true,true,false,false,true,false,true,true,true,true,true,false);

					if (aAttrib026_1[0] == undefined || !getObjectById(aAttrib026_1[0]) ) {
						aFormelems[aFormelems.length] = "quant";
						aElemtype[aElemtype.length] = "hidden";
						aElemdefault[aElemdefault.length] = "1";
						aForcedefault[aForcedefault.length] = "false";
					}
				} else {
					document.forms[aAttrib024_1[nI]].action = global_listingpage_url;	//global_shopcart_url;
					document.forms[aAttrib024_1[nI]].method = "get";
					var aFormelems	= new Array("pg","s","stext","posted","sprice");
					var aElemtype	= new Array("hidden","hidden","hidden","hidden","hidden");
					var aElemdefault=new Array("","",GetVars('stext'),"","");
					var aForcedefault=new Array(false,false,false,false,false);
					if (getObjectById(aAttrib039_1[nI]) && aAttrib039_2[nI] != undefined && isNaN(aAttrib039_2[nI]) && aAttrib039_2[nI].toLowerCase()=="ul" ) {
						aFormelems[aFormelems.length] = "ps";
						aElemtype[aElemtype.length] = "hidden";
						aElemdefault[aElemdefault.length] = global_rec_page;
						aForcedefault[aForcedefault.length] = "false";
					}
					if (getObjectById(aAttrib033_1[nI]) && aAttrib033_2[nI] != undefined && isNaN(aAttrib033_2[nI]) && aAttrib033_2[nI].toLowerCase()=="ul" ) {
						aFormelems[aFormelems.length] = "sort";
						aElemtype[aElemtype.length] = "hidden";
						aElemdefault[aElemdefault.length] = parseInt(GetVars('sort'));
						aForcedefault[aForcedefault.length] = "false";
					}
					if (global_eshirt_pagemode==0 ) {
/* NOTE: in the condition: global_eshirt_pagemode==0 && global_pro_pagemode==1 a category for Pro-designs can be selected by putting the form variable scat=XX in the main form element. */
						aFormelems[aFormelems.length] = "sec";
						aElemtype[aElemtype.length] = "hidden";
						aElemdefault[aElemdefault.length] = (GetVars('sec')==""?"0":parseInt(GetVars('sec')));
						aForcedefault[aForcedefault.length] = "false";
					} else {
						aFormelems[aFormelems.length] = "scat";
						aElemtype[aElemtype.length] = "hidden";
						aElemdefault[aElemdefault.length] = (GetVars('scat')==""?"0":parseInt(GetVars('scat')));
						aForcedefault[aForcedefault.length] = "false";
					}				


				}
				AddFormElements(global_formname, aFormelems, aElemtype, aElemdefault, aForcedefault);
			} else {
				alert("HTML ERROR: Page <FORM> ("+aAttrib024_1[nI]+") not found or not defined.");
				throw("terminating on No-Form error.");
			}
		}

	
		//The actions at this level are only performed once per data feed versus for each product elements in the XML Doc.
		if (aAttrib036_1.length > 0) {	//Was a List box defined?
			if (getObjectById(aAttrib036_1[0])) {
				if (getObjectById(aAttrib036_1[0])) $("#"+aAttrib036_1[0]).show();
				//Get ref of Master Copies PARENT
				if (getObjectById(aAttrib036_1[0]).parentNode) {
					global_list_template_parent = getObjectById(aAttrib036_1[0]).parentNode;	//This is retained in order to give us a handle on the envelope where we append products.
				}
				//Wrap DIV around global_list_template_Inner_HTML and Assign CLASS to new Wrapper DIV around global_list_template_Inner_HTML
				//Make Master copy of Listing element.
				global_list_template_Inner_HTML = getObjectById(aAttrib036_1[0]);

				if (aAttrib036_2[0] != undefined && getObjectById(aAttrib036_2[0])) {
						global_list_item_spacer = getObjectById(aAttrib036_2[0]);
				}
				if (aAttrib036_7[0] != undefined && getObjectById(aAttrib036_7[0])) {
						global_list_begin_line_spacer = getObjectById(aAttrib036_7[0]);
				}
				if (aAttrib036_8[0] != undefined && getObjectById(aAttrib036_8[0])) {
						global_list_between_row_spacer = getObjectById(aAttrib036_8[0]);
				}
				if (aAttrib036_9[0] != undefined && getObjectById(aAttrib036_9[0])) {
						global_list_row_container = getObjectById(aAttrib036_9[0]);
				}
				tempnum1 = getObjectById("eshirt200905_container").offsetHeight - 2*parseInt(global_list_between_row_spacer.offsetHeight)- parseInt(global_list_template_parent.offsetHeight);
				if (tempnum1 < 0) tempnum1 = 0;		//In some cases this number might calculate negative, this causes un untrappable error in IE.

				getObjectById("eshirt200905_container").style.height = "" + tempnum1 + "px";

				if (aAttrib037_1[0] != undefined && isNaN(aAttrib037_1[0]) && aAttrib037_1[0].toLowerCase() == 'on' ) {
					global_list_images_zoom = true;
				} else {
					global_list_images_zoom = false;
				}

//Move this to end of cycle.
//						$("#"+global_list_template_parent.id).html("");	//Empty List Node - Erase Template now that we have it stored.
			}
		}

$("#ES_Progressbar").progressBar(global_progressbar+20,{running_value : global_progressbar}); global_progressbar += 20;
		//Cycle through every Product/Owner element in the XML document
		for (var iNode in root) {	//Product_Data, COLLECTION_DETAILS, SECTIONS & Owner_Data(data)

			if (global_progressbar < 80) {
				$("#ES_Progressbar").progressBar(global_progressbar+5,{running_value : global_progressbar}); global_progressbar += 5;
			}

			var node = root[iNode];		//root.childNodes.item(iNode);
			if (isArray(node)) {
				nArrayObjCntr = 0;
				nArrayLength = node.length;
				global_sml_img_front = "";
				global_sml_img_back = "";
				global_lrg_img_front = "";
				global_lrg_img_back = "";
			} else {
				nArrayObjCntr = 0;
				nArrayLength = 1;
			}
//				for (var iNode = 0; iNode < root.childNodes.length; iNode++) {

			//Cycle through every Product Data Element in the XML Document.
			while (nArrayObjCntr < nArrayLength) {
				oActiveNode = node[nArrayObjCntr];

				if (isArray(node)) {
					oActiveNode = node[nArrayObjCntr];
				} else {
					oActiveNode = node;
				}
				//Zero out any variables that need to be reset between products.

				for (var sNodeKey in oActiveNode) {
					JSONdataengine(oActiveNode, sNodeKey);
				} //FOR (Params)
				if ( iNode == "PRODUCT_DATA" && global_page_type == ES_PRODUCT_LIST_PAGE ) {
					nListCnt++;
					es_ListItemFill(document, global_list_template_Inner_HTML, nListCnt, global_list_images_zoom);

					global_list_item_template = global_list_template_Inner_HTML.cloneNode(true);
					global_list_item_template.id="es200905_"+nListCnt;																					//Rename the product envelope to make it unique.

					//Add spacer
					if (nListCnt <= global_rec_page) {
						nListDisplayed++;
						global_list_template_parent.insertBefore(global_list_item_template, global_list_template_Inner_HTML);
						if (nListCnt%global_col_per_page != 0) {
							oTemp = global_list_item_spacer.cloneNode(true);
							oTemp.id = "es200905spcr_"+nListCnt;
							global_list_template_parent.insertBefore(oTemp, global_list_template_Inner_HTML);
						} else {
							//Perhaps you will need to insert a short long DIV spacer here between cells.

							oTemp = global_list_begin_line_spacer.cloneNode(true);
							oTemp.id = "es200905bol_"+nListCnt;
							global_list_template_parent.insertBefore(oTemp, global_list_template_parent.firstChild);

							if (nListCnt != global_rec_page) {
								//Get NODE CLONE of template for new row and Delete old template in last row
								oTemp4 = global_list_template_Inner_HTML.cloneNode(true);
								$("#"+global_list_template_Inner_HTML.id).remove();
								oTemp4.id = aAttrib036_1[0];

								//Get parent of ROW and APPEND new row (global_list_template_Inner_HTML)
								oTemp3 = global_list_row_container.cloneNode(false);
								oTemp3.id = "es200905_row_"+nListCnt;
								global_list_template_parent.parentNode.appendChild(oTemp3);
								global_list_template_parent = getObjectById("es200905_row_"+nListCnt);
								
								//Paste Template into New Row
								global_list_template_parent.appendChild(oTemp4);
								global_list_template_Inner_HTML = getObjectById(aAttrib036_1[0]);
							}
							//Insert Template into new Row
							//Set global_list_template_Inner_HTML to new Template
							oTemp2 = global_list_between_row_spacer.cloneNode(true);
							oTemp2.id = "es200905brs_"+nListCnt;
							global_list_template_parent.parentNode.appendChild(oTemp2);
						}
					}
				}
				nArrayObjCntr++;
			} //While Array
		}//FOR Document

		$("#ES_Progressbar").progressBar(global_progressbar+10,{running_value : global_progressbar}); global_progressbar += 10;

		if (nListCnt%global_col_per_page != 0) {	//Finish off a row if it was not completely filled. (Partial row)
			nListDisplayed = nListDisplayed + (global_col_per_page - (nListCnt%global_col_per_page));		//Add the remaining items in row to trick envelop height adjustor.
			oTemp = global_list_begin_line_spacer.cloneNode(true);
			oTemp.id = "es200905bol_"+nListCnt;
			global_list_template_parent.insertBefore(oTemp, global_list_template_parent.firstChild);
		}
		/* Clean up before adjusting height, otherwise the garbage will adjust footer location */
		if (global_list_template_Inner_HTML) $("#"+global_list_template_Inner_HTML.id).remove();
		if (global_list_begin_line_spacer) $("#"+global_list_begin_line_spacer.id).remove();
		if (global_list_item_spacer) $("#"+global_list_item_spacer.id).remove();
		$(".cat_rowspacer:last").remove();

		/* No items in the Product Listing, give them the option of searching or Going to the full list. */
		if (nListCnt==0 && global_page_type == ES_PRODUCT_LIST_PAGE) {
			var sEmptyList = "<table><tr><td bgcolor='#FFFFFF'><font color='#000000' size=3><b>No Items to Display</b></font></td></tr><tr><td><font size=1><a href=\""+global_listingpage_url+"\" title=\"View All Items\">Click to Return to -ALL- Items.</a><br>";
			if (aAttrib038_1[nI] != undefined && getObjectById(aAttrib038_1[nI]))	
				sEmptyList += "<a href=\"javascript:$('#ES_filtermenu').slideToggle('normal'); es_gradient('eshirt200905_body', 1.0); toggleBox('overDiv', 0); void(0);\" title=\"View All Items\">Click Here to Search Catalog.</a>";
			sEmptyList += "</font></td></tr></table>";
			overlib(sEmptyList, STICKY, FIXX, es_CenterXPos()-80, RELY, 200);
			toggleBox('overDiv', 1);
			es_gradient('eshirt200905_body', 0.2);
			$("#overDiv").show("normal", function () {toggleBox('overDiv', 1);});	
		}

		if (global_list_row_container) {
//alert(parseInt(getObjectById("eshirt200905_container").style.height));
//alert((parseInt(nListDisplayed / global_col_per_page))*(global_list_row_container.offsetHeight + 12));
//			$("#eshirt200905_container").animate({height: parseInt(getObjectById("eshirt200905_container").style.height) + (parseInt(nListDisplayed / global_col_per_page))*(global_list_row_container.offsetHeight + 0) + "px"}, 2000);
			$("#eshirt200905_container").animate({height: $(document).height() + "px"}, 2000);
		} else {
			nCurHeight = getObjectById("eshirt200905_container").style.height;
			nCurBodyHeight = ($.browser.msie)?document.body.offsetHeight:window.innerHeight;
//alert(nCurBodyHeight);
			if (!nCurHeight || nCurHeight < 600) {
				if (!nCurHeight) nCurHeight = 50;
//alert(parseInt(parseInt(getObjectById("eshirt200905_footer").offsetHeight)));
//alert(nCurBodyHeight);
//alert($(document).height());
//alert(2*parseInt(getObjectById("eshirt200905_footer").offsetHeight) + nCurBodyHeight); 2*parseInt(getObjectById("eshirt200905_footer").offsetHeight) +
				$("#eshirt200905_container").animate({height: $(document).height() + "px"}, 2000);
			}
		}
			
	}	//try
	catch(e) {
		if (isNaN(e)) {
			alert("ERROR: "+ e +". Terminating Execution, please retry.");
			throw("termiating on feed error.");
		} else {
			alert(e.name + ": "+e.message);
		}
	}
	
	if (!$.browser.safari ) { 
		for (nI=0; nI<aAttrib023_1.length; nI++) {
			sDefBckgnd = "#FFFFFF";
			if ($("#"+aAttrib023_1[nI]).attr("ESbackgroundColor") != undefined) {
				sDefBckgnd = $("#"+aAttrib023_1[nI]).attr("ESbackgroundColor");
				if (sDefBckgnd.length > 5 && sDefBckgnd.length < 7 && sDefBckgnd.indexOf("#")==-1) sDefBckgnd = "#"+sDefBckgnd;
			}

			if (aAttrib023_2[nI] != undefined) {		//We have found a non-default background color.
				sDefBckgnd = aAttrib023_2[nI];
			}
			eval("es_addNewEvent(aAttrib023_1[nI], 'mouseover', function () { es_gradient('eshirt200905_body', 1.0); toggleBox('overDiv', 0); sImgSrc=getObjectById('"+aAttrib023_1[nI]+"').src; if (sImgSrc != '' && sImgSrc.search('clear.gif') ==-1) {overlib(es_Zoom_in('"+sDefBckgnd+"', 'http://e-shirt.com', sImgSrc),FGCOLOR,'#FFFFFF',BGCOLOR,'#000000',WIDTH,194,VAUTO,HAUTO,TEXTPADDING,0,BORDER,0); $(\"#overDiv\").show(\"normal\");}})");
			eval("es_addNewEvent(aAttrib023_1[nI], 'mouseout', function () { try { return nd(); } catch(err) {} })");
		}
	}
	//There may be in filled alternate slots that had default URLs and Images.  Fill those now.
	for (nJ=global_nAlt_Counter; nJ<5; nJ++) {
		for (nI=0; nI<aAttrib013_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
			if (getObjectById(aAttrib013_1[nI]) && aAttrib013_2[nI] != undefined && !isNaN(aAttrib013_2[nI])) {
				if (aAttrib013_2[nI] == nJ && aAttrib013_3[nI] != undefined) {		//We have found the default value
					getObjectById(aAttrib013_1[nI]).href = aAttrib013_3[nI];
				}
			}
		}
		for (nI=0; nI<aAttrib014_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
			if (getObjectById(aAttrib014_1[nI]) && aAttrib014_2[nI] != undefined && !isNaN(aAttrib014_2[nI])) {
				if (aAttrib014_2[nI] == nJ && aAttrib014_3[nI] != undefined) {		//We have found the default value
					getObjectById(aAttrib014_1[nI]).src = aAttrib014_3[nI];
				}
			}
		}
	}

	for (nI=0; nI<aAttrib030_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
		if (getObjectById(aAttrib030_1[nI])) {
			sURL = global_shopcart_url+"?SID="+MakeSessionID(global_sessionid)+"&MID="+global_storeid;
			getObjectById(aAttrib030_1[nI]).href = sURL;
		}
	}

	objFormVar = document.forms[global_formname];
	if (!objFormVar) alert("HTML ERROR: Page Form ("+global_formname+") not found or not defined.");

	for (nI=0; nI<aAttrib028_1.length; nI++) {
		if (getObjectById(aAttrib028_1[nI]) && nI==0) {//Only do it once...
			if (aAttrib028_2[nI] == undefined || !isNaN(aAttrib028_2[nI]) || aAttrib028_2[nI].toLowerCase() != "dropdown") {
				es_OutputSlider(objFormVar.hidClr0.value, 0);	//Start Color Slider
			} else {
				es_GarmentSelect(aAttrib028_1[nI], objFormVar.hidClr0.value, 0);
			}
		}
	}
	for (nI=0; nI<aAttrib027_1.length; nI++) {
		if (getObjectById(aAttrib027_1[nI]) && nI==0) {	//Only do it once...
			if (aAttrib027_2[nI] == undefined || !isNaN(aAttrib027_2[nI]) || aAttrib027_2[nI].toLowerCase() != "dropdown") {
				es_OutputSlider(objFormVar.hidApp0.value, 0);		//Start Apparel Slider
			} else {
				es_GarmentSelect(aAttrib027_1[nI], objFormVar.hidApp0.value, 0);
			}
		}
	}

	$("#ES_Progressbar").progressBar(global_progressbar+5,{running_value : global_progressbar}); global_progressbar += 5;

	/* This makes the dropdown appear and disappear */
	$(".dropdown dt a").live("click", function() { $(this).parent().siblings("dd").children("ul").toggle() });	//$(".dropdown dd ul").toggle(); $(this).parent().parent("dd ul").toggle();
//	$(".dropdown dt a").click(function() { $(this).parent().siblings("dd").children("ul").toggle() });	//$(".dropdown dd ul").toggle(); $(this).parent().parent("dd ul").toggle();
	
//	$(".dropdown dd ul li a").click(function() {
	$(".dropdown dd ul li a").live("click", function() {
			var text = $(this).html();
			var sAttrib = $(this).attr("title");
			$(this).parent().parent().parent().siblings('dt').children('a').children('span').html(text);
			$(this).parent().parent().parent().siblings('dt').children('a').children('span').attr("title", sAttrib);
			objFormVar = document.forms[global_formname];
			sActiveID = $(this).parent().parent().parent().parent().parent().attr('id');
			sFormField = "";
			switch (sActiveID) {
				case "appselect": sFormField = "cboApp0"; break;
				case "clrselect":  sFormField = "cboClr0"; break;
				case "sizeselect":  sFormField = "cboSize0";	break
			}
			eval("objFormVar."+ sFormField +".value="+ getSelectedValue(sActiveID));
			$(".dropdown dt a span img").remove();
			$(".dropdown dd ul").hide();
	}); 
	$(document).bind('click', function(e) {
    var $clicked = $(e.target);
    if (! $clicked.parents().hasClass("dropdown"))
        $(".dropdown dd ul").hide();
	});


/*	for (nI=0; nI<aAttrib031_1.length; nI++) {			//Change Tag Contents
		var bSearchTerms=false, bCategorySel=false, sSearchDiv="", sCatDiv="";
		if (aAttrib031_2[nI] != undefined ) {
			if (aAttrib031_2[nI]) {bSearchTerms = true;}
		}
		if (aAttrib031_3[nI] != undefined ) {
			if (aAttrib031_3[nI]) {bCategorySel = true;}
		}
		if (aAttrib031_4[nI] != undefined ) sSearchDiv = aAttrib031_4[nI];
		if (aAttrib031_5[nI] != undefined ) sCatDiv = aAttrib031_5[nI];
		CreateSearchBox(aAttrib031_1[nI], bSearchTerms, bCategorySel, sSearchDiv, sCatDiv);
	}	
*/
	for (nI=0; nI<aAttrib032_1.length; nI++) {	//Write Paging links.
		if (getObjectById(aAttrib032_1[nI])) {
			alterDivContent(aAttrib032_1[nI], WritePagingLinks() );
		}
	}
	for (nI=0; nI<aAttrib038_1.length; nI++) {	//Write Filter menu.
		if (getObjectById(aAttrib038_1[nI])) {
			sFilterTxt = "";
			if (aAttrib038_2[nI] != undefined ) {
				if (aAttrib038_2[nI] && aAttrib038_2[nI] != "") {sFilterTxt = aAttrib038_2[nI];}
			}
			alterDivContent(aAttrib038_1[nI], FilterList(sFilterTxt) );
			es_addNewEvent("es_search", "change", function () {document.forms[global_formname].stext.value = this.value;});	//Save searchs to stext form variable
			es_addNewEvent("es_reset1", "click", function () {document.forms[global_formname].stext.value = "";});
			qm_create(0,true,250,250,false,false,false,false,false);
		}
	}

	for (nI=0; nI<aAttrib033_1.length; nI++) {	//Write Sorting menu.
		if (getObjectById(aAttrib033_1[nI])) {
			sListType = "dropdown";
			if (aAttrib033_2[nI] != undefined && isNaN(aAttrib033_2[nI]) ) sListType = aAttrib033_2[nI].toLowerCase();
			alterDivContent(aAttrib033_1[nI], SortMenu(sListType) );
		}
	}
	for (nI=0; nI<aAttrib039_1.length; nI++) {	//Write Items per page menu.
		if (getObjectById(aAttrib039_1[nI])) {
			sListType = "dropdown";
			if (aAttrib039_2[nI] != undefined && isNaN(aAttrib039_2[nI]) ) sListType = aAttrib039_2[nI].toLowerCase();
			alterDivContent(aAttrib039_1[nI], ItemsPP(sListType) );
		}
	}
	for (nI=0; nI<aAttrib035_1.length; nI++) {	//Write total designs in list
		if (getObjectById(aAttrib035_1[nI])) {
			alterDivContent(aAttrib035_1[nI], global_rec_total );
		}
	}
	//toggleBox("overDiv", 0);
	if (aAttrib040_1.length > 0) {
		parameters = "?det=0&ses="+ global_sessionid +"&t="+ global_token +"&s="+global_storeid;
		if (global_cartdiffitems==0 && global_carttotitems == 0) {
			makeRequest("http://e-shirt.com/ajaxadd_JSON.php", parameters, cartCount );
		}
	}
	
	$("#ES_Progressbar").progressBar(99,{running_value : global_progressbar}); global_progressbar = 99;
	//OK, all data has been placed.  Now run all code that has to be run after loading.
	for (nI=0; nI<aAttrib100_1.length; nI++) {
		eval(aAttrib100_1[nI]);
	}
//	$("#ES_Progressbar").fadeOut(2000);
//	$("#ES_overDiv").fadeOut(3000, function() {$('#ES_overDiv').html('');});

	$("#ES_Progressbar").progressBar(100 , {
	 callback: function(data){
			if (data.running_value==data.value){
				$("#ES_Progressbar").fadeOut(2000);
				$("#ES_overDiv").fadeOut(3000, function() {$('#ES_overDiv').html('');});
			}
		}
	});
}

//Take specific actions for the various Product Child Nodes (by NODE NAME). Note that this is a UNION of ProductList and ProductDetail Node names.
function JSONdataengine(node, sNodeKey) {
	var oImg, nDsnQuantity, bFoundID, sID, altnode, sTitle, sImgURL, sPrefix, sPostfix, sURL, objFormVar, sTemp;

	var sibl = node[sNodeKey];		//node.childNodes.item(i);
	sContents = sibl;		//getNodeText(sibl);
	switch (sNodeKey) {
		case "ERRORS":
			if (sContents.replace(/^\s+|\s+$/g,"") != "" && sContents.replace(/^\s+|\s+$/g,"") != "OK") throw(sContents);	//If Error field is not empty
			break;
		case "CAT_NAME": //Product_List
			for (var iCat in sibl) {	//Loop through each Apparel Arrat Element
				var catNode = sibl[iCat];
				if (catNode.catid && catNode.name) {
					sID = catNode.catid;
					sContents = catNode.name;
					if (parseInt(sID)==((global_eshirt_pagemode==0)? parseInt(GetVars('sec')) : parseInt(GetVars('scat')) )) global_cur_cat = sContents;
					global_cat_list += "<li><a href=\"javascript: eval('document."+aAttrib024_1[0]+"."+ ((global_eshirt_pagemode==0)?"sec":"scat") +".value="+sID+"'); document."+aAttrib024_1[0]+".submit(); \">"+ sContents +"</a></li>";
				}
			}
			break;
		case "PRODUCT_ID":	//DETAILS ONLY (NOT CONVERTED TO JSON)
			global_pid = sContents;
			for (nI=0; nI<aAttrib011_1.length; nI++) {			//Change Title Attribute Contents
				if (getObjectById(aAttrib011_1[nI]) && aAttrib011_2[nI] != undefined) {
					sPrefix = "";
					if (aAttrib011_3[nI] != undefined) sPrefix = aAttrib011_3[nI];
					try { eval("getObjectById(aAttrib011_1[nI])."+ aAttrib011_2[nI] +" = sPrefix+sContents"); }
					catch (e) {}
				}
			}
			break;
		case "PRODUCT_NAME":
			global_pName = sContents;
			for (nI=0; nI<aAttrib001_1.length; nI++) {			//Change Tag Contents
				alterDivContent(aAttrib001_1[nI], sContents);
			}
			
			for (nI=0; nI<aAttrib002_1.length; nI++) {			//Change Title Attribute Contents
				if (getObjectById(aAttrib002_1[nI]))
					getObjectById(aAttrib002_1[nI]).title = sContents;
			}
			
			if (aAttrib003_1.length > 0)										//Set Webpage Title
				document.title = (aAttrib003_2.length>0?(aAttrib003_2[0]+" "):"")+sContents+(aAttrib003_3.length>0?(" "+aAttrib003_3[0]):"");
	
			for (nI=0; nI<aAttrib017_1.length; nI++) {			//Set Bookmarks
				if (getObjectById(aAttrib017_1[nI]))
					es_changeFunction(aAttrib017_1[nI], es_addBookmark);
			}
	
			break;
		case "DESCRIPTION":
			for (nI=0; nI<aAttrib004_1.length; nI++) {			//Change Tag Contents
				alterDivContent(aAttrib004_1[nI], (sContents.length==0)?"&lt;no description for this product&gt;":sContents );
			}
			
			for (nI=0; nI<aAttrib005_1.length; nI++) {			//Change Title Attribute Contents
				if (getObjectById(aAttrib005_1[nI]))
					getObjectById(aAttrib005_1[nI]).description = sContents;
			}
			if (global_page_type == ES_PRODUCT_DETAIL_PAGE && aAttrib006_1.length > 0)										//Set Webpage Description
				document.title = (aAttrib006_2.length>0?aAttrib006_2[0]:"")+" "+sContents+" "+(aAttrib006_3.length>0?aAttrib006_3[0]:"");
			break;
		case "SECTION_NAME":
			break;
		case "SEARCH"://PRODUCT_LIST only - Category for each product in list.
			global_cur_search_keywords = sContents;
			global_search = sContents;
			sContents = "Search&nbsp;-&nbsp;" + sContents.substr(0,12) + ((sContents.length>12)?"...":"");
			//We don't put a 'break' here because we want it to flow into the next section.
		case "CATEGORY":	//PRODUCT LIST ONLY
			if (sibl.catid) global_cur_catid = sibl.catid;
			if (sibl.name) global_cur_cattitle = sibl.name;
			//break;	Allow it to flow into SECTION...
		case "SECTION":	//DETAILS ONLY (Singular)
			for (nI=0; nI<aAttrib007_1.length; nI++) {			//Change Tag Contents
				if (getObjectById(aAttrib007_1[nI])) {
					sContents = "";
					global_section_id = 0;
					if (sibl.catid) global_section_id = sibl.catid;
					if (sibl.name) sContents = sibl.name;
					sPrefix = '';
					sPostfix = '';
					sPrefix2 = '<a class="ES_cat_href" href="'+global_listingpage_url+global_page_url_GET+'&p=1&cat=0" >';
					sPostfix2 = '</a>';
					if (aAttrib007_3[nI] != undefined && aAttrib007_3[nI]==true) {
						sPrefix = '<a class="ES_cat_href" href="'+global_listingpage_url+global_page_url_GET+'&p=1&'+ ((global_eshirt_pagemode==0)?'sec=':'scat=') + global_section_id +'" >';
						sPostfix = '</a>';
					}
					if (typeof(sContents) != "object" && sContents!="") {
						sTemp = sPrefix2+"&nbsp;"+(aAttrib007_2[nI]==""?"ALL":aAttrib007_2[nI]) + sPostfix2+ "&nbsp;&raquo;&nbsp;" +sPrefix+"&nbsp;"+ sContents + sPostfix;
					} else {
						sTemp = sPrefix2+"&nbsp;" + (aAttrib007_2[nI]==""?"ALL":aAttrib007_2[nI]) + sPostfix2;
					}
					//sTemp = sPrefix+"&nbsp;"+(sContents!=""?sContents:aAttrib007_2[nI])+sPostfix;
					alterDivContent(aAttrib007_1[nI], sTemp);
				}
			}
			break;
		case "PRODUCT_TYPE":
			break;
		case "PRICE":	//Both List and Details
			if (global_page_type == ES_PRODUCT_DETAIL_PAGE) {
				var nDsnPrice = es_CalcPrice(0,0,0,0,0);
				for (nI=0; nI<aAttrib008_1.length; nI++) {			//Change Tag Contents
					if ( aAttrib008_2[nI] != undefined && !isNaN(aAttrib008_2[nI]) && aAttrib008_2[nI]==1 ) {	//
						global_currencyindicator = "";
					}
					nDsnPrice = global_currencyindicator + nDsnPrice;
					alterDivContent(aAttrib008_1[nI], nDsnPrice);
				}
			} else {
				global_price = sContents;
			}
			break;
		case "DISPLAY":
			break;
		case "SELL":
			//Show proper indicator to customer based on wether product is for sale.
			for (nI=0; nI<aAttrib009_1.length; nI++) {			//Change Tag Contents
				var sButton = (aAttrib009_2[nI]=="")? "<input name=\"submit\" type=\"image\" value=\"1\" src=\"images/details/r11_c21.jpg\" alt=\"Add to Cart\" width=\"151\" height=\"69\" border=\"0\" onclick=\"overlib(global_sPleaseWait, STICKY, FIXX, es_CenterXPos()-80, RELY, 130);\" />" : aAttrib009_2[nI];
				var sNotForSale = (aAttrib009_3[nI]=="")? "<img src=\"images/details/unavailable.gif\" alt=\"Unavailable\" width=\"151\" height=\"69\" border=\"0\" />": aAttrib009_3[nI];
				alterDivContent(aAttrib009_1[nI], (sContents==1)?sButton:sNotForSale);
			}												
			break;
		case "SUGG_BK_COLOR":
			for (nI=0; nI<aAttrib010_1.length; nI++) {			//Change Tag Contents
				es_SetBkgndColor(aAttrib010_1[nI], sContents);
			}
			global_sug_bkgnd = sContents;
			break;
		case "SMALL_IMAGE":
			sLocation = "front";
			if (isArray(sibl)) {
				nArrayCtr = 0;
				nArrayLen = sibl.length;
			} else {
				nArrayCtr = 0;
				nArrayLen = 1;
			}
			while (nArrayCtr < nArrayLen) {
				if (isArray(sibl)) {
					sContents = sibl[nArrayCtr];
				} else {
					sContents = sibl;
				}
				nArrayCtr++;
				if (sContents.location) sLocation = sContents.location.toLowerCase();
				if (sContents.path) sImgPath = sContents.path;
			
				if (sLocation == "back") {
					global_sml_img_back = sImgPath;
					for (nI=0; nI<aAttrib022_1.length; nI++) {			//Change Tag Contents
						if (aAttrib022_1[nI]!=undefined && getObjectById(aAttrib022_1[nI]) ) {
							if (aAttrib022_2[nI] == undefined ) {
								getObjectById(aAttrib022_1[nI]).src = global_sml_img_back;	//Use small image
							} else {
								getObjectById(aAttrib022_1[nI]).src = aAttrib022_2[nI];	//Use set image
							}
							es_changeFunction(aAttrib022_1[nI], es_switchtoback);	//Set Click Action
						}	
					}
				}
				if (sLocation == "front") {
					global_sml_img_front = sImgPath;
	
					for (nI=0; nI<aAttrib021_1.length; nI++) {			//Change Tag Contents
						if (aAttrib021_1[nI]!=undefined && getObjectById(aAttrib021_1[nI])) {
							if (aAttrib021_2[nI] == undefined ) {
								getObjectById(aAttrib021_1[nI]).src = global_sml_img_front;	//Use small image
							} else {
								getObjectById(aAttrib021_1[nI]).src = aAttrib021_2[nI];	//Use set image
							}
							es_changeFunction(aAttrib021_1[nI], es_switchtofront);	//Set Click Action
						}	
					}
				}
			}
			break;
		case "LARGE_IMAGE":	
			sLocation = "front";


			if (isArray(sibl)) {
				nArrayCtr = 0;
				nArrayLen = sibl.length;
			} else {
				nArrayCtr = 0;
				nArrayLen = 1;
			}
			while (nArrayCtr < nArrayLen) {
				if (isArray(sibl)) {
					sContents = sibl[nArrayCtr];
				} else {
					sContents = sibl;
				}
				nArrayCtr++;
				if (sContents.location) sLocation = sContents.location.toLowerCase();
				if (sContents.path) sImgPath = sContents.path;


				if (sLocation == "back") {
					global_lrg_img_back = sImgPath;
				}
				if (sLocation == "front") {
					global_lrg_img_front = sImgPath;
				}
				for (nI=0; nI<aAttrib015_1.length; nI++) {			//Change Tag Contents
					if (getObjectById(aAttrib015_1[nI]) && getObjectById(aAttrib015_2[nI]) && aAttrib015_3[nI] != undefined ) {
						if (aAttrib015_4[nI] != undefined && !isNaN(aAttrib015_4[nI])) {
							//they chose a side to show.
							if (aAttrib015_4[nI] == 1) 
								getObjectById(aAttrib015_2[nI]).src = global_lrg_img_front;
							else if (aAttrib015_3[nI] == 2) 
								getObjectById(aAttrib015_2[nI]).src = global_lrg_img_back;	
						} else {
							//automatic.
							if (global_lrg_img_front != "") 
								getObjectById(aAttrib015_2[nI]).src = global_lrg_img_front;
							else if (global_lrg_img_back != "") 
								getObjectById(aAttrib015_2[nI]).src = global_lrg_img_back;			
						}
						//es_changeFunction(aAttrib015_2[nI]);
						global_main_div_img = aAttrib015_1[nI];
						global_main_img = aAttrib015_3[nI];	
					}
				}
			}
			if (true) {//!$.browser.safari
				for (nI=0; nI<aAttrib016_1.length; nI++) {			//Change Tag Contents
					if (getObjectById(aAttrib016_1[nI]) ) {
						es_changeFunction(aAttrib016_1[nI], es_ZoomImage);
					}
				}	
			}
			break;
		case "LIST_PRICE":
			break;
		case "OPTIONS":
			es_processOptions(sibl, oProduct);
			var theForm = document.forms[global_formname];
			theForm.hidApp0.value = oProduct.Type;
			theForm.hidClr0.value = oProduct.Color;
			theForm.hidSize0.value = oProduct.Size;
	
			for (nI=0; nI<aAttrib026_1.length; nI++) {			//Add Quantity select Fields.
					if (getObjectById(aAttrib026_1[nI]) ) {
						nDsnQuantity = '<select name="quant">';
						for (nJ=1; nJ<29; nJ++) {
							nDsnQuantity = nDsnQuantity + '<option value="'+ nJ +'">'+ nJ +'</option>';
						}
						nDsnQuantity = nDsnQuantity + '</select>';
						alterDivContent(aAttrib026_1[nI], nDsnQuantity);
					}
			}
			break;
		case "SIMILIAR_PRODUCT_IDS": 
			for (var iNodeA in sibl) {	//Loop through each Apparel Arrat Element
				var appNode = sibl[iNodeA];	
		
				if (appNode["@attributes"]) {
					sID = appNode["@attributes"].ID;
				}
				sTitle = appNode.TITLE;
				sImgURL = appNode.IMG_URL;
				sDesc = appNode.DESCRIPTION;
				sSugBckColor = appNode.SUGG_BK_COLOR;

				global_nAlt_Counter++;
				for (nI=0; nI<aAttrib012_1.length; nI++) {			//Change Tag Contents
					if (aAttrib012_2[nI] != undefined && !isNaN(aAttrib012_2[nI])) {
						if (global_nAlt_Counter == aAttrib012_2[nI]) alterDivContent(aAttrib012_1[nI], sTitle);			//Only set it if this is the correct ALT index.
					}
				}
				for (nI=0; nI<aAttrib041_1.length; nI++) {			//Change Tag Contents
					if (aAttrib041_2[nI] != undefined && !isNaN(aAttrib041_2[nI])) {
						if (global_nAlt_Counter == aAttrib041_2[nI]) alterDivContent(aAttrib041_1[nI], sDesc);			//Only set it if this is the correct ALT index.
					}
				}
				for (nI=0; nI<aAttrib013_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
					if (getObjectById(aAttrib013_1[nI]) && aAttrib013_2[nI] != undefined && !isNaN(aAttrib013_2[nI])) {
						sPrefix = global_detailpage_url+global_page_url_GET;
						//if (aAttrib013_3[nI] != undefined) sPrefix = aAttrib013_3[nI];	Removed and used for alt URL
						if (global_nAlt_Counter == aAttrib013_2[nI]) {
							getObjectById(aAttrib013_1[nI]).href = sPrefix+sID;
							aAttrib013_3[nI] = sPrefix+sID;	//For Later
						}
					}
				}
				for (nI=0; nI<aAttrib014_1.length; nI++) {			//ALT Image
					if (aAttrib014_2[nI] != undefined && !isNaN(aAttrib014_2[nI])) {
						if (global_nAlt_Counter == aAttrib014_2[nI]) {
							if (getObjectById(aAttrib014_1[nI])) {
								getObjectById(aAttrib014_1[nI]).src = sImgURL;
								aAttrib014_3[nI] = sImgURL;
							}
						}
					}
				}	
				for (nI=0; nI<aAttrib044_1.length; nI++) {			//ALT Background Color
					if (aAttrib044_2[nI] != undefined && !isNaN(aAttrib044_2[nI])) {
						if (global_nAlt_Counter == aAttrib044_2[nI]) {
							if (getObjectById(aAttrib044_1[nI])) {
								if (sSugBckColor.length>0) {
									if (sSugBckColor.length > 5 && sSugBckColor.length < 7 && sSugBckColor.indexOf("#")==-1) sSugBckColor = "#"+sSugBckColor;
									$("#"+aAttrib044_1[nI]).css("backgroundColor",sSugBckColor);
									$("#"+aAttrib044_1[nI]+" img").attr("ESbackgroundColor",sSugBckColor);		//create an synthetic attribute in all children IMG tags for future reference 
								} else if ( aAttrib044_3[nI] != undefined && isNaN(aAttrib044_3[nI]) ) {
									$("#"+aAttrib044_1[nI]).css("backgroundColor",aAttrib044_3[nI] );
									$("#"+aAttrib044_1[nI]+" img").attr("ESbackgroundColor",sSugBckColor);		//create an synthetic attribute in all children IMG tags for future reference 
								}
							}
						}
					}
				}	

			}
			break;
		default:
			//document.write("I'm looking forward to this weekend!");
	}	//switch

}

function dynamicallyLoadCSS(sFile) {
	$('head', document).append('<link rel="stylesheet" type="text/css" media="screen, projection" href="'+ sFile +'" />');
}

function getWindowHeight() {
  var windowHeight = 0;
  if (typeof(window.innerHeight) == 'number')
    windowHeight = window.innerHeight;
  else {
    if (document.documentElement && document.documentElement.clientHeight) windowHeight = document.documentElement.clientHeight;
    else {
      if (document.body && document.body.clientHeight) windowHeight = document.body.clientHeight; 
		}; 
	};
				
  return windowHeight;
};


/*** Determine whether a njQuery.getScriptode's text content is entirely whitespace.
 * @param nod  A node implementing the |CharacterData| interface (i.e.,
 *             a |Text|, |Comment|, or |CDATASection| node
 * @return     True if all of the text content of |nod| is whitespace,
 *             otherwise false. */
function is_all_ws( nod ) {
  return !(/[^\t\n\r ]/.test(nod.data));
}


/*** Determine if a node should be ignored by the iterator functions.
 * @param nod  An object implementing the DOM1 |Node| interface.
 * @return     true if the node is:
 *                1) A |Text| node that is all whitespace
 *                2) A |Comment| node
 *             and otherwise false. */
function is_ignorable( nod ) {
  return ( nod.nodeType == 8) || // A comment node
         ( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}

function isArray(obj) {
    return $.isArray(obj);
}

function getObjectById( id ) {
	return es_getObjectById(id, document);
}

function es_getObjectById( id, parent ) {
	if (parent.getElementById)
		var returnVar = parent.getElementById(id);
	else if (parent.all)
		var returnVar = parent.all[id];
	else if (parent.layers)
		var returnVar = parent.layers[id];
	return returnVar;
}

function es_GarmentSelect(sDest, sCSV, nParent) {
	parts=sCSV.split(",");
	if (parts.length > 1) {
		switch (parts[2].toLowerCase()) {
		case "apparel":
			es_setOptionsSelect(sDest, nParent /*parentID*/, parts, 11 /*reclength*/, 3/*nameindex*/, 4/*costindex*/, 11/*imgindex*/, "apparel");
			break;
		case "color":
			es_setOptionsSelect(sDest, nParent /*parentID*/, parts, 6 /*reclength*/, 3/*nameindex*/, 4/*costindex*/, 5/*imgindex*/, "color");
			break;
		case "size":
			es_setOptionsSelect(sDest, nParent /*parentID*/, parts, 4 /*reclength*/, 3/*nameindex*/, 4/*costindex*/, 0/*imgindex*/, "size");
			break;		
		}
	} else {	
		//There are none of this type of option for this product,

		sType = "";
		sNewDest = "";
		for (nI2=0; nI2<aAttrib028_1.length; nI2++) 
			if (sDest == aAttrib028_1[nI2]) {
				sType = "color";
				sNewDest = aAttrib028_1[nI2];
			}
		for (nI2=0; nI2<aAttrib027_1.length; nI2++) 
			if (sDest == aAttrib027_1[nI2]) {
				sType = "apparel";
				sNewDest = aAttrib027_1[nI2];
			}
		for (nI2=0; nI2<aAttrib029_1.length; nI2++) 
			if (sDest == aAttrib029_1[nI2]) {
				sType = "size";
				sNewDest = aAttrib029_1[nI2];
			}

		if (nParent == 0) {
			sPreSelected = '<span title="As Shown">As Shown<span class="value">0</span></span>';
			sOutput = '<dl class="dropdown ES_select_'+ sType +'"><dt><a href="#">'+ sPreSelected +'</span></a></dt><dd><ul> </ul></dd></dl>';
			alterDivContent(sDest, sOutput);
		}
	}
}

function getSelectedValue(id) {
	return $("#" + id).find("dt a span.value").html();
}


function es_setOptionsSelect(sDest, nIndex, parts, nRecLength, nNameIndex, nCostIndex, ImgIndex, sType) {
	var sOutput = "";
	aOpts=new Array();
	var c=0;
	var f=0;
	for (nI=0; nI<=nRecLength; nI++) {
		aOpts[nI]=new Array();
	}
	/*This section creates a 2-d array, rows a distinct customer options, columns are details of that option.*/
	while (c < parts.length) {	//cycle through all elements in CSV
		if (parts[c]==nIndex) {		//if this element has the parent element we are looking for...
			for (nI=0; nI<=nRecLength; nI++) {
				aOpts[nI][f] = parts[c+nI];
			}
			f++;	//Increment customer Option counter
		}
		c = c + nRecLength+1;
	}	//While

	nNumSliderItems = 0;
	sText = "";
	sAttrib = "";

	for (nI=0; nI<f; nI++) {	//Loop through all customer options.
		if (aOpts[0][nI]==nIndex) {		//If related to previous selection, then show it.
			sOptionName	 = aOpts[nNameIndex][nI];
			sOptionName = sOptionName.replace("'","");	//&#39;
			sOptURL = "";
			if (ImgIndex > 0)	sOptURL = aOpts[ImgIndex][nI];
			nNumSliderItems++;
			sURL = "http://";
			//Set up click events for these options.
			if (sType=="apparel") {
				sURL = "global_nPrice="+ aOpts[4][nI]+"; global_cPrice=0; global_sPrice=0; toggleBox('overDiv', 0); es_CalculateTotalPrice(global_formname); showProduct("+aOpts[1][nI]+", '"+aOpts[5][nI]+"', "+aOpts[7][nI]+", "+aOpts[8][nI]+"); es_LoadTopic("+aOpts[1][nI]+", 3); objFormVar = document.forms[global_formname]; objFormVar.cboApp0.value="+ aOpts[1][nI] +"; showSelected('"+ sOptURL +"', '"+ sOptionName +"', '"+ sType +"', true); if (objFormVar.hidClr0&&objFormVar.hidClr0.value!='') { es_BlankSelection('size'); es_GarmentSelect(aAttrib028_1[0],document.forms[global_formname].hidClr0.value, "+aOpts[1][nI]+");}  else if (objFormVar.hidSize0&&objFormVar.hidSize0.value!='') {es_GarmentSelect(aAttrib029_1[0],document.forms[global_formname].hidSize0.value, "+aOpts[1][nI]+");}";
				sClassItemIndex = "";
			}
			if (sType=="color") {
				if (nI==0) es_bcolor("#"+aOpts[6][0], "main_img");
				sURL = "global_cPrice="+ aOpts[4][nI] +"; global_sPrice=0; toggleBox('overDiv', 0); es_CalculateTotalPrice(global_formname); objFormVar = document.forms[global_formname]; objFormVar.cboClr0.value="+ aOpts[1][nI] +"; showSelected('"+ sOptURL +"', '"+ sOptionName +"', '"+ sType +"', true); es_bcolor('#"+aOpts[6][nI]+"', 'main_img'); if (objFormVar.hidSize0&&objFormVar.hidSize0.value!='') { es_GarmentSelect(aAttrib029_1[0],document.forms[global_formname].hidSize0.value, "+aOpts[1][nI]+");} ";
				sClassItemIndex = "2";
			}
			if (sType=="size") {
				sURL = "es_CalSizePrice(global_formname, 0); toggleBox('overDiv', 0);";
			}
			if (aOpts[nCostIndex][nI] != 0) {
				sSign=" (+";
				if (aOpts[nCostIndex][nI] < 0)
					sSign = " (-";
				sOptionName = sOptionName + sSign + es_formatCurrency(Math.round(Math.abs(aOpts[nCostIndex][nI])*100.0)/100.0) + ")";
			}
			sText = aOpts[1][nI];
			sAttrib = sOptionName;
			sImg = "";
			if (sOptURL !="") sImg = '<img src="'+ sOptURL +'" height="25" border="0" alt="'+ sOptionName +'" class="es_flag" />';
			sOutput = sOutput + '<li><a href="javascript: '+ sURL +' void(0);" title="'+sOptionName+'">'+ sOptionName + sImg +'<span class="value">'+ aOpts[1][nI] +'</span></a></li>';
		}
	}	//for

	if (f==1)
		sPreSelected = '<span title="'+sOptionName+'">'+ sOptionName +'<span class="value">'+ sText +'</span></span>';
	else
		sPreSelected = '<span >select '+sType.toLowerCase() +'</span>';
	sOutput = '<dl class="dropdown ES_select_'+ sType +'"><dt><a href="#">'+ sPreSelected +'</span></a></dt><dd><ul>' + sOutput + '</ul></dd></dl>';

	alterDivContent(sDest, sOutput); 
	if (f==1) {
		eval(sURL);
	}
//		$(".dropdown dt a").click(function() { $(this).parent().siblings("dd").children("ul").toggle() });
/*		$(".dropdown dd ul li a").click(function() {
				var text = $(this).html();
				var sAttrib = $(this).attr("title");
				$(this).parent().parent().parent().siblings('dt').children('a').children('span').html(text);
				$(this).parent().parent().parent().siblings('dt').children('a').children('span').attr("title", sAttrib);
				$(".dropdown dd ul").hide();
		}); 
*/
	return f;		//This is returned to inform the caller that only one option was available, it was selected by default.
}

function es_OutputSlider(sCSV, nParent) {
	parts=sCSV.split(",");

	if (parts.length > 1) {
		switch (parts[2].toLowerCase()) {
			case "apparel":
				if (es_setOptions(nParent /*parentID*/, parts, 11 /*reclength*/, 3/*nameindex*/, 4/*costindex*/, 11/*imgindex*/, "apparel") == 1) {
					try {
						jQuery(".messaging",$(".apparel")).css("display","none");	//Turn off the No-Javascript message.
						jQuery(".next",$(".apparel")).css("display","block");	//Turn on the NEXT arrow DIV on the slider
					}
					catch (err) {	}
				} else {
					try {
						$(function() {
								$(".apparel").accessNews({
										newsHeadline: "",
										newsSpeed: "normal"
								});
						});
					}
					catch(err) {}
				}
				break;
			case "color":
				if (es_setOptions(nParent /*parentID*/, parts, 6 /*reclength*/, 3/*nameindex*/, 4/*costindex*/, 5/*imgindex*/, "color") == 1) {
					try {
					jQuery(".messaging",$(".color")).css("display","none");
					}
					catch (err) {
						alert("error");
					}
				} else {
					try {
					$(function() {
							$(".color").accessNews2({
									newsHeadline: "",
									newsSpeed: "normal"
							});
					});
					}
					catch (err) {	}
				}
				break;
			case "size":
				break;
		}
	} else {	//No options of this type, turn off Javascript mesages.
		jQuery(".messaging",$(".apparel")).html("No apparel options.");	//Turn off the No-Javascript message.
		jQuery(".messaging",$(".color")).html("No color options.");
		jQuery(".messaging",$(".color")).css("backgroundColor","");
		jQuery(".messaging").css("padding","15px");
		jQuery(".news_slider").css("border","0");
	}
}


function es_setOptions(nIndex, parts, nRecLength, nNameIndex, nCostIndex, ImgIndex, sType) {
	var sOutput = "";
	aOpts=new Array();
	var c=0;
	var f=0;
	for (nI=0; nI<=nRecLength; nI++) {
		aOpts[nI]=new Array();
	}
	/*This section creates a 2-d array, rows a distinct customer options, columns are details of that option.*/
	while (c < parts.length) {	//cycle through all elements in CSV
		if (parts[c]==nIndex) {		//if this element has the parent element we are looking for...
			for (nI=0; nI<=nRecLength; nI++) {
				aOpts[nI][f] = parts[c+nI];
			}
			f++;	//Increment customer Option counter
		}
		c = c + nRecLength+1;
	}	//While

	nNumSliderItems = 0;

	for (nI=0; nI<f; nI++) {	//Loop through all customer options.
		if (aOpts[0][nI]==nIndex) {		//If related to previous selection, then show it.
			sOptionName	 = aOpts[nNameIndex][nI];
			sOptionName = sOptionName.replace("'","");	//&#39;
			sOptURL = aOpts[ImgIndex][nI];
			nNumSliderItems++;
			sURL = "http://";
			//Set up click events for these options.
			if (sType=="apparel") {
				sURL = "global_nPrice="+ aOpts[4][nI]+"; global_cPrice=0; global_sPrice=0; toggleBox('overDiv', 0); es_CalculateTotalPrice(global_formname); showProduct("+aOpts[1][nI]+", '"+aOpts[5][nI]+"', "+aOpts[7][nI]+", "+aOpts[8][nI]+"); es_LoadTopic("+aOpts[1][nI]+", 3); objFormVar = document.forms[global_formname]; objFormVar.cboApp0.value="+ aOpts[1][nI] +"; showSelected('"+ sOptURL +"', '"+ sOptionName +"', '"+ sType +"', true); if (objFormVar.hidClr0&&objFormVar.hidClr0.value!='') { es_BlankSelection('size'); es_OutputSlider(document.forms[global_formname].hidClr0.value, "+aOpts[1][nI]+");}  else if (objFormVar.hidSize0&&objFormVar.hidSize0.value!='') { es_FindSize(global_formname);}";
				nHeight = 50;
				nBorder = 0;
				sClassItemIndex = "";
			}
			if (sType=="color") {
				if (nI==0) es_bcolor("#"+aOpts[6][0], "main_img");
				sURL = "global_cPrice="+ aOpts[4][nI] +"; global_sPrice=0; toggleBox('overDiv', 0); es_CalculateTotalPrice(global_formname); objFormVar = document.forms[global_formname]; objFormVar.cboClr0.value="+ aOpts[1][nI] +"; showSelected('"+ sOptURL +"', '"+ sOptionName +"', '"+ sType +"', true); es_bcolor('#"+aOpts[6][nI]+"', 'main_img'); es_FindSize(global_formname);";

				nHeight = 20;
				nBorder = 1;
				sClassItemIndex = "2";
//						sURL = " es_FindSize('tForm0', 0);  void(0);"
			}
			if (aOpts[nCostIndex][nI] != 0) {
				sSign=" (+";
				if (aOpts[nCostIndex][nI] < 0)
					sSign = " (-";
				sOptionName = sOptionName + sSign + es_formatCurrency(Math.round(Math.abs(aOpts[nCostIndex][nI])*100.0)/100.0) + ")";
			}
			sOutput = sOutput + '<div class="item'+ sClassItemIndex +' fl"><a class="opacityit" href="javascript:'+ sURL +' void(0);" title="'+sOptionName+'"><img src="'+ sOptURL +'" height="'+ nHeight +'" border="'+nBorder+'" alt="'+ sOptionName +'" class="fl" /></a></div>';
		}
	}	//for

	if (f==1) {
		eval(sURL);
	} else {
		if (sType=="apparel")	alterDivContent("apparelcontainer", "<div class='container fl'>"+sOutput+"</div>"); 
		if (sType=="color")	alterDivContent("colorcontainer", "<div class='container fl'>"+sOutput+"</div>");
	}
	return f;		//This is returned to inform the caller that only one option was available, it was selected by default.
}

function es_LoadTopic(appID, nType) {
	sIDType="pt_app_lookup";
	if (nType==1) sIDType="pt_app_xml";
	if (nType==2) sIDType="app_lookup";
	if (nType==3) sIDType="pt_app_json";
//	if (!getObjectById( appID ) || !getObjectById( sDivID ) ) return 0;
	//sRestoreBkgndColor = es_SetBkgndColor(sDivID, '#CCCCCC');	//
//	global_sGblDivID = sDivID;
//	global_sGblBkgnd = sRestoreBkgndColor;

	if (aAttrib042_1[0] != undefined ) {
		makeRequest('http://e-shirt.com/appfeatures_ajax_json.php', '?pid='+ global_pid +'&topic='+ sIDType +'&id='+ appID, es_display_content);
	}
}


function es_display_content(jsondata) { 
//	if (http_request.readyState == 4) {
//  if (http_request.status == 200) {
//    var oXML = http_request.responseXML;
	var sAltAppTypes = "";
	var Features = "";
		sContent = "";
/*		if (!oXML) return;
		if (!oXML.getElementsByTagName('ERROR_STATUS')[0]) return;
		if (oXML.getElementsByTagName('ERROR_STATUS')[0].firstChild.data!='OK') return;*/
	var root = jsondata.XML_RESPONSE;
	if (!root) return 0;
	var aRecCollection = root.RECORD; //Array
	if (!aRecCollection) return 0;
	if (root.ERROR_STATUS != "OK") return 0;
	
	if (isArray(aRecCollection)) {
		nArrayLength = aRecCollection.length;
	} else {
		nArrayLength = 1;
	}	
	nCounter = 0;
	while (nCounter < nArrayLength) {
		RecNode = aRecCollection[nCounter];
	
		if (isArray(aRecCollection)) {
			RecNode = aRecCollection[nCounter];
		} else {
			RecNode = aRecCollection;
		}
	
			if (nCounter==0) {
//				alterDivContent("nameid", nameid);
					for (nI=0; nI<aAttrib042_1.length; nI++) {
						if (aAttrib042_1[nI]!="" && getObjectById(aAttrib042_1[nI]) ) {
							$("#"+aAttrib042_1[nI]).html(RecNode.TITLE);		//Write the Apparel Title in all registered spaces.
						}
					}
				MarketingText = RecNode.MARKETINGTEXT;
				if (!MarketingText || MarketingText=="") MarketingText = "We only choose the highest quality garments for your apparel.  Not only are these durable and guaranteed, but we only use well-known brands that have a reputation of meeting our high standards.";
//				alterDivContent("marketingtext", MarketingText);
				for (nI=0; nI<aAttrib042_2.length; nI++) {
					if (aAttrib042_2[nI]!="" && getObjectById(aAttrib042_2[nI]) ) {
						$("#"+aAttrib042_2[nI]).html(MarketingText);		//Write the Apparel Title in all registered spaces.
					}
				}
				BrandLogoURL = RecNode.BRANDLOGOURL;
				if (!BrandLogoURL || BrandLogoURL=="") {
//					alterDivContent("brandlogourl", "");
					$("#brandlogourl").html("");
					for (nI=0; nI<aAttrib042_3.length; nI++) {
						if (aAttrib042_3[nI]!="" && getObjectById(aAttrib042_3[nI]) ) {
							$("#"+aAttrib042_3[nI]).hide();		//Write the Apparel Logo in all registered spaces.
						}
					}
//					toggleBox("prodrow", 0);
				} else {
//					alterDivContent("brandlogourl", "<img src=\""+ BrandLogoURL +"\" style=\"border: 1px solid #CCCCCC\" title=\""+ BrandName +"\"/>");
					for (nI=0; nI<aAttrib042_3.length; nI++) {
						if (aAttrib042_3[nI]!="" && getObjectById(aAttrib042_3[nI]) ) {
							$("#"+aAttrib042_3[nI]).show();	
							$("#"+aAttrib042_3[nI]).html("<img src=\""+ BrandLogoURL +"\" style=\"border: 1px solid #CCCCCC\" title=\""+ RecNode.BRAND +"\"/>");		//Write the Apparel Logo in all registered spaces.
						}
					}
				}

//				alterDivContent("modelnumber", "<b>Model:</b> "+ ModelNumber);
				for (nI=0; nI<aAttrib042_4.length; nI++) {
					if (aAttrib042_4[nI]!="" && getObjectById(aAttrib042_4[nI]) ) {
						$("#"+aAttrib042_4[nI]).html(RecNode.MODEL);		//Write the Apparel Title in all registered spaces.
					}
				}
//				alterDivContent("fabricweight", "FABRIC WEIGHT<br />"+ FabricWeight +" "+ FabricType);
				Features = RecNode.FEATURES;
				Features = Features.replace(/\&bull;/g, "");
				Features = Features.replace(/\r\n/g, "<br /> &bull; ");
				Features = Features.replace(/\n/g, "<br /> &bull; ");
				if (!Features || Features=="") {
//					alterDivContent("features", "&nbsp;");
					for (nI=0; nI<aAttrib042_5.length; nI++) {
						if (aAttrib042_5[nI]!="" && getObjectById(aAttrib042_5[nI]) ) {
							$("#"+aAttrib042_5[nI]).hide();	
						}
					}
				} else {
					for (nI=0; nI<aAttrib042_5.length; nI++) {
						if (aAttrib042_5[nI]!="" && getObjectById(aAttrib042_5[nI]) ) {
							$("#"+aAttrib042_5[nI]).show();	
							$("#"+aAttrib042_5[nI]).html("&bull; "+Features);		//Write the Apparel Logo in all registered spaces.
						}
					}
//					alterDivContent("features", "&bull; "+Features);
				}

				MedImgURL = RecNode.MEDIMGMURL;
				MedImgURL.replace(/\\\//g, "\/");
				if (MedImgURL && MedImgURL != "") {
//					alterDivContent("smlimgurl", "<img src=\""+ MedImgURL +"\" style=\"border: 1px solid #C0C0C0\" />");

					for (nI=0; nI<aAttrib042_6.length; nI++) {
						if (aAttrib042_6[nI]!="" && getObjectById(aAttrib042_6[nI]) ) {
							$("#"+aAttrib042_6[nI]).show();	
							getObjectById(aAttrib042_6[nI]).src = MedImgURL+"?r=" + Math.floor(Math.random()*1000);	//Random number prevents caching, caching breaks event driven resizer.
						}
					}
				} else {
					for (nI=0; nI<aAttrib042_6.length; nI++) {
						if (aAttrib042_6[nI]!="" && getObjectById(aAttrib042_6[nI]) ) {
							$("#"+aAttrib042_6[nI]).hide();	
						}
					}
//					alterDivContent("smlimgurl", "&nbsp;");
				}
				sAltAppTypes = ' <a href="javascript: es_LoadTopic('+ RecNode.PID +', 3); void(0);">'+ RecNode.BRAND +'</a>,';
			} else {
				//create the other apparels links.
				sAltAppTypes = ' <a href="javascript: es_LoadTopic('+ RecNode.PID +', 3); void(0);">'+ RecNode.BRAND +'</a>,' + sAltAppTypes;
			}
			nCounter++;
		}
/*		if (nCounter > 1) {
			sAltAppTypes = "<BR /><b>Other possible brands used:</b><br />" + sAltAppTypes;
			sAltAppTypes = sAltAppTypes.substring(0,sAltAppTypes.length-2);
//			alterDivContent("altappid", sAltAppTypes);
			$("#altappid").html(sAltAppTypes);
		} else {
//			alterDivContent("altappid", "");
			$("#altappid").html("&nbsp;");
		}*/
		//es_SetBkgndColor(global_sGblDivID, global_sGblBkgnd);
//	}}
}

function es_bcolor(bcol, cel) {
	if (getObjectById( cel ) && getObjectById( cel ).style.backgroundColor) getObjectById( cel ).style.backgroundColor = bcol;
}

function es_CalculateTotalPrice(sFormName) {
	var nBaseVal=0;
	var pDiv;
	eval("nBaseVal=document."+ sFormName +".hidBase0.value;");
	tPrice=Number( (global_nPrice?global_nPrice:0) )+Number( (global_cPrice?global_cPrice:0) )+Number( (global_sPrice?global_sPrice:0) )+Number( (nBaseVal?nBaseVal:0) ) + es_updateprice0();
	//tPrice=tPrice.toFixed(2);
	for (nI=0; nI<aAttrib008_1.length; nI++) {			//Change Tag Contents
		alterDivContent(aAttrib008_1[nI], es_formatCurrency(Math.round(tPrice*100.0)/100.0));
	}
}

function es_updateprice0() {
	return 0;
}

function es_FindSize(sFormName) {
	var objApp, objColor, objSize;

	eval("objApp=document."+ sFormName +".cboApp0;");
	eval("objColor=document."+ sFormName +".cboClr0;");
	eval("objSize=document."+ sFormName +".cboSize0;");

	//code for dropdown color change
	if (objSize) {
		objSize.focus();
		objSize.style.background='#cc3300';
		objSize.style.color='#FFFFFF';
	}
	//assign 0 for SizePrice
	global_sPrice=0;
	var tempColor;
	//assign 0 for color price
	global_cPrice=0;
	//from here code for color price
	if (objColor) {
		tempColor = objColor.value;
		var strColor;
		eval("strColor=document."+ sFormName +".hidClr0.value;");
		partsColor=strColor.split(",");
		var priceFirst=new Array();
		priceFirst[0]=new Array();
		priceFirst[1]=new Array();
		var x=0;
		var y=0;
		while (x<partsColor.length)	{
			priceFirst[0][y]=partsColor[x+1];	//ColorID
			priceFirst[1][y]=partsColor[x+4];	//ColorPrice
			y++;
			x+=6;		
		}
		for(t=0; t<y; t++) {
			if(priceFirst[0][t] == tempColor) {
					global_cPrice=priceFirst[1][t];
			}
		}
	}
	if (objSize) {
		var str;
		eval("str=document."+ sFormName +".hidSize0.value;");
		objSize.length=0;
		var k=0;
		parts=str.split(",");
	
		first=new Array();
		first[0]=new Array();
		first[1]=new Array();
		first[2]=new Array();
		first[3]=new Array();
		first[4]=new Array();
		var nI=0;

		while (nI<parts.length) {
			first[0][k]=parts[nI];//Parent colorID
			first[1][k]=parts[nI+1];//SizeID
			first[2][k]=parts[nI+2];//Size Type
			first[3][k]=parts[nI+3];//Size Name
			first[4][k]=parts[nI+4];//Price Diff
			nI+=5;
			k++;
		}
		matchvalue = "";
		if (objColor)
			matchvalue = objColor.value;
		else { if (objApp)
			matchvalue = objApp.value;
		}

		var m=0;
		var p=0;
		temp="Select "+first[2][0].toLowerCase();
		objSize.length=0;
		objSize.options[0]=new Option(temp,"0");

		while (m<k)	{
			if(matchvalue==first[0][m] || matchvalue=="") {
				sOptionName = first[3][m];

				if (first[4][m] != 0) {
					sSign=" (+";
					if (first[4][m] < 0)
						sSign = " (-";
					sOptionName = sOptionName + sSign + es_formatCurrency(Math.round(Math.abs(first[4][m])*100.0)/100.0) + ")";
				}
				temp=first[3][m];
				val=first[1][m];
				objSize.options[p+1]=new Option(sOptionName,val);
				p++;
			}
			m++;
		}	//While
	}	//objSize
}// end of function

function es_formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + global_currencyindicator + num + '.' + cents);
}


function es_SetBkgndColor(divID, newcolor) {
	sPreviousColor = '';
	if (newcolor.length > 5 && newcolor.length < 7 && newcolor.indexOf("#")==-1) newcolor = "#"+newcolor;
	if (!getObjectById(divID)) return "#FFFFFF";
	if(document.layers) { // browser="NN4"
		sPreviousColor = document.layers[divID].bgColor;
		document.layers[divID].bgColor = newcolor;
	}
	if (document.all || document.getElementById) {
		sPreviousColor = $("#"+divID).css("background-color");
		$("#"+divID).css("backgroundColor",newcolor);
		$("#"+divID+" img").attr("ESbackgroundColor",newcolor);		//create an synthetic attribute in all children IMG tags for future reference 
	}
/*	
	if(document.all) { // browser="IE";
		eval("sPreviousColor = document.all."+divID+".style.backgroundColor;");
		eval("document.all."+divID+".style.backgroundColor = newcolor;");
	}
	if(!document.all && document.getElementById) { // browser="NN6+ or IE5+ if you're willing to dump the !document.all stuff";
		sPreviousColor = document.getElementById(divID).style.backgroundColor;
		document.getElementById(divID).style.backgroundColor = newcolor;
	}
*/
	return sPreviousColor;
}

/********************************************************************************************
Basically this function takes a reference into the existing DOM for the template.
It modifies this template, without changing the handle names (because we will need those the...
	next time this template is used).  
NOTE: This function is recursive in order to span the entire DOM tree of the template.  It calls 
itself with the child tree, until no children exist.  In each sub-tree it searches for the handle IDs.
This allows it to find a named child element even if it is buried deep within the tree.
**********************************************************************************************/
function es_ListItemFill(doc, node, nListCnt, global_list_images_zoom) {
	var i, children;
  children = node.childNodes;

  for (i = 0; i < children.length; ++i) {
		elem = children.item(i);
		//Loop if non-element or whitespace
		if (!(elem) || is_ignorable( elem )) continue;


		//Find an ID within the #global_list_item_template template that will hold the image
		if (aAttrib036_3[0] != undefined && elem.id==aAttrib036_3[0])	{	
			oTemp = elem;
			if (oTemp != null) {	//Confirm we found the Image NODE
				//Set the background of the element to the Datafeed specified color.  This is primarily for PNG images.
				if (global_sug_bkgnd.length > 5 && global_sug_bkgnd.length < 7 && global_sug_bkgnd.indexOf("#")==-1) global_sug_bkgnd = "#"+global_sug_bkgnd;
				elem.style.backgroundColor=global_sug_bkgnd;
				
				elem.style.left="5px";

				var oimg = global_sml_img_front;
				if (global_sml_img_front == undefined || global_sml_img_front=="") oimg = global_sml_img_back;

				//Build Hyperlinked Image element
				sTemp = '<a href="'+ global_detailpage_url + global_page_url_GET + global_pid +'" title="'+ unescape(global_pName) +'">';
				sTemp = sTemp + '<img name="esimg_200505_'+nListCnt+'" id="esimg_200505_'+nListCnt+'" src="'+ oimg +'" height="100%" border="0" ESbackgroundColor="'+ global_sug_bkgnd +'" onLoad="try {oDiv=this.parentNode.parentNode; ES_adjIMGs(oDiv, this, $(oDiv).css(\'width\'), $(oDiv).css(\'height\'))} catch (err){}" ></a>';
				oTemp.innerHTML = sTemp;		//Write hyperlink wrapped image to image envelope.
				
				/* If they have turned on List Image Zoom, then register this image for the zoom effect.  Also, use the globally set background color
				that was set in the "JSONdataengine" routine, and is reset for each item.	*/
				if (global_list_images_zoom) Register_ID(ES_ATTACH_MOUSEOVER_MAGNIFY_EFFECT_TO_IMAGE , "esimg_200505_"+nListCnt, global_sug_bkgnd);
				continue;
			} else {
				alert("Product image node ID not found.");
			}
		}
		//Add Title
		if (aAttrib036_4[0] != undefined && elem.id==aAttrib036_4[0]) {
			oTemp = elem;	//Find an ID within the #global_list_item_template template that will hold the title (the titlebox)
			if (oTemp != null) {	//Confirm we found the Image NODE
				sTemp = '<a href="'+ global_detailpage_url+global_page_url_GET+global_pid +'" class="es_titlebar_CSS" >'+ global_pName +'</a>';
				oTemp.innerHTML = sTemp;
				continue;
			} else {
				alert("Product title node ID not found.");
			}									
		}
		//Add Price
		if (aAttrib036_5[0] != undefined && elem.id==aAttrib036_5[0]) {
			oTemp = elem;	//Find an ID within the #global_list_item_template template that will hold the price
			if (oTemp != null) {	//Confirm we found the Image NODE
				if (nListCnt == 1) global_pricebox_content = oTemp.innerHTML;	//We are going to replace the contents on future copies, so record the content for use on all other copies.
				oTemp.innerHTML = global_pricebox_content + global_currencyindicator + global_price;	
				continue;
			} else {
				alert("Product Price node ID not found.");
			}									
		}
		//Add Button Link
		if (aAttrib036_6[0] != undefined && elem.id==aAttrib036_6[0]) {
			oTemp = elem;	//Find an ID within the #global_list_item_template template that will hold the image
			if (oTemp != null) {	//Confirm we found the Image NODE
				if (nListCnt == 1) global_buybox_content = oTemp.innerHTML;
				sTemp = '<a href="'+ global_detailpage_url+global_page_url_GET+global_pid +'" title="'+ escape(global_pName) +'">'+ global_buybox_content +'</a>';
				oTemp.innerHTML = sTemp;
				continue;
			} else {
				alert("Purchase Button node ID not found.");
			}									
		}
   ret = es_ListItemFill(doc, elem, nListCnt, global_list_images_zoom);
   if (ret !== null) return ret;
  }
  return null;
}

function alterDivContent(sID, theText) {
	var bvalid = document.all||document.getElementById||document.layers;
	if (!bvalid) {
		alert("We apologize, but this webpage does not support your browser. Please use a Firefox, MS IE, Opera, or Safari browser.");
		return false;
	}
	try {
		$("#"+sID).html(theText);
/*
		if (document.all||document.getElementById) {
			if (!document.getElementById(sID)) return false;
			document.getElementById(sID).innerHTML = theText;
		} else {
			$("#"+sID).html(theText);
		}
*/
	} catch(err) {window.status="API unable to write content, likely due to incompatable browser.";}
}

function es_CreateFormElement(sFormName, Elem, ElemType, ElemName, ElemID, ElemValue) {
	var curElem = document.createElement(Elem);
	if (curElem.setAttribute) {
		curElem.setAttribute("type", ElemType);
		curElem.setAttribute("name", ElemName);
		curElem.setAttribute("id", ElemID);
		curElem.setAttribute("value", ElemValue);
	} else {
		curElem.type = ElemType;
		curElem.name = ElemName;
		curElem.value = ElemValue;
		curElem.id = ElemID;
	}
	document.forms[sFormName].appendChild(curElem);	
}

function CreateSearchBox(sDiv, bKeyword, bCategory, sSearchDiv, sCategoryDiv) {
	var sTemp1;
	var sTemp = '<form name="searchform200905" id="searchform200905" method="get" action="'+ global_listingpage_url +' >'+
							'<input type="hidden" name="stext" value="" /><input type="hidden" name="scat" value="" /></form>';
	alterDivContent("footersearch200905", sTemp);
	sTemp = "";
	if (bKeyword) {
		sTemp1 = '<input name="es_st2009" id="es_st2009" type="text" size="25" value="" onblur="document.searchform200905.stext.value=this.value;"/>';
		if (sSearchDiv == "") sTemp += sTemp1;
		else if (getObjectById( sSearchDiv )) alterDivContent(sSearchDiv, sTemp1);
	}
	if (bCategory) {
		sTemp1 = '<select name="es_sc2009" id="es_sc2009" onChange="document.searchform200905.scat.value=this.options[this.selectedIndex].value;" ><option selected="selected" value="0">All Catagories</option>'+global_cat_list+'</select>';
		if (sCategoryDiv == "") sTemp += sTemp1;
		else if (getObjectById( sCategoryDiv )) alterDivContent(sCategoryDiv, sTemp1);
	}		
	sTemp += '<input type="button" name="xSearch" id="xSearch" value="Search" onClick="document.searchform200905.submit();"/>';
	alterDivContent(sDiv, sTemp);	
}

function WritePagingLinks() {
	var sPageNav = "";
	//If the MAX number of designs in the feed exceed maximum number that will be returned by the data feed, then...
	usable_rec_total = parseInt(global_rec_total.replace(">",""));
	if (usable_rec_total > parseInt(global_rec_pagesize)) {
		sPageNav = " ";
		if (GetVars('pg')=="") {
			nPG = 0;
		} else {
			nPG = parseInt(GetVars('pg'));
		}
//alert("nPG="+nPG); //This is number of products that will be displayed as specified by the Application.
		if (nPG != 0) sPageNav += "<a class=\"ES_paging_href\" href=\"javascript: es_navig("+ (nPG-1) +", '"+global_listingpage_url+"')\" title=\"previous\" >&laquo; Previous</a>&nbsp;";
		if (nPG > 2) sPageNav += "<a class=\"ES_paging_href\" href=\"javascript: es_navig(0, '"+ global_listingpage_url +"')\" title=\"1st\" >1</a>&nbsp;"+ (nPG>3?"...&nbsp;":"");
		var nLastPage = parseInt(usable_rec_total/global_rec_pagesize)+1; 
		
		for (nI=nPG-2; nI<nPG+3; nI++) {
			if (nI > -1 && nI < nLastPage ) {
				if (nI == nPG)
					sPageNav += ((nPG==0)?"":"| ") + "<span class=\"ES_current_page\" style=\"font-weight:bold;\">"+ (nI+1) +"</span>&nbsp;";
				else
					sPageNav += "| <a class=\"ES_paging_href\" href=\"javascript: es_navig("+nI+", '"+ global_listingpage_url +"')\" >"+ (nI+1) +"</a>&nbsp;";
			}
		}
		if (nPG < (nLastPage-3) ) sPageNav += ((nPG<(nLastPage-4)) ? "...&nbsp;" : "| ") +"<a class=\"ES_paging_href\" href=\"javascript: es_navig("+ (nLastPage-1) +", '"+ global_listingpage_url +"')\" title=\""+ nLastPage +"\" >"+ nLastPage +"</a>&nbsp;";	
		if (nPG != (nLastPage-1)) sPageNav += "| <a class=\"ES_paging_href\" href=\"javascript: es_navig("+ (nPG+1) +", '"+ global_listingpage_url +"')\" title=\"next\" >Next &raquo;</a>";
		sPageNav += "&nbsp;";
	}
	return sPageNav;
}


function es_navig(cpg, dest) {
	if (dest=="") dest = "products.php";
	document.designlist.pg.value = cpg;
	document.designlist.action = dest;
	document.designlist.submit();
}	

function SortMenu(sListType) {	//This function creates the sort order selector. 
	var aChoices	= new Array("by&nbsp;Popularity","by&nbsp;Newest","Randomly","Alphabetically");
	var aValues	= new Array("5","7","1","2");
	if (global_eshirt_pagemode == ES_PAGEMODE_DONT_SHOW_ANY_FREELANCE_ARTISTS) {	//Don't show this sort method for e-shirt items.  They have a base price of $0
		aChoices[aChoices.length]="by&nbsp;Price";
		aValues[aValues.length]="3";
	}
	//var sSelect = '<select name="sort" class="ES_sortselect" onChange="document.'+ global_formname +'.submit()" >';
	var sSelect = (sListType=="ul")?('<ul class="ES_sortselect">'):('<select name="sort" class="ES_sortselect" onChange="document.'+ global_formname +'.submit()" >');
	for ( var nI in aChoices) {
		sSelect += (sListType=="ul")?('<li class="ES_sortselect_choice"><a href="javascript: document.'+ global_formname +'.sort.value='+ aValues[nI] +'; document.'+ global_formname +'.submit(); void(0);">'+ ((global_sortby==aValues[nI])?("<b>"+aChoices[nI]+"</b>"):(aChoices[nI])) +'</a></li>'):('<option '+ ((global_sortby==aValues[nI])?"selected=\"selected\"":"") + 'value="'+ aValues[nI] +'">'+ aChoices[nI] +'</option>');
	}
	sSelect += (sListType=="ul")?('</ul>'):('');
	return sSelect;
}

function ItemsPP(sListType) {	//This function creates the # of items to display per page selector. 
	var sSelect = (sListType=="ul")?('<ul class="ES_itemppselect">'):('<select name="ps" class="ES_itemppselect" onChange="document.'+ global_formname +'.submit()" >');
	//var sSelect = '<select name="ps" class="ES_itemppselect" onChange="document.'+ global_formname +'.submit()" >';
	nJ = 0;
	for (nI=global_col_per_page; nI <= 30;  nI=nI+global_col_per_page) {
		//sSelect += '<option '+ ((global_rec_page==nI)?"selected=\"selected\"":"") + 'value="'+ nI +'">'+ nI +'</option>';
		sSelect += (sListType=="ul")?('<li class="ES_itempp_choice"><a href="javascript: document.'+ global_formname +'.ps.value='+ nI +'; document.'+ global_formname +'.submit(); void(0);">'+ ((global_rec_page==nI)?("<b>"+nI+"</b>"):(nI)) +'</a></li>'):('<option '+ ((global_rec_page==nI)?"selected=\"selected\"":"") + 'value="'+ nI +'">'+ nI +'</option>');
	}
	sSelect += (sListType=="ul")?('</ul>'):('');
	return sSelect;
}

function FilterList(sDescTxt) {
	sFilter = "<span id=\"ES_Filter_Container\" class=\"ES_filter_1\" >&nbsp;<a id=\"ES_Filter_Ref\" class=\"ES_A_footer ES_filter_text\" href=\"javascript:$('#ES_filtermenu').slideToggle('normal'); void(0);\">"+ ((sDescTxt!="")?sDescTxt:"+&nbsp;filter&nbsp;results") +"</a>";
	sFilter += "<div id=\"ES_filtermenu\" class=\"ES_filter_3\"><ul id=\"qm0\" class=\"qmmc\">";
	if (global_cat_list != "" && aAttrib038_3[0]==undefined) {
		s1stItem = "<li><a href=\"javascript: eval('document."+aAttrib024_1[0]+"."+ ((global_eshirt_pagemode==0)?"sec":"scat") +".value=0'); document."+aAttrib024_1[0]+".submit(); \">All Categories</a></li>";
		sFilter += "<li><a class=\"qmparent\" href=\"javascript:void(0)\">categories &nbsp;&raquo; <span id=\"es_curcat\" class=\"ES_filter_curcat\">"+ ((global_cur_cat.length>15)?(global_cur_cat.substr(0,15)+"…"):global_cur_cat) +"</span></a><ul>" + s1stItem + global_cat_list + "</ul></li>";
	}
	sFilter += "<li class=\"ES_filter_4\"><a href=\"javascript:void(0);\">search:&nbsp;<input type=\"text\" name=\"es_search\" id=\"es_search\" class=\"ES_filter_fonts\" value=\""+ GetVars('stext') +"\" size=\"12\" />";
	sFilter += "<input type=\"image\" src=\"http://e-shirt.com/images/go_butt21x21.gif\" height=\"21\" width=\"21\" class=\"ES_filter_but\" title=\"Search for Terms\" /><input id=\"es_reset1\" type=\"image\" src=\"http://e-shirt.com/images/reset_butt21x21.gif\" height=\"21\" width=\"21\" class=\"ES_filter_but\" title=\"Clear Search Terms\" /></a></li><li class=\"qmclear\">&nbsp;</li></ul></div></span>";
	return sFilter;
}

function showProduct(i, sImg, x, y) {
	return false;
	//IGNORE REST OF ROUTINE...
	var nPick;
	if (nPick!=0 && global_sml_img_front.indexOf(".png")==-1 ) {
		global_bProductShown = true;

		sImgpath = global_sml_img_front;
		if (sImgpath.indexOf(".png") > -1) 
			sImg = "http://69.13.97.211/t-shirt-designs/vsadmin/" + sImg.replace(".jpg","_285.png");
		else
			sImg = "http://69.13.97.211/t-shirt-designs/vsadmin/" + sImg.replace(".jpg","_285.jpg");

		if (es_isString(x)) x = parseInt(x);
		if (es_isString(y)) y = parseInt(y);
		nX = 0.52*x;
		nY = y;
		if (xwidth!=0 && yheight!=0) {
			ChangeBackgroundImage(global_main_div_img, sImg);
			FixIMG1(global_main_img, global_main_div_img, 122, 122, sImgpath, nX, nY);
		} else {
			ChangeBackgroundImage(global_main_div_img, sImg);
			FixIMG1(global_main_img, global_main_div_img, 122, 122, sImgpath, nX, nY);
		}
	}
}

function ChangeBackgroundImage(idCell, imgName) {
	document.getElementById(idCell).style.backgroundRepeat = "no-repeat";
	document.getElementById(idCell).style.backgroundPosition = "center center";
	if (($.browser.msie && parseInt($.browser.version.substr(0,1)) < 7) && imgName.match(/.*\.png.*/i) != null) {
		document.getElementById(idCell).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgName+"', sizingMethod='scale')";
	} else {
		document.getElementById(idCell).style.background = "url(" + imgName + ")";
	}
}


function showSelected(sImg, sName, sType, bAlter) {
	var theText = "<div style=\"position:relative; float:left; height:"+ ((sType=='color')?"6":"10") +"px; width:144px;\"></div><div style=\"position:relative; float:left; height:"+ ((sType=='color')?"31":"57") +"px; width:50px;\" align=\"right\">";
	theText = theText + "<img src='"+ sImg +"' height='"+ ((sType=='color')?"29":"50") +"' title='"+ sName +"' /></div><div style=\"position:relative; left:2px; float:left; height:"+ ((sType=='color')?"31":"57") +"px; width:90px;\" align=\"left\"><span class=\"font_10_black\">"+ sName.toUpperCase();
	if (bAlter) {
		if (sType=="apparel") {
			jQuery(".next",$(".apparel")).css("display","none");
			jQuery(".prev",$(".apparel")).css("display","none");
			theText = theText + "<br><a href='javascript: global_nPrice=0; es_OutputSlider(document."+global_formname+".hidApp0.value, 0); document."+global_formname+".cboApp0.value=\"\"; global_bProductShown=false; CellOBJ = getObjectById(global_main_div_img).style; es_BlankBkgnd(CellOBJ); es_SetBkgndColor(global_main_div_img, global_sug_bkgnd); if (sImgpath.length>0) {FixIMG1(global_main_img, global_main_div_img, 284, 284, global_sml_img_front, -1, -1); } es_BlankSelection(\"size\"); es_BlankSelection(\"color\");  void(0);' title='Change Selection'><font color='#0000ff'><u>Change</u></font></a></div>";
			alterDivContent("apparelcontainer", theText);
			// es_BlankSelection(document."+global_formname+".hidClr0, \"color\", 2); es_BlankSelection(document.tForm0.cboSize0, \"size\", 0);
		} else if(sType=="color") {
			jQuery(".next",$(".color")).css("display","none");
			jQuery(".prev",$(".color")).css("display","none");
			theText = theText + "<br><a href='javascript: global_cPrice=0; objFormVar = document."+global_formname+".hidClr0; es_OutputSlider(document."+global_formname+".hidClr0.value, document."+global_formname+".cboApp0.value); es_BlankSelection(\"size\"); document."+global_formname+".cboClr0.value=\"\"; es_SetBkgndColor(global_main_div_img, global_sug_bkgnd);  es_BlankSelection(\"size\"); void(0);' title='Change Selection'><font color='#0000ff'><u>Change</u></font></a></td></tr></table>";
			alterDivContent("colorcontainer", theText);			
		}
	}
}

function es_BlankBkgnd(divIDobj) {
	if (($.browser.msie && parseInt($.browser.version.substr(0,1)) < 7) ) {
		divIDobj.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";
	}
	divIDobj.background = "";
}

function es_changeFunction(obj, func) {
    var elem = getObjectById(obj);
    if (elem) {
			if (window.addEventListener) { 	// Mozilla, Netscape, Firefox
				elem.addEventListener('click', func, false);
			} else {	// IE
				elem.onclick = func;
			}
		}
}

function es_addNewEvent(obj, type, func) {
    var elem = getObjectById(obj);
    if (elem) {
			if (window.addEventListener) { 	// Mozilla, Netscape, Firefox
				elem.addEventListener(type, func, false);
			} else {	// IE
				eval("elem.on"+type+" = func");
			}
		}
}


function es_BlankSelection(sType) {
	if (sType=="color") {
		if (document.forms[global_formname].hidClr0) {
			es_OutputSlider(document.forms[global_formname].hidClr0.value, 0);
			document.forms[global_formname].cboClr0.value="";
		}
		global_cPrice="0";
		es_CalculateTotalPrice(global_formname);
	} else {
		if (aAttrib029_2[0] == undefined || !isNaN(aAttrib029_2[0]) || aAttrib029_2[0].toLowerCase() != "dropdown") {
			document.forms[global_formname].cboSize0.options.length=0;
			document.forms[global_formname].cboSize0.options[0]=new Option('Select a size','0');
		} else {
			if (getObjectById(aAttrib029_1[0])) WriteSelectionEnvelope(aAttrib029_1[0], 2, "size");
			document.forms[global_formname].cboSize0.value="";
		}
		global_sPrice="0";
		es_CalculateTotalPrice(global_formname);
	}
}

function es_addBookmark() {
	var title = global_pName+' - Apparel/Products';
	var url = pgtypeval(global_detailpage_url, global_listingpage_url) + global_page_url_GET+escape(global_pid);
	if (document.all) {
    // Add to Favorites (Internet Explorer)
		window.external.AddFavorite(url,title);
	} else {
		// Add to Bookmarks (Mozilla Firefox)
		window.sidebar.addPanel(title, url, '');
	}
}

function es_ZoomImage() {
	var sImgSRC;
	es_gradient('eshirt200905_body', 0.2);
	toggleBox('overDiv', 0);
	if (global_side_display==1) {
		sImgSRC = global_lrg_img_front;
	} else {
		sImgSRC = global_lrg_img_back;
	}
	overlib(es_Zoom_in2(global_sug_bkgnd, sImgSRC),STICKY, CAPTION, 'Detailed Image', CLOSETEXT,'', FGCOLOR,'#FFFFFF',BGCOLOR,'#FFFFFF',RELX,50,RELY,50,WIDTH,450,HEIGHT,450,CENTER,TEXTPADDING,0,BORDER,0);
	$("#overDiv").show("slow");
}

function es_LoadFunction() {
	var pi, token;
	
	if (aAttrib036_1.length > 0) {	//Was a List box defined?
		if (getObjectById(aAttrib036_1[0])) $("#"+aAttrib036_1[0]).hide();
	}
	// Cache images:
	var imageArray = ['http://e-shirt.com/images/progressbar/progressbar.gif','http://e-shirt.com/images/progressbar/progressbg_red.gif'];
	$.each(imageArray, function (i, val) {	$('<img/>').attr('src', val);	});

	es_removeElement("overDiv");
	global_pid = GetVars('prod');
	pid = global_pid;
	token = es_ReadCookie('token');

	global_token = token;
	global_sessionid = es_ReadCookie('sessionid');
	if (global_sessionid==null) location.reload(true);				//If this page was cached so long that the session vaiable was deleted, then refresh page.
	global_storeid = es_ReadCookie('s');
	$("body").html("<div id=\"eshirt200905_container\" class=\"ES_pagebody\" ><div id=\"overDiv\" style=\"position:absolute; visibility:hidden; z-index:3000;\"></div><div id=\"ES_overDiv\" style=\"position:absolute; visibility:hidden; z-index:3000;\"></div><div id=\"eshirt200905_body\" style=\"zoom:1; height:100%;\">"+ $("body").html() +"</div></div>"+ es_addFooter() +"");
	toggleBox('ES_overDiv', 1);
	$('#ES_overDiv').html('<div style="border:outset #000000 2px; width:150px;" align="center"><span style="width: 100%"><center>...Loading Page...</center></span><span id="ES_Progressbar"></span></div>');
	$('#ES_overDiv').css({'background-color':'#FFFFFF','padding':'15px 10px 15px 10px', 'top':'150px', 'left': ''+ (es_CenterXPos()-80) +'px'});
	global_progressbar = 0;
	$("#ES_Progressbar").progressBar(global_progressbar /*, {
	 callback: function(data){
			if (data.running_value>=100){
				$('#ES_overDiv').hide('slow', function() {$('#ES_overDiv').html('');});
			}
		}
	}*/);

	global_submitvars = unescape(es_ReadCookie('v'));
//	global_pid = getFormvar('prod');
	dynamicallyLoadCSS("http://e-shirt.com/stylesheets/template/template_required_ver1_comp.css");
	$.getScript("http://e-shirt.com/js/overlib2009_02/overlibmws.js", function () {	$("#ES_Progressbar").progressBar(global_progressbar+5,{running_value : global_progressbar}); global_progressbar += 5; });

/* 1. We delete the cookies after we capture the data so that we will not have persistence problems on page refresh or store changes. */
/* 2. However when we deleted cookie, Firefox exhibited problems when the back button was used. The JSON call was messed up, and alertContents never run */

//Create Choice selection envelopes before data loading.
	for (nI=0; nI<aAttrib027_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
		if (getObjectById(aAttrib027_1[nI])) {
			if (aAttrib027_2[nI] == undefined || !isNaN(aAttrib027_2[nI]) || aAttrib027_2[nI].toLowerCase() != "dropdown")  
				WriteSelectionEnvelope(aAttrib027_1[0], 1, "apparel");	//At the current time, only use first reference: 1=slider, 2=dropdown
			else
				WriteSelectionEnvelope(aAttrib027_1[0], 2, "apparel");
		}
	}

	for (nI=0; nI<aAttrib028_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
		if (getObjectById(aAttrib028_1[nI])) {
			if (aAttrib028_2[nI] == undefined || !isNaN(aAttrib028_2[nI]) || aAttrib028_2[nI].toLowerCase() != "dropdown") 
				WriteSelectionEnvelope(aAttrib028_1[0], 1, "color");	//At the current time, only use first reference: 1=slider, 2=dropdown
			else
				WriteSelectionEnvelope(aAttrib028_1[0], 2, "color");
		}
	}

	for (nI=0; nI<aAttrib029_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
		if (getObjectById(aAttrib029_1[nI])) {
			if (aAttrib029_2[nI] == undefined || !isNaN(aAttrib029_2[nI]) || aAttrib029_2[nI].toLowerCase() != "dropdown") 
				WriteSizeSelection(aAttrib029_1[0]);				//Add Size Selection
			else
				WriteSelectionEnvelope(aAttrib029_1[0], 2, "size");
		}
	}

	global_col_per_page = 4;
	global_rec_page = 12;
	for (nI=0; nI<aAttrib034_1.length; nI++) {	//set list details.
		if (aAttrib034_1[nI] != undefined && !isNaN(aAttrib034_1[nI]) ) global_col_per_page = aAttrib034_1[nI];
		if (aAttrib034_2[nI] != undefined && !isNaN(aAttrib034_2[nI]) ) global_rec_page = aAttrib034_2[nI];
	}

	for (nI=0; nI<aAttrib043_1.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
		if (aAttrib043_1[nI] == undefined || isNaN(aAttrib043_1[nI])) {
			global_eshirt_pagemode = 0;
		} else {
			global_eshirt_pagemode = aAttrib043_1[nI];
		}
	}
	for (nI=0; nI<aAttrib043_2.length; nI++) {			//Change Href contents of Alt #global_nAlt_Counter
		if (aAttrib043_2[nI] == undefined || isNaN(aAttrib043_2[nI])) {
			global_pro_pagemode = 0;
		} else {
			global_pro_pagemode = aAttrib043_2[nI];
		}
	}

	for (nI=0; nI<aAttrib038_1.length; nI++) {	//Write Filter menu.
		//Placed outside getObjectById to enable default category and search filters even if the filter choices are not offered to the surfer.
		if (aAttrib038_3[nI] != undefined ) {
			if (aAttrib038_3[nI] && aAttrib038_3[nI] != "") {global_default_category = aAttrib038_3[nI];}
		}
		if (aAttrib038_4[nI] != undefined ) {
			if (aAttrib038_4[nI] && aAttrib038_4[nI] != "") {global_default_search = aAttrib038_4[nI]; }
		}	
	}


	nCurPage = 0;
	nPageSz = global_rec_page;
	nSort = 0;
	var aChoices	= new Array("by Popularity","by Newest","Randomly","Alphabetically","by Price");
	var aValues	= new Array("5","7","1","2","3");
	for (nI=0; nI<aAttrib033_3.length; nI++) {
		for (var nI2=0; nI2<aChoices.length; nI2++)
			if (aAttrib033_3[nI].toLowerCase() == aChoices[nI2].toLowerCase()) nSort = aValues[nI2];	//If default sort, then preset it.
	}
	sCat = "";
	sSearch = "";
	sSec = "";

	if (!isNaN(GetVars('pg')) && GetVars('pg')!="") nCurPage = parseInt(GetVars('pg')) + 1;
	if (!isNaN(GetVars('ps')) && GetVars('ps')!="") nPageSz = parseInt(GetVars('ps'));
	if (!isNaN(GetVars('sort')) && GetVars('sort')!="") nSort = parseInt(GetVars('sort'));
	//If "ALL E-Shirt designs" OR "Pro-Designs" are enabled, then enable this variable to allow design categories to be selecteds

	if (global_pro_pagemode==1 && global_default_category !="" && !isNaN(global_default_category)) sCat = "&scat="+ global_default_category;
	if (!isNaN(GetVars('scat')) && GetVars('scat')!="" && GetVars('scat')!="0" && (global_eshirt_pagemode==1 || global_pro_pagemode==1)) sCat = "&scat="+ parseInt(GetVars('scat'));  //nCat = parseInt(GetVars('scat'));
	//If "Store-Owners E-Shirt designs" are selected, then enable this variable to allow section selection.
	if (!isNaN(GetVars('sec')) && GetVars('sec')!="" && global_eshirt_pagemode==0) sSec = "&sec="+ parseInt(GetVars('sec'));		//nSec = parseInt(GetVars('sec'));
	if (GetVars('stext')!="" || global_default_search!="") sSearch = GetVars('stext')+"%20"+escape(global_default_search);

	$("#ES_Progressbar").progressBar(global_progressbar+5,{running_value : global_progressbar}); global_progressbar += 5;

	makeRequest( global_page_type == ES_PRODUCT_DETAIL_PAGE?'http://e-shirt.com/xml_ProductDetails_ver3.php':'http://e-shirt.com/xml_ProductList_ver4.php', '?t='+token+'&mde='+ global_eshirt_pagemode + '&mdp='+ global_pro_pagemode + '&s='+ global_storeid + '&sid='+ global_sessionid +'&did=' + global_pid + '&sort='+ nSort    +'&search=' + sSearch + sCat + sSec + '&ps='+nPageSz+'&p='+nCurPage+ '&format=JSON', alertContents );
}

function es_addFooter() {
	var d = new Date();
	var curr_year = d.getFullYear();
	return	'<div id="eshirt200905_footer" class="footer_blue" align="center">'+
					'<div style="width:715px;">'+
					'<div style="position:relative; float:right; top:3px; width:475px;" > <span style="position:relative; top:0px; left:35px; float:left;">powered by:</span><a href="http://e-shirt.com" style="position:relative; float:left; top:4px; left:35px;" target="_self" title="E-Shirt.com T-Shirts, Gifts and Apparel"><img name="E-Shirt.com" src="http://e-shirt.com/images/e-shirt88x31_2.gif" width="88" height="31" border="0" alt=""></a> <br>'+
					'<span style="position:relative; left:13px;">|&nbsp;&nbsp;<a class="ES_A_footer" href="'+ global_shopcart_url+"?SID="+MakeSessionID(global_sessionid)+"&MID="+global_storeid+'">Shopping Cart</a>&nbsp;&nbsp; | &nbsp;&nbsp;<a class="ES_A_footer" href="http://artapart.com/OrderStatus.asp">Order Status</a>&nbsp;&nbsp; | &nbsp;&nbsp;<a class="ES_A_footer" href="javascript:window.open(\'http://e-shirt.com/sell_promo.html\',\'newWin\',\'scrollbars=no,status=no,width=470,height=395\'); \location=\'http://www.e-shirt.com/Affiliate/ProfileEditor.php\';">Free T-Shirt Store</a></span> <br>'+
					'<span style="position:absolute; top:33px; left:122px; display:block;"><a class="ES_A_footer" href="http://artapart.com/copyright.asp" style="TEXT-DECORATION: none" target="_self" >Copyright</a> © 1998-'+ curr_year +' Aajost&nbsp;Technologies,&nbsp;Inc. All&nbsp;rights&nbsp;reserved.</span></div>'+
					'<div style="position:relative; float:left; top:5px; width:240px;"> <img name="credit_cards" src="http://e-shirt.com/images/borders/default_205.gif" width="165" height="43" border="0" alt="" style="position:relative; float:left; "> <a href="http://artapart.com/tshirtinfo.asp#Return Policy" target="_self" style="position:relative;  "><img name="seal" src="http://e-shirt.com/images/borders/default_213.gif" width="48" height="43" border="0" alt=""></a> </div>'+
					'</div><div id="footersearch200905" style="position:relative; width: 1px; height: 1px;"></div></div>';
}

function es_removeElement(deleteDiv) {
	$("#"+deleteDiv).remove();
}

function es_processOptions(JSONfeed, objProduct) {
	var sAppLbl, sImg1, sImg2, nID, sName, sMicroIMG, nCostAdder, nID2;
	var sApparel= "";
	var sColors = "";
	var sSizes	= "";
	var nCounterApp=0;
	var nCounterClr=0;
	var nCounterSiz=0;

	/*FYI - appArray may be an array (if >1 apparel items) or a single item (id =1 item)*/
	appArray = JSONfeed.AOPTION;	//There is only one AOPTION, but it is an array.  Grab it.
	if (isArray(appArray)) {
		nArrayAppCtr = 0;
		nAppArrayLen = appArray.length;
	} else {
		nArrayAppCtr = 0;
		nAppArrayLen = 1;
	}
	while (nArrayAppCtr < nAppArrayLen) {
		if (isArray(appArray)) {
			appNode = appArray[nArrayAppCtr];
		} else {
			appNode = appArray;
		}
		nArrayAppCtr++;

//	for (var iNodeA in appArray) {	//Loop through each Apparel Arrat Element
//		var appNode = appArray[iNodeA];	

		nCounterApp++;
		sAppLbl = "APPAREL";
		sImg1 = "";
		sImg2 = "";
		nID = 0;
		sName = "";
		sMicroIMG = "";
		nCostAdder = 0;
		
		if (appNode) {	//This conditional handles the case that a product does not have an apparel selection (for example color options, but no apparel selections)
			if (appNode["@attributes"]) {
				nID = appNode["@attributes"].id.toLowerCase();
				sName = appNode["@attributes"].name.toLowerCase();
				nCostAdder = appNode["@attributes"].costadder.toLowerCase();
				sMicroIMG = appNode["@attributes"].imageurl.toLowerCase();
			}
			sApparel = sApparel + "0,"+nID+",APPAREL,"+sName+","+nCostAdder+",,,0,0,0,0,"+sMicroIMG+",";
		} else {	//There is no apparel node, see if top level node is a color node.
			appNode = JSONfeed;
			if (nCounterApp<2) nCounterApp = 0;	//if the only count was the first time through, then there was really no apparel items.
		}

		clrArray = appNode.COPTION;	//There is only one COPTION, but it is an array.  Grab it.
		if (isArray(clrArray)) {
			nArrayClrCtr = 0;
			nClrArrayLen = clrArray.length;
		} else {
			nArrayClrCtr = 0;
			nClrArrayLen = 1;
		}
		while (nArrayClrCtr < nClrArrayLen) {
			if (isArray(clrArray)) {
				clrNode = clrArray[nArrayClrCtr];
			} else {
				clrNode = clrArray;
			}
			nArrayClrCtr++;

//		for (var iNodeB in clrArray) {	
//			var clrNode = clrArray[iNodeB];	
			nCounterClr++;
			nID2 = 0;
			sName = "";
			sMicroIMG = "";
			nCostAdder = 0;

			if (clrNode) {	//This conditional handles the case that a product does not have a color selection (for example size options, but no color selections)
				if (clrNode["@attributes"]) {
					nID2 = clrNode["@attributes"].id.toLowerCase();
					sName = clrNode["@attributes"].name.toLowerCase(); 
					nCostAdder = clrNode["@attributes"].costadder.toLowerCase(); 
					if (clrNode["@attributes"].imageurl) sMicroIMG = clrNode["@attributes"].imageurl.toLowerCase(); 
				}
				sColors = sColors + nID +","+nID2+",COLOR,"+sName+","+nCostAdder+","+sMicroIMG+",FFFFFF,";
			} else {
				if (nCounterApp>0) {
					clrNode = appNode;	//Even though no color choices existed, apparel choices DID exist.
					nID2 = nID;		//Done to retain the parent-child relationship if color option does not exist.
				} else {
					clrNode = JSONfeed;	//No apparel or color choices existed, SIZE options would be the Top Node Items.
				}
				if (nCounterClr<2) nCounterClr = 0;	//if the only count was the first time through, then there was really no color items.
			}
			szArray = clrNode.SOPTION;	//There is only one SOPTION, but it is an array.  Grab it.

			if (isArray(szArray)) {
				nArraySzCtr = 0;
				nSzArrayLen = szArray.length;
			} else {
				nArraySzCtr = 0;
				nSzArrayLen = 1;
			}
			while (nArraySzCtr < nSzArrayLen) {
				if (isArray(szArray)) {
					szNode = szArray[nArraySzCtr];
				} else {
					szNode = szArray;
				}
				nArraySzCtr++;
//			for (var iNodeC in szArray) {	
//				var szNode = szArray[iNodeC];	

				nID3 = 0;
				sName = "";
				sMicroIMG = "";
				nCostAdder = 0;
				if (szNode) {	//This conditional handles the case that a product does not have a size selections
					if (szNode["@attributes"]) {	
						nID3 = szNode["@attributes"].id.toLowerCase(); 
						sName = szNode["@attributes"].name.toLowerCase(); 
						nCostAdder = szNode["@attributes"].costadder.toLowerCase(); 
					}
					sSizes = sSizes + nID2+","+nID3+",SIZE,"+sName+","+nCostAdder+",";
				}
			}
		} //For clrNode

	} //For AppNode

	objProduct.Type = sApparel.substr(0,sApparel.length - 1);
	if (sColors !="") objProduct.Color = sColors.substr(0,sColors.length - 1);
	if (sSizes !="") objProduct.Size =  sSizes.substr(0,sSizes.length - 1);
}

function ProductOptions() {
	this.Type = "";
	this.Color = "";
	this.Size = "";
}

// JavaScript Document Supporting Related Design Popup Windows.
/*
function newImageLoad(pid, max_x, max_y, arg) {
	if (document.images) {
		var sExec = "rslt.onload=function() { AdjImages('"+pid+"', this, "+max_x+", "+max_y+",'"+arg+"');}";
		var rslt = new Image();
		eval(sExec);
		rslt.src = arg;
		return rslt;
	}
}

function layerWrite2(id,nestref,text) {
	if (browser.isIE4x) {
		document.all[id].innerHTML = text;
	} else {
		if (browser.isNS4x) {
			var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document;
			lyr.open();
			lyr.write(text);
			lyr.close();
		} else {
			document.getElementById(id).innerHTML = text;
		}
	}
}
*/

function es_Zoom_in(sRGB, sProdDetails, spImage) {
	var spop1a = '<div style="background-image:url(';
	var spop1b = '); background-position:center; background-repeat:no-repeat"></div>';
	var spop2 = '<div id="image_container" style="background-color: ';
	var spop3 = '<div id="image_container" style="background-color: ';
	var spop2a = ';"><a href="';
	var spop2b = '"><img border="0" width="125%" height="125%" src="';
	var spop3b = '"><img border="0" src="';
	var spop2c = '" onload="adjIMGs(\'image_container\', this, 190, 190);" ></a></div>';
	if ($.browser.msie) {
		sURL = spop3 + sRGB + spop2a + sProdDetails + spop3b + spImage + spop2c;
	} else {
		sURL = spop2 + sRGB + spop2a + sProdDetails + spop2b + spImage + spop2c;
	}
	return sURL;
}

function es_Zoom_in2(sRGB, spImage) {
	//var spop1a = '<div style="background-image:url(';
	//var spop1b = '); background-position:center; background-repeat:no-repeat"></div>';
	var spop2 = '<div id="image_container" style="background-color: ';
	var spop3 = '<div id="image_container2" style="background-color: ';
	var spop2a = "; \" onClick=\"es_gradient('eshirt200905_body', 1.0); $('#overDiv').hide('slow'); \">";
	var spop3a = "; height:450px; width:450px; \" onClick=\"es_gradient('eshirt200905_body', 1.0); $('#overDiv').hide('slow'); \">";
	var spop2b = '<img border="0" src="';
	var spop3b = '<img width="125%" height="125%" border="0" src="';
	var spop2c = "\" ></div>";
	if ($.browser.msie || $.browser.safari) {
		sURL = spop3 + sRGB + spop3a + spop3b + spImage +"?r=" + Math.floor(Math.random()*1000) + spop2c;
	} else {
		sURL = spop2 + sRGB + spop2a + spop2b + spImage +"?r=" + Math.floor(Math.random()*1000) + spop2c;
	}
	return sURL;
}

function es_gradient(id, level) {
	$("#"+id).fadeTo("slow", level);	//jQuery Fade
	return;
}

function OLcmdExT1() {
	nSuggestLoad = 0;
	return overlib(OLresponseAJAX, WIDTH, 305, STICKY, NOCLOSE);
}

function WriteSelectionEnvelope(sDiv, sType, sSubClass) {
	if (sType != 2) {
		sSliderHTML = '<div class="messaging"> This Page requires JavaScript and/or CSS. Currently one or both of these is disabled in your browser. </div>'+
									'<a href="#" class="prev"><img src="images/details/leftscroll.gif" width="14" height="14" alt="Previous" title="Previous" env="images" /></a>'+
									'<a href="#" class="next"><img src="images/details/rightscroll.gif" width="14" height="14" alt="Next" title="Next" env="images" /></a>'+
									'<div id="'+sSubClass+'container" class="'+sSubClass+'container"> </div>';
		$("#"+sDiv).addClass("news_slider");
		$("#"+sDiv).addClass(sSubClass);
	} else {
//		sSliderHTML = "<select id=\"ES_select_"+ sSubClass +"\" class=\"ES_select_"+ sSubClass +"\" name=\"ES_select_"+ sSubClass +"\" onChange=\"\">"+
//									'<option selected value="0">Select '+ sSubClass.toLowerCase() +'</option></select>';
		sSliderHTML = "<dl id=\"ES_select_"+ sSubClass +"\"  class=\"dropdown ES_select_"+ sSubClass +"\"><dt><a href=\"#\"><span>select "+ sSubClass.toLowerCase() +"</span></a></dt><dd><ul style=\"display: none;\">"+
									'<li><a href=\"#\" title=\"Select '+ sSubClass.toUpperCase() +'\">select '+ sSubClass.toLowerCase() +'<span class=\"value\">1</span></a></li></ul></dd></dl>';
	}

	alterDivContent(sDiv, sSliderHTML);
}

function WriteSizeSelection(sDiv) {
	sHTML = "<select id=\"cboSize0\" class=\"ES_select_size\" name=\"cboSize0\" onChange=\"es_CalSizePrice(global_formname, 0); toggleBox('overDiv', 0);\">"+
								'<option selected value="0">Select SIZE</option></select>';
	alterDivContent(sDiv, sHTML);
}


function es_CalSizePrice(sFormName) {
	var objSize;
	eval("objSize=document."+ sFormName +".cboSize0;");
	
	objSize.style.background='#FFFFFF';
	objSize.style.color='Black';
	global_sPrice=0;
	var str;
	eval("str=document."+ sFormName +".hidSize0.value;");
	var parts=str.split(",");
	var arrprice=new Array();
	arrprice[0]=new Array();
	arrprice[1]=new Array();
	var x=0;
	var y=0;
	while (x<parts.length) {
		arrprice[0][y]=parts[x+1];//sizeID
		arrprice[1][y]=parts[x+4];//sizePrice
		y++;
		x+=5;
	}
	nSelect = objSize.value;
	var k;
	for(k=0;k<y;k++) {
		if(nSelect == arrprice[0][k]) {
			global_sPrice=arrprice[1][k];
		}
	}//end of for
	es_CalculateTotalPrice(sFormName);
}//end of function


function MakeSessionID(sIP) {
	var sSessID="";
	var sTemp;
	if (sIP==null) return "";
	if (sIP.indexOf(".")==-1) return sIP;
	var aAdd = sIP.split(".");
	for ( var nI in aAdd) {
		sTemp = "000"+aAdd[nI];
		sMaxLength = aAdd[nI].length;
		sSessID = sSessID + sTemp.substring(sTemp.length-((sMaxLength<3)?3:sMaxLength));	//Limit IP subsections to a minimum of 3 digits, but allow longer numbers.
	}
	return "1"+sSessID;
}

function pgtypeval(oDetail, oList) {
	if (global_page_type == ES_PRODUCT_DETAIL_PAGE) return oDetail;
	else return oList;
}

function AddFormElements(sFormname, aFormelems, aElemtype, aElemdefault, aForcedefault) {	//Create mass form elements form arrays.
	var oFormElem;
	for (nJ in aFormelems) {
		eval("oFormElem = document.forms['"+ sFormname +"']."+aFormelems[nJ]);
		if (!oFormElem || aFormelems[nJ]=="cat") {	//If form element does not exist, then create one.
			es_CreateFormElement(sFormname, "input", aElemtype[nJ], aFormelems[nJ], aFormelems[nJ], aElemdefault[nJ]);	//Create quant element
		} else {
			if (aForcedefault[nJ] && aElemdefault[nJ] !="") {
				oFormElem.value = aElemdefault[nJ];	// id already exists, fill it.
			}
		}
	}
}

function pausecomp(millis) {
	var date = new Date();
	var curDate = null;
	do { curDate = new Date(); }
	while(curDate-date < millis);
}

function FixIMG1(sImgsrc, sDiv, max_x, max_y, ImagePath, posx, posy) {
	var imgPreview = new Image();
	var randomnumber = Math.floor(Math.random()*10001);
	imgPreview.onload = function(){eval("FixIMG2('"+sImgsrc+"', '"+sDiv+"', this.width, this.height, "+max_x+", "+max_y+", '"+ImagePath+"', "+posx+", "+posy+", "+randomnumber+");");};
	imgPreview.src = ImagePath;	//oImgsrc.src;
	if (imgPreview.width > 0 ) {
		FixIMG2(sImgsrc, sDiv, imgPreview.width, imgPreview.height, max_x, max_y, ImagePath, posx, posy, randomnumber);
	}
}

function FixIMG2(sImgsrc, sDiv, nx2, ny2, max_x, max_y, ImagePath, posx, posy, randomnumber) {
	var oDiv, oImgsrc;
	if (randomnumber != global_es_bounceprotect) {
		global_es_bounceprotect = randomnumber;
		if (nx2>max_x) {ny2=Math.round(ny2/(nx2/max_x)); nx2=max_x;}
		if (ny2>max_y) {nx2=Math.round(nx2/(ny2/max_y)); ny2=max_y;}

		if (posx == -1) {
			posx = 142 - Math.round(nx2/2);			//Center X
		} else {
			posx = Math.round(posx) + Math.round((142-nx2)/2)+8;
		}
		if (posy == -1) {
			posy = 142 - Math.round(ny2/2);			//Center Y
		} else {
			nVadj = ((parseInt(10*nx2/ny2)-10));
			if (nVadj < 0) nVadj = 0;
			posy = Math.round(posy) + Math.round(((120-ny2)/2)-nVadj);
		}

		if (isNaN(posx)) {
			//alert("Position is Not a Number");
		} else {
			if (document.getElementById) {
				eval("oDiv=document.getElementById('"+sDiv+"')");
			} else {
				eval ('oDiv = document.all.'+sDiv+'.style');
			}

			oDiv.style.width=nx2+"px";
			oDiv.style.height=ny2+"px";
			oDiv.style.left=posx+"px";
			oDiv.style.top=posy+"px";
			eval("oImgsrc = document."+sImgsrc);
			oImgsrc.height=ny2;
			oImgsrc.width=nx2;
			if (($.browser.msie && parseInt($.browser.version.substr(0,1)) < 7) && oImgsrc.src.match(/.*\.png.*/i) != null) {
				oImgsrc.style.width=nx2+'px'; 
				oImgsrc.style.height=ny2+'px';
				oImgsrc.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ ImagePath +"', sizingMethod='scale')";
				oImgsrc.src='/images/clear.gif';
			}
		}
	}
}

function toggleBox(szDivID, iState) {// 1 visible, 0 hidden
    if(document.layers) {  //NN4+
			document.layers[szDivID].visibility = iState ? "show" : "hide";
			document.layers[szDivID].display = iState ? "" : "none";
    } else if(document.getElementById) {	  //gecko(NN6) + IE 5+

			var obj = document.getElementById(szDivID);
			if (obj) {
				obj.style.visibility = iState ? "visible" : "hidden";
				obj.style.display = iState ? "" : "none";
			}
    } else if(document.all) {	// IE 4
			document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
			document.all[szDivID].style.display = iState ? "" : "none";
    }
}

/************************************************************************************************
	EXPOSE THE FOLLOWING FUNCTIONS EXTERNALLY
*************************************************************************************************/

function Register_ID() {	//attribute index, divid, parameters
	//FORMAT: aAttrib999_1[0] Where '999' is the attribute index number (000-999), and '1' is the Register_ID function parameter number (1-9), and '0' is the index number.
	if ( arguments[0] == undefined || arguments[1] == undefined) return;
	if (isNaN(arguments[0]) ) return;
	var nAttribIndex = arguments[0];

	if (nAttribIndex<10) 
		sAttribIndex = "00"+nAttribIndex;
	else {
		if (nAttribIndex<100) 
			sAttribIndex = "0"+nAttribIndex;
		else
			sAttribIndex = ""+nAttribIndex;
	}

	eval("var nMasterIndex = aAttrib"+sAttribIndex+"_1.length");	//The second parameter is REQUIRED, so use it as a anchor reference for next array index.

for (nI=1; nI<=9; nI++) {		//Loop through up to 9 parameters of the Register_ID Function.
		try {
			eval("sObj = aAttrib"+sAttribIndex+"_"+ nI+".constructor");
			if ( arguments[nI] != undefined && sObj==Array )	//if parameter exists and array exists.
				sCommand = "aAttrib"+sAttribIndex+"_"+ nI +"["+ nMasterIndex +"] = arguments["+nI+"]";
				if (arguments[nI] != "") 	eval(sCommand);
		}
		catch(e) { 
			//This catch is ultra critical.  Many errors occur in the above TRY whenever a user supplied parameter does not exist.
			//We ignore these errors and move onto the next parameter.
		}
	}
}


function es_CalcPrice(nSides, ApparelID, ColorID, SizeID, nQty) {
	return "0.00";
}

function es_DefinePageType(nType) {
	global_page_type = nType;
	if (nType==ES_PRODUCT_DETAIL_PAGE) {
		if ($.browser.msie)
			dynamicallyLoadCSS("http://e-shirt.com/stylesheets/template/ES_Template_IE_Only.css");	//Only load CSS if needed.
		else
			dynamicallyLoadCSS("http://e-shirt.com/stylesheets/template/ES_Template_AllStdBrowsers.css");	//Only load CSS if needed.
		
		$.getScript("http://e-shirt.com/js/jquery.options-slider_comp.js");
	}

}


/* Main User Callable Function - This function, when called by the user, executes all product and page code.  
Hopefully the data is already loading in the background.  
If it is not yet ready, then we wait and let the "loaded" event handler call the code. Otherwise we call it here. */
function es_ExecutePage() {
	global_commands_loaded=true;
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			// global_XML_processed is set in the alertContents() function, and so if the function has already been executed, it is not called again.  There is a very tight race condition window.  Failure should be very rare.
			if(!global_XML_processed) {	alertContents();}	
		}
	}		
}


function es_isString(a) {
    return typeof a == 'string';
}

function es_ProductDetailPageURL() {
	if ( arguments[0] != undefined) 
		if (arguments[0] != "") global_detailpage_url = arguments[0];
	if ( arguments[1] != undefined) 
		if (arguments[1] != "") global_page_url_GET = arguments[1];
}

function es_ProductListingPageURL() {
	if ( arguments[0] != undefined) 
		if (arguments[0] != "") global_listingpage_url = arguments[0];
	if ( arguments[1] != undefined) 
		if (arguments[1] != "") global_page_url_GET = arguments[1];
}

/*
function AdjImages(pid, oNewSrc, max_x, max_y, ImagePath) {
	var nx, ny, oImgsrc;
	nx=oNewSrc.width; ny=oNewSrc.height;
	if (nx>max_x) {ny=Math.round(ny/(nx/max_x)); nx=max_x}
	if (ny>max_y) {nx=Math.round(nx/(ny/max_y)); ny=max_y;}
	layerWrite2(pid, "", "<img border=\"0\" src=\"\" id=\""+pid+"_img\" width=\""+ nx +"\" height=\""+ ny +"\" />");
	oImgsrc = document.getElementById(pid+"_img");
	oImgsrc.src=oNewSrc.src;
	if ((browser.isIE55 || browser.isIE6x) && browser.isWin32 && oImgsrc.src.match(/.*\.png.* /i) != null) {
		oImgsrc.style.width=nx+'px'; 
		oImgsrc.style.height=ny+'px';
		oImgsrc.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ ImagePath +"', sizingMethod='scale')";
		oImgsrc.src='/images/clear.gif';
	}
}
*/

function adjIMGs(sDiv, oImgsrc, max_x, max_y) {	
	var oDiv = getObjectById( sDiv );
	ES_adjIMGs(oDiv, oImgsrc, max_x, max_y);
}

function ES_adjIMGs(oDiv, oImgsrc, max_x, max_y) {	
	var nx, ny;
	var nDivHeight=0;

	nx=oImgsrc.width; ny=oImgsrc.height;
	if (nx && ny) {
		if (isNaN(max_x)) max_x = parseInt(max_x);
		if (isNaN(max_y)) max_y = parseInt(max_y);
		if (nx>max_x) {ny=Math.round(ny/(nx/max_x)); nx=max_x}
		if (ny>max_y) {nx=Math.round(nx/(ny/max_y)); ny=max_y;}

		oImgsrc.height=ny;
		oImgsrc.width=nx;
		if (oDiv) {	//This section does a vertical centering of the image.
			nDivHeight = oDiv.offsetHeight;		//This grabs the resultant height of the div-image container.
			if (nDivHeight > 0) {
				nTopPadHeight = Math.round((nDivHeight-ny)/2)-1;
				if (nTopPadHeight > 0) {
//This adds padding to the top of the box, and because this moves the DIV down, it shortens the DIV box by the same amount.
//	Even though it is animated, it is done so fast that the effect is not visible.
					if ($(oDiv).attr("ES_MaxHeight")==undefined || $(oDiv).attr("ES_MaxHeight") < $(oDiv).css('height') ) $(oDiv).attr("ES_MaxHeight", $(oDiv).css('height'));
					$(oDiv).animate( {height: ""+ (parseInt($(oDiv).css('height')) - nTopPadHeight) +"px" }, 10)
								.animate( {paddingTop: ""+nTopPadHeight+"px" }, 10);
				}
			}
			nDivWidth = oDiv.offsetWidth;
			if (nDivWidth > 0) {
				nLeftPadHeight = Math.round((nDivWidth-nx)/2)-1;
				if (nLeftPadHeight > 0) {
//This adds padding to the left of the box, and because this moves the DIV right, it shortens the DIV box by the same amount.
//	Even though it is animated, it is done so fast that the effect is not visible.
					if ($(oDiv).attr("ES_MaxWidth")==undefined || $(oDiv).attr("ES_MaxWidth") < $(oDiv).css('width') ) $(oDiv).attr("ES_MaxWidth", $(oDiv).css('width'));
					$(oDiv).animate( {width: ""+ (parseInt($(oDiv).css('width')) - nLeftPadHeight) +"px" }, 10)
								.animate( {paddingLeft: ""+nLeftPadHeight+"px" }, 10);
				}
			}	
		}
		if (oImgsrc.src && $.browser.msie && parseInt($.browser.version.substr(0,1)) < 7 && oImgsrc.src.match(/.*\.png.*/i) != null) {
			oImgsrc.style.width=nx+'px'; 
			oImgsrc.style.height=ny+'px';
			oImgsrc.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ oImgsrc.src +"', sizingMethod='scale')";
			oImgsrc.src='http://e-shirt.com/images/clear.gif';
		}
	}
}

function es_switchtofront() {
	global_side_display = 1;
	for (nI=0; nI<aAttrib015_1.length; nI++) {			//Change Tag Contents
		if (getObjectById(aAttrib015_1[nI]) && getObjectById(aAttrib015_2[nI]) && aAttrib015_3[nI] != undefined ) {
			if (aAttrib015_4[nI] == undefined || isNaN(aAttrib015_4[nI]) ) {
				//If this ID contains an image used to show both sides, then switch it.
				ES_MainSwapSizer(global_lrg_img_front);
			} else {
				if (aAttrib015_4[nI] == 2) 
					getObjectById(aAttrib015_2[nI]).src = global_lrg_img_back;
				else
					getObjectById(aAttrib015_2[nI]).src = global_lrg_img_front;
			}
		}
	}
}

function es_switchtoback() {
	global_side_display = 2;
	for (nI=0; nI<aAttrib015_1.length; nI++) {			//Change Tag Contents
		if (getObjectById(aAttrib015_1[nI]) && getObjectById(aAttrib015_2[nI]) && aAttrib015_3[nI] != undefined ) {
			if (aAttrib015_4[nI] == undefined ) {
				ES_MainSwapSizer(global_lrg_img_back);
			} 
		}
	}
}

var global_imgswappervar;

function ES_MainSwapSizer(sImage) {
	$("#"+aAttrib015_2[0]).fadeTo(250,0.05, function () {getObjectById(aAttrib015_2[0]).src = sImage;});
	global_imgswappervar = new Image();
	global_imgswappervar.onload = function () { ES_RestoreMainImgSize(0); $("#"+aAttrib015_2[0]).attr("width", this.width); $("#"+aAttrib015_1[0]+" img").attr("height", this.height); getObjectById(aAttrib015_2[0]).src = sImage; $("#"+aAttrib015_2[0]).fadeTo(250,1.0);};
	global_imgswappervar.src = sImage;
}

function ES_RestoreMainImgSize(nI) {
	if ($("#"+aAttrib015_1[nI]).attr("ES_MaxWidth")!=undefined && parseInt($("#"+aAttrib015_1[nI]).attr("ES_MaxWidth")) > parseInt($("#"+aAttrib015_1[nI]).css('width')) ) {
		$("#"+aAttrib015_1[nI]).css('padding-left', 0);
		$("#"+aAttrib015_1[nI]).css('width', $("#"+aAttrib015_1[nI]).attr("ES_MaxWidth"));
	}
	if ($("#"+aAttrib015_1[nI]).attr("ES_MaxHeight")!=undefined && parseInt($("#"+aAttrib015_1[nI]).attr("ES_MaxHeight")) > parseInt($("#"+aAttrib015_1[nI]).css('height')) ) {
		$("#"+aAttrib015_1[nI]).css('padding-top', 0);
		$("#"+aAttrib015_1[nI]).css('height', $("#"+aAttrib015_1[nI]).attr("ES_MaxHeight"));
	}
}

function es_ReadCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0)
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function GetVars(varname) {
  varname = varname.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+varname+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}


function es_chooseOption(theObj){
	alert('Please choose from the available product options.');
	theObj.focus();
	return(false);
}

function es_FormValidator() {
	//	via AJAX call: ajaxadd.php?did=&q=&aid=&cid=&sid=&ses=&t=&s=
	var theForm = document.forms[global_formname];
	if(theForm.optn0 && theForm.optn0.selectedIndex==0) return(es_chooseOption(theForm.optn0));

	var objApp, objColor, objSize;
	var objApp	= theForm.cboApp0;
	var objColor= theForm.cboClr0;
	var objSize = theForm.cboSize0;
	if (objApp) {
		if (objApp.value == "" && theForm.hidApp0.value!="") {
			alert('Please choose from the available apparel options.');
			return(false);
		}
	}
	if (objColor) {
		if (objColor.value == "" && theForm.hidClr0.value!="") {
			alert('Please choose from the available color options.');
			return(false);
		}
	}
	if (objSize) {
		if (aAttrib029_2[0] == undefined || !isNaN(aAttrib029_2[0]) || aAttrib029_2[0].toLowerCase() != "dropdown") {
			if (objSize.selectedIndex==0) {
				alert('Please choose from the available size options.');
				objSize.focus();
				return(false);
			} else {
				sID = objSize.options[objSize.selectedIndex].value;
			}
		} else {
			if (objSize.value == "") {
				alert('Please choose from the available size options.');
				return(false);
			} else {
				sID = objSize.value;
			}
		}
	}
	nQty = 1;
	if (aAttrib026_1.length == 0) nQty = theForm.quant.value;		//If no ES_WRITE_QUANTITY_SELECTION command, then get hidden form amount.
	for (nI=0; nI<aAttrib026_1.length; nI++) {			//Get Quantiity from drop down menu
		if (getObjectById(aAttrib026_1[nI]) ) {
			objQuan = theForm.quant;
			if (objQuan.selectedIndex != undefined) nQty = objQuan.options[objQuan.selectedIndex].value;
		}
	}
	toggleBox('overDiv', 0); overlib(global_sPleaseWait, STICKY, FIXX, es_CenterXPos()-80, RELY, 130); $("#overDiv").show("normal");
	var sCart = "<table width=\"165\"><tr><td bgcolor=\"#FFFFFF\"><font color=\"#000000\" size=3><b>Added to Cart...</b></font></td></tr><tr><td><font size=1>The current item was added <br>the the shopping cart.</font></td></tr></table>";
	var parameters = "?did="+global_pid+"&q="+ nQty +"&aid="+ objApp.value +"&cid="+ objColor.value +"&sid="+ sID +"&det=1&ses="+ global_sessionid +"&t="+ global_token +"&s="+global_storeid;
	makeRequest("http://e-shirt.com/ajaxadd_JSON.php", parameters, cartContents);
  return false;
}

function cartCount(jsondata) {
	var cartJSON_ver="1.0"; cartJSON_acc = false;
	var root = jsondata.CartReply;		//xmldoc.getElementsByTagName('DATAFEED')[0];
	var nodeCollection = root.COLLECTION_DETAILS;		//xmldoc.getElementsByTagName('COLLECTION_DETAILS')[0];
	try {
			if (root["@attributes"].version) {	cartJSON_ver = root["@attributes"].version;}
			if (root["@attributes"].access) {	cartJSON_acc = (root["@attributes"].access=="accepted"?true:false);}
	}
	catch(err) { alert(err.message); }

	if (cartJSON_acc) {
		global_cartdiffitems = root.cartcontents.differentitemqty;
		global_carttotitems = root.cartcontents.totalitemqty;
	} else {
		global_cartdiffitems = 0;
		global_carttotitems = 0;
	}
	for (nI=0; nI<aAttrib040_1.length; nI++) {	//Write Items per page menu.
		if (getObjectById(aAttrib040_1[nI])) {
//			parameters = "?det=0&ses="+ global_sessionid +"&t="+ global_token +"&s="+global_storeid;
//			if (global_cartdiffitems==0 && global_carttotitems == 0) {
//				makeRequest("http://e-shirt.com/ajaxadd_JSON.php", parameters, cartCount );
//			}
			alterDivContent(aAttrib040_1[nI], global_carttotitems );
		}
		if (getObjectById(aAttrib040_2[nI])) {
			alterDivContent(aAttrib040_2[nI], global_cartdiffitems );
		}
	}
}

function cartContents(jsondata) {
	var cartJSON_ver="1.0"; cartJSON_acc = false;
	var root = jsondata.CartReply;		//xmldoc.getElementsByTagName('DATAFEED')[0];
	var nodeCollection = root.COLLECTION_DETAILS;		//xmldoc.getElementsByTagName('COLLECTION_DETAILS')[0];
	try {
			if (root["@attributes"].version) {	cartJSON_ver = root["@attributes"].version;}
			if (root["@attributes"].access) {	cartJSON_acc = (root["@attributes"].access=="accepted"?true:false);}
	}
	catch(err) { alert(err.message); }

	if (cartJSON_acc) {
		global_cartdiffitems = root.cartcontents.differentitemqty;
		global_carttotitems = root.cartcontents.totalitemqty;
		cartMsg = "<tr><td><font size=1>"+ global_cartdiffitems +" different items in cart.<br>"+ global_carttotitems +" total items in cart.</font></td></tr></table>";
	
		if (root.actionstatus==1) {
			cartMsg = "<table><tr><td bgcolor='#FFFFFF'><font color='#000000' size=3><b>Added to Cart...</b></font></td></tr>" + cartMsg;
		} else {
			cartMsg = "<table><tr><td bgcolor='#FFFFFF'><font color='#CC0000' size=3><b>Failed! Retry...</b></font></td></tr>" + cartMsg;		
		}
	} else {
		cartMsg = "<table><tr><td bgcolor='#FFFFFF'><font color='#CC0000' size=3><b>Oppps!...</b></font></td></tr><tr><td><font size=1>Unable to get permission<br>to add item to cart.</font></td></tr></table>";
	}
	global_cartMsg = cartMsg;
	$("#overDiv").hide("fast", function() {	overlib(global_cartMsg, TIMEOUT, 6500, WIDTH, 165, FIXX, es_CenterXPos()-80, RELY, 130); $('#overDiv').show('slow');} );

	//Now update the On-page Cart Count, if one exists.
	for (nI=0; nI<aAttrib040_1.length; nI++) {	//Write Items per page menu.
		if (getObjectById(aAttrib040_1[nI])) {
			alterDivContent(aAttrib040_1[nI], global_carttotitems );
		}
		if (getObjectById(aAttrib040_2[nI])) {
			alterDivContent(aAttrib040_2[nI], global_cartdiffitems );
		}
	}
}


function es_CenterXPos() {
	if($.browser.mozilla) {		// is.ns4 || is.ns6
		available_width = (window.innerWidth / 2) + window.pageXOffset;
	} else if($.browser.msie) {	//is.ie4 || is.ie5 || is.ieX
		available_width = (document.compatMode=="CSS1Compat")?document.documentElement.clientWidth : document.body.clientWidth;
		nscrollLeft = (document.compatMode=="CSS1Compat")?document.documentElement.scrollLeft : document.body.scrollLeft;
    	available_width = (available_width / 2) + nscrollLeft;
	} else {
		available_width=document.body.offsetWidth;
    }
	return (available_width - 20);
}


/* DEBUGGING ONLY */
/* <![CDATA[ */var qm_si,qm_li,qm_lo,qm_tt,qm_th,qm_ts,qm_la,qm_ic,qm_ib;var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&qm_t.indexOf("ersion/2")+1;var qm_s3=qm_s&&qm_t.indexOf("ersion/3")+1;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,ft,aux,l){var w="onmouseover";var ww=w;var e="onclick";if(oc){if(oc=="all"||(oc=="lev2"&&l>=2)){w=e;ts=0;}if(oc=="all"||oc=="main"){ww=e;th=0;}}if(!l){l=1;qm_th=th;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e){qm_kille(e)};document[ww]=qm_bo;if(oc=="main"){qm_ib=true;sd[e]=function(event){qm_ic=true;qm_oo(new Object(),qm_la,1);qm_kille(event)};document.onmouseover=function(){qm_la=null;clearTimeout(qm_tt);qm_tt=null;};}sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else  if(sh)sd.ch=1;if(oc)sd.oc=oc;if(sh)sd.sh=1;if(fl)sd.fl=1;if(ft)sd.ft=1;if(rl)sd.rl=1;sd.style.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){lsp=b;b[w]=qm_oo;if(w==e)b.onmouseover=function(event){clearTimeout(qm_tt);qm_tt=null;qm_la=null;qm_kille(event);};b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}else  if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'>&nbsp;</span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,ft,aux,l+1);}}};function qm_bo(e){qm_ic=false;qm_la=null;clearTimeout(qm_tt);qm_tt=null;if(qm_li)qm_tt=setTimeout("x0()",qm_th);};function x0(){var a;if((a=qm_li)){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a))}qm_li=null;};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));};function qm_oo(e,o,nt){if(!o)o=this;if(qm_la==o&&!nt)return;if(window.qmv_a&&!nt)qmv_a(o);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;qm_la=o;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}if(qm_ib&&!qm_ic)return;var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li)go=false;}if(qm_li&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li))qm_uo(qm_li);a=qm_li;while((a=a[qp])&&!qm_a(a)){if(a!=o[qp]&&a!=o.cdiv)qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.ft)ay=0;if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if(qm_s2&&!qm_s3){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li=c;}else  if(!qm_a(b[qp]))qm_li=b[qp];else qm_li=null;qm_kille(e);};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();};function qm_pure(sd){if(sd.tagName=="UL"){var nd=document.createElement("DIV");nd.qmpure=1;var c;if(c=sd.style.cssText)nd.style.cssText=c;qm_convert(sd,nd);var csp=document.createElement("SPAN");csp.className="qmclear";csp.innerHTML="&nbsp;";nd.appendChild(csp);sd=sd[qp].replaceChild(nd,sd);sd=nd;}return sd;};function qm_convert(a,bm,l){if(!l)bm[qc]=a[qc];bm.id=a.id;var ch=a.childNodes;for(var i=0;i<ch.length;i++){if(ch[i].tagName=="LI"){var sh=ch[i].childNodes;for(var j=0;j<sh.length;j++){if(sh[j]&&(sh[j].tagName=="A"||sh[j].tagName=="SPAN"))bm.appendChild(ch[i].removeChild(sh[j]));if(sh[j]&&sh[j].tagName=="UL"){var na=document.createElement("DIV");var c;if(c=sh[j].style.cssText)na.style.cssText=c;if(c=sh[j].className)na.className=c;na=bm.appendChild(na);new qm_convert(sh[j],na,1)}}}}}/* ]]> */

/*******  Menu 0 Add-On Settings *******/
var a;
//if (window.qmad)
try {
	a = qmad.qm0 = new Object();

// Item Bullets (CSS - Imageless) Add On
	a.ibcss_apply_to = "parent";
	a.ibcss_main_type = "arrow-head";
	a.ibcss_main_direction = "right";
	a.ibcss_main_size = 5;
	a.ibcss_main_bg_color = "#B5B897";
	a.ibcss_main_bg_color_active = "#E5E7DB";
	a.ibcss_main_border_color = "#3e3f2b";
	a.ibcss_main_border_color_active = "#000000";
	a.ibcss_main_position_x = -16;
	a.ibcss_main_position_y = -2;
	a.ibcss_main_align_x = "right";
	a.ibcss_main_align_y = "middle";
	a.ibcss_sub_type = "arrow-head";
	a.ibcss_sub_direction = "right";
	a.ibcss_sub_size = 5;
	a.ibcss_sub_bg_color = "#B5B897";
	a.ibcss_sub_bg_color_active = "#E5E7DB";
	a.ibcss_sub_border_color = "#3e3f2b";
	a.ibcss_sub_border_color_active = "#000000";
	a.ibcss_sub_position_x = -16;
	a.ibcss_sub_align_x = "right";
	a.ibcss_sub_align_y = "middle";
	
	// Drop Shadow Add On
	a.shadow_offset = 4;
	a.shadow_color = "#3E3F2B";
	a.shadow_opacity = 0.5;
}
catch (err) {}

try {
/* <![CDATA[ */qmad.shadow=new Object();if(qmad.bvis.indexOf("qm_drop_shadow(b.cdiv);")==-1)qmad.bvis+="qm_drop_shadow(b.cdiv);";if(qmad.bhide.indexOf("qm_drop_shadow(a,1);")==-1)qmad.bhide+="qm_drop_shadow(a,1);";;function qm_drop_shadow(a,hide,force){var z;if(!hide&&((z=window.qmv)&&(z=z.addons)&&(z=z.drop_shadow)&&!z["on"+qm_index(a)]))return;if((!hide&&!a.hasshadow)||force){var ss;if(!a.settingsid){var v=a;while((v=v.parentNode)){if(v.className.indexOf("qmmc")+1){a.settingsid=v.id;break;}}}ss=qmad[a.settingsid];if(!ss)return;if(isNaN(ss.shadow_offset))return;qmad.shadow.offset=ss.shadow_offset;var f=document.createElement("SPAN");x2("qmshadow",f,1);var fs=f.style;fs.position="absolute";fs.display="block";fs.backgroundColor="#999999";fs.visibility="inherit";var sh;if((sh=ss.shadow_opacity)){f.style.opacity=sh;f.style.filter="alpha(opacity="+(sh*100)+")";}if((sh=ss.shadow_color))f.style.backgroundColor=sh;f=a.parentNode.appendChild(f);a.hasshadow=f;}var c=qmad.shadow.offset;var b=a.hasshadow;if(b){if(hide)b.style.visibility="hidden";else {b.style.width=a.offsetWidth+"px";b.style.height=a.offsetHeight+"px";var ft=0;var fl=0;if(qm_o){ft=b[qp].clientTop;fl=b[qp].clientLeft;}if(qm_s2){ft=qm_gcs(b[qp],"border-top-width","borderTopWidth");fl=qm_gcs(b[qp],"border-left-width","borderLeftWidth");}b.style.top=a.offsetTop+c-ft+"px";b.style.left=a.offsetLeft+c-fl+"px";b.style.visibility="inherit";}}}/* ]]> */
} catch (err) {}
try {
/* <![CDATA[ */qmad.br_navigator=navigator.userAgent.indexOf("Netscape")+1;qmad.br_version=parseFloat(navigator.vendorSub);qmad.br_oldnav6=qmad.br_navigator&&qmad.br_version<7;qmad.br_strict=(dcm=document.compatMode)&&dcm=="CSS1Compat";qmad.br_ie=window.showHelp;qmad.str=(qmad.br_ie&&!qmad.br_strict);if(!qmad.br_oldnav6){if(!qmad.ibcss)qmad.ibcss=new Object();if(qmad.bvis.indexOf("qm_ibcss_active(o,false);")==-1){qmad.bvis+="qm_ibcss_active(o,false);";qmad.bhide+="qm_ibcss_active(a,1);";if(window.attachEvent)window.attachEvent("onload",qm_ibcss_init);else  if(window.addEventListener)window.addEventListener("load",qm_ibcss_init,1);if(window.attachEvent)document.attachEvent("onmouseover",qm_ibcss_hover_off);else  if(window.addEventListener)document.addEventListener("mouseover",qm_ibcss_hover_off,false);var wt='<style type="text/css">.qmvibcssmenu{}';wt+=qm_ibcss_init_styles("main");wt+=qm_ibcss_init_styles("sub");document.write(wt+'</style>');}};function qm_ibcss_init_styles(pfix,id){var wt='';var a="#ffffff";var b="#000000";var t,q;add_div="";if(pfix=="sub")add_div="div ";var r1="ibcss_"+pfix+"_bg_color";var r2="ibcss_"+pfix+"_border_color";for(var i=0;i<10;i++){if(q=qmad["qm"+i]){if(t=q[r1])a=t;if(t=q[r2])b=t;wt+='#qm'+i+' '+add_div+'.qm-ibcss-static span{background-color:'+a+';border-color:'+b+';}';if(t=q[r1+"_hover"])a=t;if(t=q[r2+"_hover"])b=t;wt+='#qm'+i+'  '+add_div+'.qm-ibcss-hover span{background-color:'+a+';border-color:'+b+';}';if(t=q[r1+"_active"])a=t;if(t=q[r2+"_active"])b=t;wt+='#qm'+i+'  '+add_div+'.qm-ibcss-active span{background-color:'+a+';border-color:'+b+';}';}}return wt;};function qm_ibcss_init(e,spec){var z;if((z=window.qmv)&&(z=z.addons)&&(z=z.ibcss)&&(!z["on"+qmv.id]&&z["on"+qmv.id]!=undefined&&z["on"+qmv.id]!=null))return;qm_ts=1;var q=qmad.ibcss;var a,b,r,sx,sy;z=window.qmv;for(i=0;i<10;i++){if(!(a=document.getElementById("qm"+i))||(!isNaN(spec)&&spec!=i))continue;var ss=qmad[a.id];if(ss&&(ss.ibcss_main_type||ss.ibcss_sub_type)){q.mtype=ss.ibcss_main_type;q.msize=ss.ibcss_main_size;if(!q.msize)q.msize=5;q.md=ss.ibcss_main_direction;if(!q.md)md="right";q.mbg=ss.ibcss_main_bg_color;q.mborder=ss.ibcss_main_border_color;sx=ss.ibcss_main_position_x;sy=ss.ibcss_main_position_y;if(!sx)sx=0;if(!sy)sy=0;q.mpos=eval("new Array('"+sx+"','"+sy+"')");q.malign=eval("new Array('"+ss.ibcss_main_align_x+"','"+ss.ibcss_main_align_y+"')");r=q.malign;if(!r[0])r[0]="right";if(!r[1])r[1]="center";q.stype=ss.ibcss_sub_type;q.ssize=ss.ibcss_sub_size;if(!q.ssize)q.ssize=5;q.sd=ss.ibcss_sub_direction;if(!q.sd)sd="right";q.sbg=ss.ibcss_sub_bg_color;q.sborder=ss.ibcss_sub_border_color;sx=ss.ibcss_sub_position_x;sy=ss.ibcss_sub_position_y;if(!sx)sx=0;if(!sy)sy=0;q.spos=eval("new Array('"+sx+"','"+sy+"')");q.salign=eval("new Array('"+ss.ibcss_sub_align_x+"','"+ss.ibcss_sub_align_y+"')");r=q.salign;if(!r[0])r[0]="right";if(!r[1])r[1]="middle";q.type=ss.ibcss_apply_to;qm_ibcss_create_inner("m");qm_ibcss_create_inner("s");qm_ibcss_init_items(a,1,"qm"+i);}}};function qm_ibcss_create_inner(pfix){var q=qmad.ibcss;var wt="";var s=q[pfix+"size"];var type=q[pfix+"type"];var head;if(type.indexOf("head")+1)head=true;var gap;if(type.indexOf("gap")+1)gap=true;var v;if(type.indexOf("-v")+1)v=true;if(type.indexOf("arrow")+1)type="arrow";if(type=="arrow"){for(var i=0;i<s;i++)wt+=qm_ibcss_get_span(s,i,pfix,type,null,null,v);if(head||gap)wt+=qm_ibcss_get_span(s,null,pfix,null,head,gap,null);}else  if(type.indexOf("square")+1){var inner;if(type.indexOf("-inner")+1)inner=true;var raised;if(type.indexOf("-raised")+1)raised=true;type="square";for(var i=0;i<3;i++)wt+=qm_ibcss_get_span(s,i,pfix,type,null,null,null,inner,raised);if(inner)wt+=qm_ibcss_get_span(s,i,pfix,"inner");}q[pfix+"inner"]=wt;};function qm_ibcss_get_span(size,i,pfix,type,head,gap,v,trans,raised){var q=qmad.ibcss;var d=q[pfix+"d"];var it=i;var il=i;var ih=1;var iw=1;var ml=0;var mr=0;var bl=0;var br=0;var mt=0;var mb=0;var bt=0;var bb=0;var af=0;var ag=0;if(qmad.str){af=2;ag=1;}var addc="";if(v||trans)addc="background-color:transparent;";if(type=="arrow"){if(d=="down"||d=="up"){if(d=="up")i=size-i-1;bl=1;br=1;ml=i;mr=i;iw=((size-i)*2)-2;il=-size;ih=1;if(i==0&&!v){bl=iw+2;br=0;ml=0;mr=0;iw=0;if(qmad.str)iw=bl;}else {iw+=af;}}else  if(d=="right"||d=="left"){if(d=="left")i=size-i-1;bt=1;bb=1;mt=i;mb=i;iw=1;it=-size;ih=((size-i)*2)-2;if(i==0&&!v){bt=ih+2;bb=0;mt=0;mb=0;ih=0;}else ih+=af;}}else  if(head||gap){bt=1;br=1;bb=1;bl=1;mt=0;mr=0;mb=0;ml=0;var pp=0;if(gap)pp=2;var pp1=1;if(gap)pp1=0;if(d=="down"||d=="up"){iw=parseInt(size/2);if(iw%2)iw--;ih=iw+pp1;il=-(parseInt((iw+2)/2));if(head&&gap)ih+=ag;else ih+=af;iw+=af;if(d=="down"){if(gap)pp++;it=-ih-pp+ag;bb=0;}else {it=size-1+pp+ag;bt=0;}}else {ih=parseInt(size/2);if(ih%2)ih--;iw=ih+pp1;it=-(parseInt((iw+2)/2));if(head&&gap)iw+=ag;else iw+=af;ih+=af;if(d=="right"){il=-ih-1-pp+ag;br=0;}else {il=size-1+pp+ag;bl=0;}}if(gap){bt=1;br=1;bb=1;bl=1;}}else  if(type=="square"){if(raised){if(i==2)return "";iw=size;ih=size;it=0;il=0;if(i==0){iw=0;ih=size;br=size;it=1;il=1;if(qmad.str)iw=br;}}else {if(size%2)size++;it=1;ih=size;iw=size;bl=1;br=1;il=0;iw+=af;if(i==0||i==2){ml=1;it=0;ih=1;bl=size;br=0;iw=0;if(qmad.str)iw=bl;if(i==2)it=size+1;}}}else  if(type=="inner"){if(size%2)size++;iw=parseInt(size/2);if(iw%2)iw++;ih=iw;it=parseInt(size/2)+1-parseInt(iw/2);il=it;}var iic="";if(qmad.str)iic="&nbsp;";return '<span style="'+addc+'border-width:'+bt+'px '+br+'px '+bb+'px '+bl+'px;border-style:solid;display:block;position:absolute;overflow:hidden;font-size:1px;line-height:0px;height:'+ih+'px;margin:'+mt+'px '+mr+'px '+mb+'px '+ml+'px;width:'+iw+'px;top:'+it+'px;left:'+il+'px;">'+iic+'</span>';};function qm_ibcss_init_items(a,main){var q=qmad.ibcss;var aa,pf;aa=a.childNodes;for(var j=0;j<aa.length;j++){if(aa[j].tagName=="A"){if(window.attachEvent)aa[j].attachEvent("onmouseover",qm_ibcss_hover);else  if(window.addEventListener)aa[j].addEventListener("mouseover",qm_ibcss_hover,false);var skip=false;if(q.type!="all"){if(q.type=="parent"&&!aa[j].cdiv)skip=true;if(q.type=="non-parent"&&aa[j].cdiv)skip=true;}if(!skip){if(main)pf="m";else pf="s";var ss=document.createElement("SPAN");ss.className="qm-ibcss-static";var s1=ss.style;s1.display="block";s1.position="relative";s1.fontSize="1px";s1.lineHeight="0px";s1.zIndex=1;ss.ibhalign=q[pf+"align"][0];ss.ibvalign=q[pf+"align"][1];ss.ibposx=q[pf+"pos"][0];ss.ibposy=q[pf+"pos"][1];ss.ibsize=q[pf+"size"];qm_ibcss_position(aa[j],ss);ss.innerHTML=q[pf+"inner"];aa[j].qmibulletcss=aa[j].insertBefore(ss,aa[j].firstChild);ss.setAttribute("qmvbefore",1);ss.setAttribute("isibulletcss",1);if(aa[j].className.indexOf("qmactive")+1)qm_ibcss_active(aa[j]);}if(aa[j].cdiv)new qm_ibcss_init_items(aa[j].cdiv,null);}}};function qm_ibcss_position(a,b){if(b.ibhalign=="right")b.style.left=(a.offsetWidth+parseInt(b.ibposx)-b.ibsize)+"px";else  if(b.ibhalign=="center")b.style.left=(parseInt(a.offsetWidth/2)-parseInt(b.ibsize/2)+parseInt(b.ibposx))+"px";else b.style.left=b.ibposx+"px";if(b.ibvalign=="bottom")b.style.top=(a.offsetHeight+parseInt(b.ibposy)-b.ibsize)+"px";else  if(b.ibvalign=="middle")b.style.top=parseInt((a.offsetHeight/2)-parseInt(b.ibsize/2)+parseInt(b.ibposy))+"px";else b.style.top=b.ibposy+"px";};function qm_ibcss_hover(e,targ){e=e||window.event;if(!targ){var targ=e.srcElement||e.target;while(targ.tagName!="A")targ=targ[qp];}var ch=qmad.ibcss.lasth;if(ch&&ch!=targ&&ch.qmibulletcss)qm_ibcss_hover_off(new Object(),ch);if(targ.className.indexOf("qmactive")+1)return;var wo=targ.qmibulletcss;if(wo){x2("qm-ibcss-hover",wo,1);qmad.ibcss.lasth=targ;}if(e)qm_kille(e);};function qm_ibcss_hover_off(e,o){if(!o)o=qmad.ibcss.lasth;if(o&&o.qmibulletcss)x2("qm-ibcss-hover",o.qmibulletcss);};function qm_ibcss_active(a,hide){if(!hide&&a.className.indexOf("qmactive")==-1)return;if(hide&&a.idiv){var o=a.idiv;if(o&&o.qmibulletcss){x2("qm-ibcss-active",o.qmibulletcss);}}else {if(!a.cdiv.offsetWidth)a.cdiv.style.visibility="inherit";qm_ibcss_wait_relative(a);var wo=a.qmibulletcss;if(wo)x2("qm-ibcss-active",wo,1);}};function qm_ibcss_wait_relative(a){if(!a)a=qmad.ibcss.cura;if(a.cdiv){if(a.cdiv.qmtree&&a.cdiv.style.position!="relative"){qmad.ibcss.cura=a;setTimeout("qm_ibcss_wait_relative()",10);return;}var aa=a.cdiv.childNodes;for(var i=0;i<aa.length;i++){if(aa[i].tagName=="A"&&aa[i].qmibulletcss)qm_ibcss_position(aa[i],aa[i].qmibulletcss);}}}/* ]]> */
} catch(err) {}

/*
 * jQuery Progress Bar plugin
 * Version 2.0 (06/22/2009)
 * @requires jQuery v1.2.1 or later
 *
 * Copyright (c) 2008 Gary Teo
 * http://t.wits.sg/misc/jQueryProgressBar/demo.php#

USAGE:
	$(".someclass").progressBar();

*/
var global_timerID;

(function($) {
	$.extend({
		progressBar: new function() {

			this.defaults = {
				steps			: 20,											// steps taken to reach target
				step_duration	: 10,											
				max				: 100,											// Upon 100% i'd assume, but configurable
				showText		: true,											// show text with percentage in next to the progressbar? - default : true
				textFormat		: 'percentage',									// Or otherwise, set to 'fraction'
				width			: 120,											// Width of the progressbar - don't forget to adjust your image too!!!												// Image to use in the progressbar. Can be a single image too: 'images/progressbg_green.gif'
				height			: 12,											// Height of the progressbar - don't forget to adjust your image too!!!
				callback		: null,											// Calls back with the config object that has the current percentage, target percentage, current image, etc
				boxImage		: 'http://e-shirt.com/images/progressbar/progressbar.gif',						// boxImage : image around the progress bar
				barImage		: {
									0:	'http://e-shirt.com/images/progressbar/progressbg_red.gif'
								},

//,
//									30: 'http://e-shirt.com/images/progressbar/progressbg_orange.gif',
//									70: 'http://e-shirt.com/images/progressbar/progressbg_green.gif'
				// Internal use
				running_value	: 0,
				value			: 0,
				image			: null
			};
			
			/* public methods */
			this.construct = function(arg1, arg2) {
				var argvalue	= null;
				var argconfig	= null;
				
				if (arg1 != null) {
					if (!isNaN(arg1)) {
						if (arg1 >= argvalue) argvalue = arg1;	//I added the if statement to make sure the value kept getting larger...
						if (arg2 != null) {
							argconfig = arg2;
						}
					} else {
						argconfig = arg1; 
					}
				}
		
				return this.each(function(child) {
					var pb		= this;
					var config	= this.config;

					if (argvalue != null && this.bar != null && this.config != null) {
						this.config.value 		= argvalue;
						if (argconfig != null)
							pb.config			= $.extend(this.config, argconfig);
						config	= pb.config;
					} else {
						var $this				= $(this);
						var config				= $.extend({}, $.progressBar.defaults, argconfig);
						config.id				= $this.attr('id') ? $this.attr('id') : Math.ceil(Math.random() * 100000);	// random id, if none provided
						
						if (argvalue == null)	//in the case that a value is not passed, it grabs the default text value in the DIV ID location.
							argvalue	= $this.html().replace("%","");	// parse percentage
						
//						config.running_value	= config.value;
						config.value			= argvalue;
						config.image			= getBarImage(config);
						
						$this.html("");
						var bar					= document.createElement('img');
						var text				= document.createElement('span');
						var $bar				= $(bar);
						var $text				= $(text);
						pb.bar					= $bar;
						
						$bar.attr('id', config.id + "_pbImage");
						$text.attr('id', config.id + "_pbText");
						$text.html(getText(config));
						$bar.attr('title', getText(config));
						$bar.attr('alt', getText(config));
						$bar.attr('src', config.boxImage);
						$bar.attr('width', config.width);
						$bar.css("width", config.width + "px");
						$bar.css("height", config.height + "px");
						$bar.css("background-image", "url(" + config.image + ")");
						$bar.css("background-position", ((config.width * -1)) + 'px 50%');
						$bar.css("padding", "0");
						$bar.css("margin", "0");
						$this.append($bar);
						$this.append($text);
					}

					function getPercentage(config) {
						return config.running_value * 100 / config.max;
					}

					function getBarImage(config) {
						var image = config.barImage;
						if (typeof(config.barImage) == 'object') {
							for (var i in config.barImage) {
								if (config.running_value >= parseInt(i)) {
									image = config.barImage[i];
								} else { break; }
							}
						}
						return image;
					}
					
					function getText(config) {
						if (config.showText) {
							if (config.textFormat == 'percentage') {
								return " " + Math.round(config.running_value) + "%";
							} else if (config.textFormat == 'fraction') {
								return " " + config.running_value + '/' + config.max;
							}
						}
					}
					
					function movebar() {
						var pixels	= config.width / 100;			// Define how many pixels go into 1%
						var stop	= false;
//alert(config.value);
/*						if (config.running_value > config.value) {
							if (config.running_value - config.increment  < config.value) {
								config.running_value = config.value;
							} else {
								config.running_value -= config.increment;
							}
						}
						else */
						if (config.running_value < config.value) {
							if (config.running_value + config.increment  > config.value) {
								config.running_value = config.value;
							} else {
								config.running_value += config.increment;
							}
						}
						
						if (config.running_value != config.value)
							global_timerID = setTimeout ( function() {movebar();}, config.step_duration );
						
						var $bar	= $("#" + config.id + "_pbImage");
						var $text	= $("#" + config.id + "_pbText");
						var image	= getBarImage(config);
						if (image != config.image) {
							$bar.css("background-image", "url(" + image + ")");
							config.image = image;
						}
						$bar.css("background-position", (((config.width * -1)) + (getPercentage(config) * pixels)) + 'px 50%');
						$bar.attr('title', getText(config));
						$text.html(getText(config));
						
						if (config.callback != null && typeof(config.callback) == 'function')
							config.callback(config);
						
						pb.config = config;
					}
					
					config.increment = Math.round((config.value - config.running_value)/config.steps);
					if (config.increment < 0)
						config.increment *= -1;
					if (config.increment < 1)
						config.increment = 1;
					
					if (global_timerID) clearTimeout(global_timerID);
					global_timerID = setTimeout ( function() {movebar();}, config.step_duration );
/*					var t = setInterval(function() {
						var pixels	= config.width / 100;			// Define how many pixels go into 1%
						var stop	= false;
						
						if (config.running_value > config.value) {
							if (config.running_value - config.increment  < config.value) {
								config.running_value = config.value;
							} else {
								config.running_value -= config.increment;
							}
						}
						else if (config.running_value < config.value) {
							if (config.running_value + config.increment  > config.value) {
								config.running_value = config.value;
							} else {
								config.running_value += config.increment;
							}
						}
						
						if (config.running_value == config.value)
							clearInterval(t);
						
						var $bar	= $("#" + config.id + "_pbImage");
						var $text	= $("#" + config.id + "_pbText");
						var image	= getBarImage(config);
						if (image != config.image) {
							$bar.css("background-image", "url(" + image + ")");
							config.image = image;
						}
						$bar.css("background-position", (((config.width * -1)) + (getPercentage(config) * pixels)) + 'px 50%');
						$bar.attr('title', getText(config));
						$text.html(getText(config));
						
						if (config.callback != null && typeof(config.callback) == 'function')
							config.callback(config);
						
						pb.config = config;
					}, config.step_duration); */
				});
			};
		}
	});
		
	$.fn.extend({
        progressBar: $.progressBar.construct
	});
	
})(jQuery);


