   function setCookie(name, value, expires) 
   {
      document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
   } 

   function getCookie (name) 
   {
      var ca = document.cookie.split(';');
      var nameEQ = name + "=";
      for(var i=0; i < ca.length; i++) 
      {
         var c = ca[i];
         while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
         if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
      }
      return null;
   }

   function toggleViewOption()
   {
      var exp = new Date();     //set new date object
      exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 365));  
      selection = "S";
      if (viewOptionsForm.seriesPageOption[0].checked)
      {
         selection = "F";
      }
      setCookie("orbitsViewOption", selection, exp);
   }

   function getViewOption()
   {
      selection = getCookie("orbitsViewOption");
      if (selection == null || selection == "")  selection = "S";
		return selection;
   }

   function openPopup(windowName,myURL,windowWidth,windowHeight)
   {
      var screenWidth=Math.min(screen.width,windowWidth);
      var screenHeight=Math.min(screen.height,windowHeight);
      var screenX=Math.round((screen.width-12-screenWidth)/2);
      var screenY=Math.round((screen.height-76-screenHeight)/2);
      popup = window.open(myURL,windowName,"scrollbars=no,dependent=no,titlebar=no,resizable=no,location=no,toolbar=no,status=no,menubar=no,screenX="+screenX+",screenY="+screenY+",left="+screenX+",top="+screenY+",width="+screenWidth+",height="+screenHeight);
      popup.focus();
   }

   function linkToSeries(seriesNumber)
   {
      selection = getViewOption();
      if (selection == "F")
      {
         newWindow = window.open("Series_" + seriesNumber + "_seriesFull.html", '_blank');
         newWindow.focus();
      }
      else
      {
         newWindow = window.open("Series_" + seriesNumber + "_1_stripPage.html", 'OrbitsStripWindow');
         newWindow.focus();
      }
   }


