// JavaScript Document 
<!--


/*********************************************************************
// Archive pull-down script (used for IE only)
// Used on any page with an archive. 
*********************************************************************/
function startList(which) {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById(which);
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        node.onmouseover=function() {
          this.className+=" over";
        }
        node.onmouseout=function() {
          this.className=this.className.replace(" over", "");
	    }
      }
    }
  }
}
//window.onload=startList();


/*********************************************************************
// resCheck() is used to jump down to a specified anchor link if 
// the user's browser is too small to display the main nav links. 
// Used in the front page for each room. 
*********************************************************************/
function resCheck() {
  if ((window.screen.availHeight < 750) && (window.location.href.indexOf('#fix')==-1)) {
	var myurl = window.location.href + '#fix';
	window.location = myurl;
  }
}


/*********************************************************************
// Standard Macromedia scripts
*********************************************************************/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}






/*********************************************************************
// Pre-Load Functions are used within each room to preload 
// certain images specific to each room. 
*********************************************************************/
function preload_career() {
  MM_preloadImages('/career-studio/common/images/career-nav-home-r.gif','/career-studio/common/images/career-nav-dish-r.gif','/career-studio/common/images/career-nav-career-r.gif','/career-studio/common/images/career-nav-fashionfile-r.gif','/career-studio/common/images/career-nav-perks-r.gif','/career-studio/common/images/career-nav-talkback-r.gif');
}
function preload_fashion_file() {
  MM_preloadImages('/fashion-file/common/images/ff-nav-careerstudio-r.gif','/fashion-file/common/images/ff-nav-dish-r.gif','/fashion-file/common/images/ff-nav-fashionfile-r.gif','/fashion-file/common/images/ff-nav-home-r.gif','/fashion-file/common/images/ff-nav-perks-r.gif','/fashion-file/common/images/ff-nav-skindeep-r.gif','/fashion-file/common/images/ff-nav-talkback-r.gif');
}
function preload_perks() {
  MM_preloadImages('/perks-and-prizes/common/images/perks-nav-career-r.gif','/perks-and-prizes/common/images/perks-nav-dish-r.gif','/perks-and-prizes/common/images/perks-nav-fashionfile-r.gif','/perks-and-prizes/common/images/perks-nav-home-r.gif','/perks-and-prizes/common/images/perks-nav-skindeep-r.gif','/perks-and-prizes/common/images/perks-nav-talkback-r.gif');
}
function preload_skin_deep() {
  MM_preloadImages('/skin-deep/common/images/skin-nav-career-r.gif','/skin-deep/common/images/skin-nav-dish-r.gif','/skin-deep/common/images/skin-nav-fashionfile-r.gif','/skin-deep/common/images/skin-nav-home-r.gif','/skin-deep/common/images/skin-nav-perks-r.gif','/skin-deep/common/images/skin-nav-talkback-r.gif');
}
function preload_talk_back() {
  MM_preloadImages('/talk-back/common/images/talk-nav-career-r.gif','/talk-back/common/images/talk-nav-dish-r.gif','/talk-back/common/images/talk-nav-fashionfile-r.gif','/talk-back/common/images/talk-nav-home-r.gif','/talk-back/common/images/talk-nav-perks-r.gif','/talk-back/common/images/talk-nav-skindeep-r.gif');
}
function preload_dish() {
  MM_preloadImages('/the-dish/common/images/dish-nav-careerstudio-r.gif','/the-dish/common/images/dish-nav-fashionfile-r.gif','/the-dish/common/images/dish-nav-home-r.gif','/the-dish/common/images/dish-nav-perks-r.gif','/the-dish/common/images/dish-nav-skindeep-r.gif','/the-dish/common/images/dish-nav-talkback-r.gif');
}
function preload_footer() {
  MM_preloadImages('/index/common/images/home-nav-home-r.gif','/index/common/images/home-nav-fashionfile-r.gif','/index/common/images/home-nav-dish-r.gif','/index/common/images/home-nav-skindeep-r.gif','/index/common/images/home-nav-careerstudio-r.gif','/index/common/images/home-nav-perks-r.gif','/index/common/images/home-nav-talkback-r.gif');
}
function preload_index() {
  MM_preloadImages('/index/common/images/home-nav-fashionfile-r.gif','/index/common/images/home-nav-dish-r.gif','/index/common/images/home-nav-skindeep-r.gif','/index/common/images/home-nav-careerstudio-r.gif','/index/common/images/home-nav-perks-r.gif','/index/common/images/home-nav-talkback-r.gif','/index/common/images/home-sub-meg-r.gif','/index/common/images/home-sub-combust-r.gif','/index/common/images/home-sub-dreamscape-r.gif','/index/common/images/home-sub-diy-r.gif','/index/common/images/home-sub-joinfc-r.gif','/index/common/images/home-sub-syoffc-r.gif','/index/common/images/home-sub-fidm-r.gif','/index/common/images/home-sub-tour-r.gif'); 
}

/*********************************************************************
// Cookies
// Original JavaScript code by Duncan Crombie: dcrombie@chirp.com.au
// revised by Bradford Mar: bradfordmar@hotmail.com
// Please acknowledge use of this code by including this header.
*********************************************************************/
  function getCookie(name) { // use: getCookie("name");
    bites = (document.cookie) ? document.cookie.split("; ") : null; // break cookie into array of bites
    if (bites != null) {
      for (var i=0; i < bites.length; i++) {
        nextbite = bites[i].split("="); // break into name and value
        if (nextbite[0] == name) {// if name matches
          return unescape(nextbite[1]); // return value
        }
      }
    } else {
      return null;
    }
    return null;
  }
  function setCookie(name, value, expDate) {
    var today = new Date();
    var yearFromNow = new Date(today.getTime() + 630720000000); // Changed by Dana Shaw: dshaw@fidm.com to 20yrs 09/18/06
    var expiry = (expDate) ? expDate.toGMTString() : yearFromNow.toGMTString();
    //var expiry = yearFromNow.toGMTString();
    if (value != null && value != "") {
      newCookie = name + "=" + escape(value) + "; path=/; expires=" + expiry;
      document.cookie = newCookie;
      bites = document.cookie.split("; "); // update cookie bites
    }
  }


/*********************************************************************
// Member Fork
// Used for contests, determines if you're a member or not, 
// and forwards you to the appropriate page. 
// members -> 2.html; non-members -> 1.html
// input parameter (nextPage) is the file name w/o number or extension
//	 i.e. 'myfile', not 'myfile1.shtm'
*********************************************************************/
function memberFork(nextPage, ext) {
  memberCheck = (getCookie('fidmname')) ? nextPage + "2." + ext : nextPage + "1." + ext;
  return memberCheck;
}


/*********************************************************************
// Fix for Netscape Users
// If you're having trouble supporting Netscape browsers, 
// just turn this variable to 'true'
*********************************************************************/
var avoidnetscape = false;	// to kick out Netscape users, turn this to 'true'
if ((navigator.userAgent.toLowerCase().indexOf('netscape') != -1) && (window.location.href.indexOf('netscape')==-1) && (avoidnetscape==true)) {
  window.location='/netscape.shtm';
}



/************************************************************
 * This will pop up an alert message only once per day. 
 * Uses cookies. Turn the "doalert" variable true or false
 * to turn the popup on or off. 
 ************************************************************/
  var doalert = false;
  
  function setCookie2(name, value, expDate) {
    var today = new Date();
    var dayFromNow = new Date(today.getTime() + 86400000); /* 86400000 = 1 day */
    var expiry = dayFromNow.toGMTString();
    if (value != null && value != "") {
      newCookie = name + "=" + escape(value) + "; path=/";
      newCookie += (expiry) ? ";expires=" + expiry : "";
      document.cookie = newCookie;
      bites = document.cookie.split("; "); // update cookie bites
    }
  }
  
  if (doalert) {
	  if (!getCookie('downmessage')) {
		setCookie2('downmessage', '1');
		MM_openBrWindow('/alert/alert.shtm','downmessage','width=400,height=430')
	  }
  }

