<!--//Exclusive Store Global Params
var bcHome="";
//-->

// Rollover  v2.0.1
// documentation: http://www.dithered.com/javascript/rollover/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)

function isDefined(property) {
  return (typeof property != 'undefined');
}

var rolloverInitialized = false;
function rolloverInit() {
   if (!rolloverInitialized && isDefined(document.images)) {
      
      // get all images (including all <input type="image">s)
      // use getElementsByTagName() if supported
      var images = new Array();
      if (isDefined(document.getElementsByTagName)) {
         images = document.getElementsByTagName('img');
         var inputs = document.getElementsByTagName('input');
         for (var i = 0; i < inputs.length; i++) {
            if (inputs[i].type == 'image') {
               images[images.length] = inputs[i];
            }
         }
      }
      
      // otherwise, use document.images and document.forms collections
      // remove if not supporting IE4, Opera 4-5
      else {
         images = document.images;
         inputs = new Array();
         for (var formIndex = 0; formIndex < document.forms.length; formIndex++) {
            for (var elementIndex = 0; elementIndex < document.forms.elements.length; elementIndex++) {
               if (isDefined(document.forms.elements[i].src)) {
                  inputs[inputs.length] = document.forms.elements[i];
               }
            }
         }
      }
      
      // get all images with '_off.' in src value
      for (var i = 0; i < images.length; i++) {
         if (images[i].src.indexOf('_off.') != -1) {
            var image = images[i];
            
            // store the off state filename in a property of the image object
            image.offImage = new Image();
            image.offImage.src = image.src;
            
            // store the on state filename in a property of the image object
            // (also preloads the on state image)
            image.onImage = new Image();
            image.onImage.imageElement = image;
            
            // add onmouseover and onmouseout event handlers once the on state image has loaded
            // Safari's onload is screwed up for off-screen images; temporary fix
            if (navigator.userAgent.toLowerCase().indexOf('safari') != - 1) {
               image.onmouseover = function() {
                  this.src = this.onImage.src;
               };
               image.onmouseout = function() {
                  this.src = this.offImage.src;
               };
            }
            else {
               image.onImage.onload = function() {
                  this.imageElement.onmouseover = function() {
                     this.src = this.onImage.src;
                  };
                  this.imageElement.onmouseout = function() {
                     this.src = this.offImage.src;
                  };
               };
            }
            
            // set src of on state image after defining onload event handler
            // so cached images (that load instantly in IE) will trigger onload
            image.onImage.src = image.src.replace(/_off\./, '_on.');
         }
      }
   }
   rolloverInitialized = true;
}

// call rolloverInit when document finishes loading
if (isDefined(window.addEventListener)) {
   window.addEventListener('load', rolloverInit, false);
}
else if (isDefined(window.attachEvent)) {
   window.attachEvent('onload', rolloverInit);
}

// Window opener functions  v1.0.6
// http://www.dithered.com/javascript/window/index.html
// code by Chris Nott (chris@NOSPAMdithered.com - remove NOSPAM)

/*******************************************************************************
	Popup Window openers
*******************************************************************************/

var winReference = null;


// Open a window at a given position on the screen
function openPositionedWindow(url, name, width, height, x, y, status, scrollbars, moreProperties, openerName) {
	
	// ie 4.5 and 5.0 mac - windows are 2 pixels too short; if a statusbar is used, the window will be an additional 15 pixels short
	var agent = navigator.userAgent.toLowerCase();
	if (agent.indexOf("mac") != -1 && agent.indexOf("msie") != -1 && (agent.indexOf("msie 4") != -1 || agent.indexOf("msie 5.0") != -1) ) {
		height += (status) ? 17 : 2;
	}

	// Adjust width if scrollbars are used (pc places scrollbars inside the content area; mac outside) 
	width += (scrollbars != '' && scrollbars != null && agent.indexOf("mac") == -1) ? 16 : 0;

	var properties = 'width=' + width + ',height=' + height + ',screenX=' + x + ',screenY=' + y + ',left=' + x + ',top=' + y + ((status) ? ',status' : '') + ',scrollbars=' + ((scrollbars) ? '' : '=no') + ((moreProperties) ? ',' + moreProperties : '');
	var reference = openWindow(url, name, properties, openerName);
	
	// resize window in ie if we can resize in ns; very messy
	// commented out because openPositionedWindow() doesn't set the resizable attribute
	// left in for reference
	/*if (resizable && agent.indexOf("msie") != -1) {
		if (agent.indexOf("mac") != -1) {
			height += (status) ? 15 : 2;
			if (parseFloat(navigator.appVersion) > 5) width -= 11;
		}
		else {
			height += (status) ? 49 : 31;
			width += 13;
		}
		setTimeout('if (reference != null && !reference.closed) reference.resizeTo(' + width + ',' + height + ');', 150);
	}*/

	return reference;
}


// Open a window at the center of the screen
function openCenteredWindow(url, name, width, height, status, scrollbars, moreProperties, openerName) {
	var x, y = 0;
	if (screen) {
      x = (screen.availWidth - width) / 2;
	   y = (screen.availHeight - height) / 2;
   }
	if (!status) status = '';
	if (!openerName) openerName = '';
	var reference = openPositionedWindow(url, name, width, height, x, y, status, scrollbars, moreProperties, openerName);
	return reference;
}	

function openCW(url, name, width, height, status, scrollbars, moreProperties, openerName) {
  openCenteredWindow(url, name, width, height, status, scrollbars, moreProperties, openerName) 
}

// Open a window at the center of the parent window
function openCenteredOnOpenerWindow(url, name, width, height, status, scrollbars, moreProperties, openerName) {
	var centerX = 0;
   var centerY = 0;
   if (window.screenX != null && window.outerWidth) {
      centerX = window.screenX + (window.outerWidth / 2);
      centerY = window.screenY + (window.outerHeight / 2);
   }
   else if (window.screenLeft) {
      if (document.documentElement) {
         centerX = window.screenLeft + (document.documentElement.offsetWidth / 2);
         centerY = window.screenTop + (document.documentElement.offsetHeight / 2);
      }
      else if (document.body && document.body.offsetWidth) {
         centerX = window.screenLeft + (document.body.offsetWidth / 2);
         centerY = window.screenTop + (document.body.offsetHeight / 2);
      }
   }
   
   if (centerX == 0) {
      openCenteredWindow(url, name, width, height, status, scrollbars, moreProperties, openerName);
   }
   var x = parseInt(centerX - (width / 2));
   var y = parseInt(centerY - (height / 2));
	if (!status) status = '';
	if (!openerName) openerName = '';
	var reference = openPositionedWindow(url, name, width, height, x, y, status, scrollbars, moreProperties, openerName);
	return reference;
}	


// Open a full-screen window (different from IE's fullscreen option)
function openMaxedWindow(url, name, scrollbars, openerName) {
	var x, y = 0;
	var width  = 600;
	var height = 800;
	if (screen) {
      if (screen.availLeft) {
         x = screen.availLeft;
         y = screen.availTop;
      }
      width  = screen.availWidth - 6;
	   height = screen.availHeight - 29;
   }
	var reference = openPositionedWindow(url, name, width, height, x, y, false, scrollbars, openerName);
	return reference;
}


// Open a full-chrome (all GUI elements) window
// This is like using a target="_blank" in a normal link but allows focussing the window
function openFullChromeWindow(url, name, openerName) {
	return openWindow(url, name, 'directories,location,menubar,resizable,scrollbars,status,toolbar');
}


// Open a sized full-chrome (all GUI elements) window 
function openSizedFullChromeWindow(url, name, width, height, openerName) {
	return openCenteredWindow(url, name, width, height, true, true, 'directories,location,menubar,resizable,toolbar', openerName)
}


// Core utility function that actually creates the window and gives focus to it
function openWindow(url, name, properties, openerName) {

	// ie4.x pc can't give focus to windows containing documents from a different domain
	// in this case, initially load a local interstisial page to allow focussing before loading final url
	var agent = navigator.userAgent.toLowerCase();
	if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) == 4 && agent.indexOf("msie 5") == -1 && agent.indexOf("msie5") == -1 && agent.indexOf("win") != -1 && url.indexOf('http://') == 0) {
		winReference = window.open('about:blank', name, properties);
		
		setTimeout('if (winReference && !winReference.closed) winReference.location.replace("' + url + '")', 300);
	}
	else {
		winReference = window.open(url, name, properties);
	}

	// ie doesn't like giving focus immediately (to new window in 4.5 on mac; to existing ones in 5 on pc)
	setTimeout('if (winReference && !winReference.closed) winReference.focus()', 200);
	
	if (openerName) self.name = openerName;
	return winReference;
}


/*******************************************************************************
	Modal Dialog controls
*******************************************************************************/

// Close a dialog
// Call from onunload event handler of any page that can create a dialog
function closeDialog(dialog) {
	if (dialog && dialog.closed != true) dialog.close();
}


// Close parent popup
// Call from onload event handler of any page that could be created from a dialog
function closeParentDialog() {
	if (top.opener && isWindowPopup(top.opener)) {
		root = top.opener.top.opener;
		top.opener.close();
		top.opener = root;
	}
}


// Check if a window is a popup
function isWindowPopup(win) {
	return ((win.opener) ? true : false);
}


//custom popup calls with fixed properties for Niketown.com
function openChatWindow(which){
  if (which && which == "wmns")
  {
    openCenteredWindow('http://nikewomen.custhelp.com/cgi-bin/nikewomen.cfg/php/enduser/live.php?', 'Chat', 550, 550);
  }
  else if (which && which == "id") 
  {
    openCenteredWindow('/niketown/info/popup_chat_id.jsp', 'Chat', 475, 275);
  }
	else 
  {
    openCenteredWindow('http://niketown.nike.com/niketown/info/popup_chat.jsp', 'Chat', 421, 450);
  }
}
function openSizing(url){
	openCenteredWindow(url, 'sizing', 525, 600, 'yes', 'yes');
}

function textCounter( field, maxlimit ) {
  if ( field.value.length > maxlimit ){
    field.value = field.value.substring( 0, maxlimit );
    alert( 'Your message may not exceed '+maxlimit+' characters in length.' );
  }
}

function cookiesEnabled(){ //Check if cookies are enabled - redirect if not - JCA
	document.cookie = "IAcceptCookies=test";
	readCookie = -1;
	if(document.cookie.length > 0){
		readCookie = document.cookie.indexOf("IAcceptCookies=");
	}
	if (readCookie == -1){
		//got no cookies;
		return false;
	} else {
		//got cookies;
		document.cookie = "IAcceptCookies=test; expires=Thu, 01-Jan-70 00:00:01 GMT";
		return true;
	}
}
function warnCookies(){
	//This document.referrer does not work in Mac OSX Safari
	var pltfrm = navigator.userAgent.toLowerCase();
	var isMacSafari = (pltfrm.indexOf("safari")>-1);
	if (!cookiesEnabled()){
		if(!isMacSafari){
		  document.location.href="/niketown/error/nocookie.jsp?ref=" + escape(document.referrer);
		}else {
		  document.location.href="/niketown/error/nocookie.jsp?ref=" + escape("../home.jsp");
		}
	}
}

function popWin(file,fname,width,height) {
	window.open(file,fname,'toolbar=no,status=no,width='+width+',height='+height+',directories=no,scrollbars=yes,location=no,resizable=yes,menubar=yes')
}

function getElementOffset(elementID, property, relativeElmID) {
   var offset = 0;
   if(typeof elementID == "object")
   {
   var element = elementID;
   }else{
   var element = document.getElementById(elementID);
   }
   if(typeof element == "undefined" || element == null)
   {
    return "NaN";
   }
   var relativeElm = document.getElementById(relativeElmID);

   if(relativeElm == null || typeof relativeElm == "undefined")
      relativeElm = document.body;
	do {
			offset += eval('element.offset' + property);
      element = element.offsetParent;
   } while (element != relativeElm && element != null);	 
	 
   return parseInt(offset);
}

function showHideZoom(action,zoomDivId){
	if (zoomDivId == null || zoomDivId == ""){
		zoomDivId = "zoomImage";	
	}
	if(action=="hide"){
    document.getElementById(zoomDivId).style.display = 'none';
  }
  if(action=="show"){
    document.getElementById(zoomDivId).style.display = 'block';  }
}

/* check for Search box is null before submitting */
function validRequired(formField,fieldLabel)
{
	var result = true;
	if (formField.value == "")
	{
		alert('Please enter a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	return result;
}

function validateForm(theForm)
{
	if (!validRequired(theForm.Ntt,"Product Search"))
		return false;
	return true;
}
//Collapsible Nav
//@Author John Meyer III
<!--

function currentOpac(id, opacEnd, millisec) { 
    //standard opacity is 100 
    var currentOpac = 100; 
    //if the element has an opacity set, get it 
    if(document.getElementById(id).style.opacity < 100) { 
        currentOpac = document.getElementById(id).style.opacity * 100; 
    } 

    //call for the function that changes the opacity 
    opacity(id, currentOpac, opacEnd, millisec) 
} 

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 


//Hide all but the one being clicked on.
function eShowHideAll(element,itemSize,actionElement) {
		iPath="/niketown/img/left/";
		iExt=".gif";
		
	itemSize = 1+itemSize;
	for(k=1; k<itemSize; k++){
		k==1?image="mens":"";
		k==2?image="womens":"";
		k==3?image="kids":"";

		elementShowHide =	document.getElementById('navList'+k);
		elementHdrShowHide =	document.getElementById("Hdr"+k);
			if('navList'+k!=actionElement){
				if(elementShowHide.className=="navList"){ currentOpac('navList'+k, 5, 300); }
				setTimeout("",1080); //delay to allow above function to complete before potentially hiding element.
				elementShowHide.className = "hidden";
				elementHdrShowHide.src = iPath+image+"_expand"+iExt;			
				}			
	}
}

//Show/Hide the one being clicked on.
function eShowHide(elementID,style,image) {
		iPath="/niketown/img/left/";
		iExt=".gif";
		eShowHideAll('navList',3,'navList'+elementID);
		setTimeout("",1080); //delay to allow above function to complete before potentially hiding element.
		elementShowHide =	document.getElementById('navList'+elementID);
		elementHdrShowHide =	document.getElementById("Hdr"+elementID);
		if (elementShowHide.className == style) { 
			currentOpac('navList'+elementID, 5, 300);
			setTimeout("",1080); //delay to allow above function to complete before potentially hiding element.
			elementShowHide.className = "hidden"; 
			elementHdrShowHide.src = iPath+image+"_expand"+iExt;
			}
		else {
			elementShowHide.className=style;
			elementHdrShowHide.src = iPath+image+iExt;
			currentOpac('navList'+elementID, 100, 600);
			}
}
-->
