function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

function checkVersion()
{
  var msg = "You're not using Internet Explorer.";
  var ver = getInternetExplorerVersion();

  if ( ver > -1 )
  {
    if ( ver >= 8.0 )
      msg = "You're using a recent copy of Internet Explorer."
    else
      msg = "You should upgrade your copy of Internet Explorer.";
  }
  alert( msg );
}

var enableBannerTrack = true;
function expandBottomBanner(){
  var bottomBannerDiv = document.getElementById('bottomBannerDiv');
  if (getInternetExplorerVersion() == 6) {
    bottomBannerDiv.style.height =  "564px";
    insertBannerTracking();
  }
  else {
    if (bottomBannerDiv.style.height != "304px") {
      bottomBannerDiv.style.height =  "304px";
      insertBannerTracking();
    }
  }

  //if (enableBannerTrack) insertBannerTracking();
  //enableBannerTrack = false;
  displayEnableBannerTrack('expandBottomBanner');
}

function collapseBottomBanner(){
  var bottomBannerDiv = document.getElementById('bottomBannerDiv');
  bottomBannerDiv.style.height = "43px";
  enableBannerTrack = true;
  displayEnableBannerTrack('collapseBottomBanner');
}

function toggleBottomBanner(){
  var bottomBannerDiv = document.getElementById('bottomBannerDiv');
  if (getInternetExplorerVersion() == 6)
    strHeight = "564px";
  else
    strHeight = "304px";
  
  if (bottomBannerDiv.style.height != strHeight)
    expandBottomBanner();
  else
    collapseBottomBanner();
}

function insertBannerTracking() {
  var xmlHttp = null;
  if (window.XMLHttpRequest) {
    // If IE7, Mozilla, Safari, and so on: Use native object.
    xmlHttp = new XMLHttpRequest();
  }
  else {
    if (window.ActiveXObject) {
       // ...otherwise, use the ActiveX control for IE5.x and IE6.
       xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
    }
  }

  var url = "/banner_tracking.asp";
  var params = "bid="+intBottomBannerID+
               "&pid="+intBottomBannerPlacementID+
               "&tid="+intBottomBannerTypeID+
               "&cid="+intBottomBannerCountryID+
               "&sid="+intBottomBannerStateID;
  xmlHttp.open("POST", url, true);
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
    if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
      //alert(xmlHttp.responseText);
    }
  }
  xmlHttp.send(params);
  enableBannerTrack = false;
  displayEnableBannerTrack('insertBannerTracking');
}


function displayEnableBannerTrack(strtemp) {
  //document.debug.txtEnableBannerTrack.value = strtemp +'**'+enableBannerTrack;
  //document.debug.txtEnableBannerTrack.value += document.getElementById('bottomBannerDiv').style.height;
  return;
}
