window.name='main';
	function change_credit_card(creditCardID){
		if (creditCardID != null && creditCardID.length > 0){
			document.payment.submit();
		}
	}
	function MM_findObj(n, d) { //v4.0
		var p,i,x;
		if(!d)
			d=document;
		if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document;
			n=n.substring(0,p);
		}
		if(!(x=d[n])&&d.all)
			x=d.all[n];

		for (i=0;!x&&i<d.forms.length;i++)
			x=d.forms[i][n];

		for(i=0;!x&&d.layers&&i<d.layers.length;i++)
			x=MM_findObj(n,d.layers[i].document);
		if(!x && document.getElementById)
			x=document.getElementById(n); return x;
	}

	function open_popup(url,options)
        {
	    window.open(url,"_new",options);
        }

	function open_window_full(url)
	 {
	    window.open(url,"_new","toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,width=800,height=540,resizable=yes");
	 }
	function open_window(url)
	 {
	    window.open(url,"_new","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width=700,height=185,resizable=no");
	 }

	function open_search_tips(url)
	{
		window.open(url,"_new","left=200,top=200,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,WIDTH=600,HEIGHT=300");
	}
	
	function open_denim_guide(url)
	{
		window.open(url,"_new","left=200,top=200,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,WIDTH=507,HEIGHT=595");
	}

  function disableShipToFields(formName,checkBox) {
    var currentForm = document.forms[formName];
    // loop through the form
    for(i=0; i < currentForm.elements.length; i++){
      var elementName = currentForm.elements[i].name;

      if (checkBox.checked) {
        // if the element has SHIP_TO_ADDRESS, then set disabled
        if ((elementName.indexOf("SHIP_TO_ADDRESS") > -1) && (currentForm.elements[i].type != 'hidden')){
          // get the value of the corresponding ADDRESS field
          var fieldName = elementName.substring(elementName.indexOf(">")+1);
          var inputName = "ADDRESS<>"+fieldName;
          var inputValue = currentForm.elements[inputName].value;

          // set the SHIP_TO_ADDRESS field equal to the ADDRESS field value
          currentForm.elements[i].value = inputValue;
          currentForm.elements[i].disabled = true;
        }
      } else {
		if ((elementName.indexOf("SHIP_TO_ADDRESS") > -1) && (currentForm.elements[i].type != 'hidden')){
		  // set the SHIP_TO_ADDRESS field equal to the ADDRESS field value
		  currentForm.elements[i].value = '';
		  currentForm.elements[i].disabled = false;
		}
      }
    }
    return true;
  }

  function enableShipToFields(formName) {
    var currentForm = document.forms[formName];

    if (currentForm.elements['indSameAsBillTo'].checked) {
      for(i=0; i < currentForm.elements.length; i++){
        currentForm.elements[i].disabled = false;
      }
    }
    return true;
  }

	function setLargeImage(newSrc){
		var obj = document.getElementById("LARGE_PICTURE");
		obj.src=newSrc;
	}
	

<!--- SWATCH JAVASCRIPT BEGIN ---->	
<!--- OBJECTS BEGIN ---->

var activeSwatch;

function Swatch(frontIn, backIn, otherIn, lookbookIn,swatchImgIn){
  this.view1 = frontIn;
  this.view2  = backIn;
  this.view3 = otherIn;
  this.view4 = lookbookIn;
  this.swatchImg = swatchImgIn;
}

function DisplayImage(largeImageIn, thumbNailIn){
  this.largeImage=largeImageIn;
  this.thumbNail=thumbNailIn;
}

function SwatchImage(regularImageIn, mouseOverImageIn){
  this.regularImage = regularImageIn;
  this.mouseOverImage = mouseOverImageIn;
}

<!--- OBJECTS END ---->

<!--- FUNCTIONS BEGIN ---->

function switchMainImageSrc(src){
  document.getElementById("LARGE_PICTURE").src = src;
}

function switchSelectedThumb(thumbNumber){
  
  var one = document.getElementById("thumbborder1");
  var oneImage = document.getElementById("productZoomThumbImage1");
  changeStyleToDefaultOnSelectedThumbSwitch(one, oneImage);
  
  var two = document.getElementById("thumbborder2");
  var twoImage = document.getElementById("productZoomThumbImage2");
  changeStyleToDefaultOnSelectedThumbSwitch(two, twoImage);
  
  var three = document.getElementById("thumbborder3");
  var threeImage = document.getElementById("productZoomThumbImage3");
  changeStyleToDefaultOnSelectedThumbSwitch(three, threeImage);
  
  var four = document.getElementById("thumbborder4");
  var fourImage = document.getElementById("productZoomThumbImage4");
  changeStyleToDefaultOnSelectedThumbSwitch(four, fourImage);
  
  
  var selected = document.getElementById("thumbborder" + thumbNumber);
  var selectedImage = document.getElementById("productZoomThumbImage" + thumbNumber);
  if (selected) {
	selected.style.border = '2px solid #FD7E07';
	selectedImage.style.margin = '2 1 2 1';
  }
}

function changeStyleToDefaultOnSelectedThumbSwitch( border, image ) {
	
	if ( (border) && (image) ) {
		border.style.border = '1px solid #8b8b8b';
		image.style.margin = '2 2 2 2';
	}

}

function setSwatchSet(swatchObject){
  activeSwatch = swatchObject;
}

function loadSwatchImagesToPage(){
  document.getElementById("LARGE_PICTURE").src = activeSwatch.view1.largeImage; 
  
  setThumbNailOnSwatchChange(activeSwatch.view1, 1); 
  setThumbNailOnSwatchChange(activeSwatch.view2, 2);
  setThumbNailOnSwatchChange(activeSwatch.view3, 3);
  setThumbNailOnSwatchChange(activeSwatch.view4, 4);
  
  switchSelectedThumb('1'); 
}

function setThumbNailOnSwatchChange(view, thumbNumber) {
	if (view && view.thumbNail) {
		
		var view1 = document.getElementById("productZoomThumbImage" + thumbNumber)
		view1.src = view.thumbNail;
		var borderAndImage = document.getElementById("thumbborder"  + thumbNumber);
		borderAndImage.style.display = "";
	} else {
		var borderAndImage = document.getElementById("thumbborder" + thumbNumber);
		borderAndImage.style.display = "none";
	}
}

<!--- FUNCTIONS BEGIN ---->	
<!--- SWATCH JAVASCRIPT END ---->		

	function updateMessages(value1, value2, value3, value4) {
		document.getElementById("productDesc1").innerHTML = value1;
		document.getElementById("productDesc2").innerHTML = value2;
		document.getElementById("productDesc3").innerHTML = value3;
		if (!value4 == '') {
      document.getElementById("moreColors").src = value4;
    }

	}


	function subscribeAll(formName, value){
	    var currentForm = document.forms[formName];
	    // loop through the form
	    for(i=0; i < currentForm.elements.length; i++){
	    	var elementName = currentForm.elements[i].name;
	    	var elementType = currentForm.elements[i].type;
	    	if (elementType == "checkbox"){
		      currentForm.elements[i].checked = value;
		    }    
	    } 
	}
	
	function subscribe(formName, fieldName){
	    var currentForm = document.forms[formName];
	    var selected = false;

	    // loop through the form looking for checkboxes
	    for(i=0; i < currentForm.elements.length; i++){
	    	var elementType = currentForm.elements[i].type;
	    	if (elementType == "checkbox"){
		      selected = selected || currentForm.elements[i].checked;
		    }    
	    } 
	   
	   	document.getElementById("unsub").checked = !selected;
	   	document.getElementById("sub").checked = selected;	
	}

	
	/*************************************************************************
	This code is from Dynamic Web Coding at http://www.dyn-web.com/
	See Terms of Use at http://www.dyn-web.com/bus/terms.html
	regarding conditions under which you may use this code.
	This notice must be retained in the code as is!
	*************************************************************************/

	var timer_id;
	function scroll_iframe(frm,inc,dir) {
	  if (timer_id) clearTimeout(timer_id);
	  if (window.frames[frm]) {
	    if (dir == "v") window.frames[frm].scrollBy(0, inc);
	    else window.frames[frm].scrollBy(inc, 0);
	    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
	  }
	}

	function stopScroll() { if (timer_id) clearTimeout(timer_id); }

  function openZoomWindow() {
    var destURL = document.getElementById("ZOOM_URL").value;
   // alert('Dest URL is ' + destURL );
    window.open(destURL, '_new', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width=470, height=710, left=300, top=0');
  }  
 
  function openBoutiqueZoomWindow() {
    var destURL = document.getElementById("ZOOM_URL").value;
   // alert('Dest URL is ' + destURL );
    window.open(destURL, '_new', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width=522, height=699, left=300, top=0');
  }
  
  function openSizeChart(url, anchor) {
    if(null != url && url != '') {
    var destURL = url;
    if(null != anchor && anchor != '') {
    	destURL = destURL + '#' + anchor;
    }
    window.open(destURL, '_new', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width=458, height=730, left=300, top=0');
    }
  }
  
  function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    window.frames[iframeName].location.href = url;
    return;
  }
  else return false;
}



/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-4 by Sharon Paine
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

function initScrollLayer() {
  if( document.getElementById('wn') && document.getElementById('lyr1') )
  {
  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll,
  // if horizontal scrolling, id of element containing scrolling content (table?)
  var wndo = new dw_scrollObj('wn', 'lyr1');

  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
  // wndo.bSizeDragBar = false;

  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
  // (x/y offsets of dragBar in track)
  //wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);

  // pass id('s) of scroll area(s) if inside table(s)
  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
  dw_scrollObj.GeckoTableBugFix('wn');
  }
}
function initLookbookLayer(priority, secondLayerPresent) {

  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll,

  // if horizontal scrolling, id of element containing scrolling content (table?)

  var wndo = new dw_scrollObj('wnLook', 'lyrLook', 't1');

  if (priority != null && priority != 1){
  	var temp = priority * 42;
  	wndo.glideTo(temp, 0, 100);
  }
  
  if (secondLayerPresent){
  	var wndo2 = new dw_scrollObj('wn', 'lyr1');
  }

  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )

  // wndo.bSizeDragBar = false;



  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset

  // (x/y offsets of dragBar in track)

//  wndo.setUpScrollbar("dragBar", "track", "h", 50, 1);



  // pass id('s) of scroll area(s) if inside table(s)

  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');

  dw_scrollObj.GeckoTableBugFix('wnLook', 'wn');

}

/******************************
	Scrolling 
******************************/

function isIE() {
	return (navigator.userAgent.indexOf("MSIE") != -1);
}
function isSafari() {
	return (navigator.userAgent.indexOf("Safari") != -1);
}

/*************************************** LEFTNAV ********************/ 


var theHandle, theRoot, theThumb, theScroll;
var thumbTravel, ratio;

var distanceFromLeft = 3;
var distanceFromTop = 118;
var spotToStarDragDistanceFromLeft = 147;
var scrollLength = 450;

var scrollPullBarDistanceFromLeft = 151;
var bottomLimitOfScrollPullBarDistanceFromTop = (isIE()) ? 473 : 471;
/*note: heightOfTheThumb is duplicated in thumb div*/
var heightOfTheThumb = 78;


theScroll = new ypSimpleScroll("scroll", distanceFromLeft, distanceFromTop - 7, spotToStarDragDistanceFromLeft, scrollLength);

function intializeLeftNav() {
	//
	theHandle = document.getElementById("handle");
	theRoot   = document.getElementById("root");
	theThumb  = document.getElementById("thumb");
	//if the thumb is null we don't have a scroll bar and we don't want a 
		// javascript error.
	if ( theThumb == null ) {
		return;
	}
	
	if (theRoot.addEventListener)
        /** DOMMouseScroll is for mozilla. */
       theRoot.addEventListener('DOMMouseScroll', wheel, false);

	theScroll.load();

	Drag.init(theHandle, theRoot);
	Drag.init(theThumb, null, scrollPullBarDistanceFromLeft, scrollPullBarDistanceFromLeft, distanceFromTop, bottomLimitOfScrollPullBarDistanceFromTop);

	// the number of pixels the thumb can travel vertically (max - min)
	thumbTravel = theThumb.maxY - theThumb.minY;

	// the ratio between scroller movement and thumbMovement
	ratio = theScroll.scrollH / thumbTravel;

	theThumb.onDrag = function(x, y) {
		theScroll.jumpTo(null, Math.round((y - theThumb.minY) * ratio));
	}


	var bottomBorderOfBrandsList = $('scrollContent').getDimensions().height;
	
	/*
	* IF we do have enought brands then we should display 
	* scrolling functionality.
	*/
	if(bottomBorderOfBrandsList >= scrollLength) {
		var leftNavHandle = document.getElementById("thumb");
		leftNavHandle.style.display="inline";
		
		
		var scrollUpImage = document.getElementById("scrollUpImage");
		var scrollDownImage = document.getElementById("scrollDownImage");
		var scrollBarSeparatorTopCell = document.getElementById("scrollBarSeparatorTopCell");
		var scrollBarSeparatorBottomCell = document.getElementById("scrollBarSeparatorBottomCell");
		var scrollBarSeparatorCenterCell = document.getElementById("scrollBarSeparatorCenterCell");

		scrollUpImage.style.display="inline";
		scrollDownImage.style.display="inline";
		scrollBarSeparatorTopCell.style.backgroundColor = "#ffffff";
		scrollBarSeparatorBottomCell.style.backgroundColor = "#ffffff";
		scrollBarSeparatorCenterCell.style.backgroundColor = "#ffffff";
	}

}


/*Event Handling follows*/

// indicates whether the scroll bar should be moving currently
var stop = true;
// timer for smooth motion scrolling
var scrollTimer;
// delay between movement to make motion appear smooth
var delay = 10;



function handleMouseDownOnDownArrow() {
	stop = false;
	scrollDown();
}

function handleMouseDownOnUpArrow() {
	stop = false;
	scrollUp();
}

function handleMouseDown(event) {
	stop = false;
	y = event.clientY
	var topOfThumb = parseInt(theThumb.style.top);
	var bottomOfThumb = topOfThumb + heightOfTheThumb;
	if ( bottomOfThumb < y ) {
		scrollDown(y - heightOfTheThumb);
	} else if (  topOfThumb > y ) { 
		scrollUp(y);
	}
	
}


// stops on mouse up
function handleMouseUp() {
	clearTimer(scrollTimer);	
}

// stops on mouse out
function handleMouseOut() {
	clearTimer(scrollTimer);	
}

// moves scroll up until scrollTimer is cleared
function scrollUp(vertical) {
	if ( theThumb == null ) {
		return;
	}
	x = parseInt(theThumb.style.top);
	if (stop 
		|| x <= distanceFromTop
		|| vertical != null && x <= vertical ) {
		return;
	}
	
	x = x - 1;
	theThumb.onDrag(null, x);
	theThumb.style.top=x + "px";
	scrollTimer = setTimeout('scrollUp('+ vertical +')', delay);

}

// moves scroll down until scrollTimer is cleared
function scrollDown(vertical) {
	if ( theThumb == null ) {
		return;
	}
	x = parseInt(theThumb.style.top);
	if (stop 
		|| x >= bottomLimitOfScrollPullBarDistanceFromTop
		|| vertical != null && x >= vertical ) {
		return;
	}
	
	x = x + 1;
	theThumb.onDrag(null, x);
	theThumb.style.top=x + "px";
	scrollTimer = setTimeout('scrollDown('+ vertical +')', delay);
}
	
// clears timer
function clearTimer(timer) {
   	if (timer) clearTimeout(timer);
   	timer = null;
   	stop = true;
}


/* Mouse wheel event handling */

/* wheels down smoothly.
amount is the number of pixels to move down.
*/
function wheelDown(id, amount) {
	var target = document.getElementById(id);
	if ( target == null ) {
		return;
	}
	x = parseInt(target.style.top);
	if (x >= bottomLimitOfScrollPullBarDistanceFromTop || amount == 0) {
		return;
	}
	
	x = x + 1;
	target.onDrag(null, x);
	target.style.top=x + "px";
	amount = amount - 1;
	scrollTimer = setTimeout('wheelDown("'+ id +'", '+amount+')', delay);
}

/* wheels up smoothly
amount is the number of pixels to move up.
*/
function wheelUp(id, amount) {
	var target = document.getElementById(id);
	if ( target == null ) {
		return;
	}
	x = parseInt(target.style.top);
	if (x <= distanceFromTop || amount == 0) {
		return;
	}
	
	x = x - 1;
	target.onDrag(null, x);
	target.style.top=x + "px";
	amount = amount - 1;
	scrollTimer = setTimeout('wheelUp("'+ id +'", '+amount+')', delay);

}


/** This is high-level function.
 * It must react to delta being more/less than zero.
 */
function handle(id, delta) {
	    if ( delta < 0 ) {
			wheelDown(id, Math.abs(delta) * 10);
		} else if ( delta > 0 ) {
			wheelUp(id, delta * 10);
		}
}

/** Event handler for mouse wheel event.
 */
function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
        /** If delta is nonzero, handle it.
         * Basically, delta is now positive if wheel was scrolled up,
         * and negative, if wheel was scrolled down.
         */
 
        if (delta)
                handle("thumb", delta);
                

	/** Prevent default actions caused by mouse wheel.
         * That might be ugly, but we handle scrolls somehow
         * anyway, so don't bother here..
         */
       if (event.preventDefault) {
                event.preventDefault();
		} 
        event.returnValue = false;
}


/*************************************** SWATCHES ********************/

var theSwatchThumb;
var theSwatchScroll;

function simpleSwatchScroll(errorHeight){ 

	this.id = "swatchscroll";
	this.distanceFromLeft = 455;
	this.distanceFromTop = 90 + errorHeight;
	this.spotToStartDragDistanceFromLeft = 80;
	this.scrollLength = 407;	
	this.swatchbottomLimitOfScrollPullBarDistanceFromTop = 310;
	
	return new ypSimpleScroll(this.id, this.distanceFromLeft, this.distanceFromTop, this.spotToStartDragDistanceFromLeft, this.scrollLength);
}


function intializeColorSwatches() {
	
	var swatchscrollPullBarDistanceFromLeft = 447;
	var swatchbottomLimitOfScrollPullBarDistanceFromTop = 310;
	var swatchRatio;
	var swatchThumbTravel;
	var theSwatchHandle, theSwatchRoot;

	theSwatchHandle = document.getElementById("swatchhandle");
	theSwatchRoot   = document.getElementById("swatchroot");
	theSwatchThumb  = document.getElementById("swatchthumb");	

	if (theSwatchScroll) {
		theSwatchScroll.load();
	
		Drag.init(theSwatchHandle, theSwatchRoot);
		Drag.init(theSwatchThumb, null, swatchscrollPullBarDistanceFromLeft, swatchscrollPullBarDistanceFromLeft, theSwatchScroll.distanceFromTop, swatchbottomLimitOfScrollPullBarDistanceFromTop);
	
		// the number of pixels the thumb can travel vertically (max - min)
		swatchThumbTravel = theSwatchThumb.maxY - theSwatchThumb.minY;
	
		// the swatchRatio between scroller movement and thumbMovement
		swatchRatio = theSwatchScroll.scrollH / swatchThumbTravel;
	
		theSwatchThumb.onDrag = function(x, y) {
			theSwatchScroll.jumpTo(null, Math.round((y - theSwatchThumb.minY) * swatchRatio));
		}
	}
}


/*Event Handling follows*/

// indicates whether the scroll bar should be moving currently
var swatchstop = true;
// timer for smooth motion scrolling
var swatchscrollTimer;
// delay between movement to make motion appear smooth
var swatchdelay = 10;

function swatchhandleMouseOverDownArrow() {
	swatchstop = false;
	swatchscrollDown();
}

function swatchhandleMouseOverUpArrow() {
	swatchstop = false;
	swatchscrollUp();
}

// swatchstops on mouse out
function swatchhandleMouseOut() {
	clearTimer(swatchscrollTimer);
}

// moves scroll up until swatchscrollTimer is cleared
function swatchscrollUp(vertical) {

	
	if ( theSwatchThumb == null ) {
		return;
	}
	x = parseInt(theSwatchThumb.style.top);
	if (swatchstop 
		|| x <= theSwatchScroll.distanceFromTop
		|| vertical != null && x <= vertical ) {
		return;
	}
	
	x = x - 1;
	theSwatchThumb.onDrag(null, x);
	theSwatchThumb.style.top=x + "px";
	swatchscrollTimer = setTimeout('swatchscrollUp('+ vertical +')', swatchdelay);

}

// moves scroll down until swatchscrollTimer is cleared
function swatchscrollDown(vertical) {
	if ( theSwatchThumb == null ) {
		return;
	}
	x = parseInt(theSwatchThumb.style.top);
	var swatchbottomLimitOfScrollPullBarDistanceFromTop = 260;
	if (swatchstop 
		|| x >= swatchbottomLimitOfScrollPullBarDistanceFromTop
		|| vertical != null && x >= vertical ) {
		return;
	}
	
	x = x + 1;
	theSwatchThumb.onDrag(null, x);
	theSwatchThumb.style.top=x + "px";
	swatchscrollTimer = setTimeout('swatchscrollDown('+ vertical +')', swatchdelay);
}

// clears the default text from input fields
function clearDefaultText(field) {
	if (field.defaultValue == field.value) {
		field.value = "";
	}
}

// limits a text field to a given number of characters
function limitText(limitField, maxChars) {
	if (limitField.value.length > maxChars) {
		limitField.value = limitField.value.substring(0, maxChars);
	}
}

// clears a text field if it equals another field's value
// this is used to clear out default 'help' text
function clearTextIfEquals(field, otherField) {
	if (field.value == otherField.value) {
		field.value = "";
	}
}


