function printResize(){
 window.resizeTo('800', '600');
}
function getRandom(min, max)
{
   max++;   //add one to the max number specified so that the specified value can actually be returned
   range = max - min;
   now = new Date();
   seed = now.getSeconds();
   randomNumber = Math.random(seed);         //get a random number between 0 & 1
   randomNumber = randomNumber * range;      //convert this to a random number between 0 & range
   roundedNumber = Math.round(randomNumber); //round the number off to an integer (down if less than .5, up if greater than)
   if (roundedNumber == range)
      {roundedNumber = 0;}
   roundedNumber = roundedNumber + min;

   return roundedNumber
}

function showPopupOnce(popupTitle, chance, wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable) {

   if (chance<100)
   {
      num = getRandom(0, 100);
      if (num > chance) return false;
   }

	if (GetCookie("seenpopup" + popupTitle) == 'true') return true;

	var expires = new Date();
	expires.setTime(expires.getTime() + 3E11);

   SetCookie("seenpopup" + popupTitle, true, expires, "");
   openAnyWinTwo(wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable);

	return true;
}

function showPopup(chance, wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable) {

   if (chance<100)
   {
      num = getRandom(0, 100);
      if (num > chance) return false;
   }

   openAnyWinTwo(wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable);
	return true;
}

function SetChildOpenerNull(win)
{
  wind = eval(win);
  wind.opener = null;
}
function openInParent2(url)
{
   if(window.opener && !window.opener.closed){
      var parentWin = window.opener;
      parentWin.location.href = url;
      parentWin.focus();
      window.close();
   } else {
      now = new Date();
      var winName = 'window' + now.getHours() + now.getMinutes() + now.getSeconds();
      openAnyWinTwo(url,winName,800,600,0,0,0,1,1,1,1,1,1);
      window.close();
   }
}
function openAnyWinTwo (wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable)
{
var features= 'width='        + wWidth +
              ',height='      + wHeight +
              ',top='        + wTop +
              ',left='      + wLeft +
              ',directories=' + wDirectories +
              ',location='    + wLocation +
              ',menubar='     + wMenubar +
              ',scrollbars='  + wScrollbars +
              ',status='      + wStatus +
              ',toolbar='     + wToolbar +
              ',resizable='   + wResizable;
window.open (wUrl, wWindowName, features);
}

function openAnyWin (wUrl, wWindowName, wWidth, wHeight, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable)
{
var features= 'width='        + wWidth +
              ',height='      + wHeight +
              ',directories=' + wDirectories +
              ',location='    + wLocation +
              ',menubar='     + wMenubar +
              ',scrollbars='  + wScrollbars +
              ',status='      + wStatus +
              ',toolbar='     + wToolbar +
              ',resizable='   + wResizable;
window.open (wUrl, wWindowName, features);
}
function writebannerimage(sitetype) {
  if (sitetype == "msf" || sitetype == "msd") {
    bannerurl = statichost + "/static/global/fwimgs/" + sitetype + "_banner.jpg";
    document.write("<img src='" + bannerurl + "' border=\"0\" width=\"480\" height=\"101\">");
  } else if(sitetype == "nam") {
    bannerurl = statichost + "/static/global/fwimgs/" + sitetype + "_banner_37by306.gif";
    document.write("<IMG SRC='" + bannerurl + "' border=\"0\" width=\"306\" height=\"37\">");
 }
}

function writeCurve(sitetype) {
   var curveImage = statichost + "/static/global/fwimgs/" + sitetype + "_curve.gif";
   var curveTile = statichost + "/static/global/fwimgs/" + sitetype + "_curve_tile.gif";
   document.write("<td colspan=\"3\" background=\"" + curveTile + "\"><img src=\"" + curveImage + "\" alt=\"\" width=\"409\" height=\"6\"></img></td>");
}

function jumpto2(url) {
	if (url == "" || url == "no_jump") {
	   return;
	}
	top.location = url;
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function HandleSubscription1 () {
  openAnyWinTwo("", "ShellSubscriptionWindow", 490, 300, 168, 152, 0, 0, 0, 0, 0, 0, 0);
  window.document.SubscriptionForm.referringPage.value = location.href;
  window.document.SubscriptionForm.shellCookie.value = GetCookie("SHELL.COM");
  return true;
}

function HandleSubscription2 () {
  HandleSubscription1();
  window.document.SubscriptionForm.submit();
}

function setSecureSearchVarsAndSubmit(theForm) {
   setSecureSearchVars(theForm);
   theForm.submit();
}

function setSecureSearchVars(theForm) {
   var strFC2 = "";
   var strFC3 = "";
   var url = window.location.href;
   regex = new RegExp("FC2=\.+");
   matches = url.match(regex);
   if (matches == null) {
      strFC2 = "";
   } else {
      strFC2 = matches[0];
      if (strFC2 == "FC2=") {
         strFC2 = "";
      } else {
         // Loose the "FC2=" from the start of the string.
         strFC2 = strFC2.substring(4);
         // Get rid of any parameters that follow this one.
         if (strFC2.indexOf('&') != -1) {
            strFC2 = strFC2.substring(0, strFC2.indexOf('&'));
         }
      }
   }
	theForm.FC2.value = strFC2;
	
	regex = new RegExp("FC3=\.+");
   matches = url.match(regex);
   if (matches == null) {
      strFC3 = "";
   } else {
      strFC3 = matches[0];
      if (strFC3 == "FC3=") {
         strFC3 = "";
      } else {
         strFC3 = strFC3.substring(4);
         if (strFC3.indexOf('&') != -1) {
            strFC3 = strFC3.substring(0, strFC3.indexOf('&'));
         }
      }
   }
	theForm.FC3.value = strFC3;
}

function shell_sage_ev(intType, strURL, strSourceSiteID){
}
function shell_sage_openAnyWinTwo(intType, strSourceSiteID, strURL, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable){
openAnyWinTwo(strURL, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable);
}
