// set up variables

    // convert all characters to lowercase to simplify testing 
    var agt=navigator.userAgent.toLowerCase(); 

    var is_major = parseInt(navigator.appVersion); 
    var is_minor = parseFloat(navigator.appVersion); 
    var is_nav      =   ((agt.indexOf('mozilla') != -1) && (agt.indexOf('spoofer') == -1) && (agt.indexOf('compatible') == -1)); 
    var is_nav3     = (is_nav && (is_major < 4)); 
    var is_nav405   = (is_nav && (is_minor == 4.05));   
    var is_ie       = (agt.indexOf('msie') != -1); 
    var is_ie3      = (is_ie && (is_major < 4)); 

    var is_win      = (agt.indexOf('win')!=-1);
    var is_mac      = (agt.indexOf('mac')!=-1);
    
    // Mac IE 4.5
    var is_ie_mac4  = (is_mac && is_ie && (agt.indexOf('4.5')!=-1));

//  functions

function sheet(filename)
{
    
    document.write("<LINK HREF='http://expn.go.com/css/" + filename + ".css' REL='styleSheet' TYPE='text/css'>");   
    return;
}


function IEDetectObject(ClassID)
{
    result = false;
    endScript = '</'
    if ((is_ie) && (is_win))
    {
        document.writeln('<SCRIPT LANGUAGE=VBScript> ');
        document.writeln('on error resume next ');
        document.writeln('result = IsObject(CreateObject("' + ClassID + '")) ');
        document.writeln(endScript+'SCRIPT> ');
    }
    return result;
}
    

// test for Flash 4 ActiveX Control (IE WIN)
    var flashActiveX = IEDetectObject('ShockwaveFlash.ShockwaveFlash.4');
    
// test for Flash 4 Plug-in (NS and MAC IE5)

flashPlugIn = 0;
if ((is_nav || (is_ie && is_mac)) && navigator.plugins)
    {
    numPlugins = navigator.plugins.length;
    if (numPlugins > 0)
        {
        for (i = 0; i < numPlugins; i++)
            {
            plugin = navigator.plugins[i];
            if (plugin.description.indexOf('Flash 4') != -1)
                {
                numTypes = plugin.length;
                for (j = 0; j < numTypes; j++)
                    {
                    mimetype = plugin[j];
                    if (mimetype)
                        {
                        if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf('swf') != -1))
                        flashPlugIn = 1;
                        // Mac wierdness
                        if (navigator.mimeTypes['application/x-shockwave-flash'] == null)
                        flashPlugIn = 0;
                        }
                    }
                }
            }
        }
    }   


// load style-sheet; uses sheet() function
if (is_ie && is_win) {
    sheet('win_ie');
    }
else if (is_ie && is_mac) {
    sheet('mac_ie');
    }
else if (is_nav && is_mac) {
    sheet('mac');
    }
else {
    sheet('win_ns');
    }


// redirect non-compliant users


// fixes NS4 window resize bug
// bug-fix details: http://www.webreference.com/dhtml/diner/resize/index.html

NS_4 = document.layers;
    if (NS_4) {      
        origWidth = innerWidth;
        origHeight = innerHeight;
      }
function reDo() {
    if (innerWidth != origWidth || innerHeight != origHeight)
        location.reload();
      }
if (NS_4) onresize = reDo;

function openPopUp(url,popWidth,popHeight,name) {
    if (name == "") {
      name = 'OpenPopUp';
    }
    winWidth="width=" + popWidth;
    winHeight="height=" + popHeight;
    popup = window.open(url,name,'menubar=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,' + winWidth + ',' + winHeight);
    if (popup.opener == null) popup.opener = window;
}


function openPopUpOptions(url,popWidth,popHeight,name,mb,resize,tool,loc,dir,status,scroll,history) {
    if (name == "") {
name = 'OpenPopUpOptions';}
    winWidth="width=" + popWidth;
    winHeight="height=" + popHeight;
    if ((mb == null) || (mb == "")) {mb = 'yes';}
    if ((resize == null) || (resize == "")) {resize = 'yes';}
    if (tool == "") {tool = 'yes';}
    if (loc == "") {loc = 'yes';}
    if (dir == "") {dir = 'yes';}
    if (status == "") {status = 'yes';}
    if ((scroll == null) || (scroll == "")) {scroll = 'yes';}
    if (history == "") {history = 'yes';}
    
    popup = window.open(url,name,'menubar=' + mb + ',toolbar=' + tool+ ',location=' +loc+ ',directories=' + dir+ ',status=' +status+ ',scrollbars=' +scroll+ ',resizable=' +resize+ ',copyhistory=' + history+ ',' + winWidth + ',' + winHeight);
    popup.opener = self;
    
}

function closePopUp(url) {
    if ( (url != null) && (url != "")) {
    parent.opener.location = url;
    }
    top.close();
}

function changeWin(url) {
    if (window.opener){
        if (window.opener.location != url) {
            window.opener.location = url;
        }
    window.opener.focus();
    }
}

function changeParent(url) {
    if (window.opener){
        window.opener.location = url;
    }   
}


function ChatPopUp(url,popWidth,popHeight,RefUrl) {
self.location = RefUrl;
winWidth="width=" + popWidth;
winHeight="height=" + popHeight;
popup = window.open(url,'ChatRoom','menubar=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,' + winWidth + ',' + winHeight);
popup.creator = self;
popup.focus();
}

function WM_imageSwap(daImage, daSrc){
  var objStr,obj;

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}


function WM_preloadImages() {

  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}

    