if (top.frames.length > 0) {
   top.location = self.location;
}
 
  affiliates = ["facebook","theapplecollection","google","macmothership","yahoo"];
  affcode = ["F","B","G","M","Y"];
  ref = "";
 
  for (j=0; j<=affiliates.length; j++) {
      if (document.referrer.toLowerCase().indexOf(affiliates[j]) != -1) {
         ref = affcode[j];
         break;
      }
   }
   
   if (ref == "F") alert('Welcome Facebook user! For this visit only, you\'re eligible for 15% off anything in our store. Your discount will be applied at checkout.');
   
   if (ref !="") {
      var theDate = new Date();
      theDate.setTime(theDate.getTime() +(7 * 24 * 60 * 60 * 1000));  
      inaweek = theDate.toGMTString();
      document.cookie = "TMBreferral="+ref+"; expires="+inaweek+"; domain=missingbite.com; path=/";
    }
   
	re = new RegExp("TMBref2=([^;]+)");
	val = re.exec(document.cookie);
	if (val == null) {                      //First visit this session
		if (document.referrer == "") refe = "Direct URL";
		else refe = document.referrer.substr(7,99);
		document.cookie = "TMBref2="+refe+"; domain=missingbite.com; path=/";
	}

function ndxheader()  {
  //  defbtn = IMAGE OFFSET on page for default button to highlight
  //  Posters=5, SH=6, , MS=7, WM=8, SP=9, FAQ=10, priv=11, ... 13=thankyou (continue), 14=index (no defbtn),     0 & undefined = no default btn

   btnname = [,"posters","SH","MS","WM","SP","FAQ","sitemap","guar","test","cart","thanks","index"];
   defbtn = 14;
   lev = "./"; 
   btn = new Array();
   btninv = new Array();
   for (i=1; i<=10; i++) {
     btn[i] = new Image();
     btninv[i] = new Image();
     btn[i].src = "./std/"+btnname[i]+".gif";
     btninv[i].src = "./std/"+btnname[i]+"inv.gif";
    if (i<10) drawbtn(i);
    if (i==5)  document.writeln('<HR>');
//    if (i==5)  document.writeln('<BR><A HREF=./giftsetsec.html>Apple Gift Sets</A><HR>');
    if (i==9)  document.writeln('<HR>');
   }
}

