	
			//var isUltraTransform = true;				
			//var jsIsCheckout = false;
			//var httpsPath = 'https://www.rei.com/';
			//var httpPath = 'http://www.rei.com/';
			//var jscript_path = 'http://www.rei.com/'
			//var httpHost = 'http://www.rei.com/';
			//var httpsHost = 'https://www.rei.com/';
			//var returnUrl = window.location;
			var storeId = '8000'; 
			//var image_path = 'http://media.rei.com';
			//var yourAccountInView = 'YourAccountInfoInView?storeId=8000';
			//var yourAccountOutView = 'YourAccountInfoOutView?storeId=8000';
			//var pageIsSecure = false;
			//var referringUrlPath = '/search?p=RIE&fr=yfp-t-309&toggle=1&cop=mss&ei=UTF-8';		
				
			
			var navClass = '';
			var storeClass = 'rei';
			var sectionClass = 'reiHome';
			var pageClass = 'index';
			var contentClass = '';


//function cmSpFromCmRE(href, cmRe, linkName){
//// Turns the value a generated manual_cm_re attribute into a cm_sp impression on links where it's been added by hand
////usage examples: 
//// onClick="cmSpFromCmRE($(this).attr('href'), $(this).attr('manual_cm_re'), 'Description');"
//// onClick="cmSpFromCmRE($(this).attr('href'), $(this).attr('manual_cm_re'), $(this).text().replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, ''));"
//href = href.replace(/[#']/g, '');
//cmCreateManualLinkClickTag(href+ '?cm_sp=' + cmRe, linkName);
//}

var currentUrl = window.location.href;			
function setCookie(name, value){
var expdate = "Fri, 31-Dec-99 11:59:59 GMT"
document.cookie=name+"="+escape(value)+"; expires="+expdate+"; path=/" ;}
function logout(){
setCookie("SESSION_ID","");
setCookie("loggedin","0");
setCookie("rei_cart","0");
setCookie("GiftRegistrySetup","0");				
}				
var multipleItems = "s";
if( numOfItems == 1 ) multipleItems = "";

			
				
var makeCmReRun = false;

function makeCmRe(){
if(makeCmReRun == false){
makeCmReRun = true;
$('#pageContent a, #sidebarWrapper a') .one('mouseover', function ()
    {
        var parentId1 = $(this) .parents('[id = "pageContent"],[id = "sidebarWrapper"]') .get(0) .id;
        var parentId2 = $(this) .parents('[id]') .get(0) .id;
        var linkContent;
        if ($(this) .children('img') .length > 0 && $(this) .children('img') .attr('alt') && $(this) .children('img') .attr('alt') .length > 0) {
            linkContent = $(this) .children('img') .attr('alt') .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
        } else if ($(this) .children('img') .length > 0) {
        	linkContent = $(this) .text() .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
        } else {
            linkContent = $(this) .text() .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
        }
        $(this) .attr('manual_cm_re', parentId1 + '*' + parentId2 + '*' + linkContent);
    });
  }
}

var makeCmSpDone = {};
function makeOneCmSp(o){
    if (!makeCmSpDone[o]) {
		makeCmSpDone[o] = true;
	    cmSpMouseover.apply($(o));
	}
}
function cmSpMouseover()
{
  if($(this) .parents('[id = "headerWrapper"],[id = "footerWrapper"]').length > 0){
      var parentId1 = $(this) .parents('[id = "headerWrapper"],[id = "footerWrapper"]') .get(0) .id; 
      var parentId2 = $(this) .parents('[id]') .get(0) .id .replace('hunt3', 'subNav') .replace('hunt2', 'navTabs') .replace('hunt1', 'utilityLinks');
      var linkContent;
      if ($(this).hasClass('catList')){
        var index = $(this) .attr('class') .indexOf(' ');
          linkType = $(this) .attr('class') .substring(index+1);
          linkContent = $(this) .text() .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
      } else if($(this).parent('li').parent('ul').siblings('a').hasClass('catList')) {
          var catListObj = $(this).parent('li').parent('ul').siblings('a.catList');
          var index = catListObj .attr('class') .indexOf(' ');        	
          linkType = catListObj .attr('class') .substring(index+1) + ':' + $(this).parent('li').parent('ul').children('.subTitle') .text() .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
          linkContent = $(this) .text() .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
    } else if ($(this) .children('img') .length > 0) {
          linkType = 'image';
          linkContent = $(this) .children('img') .attr('alt') .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
      } else {
          linkType = 'text';
          linkContent = $(this) .text() .replace(/[^ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]/g, '');
      }
      var store = "REI_";
      if (storeId == "8001") {
        store = "Outlet_";
    }        
      $(this) .attr('manual_cm_sp', store + parentId1 +':' + parentId2 + '*' + linkType + '*' + linkContent);
  }
}

var numOfItems = getCookie("rei_cart");
var loggedIn = getCookie("loggedin");

if (!numOfItems) numOfItems = 0;


function getCookie(name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal(j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

//rollover on subnav
$(function(){
  // adults pages
  $("body#adults .col1.condNav").mouseover(function(){
    $("#condLink").css("background-image", "url(/images/nav/adult/conditions-treatments_on.gif)");
  });
  $("body#adults .col1.condNav").mouseout(function(){
    $("#condLink").css("background-image", "");
  });

  $("body#adults .docsNav").mouseover(function(){
    $("#docsLink").css("background-image", "url(/images/nav/adult/doctors_on.gif)");
  });
  $("body#adults .docsNav").mouseout(function(){
    $("#docsLink").css("background-image", "");
  });
  
  $("body#adults .researchNav").mouseover(function(){
    $("#researchLink").css("background-image", "url(/images/nav/adult/clinical-trials_on.gif)");
  });
  $("body#adults .researchNav").mouseout(function(){
    $("#researchLink").css("background-image", "");
  });

  $("body#adults .ppNav").mouseover(function(){
    $("#patientsparentsLink").css("background-image", "url(/images/nav/adult/parent-patiens_on.gif)");
  });
  $("body#adults .ppNav").mouseout(function(){
    $("#patientsparentsLink").css("background-image", "");
  });

  $("body#adults .visitorsNav").mouseover(function(){
    $("#visitorsLink").css("background-image", "url(/images/nav/adult/visitors_on.gif)");
  });
  $("body#adults .visitorsNav").mouseout(function(){
    $("#visitorsLink").css("background-image", "");
  });

  $("body#adults .hpNav").mouseover(function(){
    $("#HPLink").css("background-image", "url(/images/nav/adult/health-professionals_on.gif)");
  });
  $("body#adults .hpNav").mouseout(function(){
    $("#HPLink").css("background-image", "");
  });

  $("body#adults .aboutNav").mouseover(function(){
    $("#aboutLink").css("background-image", "url(/images/nav/adult/about_on.gif)");
  });
  $("body#adults .aboutNav").mouseout(function(){
    $("#aboutLink").css("background-image", "");
  });
  
  // childs pages
  $("body#childs .col1.condNav").mouseover(function(){
    $("#condLink").css("background-image", "url(/images/nav/child/conditions-treatments_on.gif)");
  });
  $("body#childs .col1.condNav").mouseout(function(){
    $("#condLink").css("background-image", "");
  });

  $("body#childs .docsNav").mouseover(function(){
    $("#docsLink").css("background-image", "url(/images/nav/child/doctors_on.gif)");
  });
  $("body#childs .docsNav").mouseout(function(){
    $("#docsLink").css("background-image", "");
  });
  
  $("body#childs .researchNav").mouseover(function(){
    $("#researchLink").css("background-image", "url(/images/nav/child/clinical-trials_on.gif)");
  });
  $("body#childs .researchNav").mouseout(function(){
    $("#researchLink").css("background-image", "");
  });

  $("body#childs .ppNav").mouseover(function(){
    $("#patientsparentsLink").css("background-image", "url(/images/nav/child/parent-patiens_on.gif)");
  });
  $("body#childs .ppNav").mouseout(function(){
    $("#patientsparentsLink").css("background-image", "");
  });

  $("body#childs .visitorsNav").mouseover(function(){
    $("#visitorsLink").css("background-image", "url(/images/nav/child/visitors_on.gif)");
  });
  $("body#childs .visitorsNav").mouseout(function(){
    $("#visitorsLink").css("background-image", "");
  });

  $("body#childs .hpNav").mouseover(function(){
    $("#HPLink").css("background-image", "url(/images/nav/child/health-professionals_on.gif)");
  });
  $("body#childs .hpNav").mouseout(function(){
    $("#HPLink").css("background-image", "");
  });

  $("body#childs .aboutNav").mouseover(function(){
    $("#aboutLink").css("background-image", "url(/images/nav/child/about_on.gif)");
  });
  $("body#childs .aboutNav").mouseout(function(){
    $("#aboutLink").css("background-image", "");
  });
});

