//*****Extend the footer to the bottom of the page**************************************************//
function extendFooter() {
  var footerHeight = jQuery('.footer').height();
  var pageHeight = jQuery(document.body).height();
  var windowHeight = jQuery(document).height();
  var difference = windowHeight - pageHeight;
  if (pageHeight < windowHeight) {
    jQuery('.footer').height(footerHeight + difference);
  } else {
    jQuery('.footer').height('150px');
  }
}
//*****Clear search text out search box on focus**************************************************//
function clearSearchBox() {
	if (!document.getElementById('newsletter')) return false;
	jQuery('#newsletter').focus(function() {
    if (jQuery(this).val() == 'Enter your email address') {
      jQuery(this).val('');
	  }
  });
}
//*****The following function make it possible to have web standard popups**************************************************//
function strictNewWindow() {
  if (!document.getElementsByTagName('a')) return false;
  jQuery('a.newwindow').click(function() {
		window.open(jQuery(this).attr('href'));
    return false;
	});
}
//*****Clear search text out search box on focus**************************************************//
function headerNavRows() {
	if (!document.getElementById('headerNav')) return false;
	jQuery('ul#headerNav ul').each(function() {
	  jQuery(this).find('li:even').addClass('even');
	});
}
//*****Change Browse All Text**************************************************//
function changeText() {
	jQuery('.cms-home ul#sidebarNav li.nav-browse-all-index a span').each(function() {
	  	if (jQuery(this).html() == 'Browse All') {
			jQuery(this).html('Shop by:');
	    }
	});
	jQuery('.cms-customer-service ul#sidebarNav li.nav-browse-all-index a span').each(function() {
	  	if (jQuery(this).html() == 'Browse All') {
			jQuery(this).html('Shop by:');
	    }
	});
	jQuery('.cms-about-urban-general-store ul#sidebarNav li.nav-browse-all-index a span').each(function() {
	  	if (jQuery(this).html() == 'Browse All') {
			jQuery(this).html('Shop by:');
	    }
	});
	jQuery('.cms-contact-us ul#sidebarNav li.nav-browse-all-index a span').each(function() {
	  	if (jQuery(this).html() == 'Browse All') {
			jQuery(this).html('Shop by:');
	    }
	});
}
//*****Load all functions**************************************************//
jQuery(document).ready(function(){
  extendFooter();
  clearSearchBox();
  strictNewWindow();
  headerNavRows();
  changeText();
});