function changeMainNav(x){	
var myPM = document.getElementById("myPathmark").src;
var myPharm = document.getElementById("pharmacy").src;
var myAbout = document.getElementById("aboutus").src;
var myPerks = document.getElementById("perks").src;
var myConsumer = document.getElementById("consumer").src;
//var myCommunity = document.getElementById("community").src;
var myContact = document.getElementById("contactus").src;

var checkPM  = myPM.indexOf("-red");
var checkPharm  = myPharm.indexOf("-red");
var checkAbout  = myAbout.indexOf("-red");
var checkPerks  = myPerks.indexOf("-red");
var checkConsumer  = myConsumer.indexOf("-red");
//var checkCommunity  = myCommunity.indexOf("-red");
var checkContact = myContact.indexOf("-red");

//document.getElementById("testingNav").innerHTML = myPM + " / " + checkPM + "<br />" + myPharm + " / " + checkPharm + "<br />" + myAbout + " / " + checkAbout + "<br />" + myPerks + " / " + checkPerks + "<br />" + myConsumer + " / " + checkConsumer + "<br />" + myCommunity  + " / " + checkCommunity + "<br />" + myContact + " / " + checkContact + "<br />";
//put in header
//<div id="testingNav">&nbsp;</div> 

  switch(x)
  {
  case "myPathmark":
    //if(checkPM < 0 && checkPM != -1){
		document.getElementById("myPathmark").src="http://pathmark.com/images/header/mainNav/myPathmark.gif";
		//}
		break;
  case "myPathmark-red":
	document.getElementById("myPathmark").src="http://pathmark.com/images/header/mainNav/myPathmark-red.gif";	break;
  case "pharmacy":
  //if(checkPharm < 0 && checkPharm != -1){
	  document.getElementById("pharmacy").src="http://pathmark.com/images/header/mainNav/pharmacy.gif";
	  //}
	  break;
  case "pharmacy-red":
	document.getElementById("pharmacy").src="http://pathmark.com/images/header/mainNav/pharmacy-red.gif";	break;	
  case "aboutus":
	document.getElementById("aboutus").src="http://pathmark.com/images/header/mainNav/aboutus.gif";	break;
  case "aboutus-red":
	document.getElementById("aboutus").src="http://pathmark.com/images/header/mainNav/aboutus-red.gif";	break;
  case "perks":
	document.getElementById("perks").src="http://pathmark.com/images/header/mainNav/pathmarkPERKS.gif";	break;
  case "perks-red":
	document.getElementById("perks").src="http://pathmark.com/images/header/mainNav/pathmarkPERKS-red.gif";	break;	
  case "consumer":
	document.getElementById("consumer").src="http://pathmark.com/images/header/mainNav/consumerCenter.gif";	break;
  case "consumer-red":
	document.getElementById("consumer").src="http://pathmark.com/images/header/mainNav/consumerCenter-red.gif";	break;
  case "community":
	document.getElementById("community").src="http://pathmark.com/images/header/mainNav/community.gif";	break;
  case "community-red":
	document.getElementById("community").src="http://pathmark.com/images/header/mainNav/community-red.gif";	break;
  case "contact":
	document.getElementById("contactus").src="http://pathmark.com/images/header/mainNav/contactus.gif";	break;
  case "contact-red":
	document.getElementById("contactus").src="http://pathmark.com/images/header/mainNav/contactus-red.gif";	break;	
  }	
}

var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
var newone = sPage.indexOf("default.asp")

var images = new Array()
function preload() {
 for (i = 0; i < preload.arguments.length; i++) {
  images[i] = new Image()
  images[i].src = preload.arguments[i]
 }
}
preload(
  "http://pathmark.com/images/pmLogo.png",
  "http://pathmark.com/images/header/mainNav/myPathmark.gif",
  "http://pathmark.com/images/header/mainNav/pharmacy.gif",
  "http://pathmark.com/images/header/mainNav/aboutus.gif",
  "http://pathmark.com/images/header/mainNav/pathmarkPERKS.gif",
  "http://pathmark.com/images/header/mainNav/consumerCenter.gif",
  "http://pathmark.com/images/header/mainNav/community.gif",
  "http://pathmark.com/images/header/mainNav/contactus.gif",
  "http://pathmark.com/images/header/mainNav/myPathmark-red.gif",
  "http://pathmark.com/images/header/mainNav/pharmacy-red.gif",
  "http://pathmark.com/images/header/mainNav/aboutus-red.gif",
  "http://pathmark.com/images/header/mainNav/pathmarkPERKS-red.gif",
  "http://pathmark.com/images/header/mainNav/consumerCenter-red.gif",
  "http://pathmark.com/images/header/mainNav/community-red.gif",
  "http://pathmark.com/images/header/mainNav/contactus-red.gif",
  "http://pathmark.com/images/header/mainNav/divider.gif",
  "http://pathmark.com/images/pmFooter.png");
    
var imagesHome = new Array()
function preloadHome() {
 for (i = 0; i < preloadHome.arguments.length; i++) {
  imagesHome[i] = new Image()
  imagesHome[i].src = preloadHome.arguments[i]
 }
}
preloadHome(
  "http://pathmark.com/images/pmLogo.png",
  "http://pathmark.com/images/header/mainNav/myPathmark.gif",
  "http://pathmark.com/images/header/mainNav/pharmacy.gif",
  "http://pathmark.com/images/header/mainNav/aboutus.gif",
  "http://pathmark.com/images/header/mainNav/pathmarkPERKS.gif",
  "http://pathmark.com/images/header/mainNav/consumerCenter.gif",
  "http://pathmark.com/images/header/mainNav/community.gif",
  "http://pathmark.com/images/header/mainNav/contactus.gif",
  "http://pathmark.com/images/header/mainNav/myPathmark-red.gif",
  "http://pathmark.com/images/header/mainNav/pharmacy-red.gif",
  "http://pathmark.com/images/header/mainNav/aboutus-red.gif",
  "http://pathmark.com/images/header/mainNav/pathmarkPERKS-red.gif",
  "http://pathmark.com/images/header/mainNav/consumerCenter-red.gif",
  "http://pathmark.com/images/header/mainNav/community-red.gif",
  "http://pathmark.com/images/header/mainNav/contactus-red.gif",
  "http://pathmark.com/images/header/mainNav/divider.gif",
  "http://pathmark.com/images/pmFooter.png",	
  "http://pathmark.com/images/home/slideshow/makinitbetter2.jpg",
  "http://pathmark.com/images/home/slideshow/thumbs/makinitbetter2.jpg",	
  "http://pathmark.com/images/home/slideshow/makinitbetter-cookoff2.jpg",
  "http://pathmark.com/images/home/slideshow/thumbs/makinitbetter-cookoff2.jpg",	
  "http://pathmark.com/images/home/slideshow/makinitbetter-couponsource2.jpg",
  "http://pathmark.com/images/home/slideshow/thumbs/makinitbetter-couponsource2.jpg",	
  "http://pathmark.com/images/home/slideshow/makinitbetter-turkey2.jpg",
  "http://pathmark.com/images/home/slideshow/thumbs/makinitbetter-turkey2.jpg",	
  "http://pathmark.com/images/home/slideshow/flushots2011.jpg",
  "http://pathmark.com/images/home/slideshow/thumbs/flushots2011.jpg",	
  "http://pathmark.com/images/carousel/arrow-left.png",
  "http://pathmark.com/images/carousel/arrow-right.png",	
  "http://pathmark.com/images/carousel/woodsonandjames.jpg",	
  "http://pathmark.com/images/carousel/midatlanticcountryfarms.jpg",	
  "http://pathmark.com/images/carousel/preferredpet.jpg",	
  "http://pathmark.com/images/carousel/livebetterbaby.jpg",	
  "http://pathmark.com/images/carousel/ezineLiveBetter.jpg",	
  "http://pathmark.com/images/carousel/seniorcoupon.jpg");
if(newone == -1){preload();}else{preloadHome();}

 function halloween2011(x){
   var flashvars = {myVariable: "" + x + ""};
   var params = { menu: "false",wmode:"transparent"}; 
   swfobject.embedSWF("http://pathmark.com/images/holiday/moonbats.swf", "topLeftID", "140", "130", "7.0.0", "js/expressInstall.swf",flashvars, params);  
   swfobject.embedSWF("http://pathmark.com/images/holiday/pumpkin.swf", "topRightID", "167", "130", "7.0.0", "js/expressInstall.swf",flashvars, params);   
   swfobject.embedSWF("http://pathmark.com/images/holiday/starbg.swf", "starsID", "1000", "180", "7.0.0", "js/expressInstall.swf",flashvars, params);     
   swfobject.embedSWF("http://pathmark.com/images/holiday/wolf.swf", "footerSpecialID", "1000", "128", "7.0.0", "js/expressInstall.swf",flashvars, params);       
 }
 
 function holidays2011(){
   var flashvars = false;
   var params = { menu: "false",wmode:"transparent",allowFullScreen: "true",scale:"noscale"}; 
   swfobject.embedSWF("images/holiday/holiday2011.swf", "snowBG", "100%", "100%", "7.0.0", "js/expressInstall.swf",flashvars, params);  
       
 }
 
 function myAccount(){
   var flashvars = false;  var params = { menu: "false",wmode:"transparent"}; 
   swfobject.embedSWF("http://pathmark.com/images/preloadCircle.swf", "preloading", "32", "32", "7.0.0", "js/expressInstall.swf",flashvars, params);  
 }
 
 function careers(){
   var flashvars = false;  var params = { menu: "false",wmode:"transparent"}; 
   swfobject.embedSWF("employmentHeader.swf", "header", "472", "207", "7.0.0", "js/expressInstall.swf",flashvars, params);  
 }
 
 function getInternetExplorerVersion(){
  var rv = -1; // false.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

 function checkVersion(){
  var ver = getInternetExplorerVersion();
  if ( ver > -1 )
  {
    if ( ver <= 7.0 ) 
	var dummy = "test";
	  //document.getElementById("browserMessage").innerHTML = "You are using Internet Explorer " + ver + ".  <a href='http://windows.microsoft.com/en-US/internet-explorer/downloads/ie' style='color:red' target='_blank'>Please upgrade your browser</a>";
  }
}
 

