﻿<!--
	var arr_apparel_options;
	var swatch_list;

	var winW = 300;
	var winY = 300;
 
	 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)
	{
		var x;
		for(x = 0; x < document.images.length; x++)
			if(document.images[x].name == 'prodImage')
			{
				document.images[x].src = '/products/' + style1 + arg1 + '_lg.jpg';
				break;
			}
	}
	
	function ChangeColor(style1)
	{
		var ct, x;
		ct = document.frmAddToCart.selectColor;
		if(ct.length <= 2)
			return;

		for(x = 0; x < ct.options.length; x++)
		{
			if(ct.options[x].selected == true)
			{
				if(style1.substring(0, 5) == 'NBSUN' || style1.substring(0, 8) == 'CIRCLE-N')
				{
					SwatchConversion(ct.options[x].value, style1);
					return;
				}else
				{
					SwatchOn(ct.options[x].value, style1);
					return;
				}
			}
		}
	}
	
	function SwatchConversion(att_val, style_val)
	{
		var x;
		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 + 1), style_val);
						return;
					}
				}
			}
		}
	}

	/* Handle mouseovers for imaging button links */
	function ImgOn(arg1)
	{
		var x, extraArg;
		/* Combine Alt View and Large Image as one button (well kind of) */
		if(arg1 == 'alt_views')
			extraArg = 'large';
		else if(arg1 == 'large')
			extraArg = 'alt_views';
		else
			extraArg = '';
		for(x = 0; x < document.images.length; x++)
			if(document.images[x].name == 'img_' + arg1)
			{
				document.images[x].src = '/images/' + arg1 + '_red.gif';
			} else if(document.images[x].name == 'img_' + extraArg)
			{
				document.images[x].src = '/images/' + extraArg + '_red.gif';
			}
	}
	
	/* Handle mouseovers for imaging button links */
	function ImgOff(arg1)
	{
		var x, extraArg;
		/* Combine Alt View and Large Image as one button (well kind of) */
		if(arg1 == 'alt_views')
			extraArg = 'large';
		else if(arg1 == 'large')
			extraArg = 'alt_views';
		else
			extraArg = '';
		for(x = 0; x < document.images.length; x++)
			if(document.images[x].name == 'img_' + arg1)
			{
				document.images[x].src = '/images/' + arg1 + '.gif';
			} else if(document.images[x].name == 'img_' + extraArg)
			{
				document.images[x].src = '/images/' + extraArg + '.gif';
			}
	}
	
	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)
	{
		getScreenSize()
		if(winW > 700)
			winW = 700;
		if(winW < 620)
			winW = 620;
		if(winY > 650)
			winY = 650;
		if(winY < 530)
			winY = 530;

		window.open('/large_pic.asp?style_number=' + arg1 , 'Tech' + arg1, '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, 'AltView' + arg1, 'left=25,top=25,resizable,width=' + winW + ',height=' + winY + ',scrollbars=yes');
	}

	function AddToCompare(style1, cls1)
	{
		var w9;
		w9 = window.open('/compare.asp?style=' + style1 + '&cls=' + cls1, '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=60');
	}

	function PopupHelp(typ, secType)
	{
		var thisAnchor;
		var thisLink;
	
		thisAnchor = '';
		if(typ == 'apparel_sizing')
			if(secType == 'ACSK')
				thisAnchor = '#sock';
			else if(secType == 'ACIN')
				thisAnchor = '#insole';
		
		if(typ == 'shoe_last')
			thisLink = typ + '&prodClass=' + secType;
		else
			thisLink = typ;
			
		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)
		{
			if(typ.toLowerCase().indexOf('nbzip_') == 0)
			{
				window.open('/information/popup/popup_features.asp?popWindow=yes&page_type=feat&fileName=' + typ, 'feat', 'left=50,top=50,resizable,width=525,height=550,scrollbars=yes');
			} else if(typ.toLowerCase().indexOf('goretex') == 0)
			{
				window.open('/information/popup/popup_features.asp?popWindow=yes&page_type=feat&fileName=' + typ, 'feat', 'left=50,top=50,resizable,width=525,height=400,scrollbars=yes');
			} else if(typ.toLowerCase().indexOf('chirunning') == 0 || typ.toLowerCase().indexOf('midfoot') == 0)
			{
				window.open('/information/popup/popup_features.asp?popWindow=yes&page_type=feat&fileName=' + typ, 'feat', 'left=50,top=50,resizable,width=450,height=400,scrollbars=yes');
			} else {
//				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');
				window.open('/information/popup/popup_features.asp?popWindow=yes&page_type=feat&fileName=' + typ, 'feat', 'left=50,top=50,resizable,width=625,height=500,scrollbars=yes');
			}
		}
		else
		{
			window.open('/information/popup/popup_main.asp?popWindow=yes&page_type=' + thisLink + thisAnchor, 'popupHelp2', '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()
	{
		var frm1, c1;
		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);
				else
					this_color = this_descrip;

				c1.options[x1] = new Option(this_descrip, this_color);
				x1 = x1 + 1;
			}
		}
		
		c1.disabled = false;
	}



	var sock_addon_arr, sock_addon_sizes_arr, sock_addon_descrip_arr, sock_addon_attribute_arr;
	function shoe_size_change(whichGender)
	{
		var ct, j, this_size, this_sock, this_descrip, this_attribute;
		ct = document.frmAddToCart.selectSize;

		this_size = '';
		this_sock = '';
		if(ct)
		{
			if(ct.options)
			{
				for(j = 0; j < ct.options.length; j++)
				{
					if(ct.options[j].selected)
					{
						this_size = ct.options[j].value;
						break;
					}
				}
			}
		}
		
		if(this_size != '')
		{
			if(whichGender == 'm')
			{
				if(parseFloat(this_size) < 5.0)
					this_size = 'S';
				else if(parseFloat(this_size) < 9.0)
					this_size = 'M';
				else if(parseFloat(this_size) < 13.0)
					this_size = 'L';
				else
					this_size = 'XL';
			}
			else if(whichGender == 'w')
			{
				if(parseFloat(this_size) <= 6.0)
					this_size = 'S';
				else if(parseFloat(this_size) <= 10.0)
					this_size = 'M';
				else if(parseFloat(this_size) <= 13.0)
					this_size = 'L';
				else
					this_size = 'XL';
			}
			
			
			for(j = 0; j < sock_addon_sizes_arr.length; j++)
			{
				if(sock_addon_sizes_arr[j].indexOf('_' + this_size + '_') >= 0)
				{
					if(j < sock_addon_arr.length && j < sock_addon_descrip_arr.length)
					{
						this_sock = sock_addon_arr[j];
						this_descrip = sock_addon_descrip_arr[j].replace('&quot;', '"').replace('&quot;', '"').replace('&#8482;', '');
						this_attribute = sock_addon_attribute_arr[j];
					}

					break;
				}
			}
		}
		
		ct = document.frmAddToCart.sock_addon;
		if((this_sock != '') && (ct))
		{
			if(ct.options[1].value.length > 0)
			{
				ct.options[1].value = this_sock;
				ct.options[1].text = this_descrip;
				ct.options[0].selected = true;
				ct = document.frmAddToCart.sock_addon_attribute;
				if(ct)
					ct.value = this_attribute;
			}
		}
	}

// -->
