<!--

/* Apparel version of Detail JavaScript */
	var arr_apparel_options;
	var swatch_list;
	var default_app_swatch;
	
	var cross_swatch_arr;
	var cross_styles_arr;

	var winW = 300;
	var winY = 300;
 
 	var current_color;
	current_color = '';
	
	 function getScreenSize()
	 {
	      if(window.innerWidth)
	           winW = window.innerWidth;
	      else if(document.body)
	      {
	           if(document.body.offsetWidth)
	                winW = document.body.offsetWidth;
	      }
	
	      if(window.innerHeight)
	           winY = window.innerHeight;
	      else if(document.body)
	      {
	           if(document.body.offsetHeight)
	                winY = document.body.offsetHeight;
	      }
	 }

	function SwatchOn(arg1, style1, color_name)
	{
		var x, c, j;
		if(arg1 == '')
			return;

		current_color = arg1;
		for(x = 0; x < document.images.length; x++)
		{
			if(document.images[x].name == 'prodImage')
			{
				document.images[x].src = '/products/' + style1 + arg1 + '_lg.jpg';
			}
			
			if(document.images[x].name.indexOf('cross_img_') == 0)
			{
				c = parseInt(document.images[x].name.substring(10, 14));
				if(isNaN(c))
					c = 1;
				c = c - 1;
				
				if(c < cross_swatch_arr.length && c < cross_styles_arr.length)
				{
					if(cross_swatch_arr[c].indexOf(' ' + arg1 + ' ') >= 0 && cross_swatch_arr[c].indexOf(' ') >= 0
						&& cross_swatch_arr[c] != ' ' + arg1 + ' ')
						document.images[x].src = '/products/' + cross_styles_arr[c] + arg1 + '_xs.jpg';
					else
						document.images[x].src = '/products/' + cross_default_arr[c] + '_xs.jpg';
				}
			}
		}
		
		var ct;
		ct = document.getElementById('swatch_color_name');
		if(ct)
		{
			ct.innerHTML = 'Shown in: ' + color_name;
		}
	}

	function CrossStyle(str_style, ref_style, str_type, val_count)
	{
		var x, c, j;
		var str_link;
		
		str_link = '';
		for(x = 0; x < document.images.length; x++)
		{
			if(document.images[x].name == 'cross_img_' + val_count)
			{
				str_link = document.images[x].src;
				c = str_link.indexOf(str_style);
				str_link = document.images[x].src.substring(c + str_style.length, c + str_style.length + 10);
				c = str_link.indexOf('_xs');
				if(c > 1)
					str_link = str_link.substring(0, c);
				else
					str_link = '';
			}
		}
		
		window.location = '/detail.asp?style=' + str_style + '&type=' + str_type + '&swatch=' + str_link + '&cross=yes&cty=app&rStyle=' + ref_style;
	}
	
	function ChangeColor(style1, isAttrConversion)
	{
		var ct, x, color_name, j;
		ct = document.frmAddToCart.selectColor;
		// Old value was 2, not 1....but changed since styles with one color weren't getting change.
		// Not sure if this was needed or not for other styles?
		if(ct.length <= 1)
			return;

		for(x = 0; x < ct.options.length; x++)
		{
			if(ct.options[x].selected == true)
			{
				color_name = ct.options[x].text;
				j = color_name.indexOf(ct.options[x].value);
				if(j >= 0 && (j + ct.options[x].value.length) < color_name.length)
				{
					color_name = color_name.substring(j + ct.options[x].value.length, 50);
				}
				else
				{
					/* Can't find the color value, because it is converted here...instead try to find
					a space which appears in first 4 characters */
					j = color_name.indexOf(' ');
					if(j >= 0 && (j + 1) < color_name.length)
						color_name = color_name.substring(j + 1, 50);
				}
					
				SwatchOn(ct.options[x].value, style1, color_name);
				return;
			}
		}
	}
	
	function SwatchConversion(att_val, style_val, this_color_name)
	{
		var x;
		if(att_val == '')
			return;

		if(swatch_list)
		{
			if(swatch_list.length)
			{
				for(x = 0; x < swatch_list.length; x++)
				{
					if(swatch_list[x].indexOf(att_val) == 0)
					{
						SwatchOn(swatch_list[x].substring(att_val.length, swatch_list[x].length - att_val.length + 3), style_val, this_color_name);
						return;
					}
				}
			}
		}
	}

	/* Handle mouseovers for imaging button links */
	function ImgOn(arg1)
	{
		var x;
		for(x = 0; x < document.images.length; x++)
			if(document.images[x].name == 'img_' + arg1)
			{
				document.images[x].src = '/images/' + arg1 + '_red.gif';
				break;
			}
	}
	
	/* Handle mouseovers for imaging button links */
	function ImgOff(arg1)
	{
		var x;
		for(x = 0; x < document.images.length; x++)
			if(document.images[x].name == 'img_' + arg1)
			{
				document.images[x].src = '/images/' + arg1 + '.gif';
				break;
			}
	}
	
	function Show360(arg1)
	{
		window.open('360_view.asp?style_number=' + arg1, '360Win' + arg1, 'left=25,top=25,resizable,width=550,height=500');
	}

	function ShowLarge(arg1)
	{
		var x, y;
		var image_name;
		getScreenSize()
		if(winW > 700)
			winW = 700;
		if(winW < 620)
			winW = 620;
		if(winY > 650)
			winY = 650;
		if(winY < 530)
			winY = 530;

		image_name = arg1;
		for(x = 0; x < document.images.length; x++)
			if(document.images[x].name == 'prodImage')
			{
				image_name = document.images[x].src.toLowerCase();
				y = image_name.indexOf('/products/');
				if(y > 0)
					image_name = image_name.substring(y + 10, image_name.length - 1);
				y = image_name.indexOf('_lg.');
				if(y > 0)
					image_name = image_name.substring(0, y);
				if(image_name.length < 2)
					image_name = arg1;
				break;
			}

		window.open('/large_pic.asp?style_number=' + arg1 + '&swatchImg=' + image_name, 'Tech' + arg1.substring(0,1), 'resizable,width=' + winW + ',height=' + winY + ',scrollbars=yes');
	}
	
	function ShowTech(arg1)
	{
		window.open('/products/tech/' + arg1 + '.pdf', 'Tech' + arg1, 'left=25,top=25,resizable,width=640,height=520,scrollbars=yes');
	}
	
	function ShowAltViews(arg1)
	{
		getScreenSize()
		if(winW > 700)
			winW = 700;
		if(winW < 620)
			winW = 620;
		if(winY > 680)
			winY = 680;
		if(winY < 530)
			winY = 530;

		window.open('/alt_view.asp?style=' + arg1 + '&curSwatch=' + current_color, 'AltView' + arg1.substring(0, 1), 'left=25,top=25,resizable,width=' + winW + ',height=' + winY + ',scrollbars=yes');
	}

	function AddToCompare(style1, cls1)
	{
		var w9;
		var x,y;
		var image_name;

		image_name = style1;
		for(x = 0; x < document.images.length; x++)
			if(document.images[x].name == 'prodImage')
			{
				image_name = document.images[x].src.toLowerCase();
				y = image_name.indexOf('/products/');
				if(y > 0)
					image_name = image_name.substring(y + 10, image_name.length - 1);
				y = image_name.indexOf('_lg.');
				if(y > 0)
					image_name = image_name.substring(0, y);
				if(image_name.length < 2)
					image_name = style1;
				break;
			}

		w9 = window.open('/compare.asp?style=' + style1 + '&cls=' + cls1 + '&swatchImg=' + image_name, 'CompareWin', 
				'left=50,top=50,resizable,width=680,height=500,scrollbars=auto,menubar=yes,toolbar=yes');
		w9.focus();
	}
	
	function TellFriend(arg1)
	{
		window.open('/tell_friend.asp?style=' + arg1, 'TellFriend', 'resizable,width=750,height=745,scrollbars=yes,left=60,top=0');
	}

	function PopupHelp(typ, secType)
	{
		var thisAnchor;
	
		thisAnchor = '';
		if(typ == 'apparel_sizing')
		{
			if(secType == 'ACSK')
				thisAnchor = '#sock';
			else if(secType == 'ACIN1')
				thisAnchor = '&insoleType=1#insole';
			else if(secType == 'ACIN2')
				thisAnchor = '&insoleType=2#insole';
			else if(secType == 'ACIN3')
				thisAnchor = '&insoleType=3#insole';
			else if(secType == 'ACIN')
				thisAnchor = '#insole';
			else if(secType == 'APZZ')
				thisAnchor = '&gotr=yes#gotr';
			else if(secType == 'APSB' || secType.indexOf('WMAPSB') == 0)
				thisAnchor = '#BraSizing';
			else if(secType.indexOf('PO') == 0)
			{
				typ = 'performance';
			}
		} else if(typ == 'madeinusa')
		{
			thisAnchor = '&type=' + secType
		}
			
		if(secType.indexOf('WM') == 0 && thisAnchor == '')
		{
			thisAnchor = '#women';
		}

		if(typ == 'apparel_care_type' && secType != '')
			thisAnchor = '#' + secType;
		
		if(typ.indexOf('#') > 0)
			thisAnchor = '';

		if(typ.toLowerCase().indexOf('.swf') > 0)
			window.open('/information/popup/popup_main.asp?popWindow=yes&page_type=flash&fileName=' + typ, 'flash', 'left=50,top=50,resizable,width=615,height=450,scrollbars=yes');
		else if(typ.toLowerCase().indexOf('.xml') > 0)
			window.open('/information/popup/popup_features.asp?popWindow=yes&page_type=feat&fileName=' + typ, 'feat', 'left=50,top=50,resizable,width=425,height=300,scrollbars=yes');
		else
			window.open('/information/popup/popup_main.asp?popWindow=yes&page_type=' + typ + thisAnchor, 'popupHelp', 'left=50,top=50,resizable,width=625,height=520,scrollbars=yes');
	}
	
	function FeaturePop(popType, popID)
	{
		window.open('/information/popup/product_feature.asp?fType=' + popType + '&id=' + popID, popType, 'left=50,top=50,resizable,width=520,height=450, scrollbars=yes');
	}
	
	function AddItem()
	{

		var frm1;
		frm1 = document.frmAddToCart;
		
		/* check for product size control...will not always exist */
		if(frm1.selectSize)
		{
			if(frm1.selectSize.options)
			{
				if(frm1.selectSize.options[0].selected == true)
				{
					alert('Please select a size.');
					return(false);
				}
			}
		}
		
		/* check for product width...will not always exist */
		if(frm1.selectWidth)
		{
			if(frm1.selectWidth.options)
			{
				if(frm1.selectWidth.options[0].selected == true)
				{
					alert('Please select a shoe width.');
					return(false);
				}
			}
		}
		
		/* check for product color...only for apparel */
		if(frm1.selectColor)
		{
			if(frm1.selectColor.options)
			{
				if(frm1.selectColor.options[0].selected == true)
				{
					alert('Please select a color.');
					return(false);
				}
			}
		}
		
		return(true);
	}
	
	function apparel_size_change(style1)
	{
		var frm1, c1, j2;
		var this_size, j1, x1;
		var this_color, this_descrip, d1;
	
		frm1 = document.frmAddToCart;
		
		c1 = frm1.selectSize;
		if(!c1)
			return;
		
		this_size = '';
		for(j1 = 0; j1 < c1.options.length; j1++)
			if(c1.options[j1].selected == true)
			{
				this_size = c1.options[j1].value;
				break;
			}
		
		/* If no colors or no size selected, exit */
		c1 = frm1.selectColor;
		if((this_size == '') || (!c1))
			return;
		
		/* Erase all current colors */
		for(j1 = c1.options.length; j1 > 0; j1--)
			c1.options[0] = null;
		
		c1.options[0] = new Option('Select Color', '');
		x1 = 1;
		for(j1 = 0; j1 < arr_apparel_options.length; j1++)
		{
			d1 = arr_apparel_options[j1].indexOf(this_size + '-');
			if(d1 == 0 && arr_apparel_options[j1].length > (d1 + this_size.length + 1))
			{
				d1 = d1 + this_size.length + 1;

				this_descrip = arr_apparel_options[j1].substring(d1, arr_apparel_options[j1].length);
				d1 = this_descrip.indexOf('-');
				if(d1 > 0)
				{
					this_color = this_descrip.substring(0, d1);
					this_descrip = this_descrip.substring(d1 + 1, this_descrip.length);
				}
				else
					this_color = this_descrip;

				c1.options[x1] = new Option(this_descrip, this_color);
				x1 = x1 + 1;
			}
		}
		
		c1.disabled = false;
	}
	
	function CMPop()
	{
		window.open('/information/popup/preordering.asp', 'AboutPreOrdering', 'left=50,top=50,resizable,width=500,height=350, scrollbars=yes');
	}
	
// -->
