

  function doLoadNews(limit){

    URL="loadNews.php?l="+limit;
    xmlReq = null;
    if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest();
    else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
    if(xmlReq==null) return; 

    xmlReq.onreadystatechange = function(){
      switch(xmlReq.readyState){
        case 0: 
          newsIn.innerHTML="loading news archives...";
          break;
        case 1: 								
          newsIn.innerHTML="loading news archives...";
          break;
        case 2: 							
          newsIn.innerHTML="loading news archives...";
          break;
        case 3: 						
          newsIn.innerHTML="loading news archives...";
          break;	
        case 4: 					
          doSomethingWithData(xmlReq.responseText);
          break;
        default:
          break;
      }
    }

    xmlReq.open ('GET', URL, true);
    xmlReq.send (null);


    function doSomethingWithData(datastr){
      newsIn.innerHTML=datastr;
    }
  }

  function doGetNews(n){
    URL="getNews.php?n="+n;
    xmlReq = null;
    if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest();
    else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
    if(xmlReq==null) return; 

    xmlReq.onreadystatechange = function(){
      switch(xmlReq.readyState){
        case 0: 
          contentIn.innerHTML="loading news...";
          break;
        case 1: 								
          contentIn.innerHTML="loading news...";
          break;
        case 2: 							
          contentIn.innerHTML="loading news...";
          break;
        case 3: 						
          contentIn.innerHTML="loading news...";
          break;	
        case 4: 					
          doSomethingWithData(xmlReq.responseText);
          break;
        default:
          break;
      }
    }

    xmlReq.open ('GET', URL, true);
    xmlReq.send (null);


    function doSomethingWithData(datastr){
      contentIn.innerHTML=datastr;
      getTabs('news.items','no')
    }
  }

  function closeDH(){
    dh.innerHTML='';
  }

  function doLogin(){
    http = null;
    if(window.XMLHttpRequest) http = new XMLHttpRequest();
    else if(window.ActiveXObject) http = new ActiveXObject("Microsoft.XMLHTTP");
    if(http==null) return; 
    var params = 'horde_user='+document.f.user.value+'&horde_pass='+document.f.pass.value;
    var url = 'http://www.mercuryspeed.com/horde/login.php?nocache=4tk1wt058yv4'
    http.open("POST", url, true);

    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http.setRequestHeader("Content-length", params.length);
    http.setRequestHeader("Connection", "close");

    http.onreadystatechange = function() {//Call a function when the state changes.
      if(http.readyState == 4 && http.status == 200) {
        OpenWindow=window.open('','hordemail','width=600,height400,toolbar=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
        OpenWindow.document.write("<TITLE>Horde Mail</TITLE>")
        OpenWindow.document.write(http.responseText)
        OpenWindow.document.write("</HTML>")

        OpenWindow.document.close()
        self.name="main"
      }
    }
    http.send(params);
  }

  function doDialup(who){
    if(who==""){
      URL="dialup.php";
    } else { URL="dialup.php?who="+who; }
    xmlReq = null;
    if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest();
    else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
    if(xmlReq==null) return; 

    xmlReq.onreadystatechange = function(){
      switch(xmlReq.readyState){
        case 0: 
          dh.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loadingdh.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Connecting...</td></tr></table>";
          break;
        case 1: 								
          dh.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loadingdh.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Finding Content...</td></tr></table>";
          break;
        case 2: 							
          dh.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loadingdh.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Reading Content...</td></tr></table>";
          break;
        case 3: 						
          dh.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loadingdh.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Complete!</td></tr></table>";
          break;	
        case 4: 					
          doSomethingWithData(xmlReq.responseText);
          break;
        default:
          break;
      }
    }

    xmlReq.open ('GET', URL, true);
    xmlReq.send (null);


    function doSomethingWithData(datastr){
      dh.innerHTML=datastr;
    }
  }

  function getContent(content,doTabs,doNews){
    URL="getContent.php?c="+content;
    xmlReq = null;
    if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest();
    else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
    if(xmlReq==null) return; 

    xmlReq.onreadystatechange = function(){
      switch(xmlReq.readyState){
        case 0: 
          contentIn.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loading1.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Connecting...</td></tr></table>";
          break;
        case 1: 								
          contentIn.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loading2.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Finding Content...</td></tr></table>";
          break;
        case 2: 							
          contentIn.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loading3.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Reading Content...</td></tr></table>";
          break;
        case 3: 						
          contentIn.innerHTML="<table border=0 cellspacing=0 cellpadding=3 width=100%><tr><td align=left valign=top><img src='images/loading4.gif'> <font style='font-size: 14px; font-family: arial,sans-serif; color: #333333'>Complete!</td></tr></table>";
          break;	
        case 4: 					
          doSomethingWithData(xmlReq.responseText);
          break;
        default:
          break;
      }
    }

    xmlReq.open ('GET', URL, true);
    xmlReq.send (null);


    function doSomethingWithData(datastr){
      contentIn.innerHTML=datastr;
      if(doTabs=="yes"){
        getTabs(content,doNews);
      }
      if(content=="home.home"){
        // wxButtonFrame.src=''
      }
    }

    // COMMENTED SECTION DESCRIPTION: adsense footer ad color change, not required anymore
    //csub=content.substring(4,7); 
    // if(csub==".ho" || csub=="e.h" || csub=="ome"){
    //   adIn.style.background="#F1E4BD"
    //   adIn.style.border="2px solid #CC9900"
    // } 

    // if(csub==".ab" || csub=="e.c" || csub==".pa" || csub=="ack"){
    //   adIn.style.background="#F3C5C5"
    //   adIn.style.border="2px solid #CC0000";
    // }

    // if(csub==".us" || csub=="e.b" || csub==".co" || csub=="ond"){
    //   adIn.style.background="#A6D2E8"
    //   adIn.style.border="2px solid #3399CC"
    // }
  }

  function getTabs(content,doNews){
    URL="getTabs.php?t="+content;
    xmlReq = null;
    if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest();
    else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
    if(xmlReq==null) return; 

    xmlReq.onreadystatechange = function(){
      switch(xmlReq.readyState){
        case 0: 
          tabIn.innerHTML="<table width=100% border=0 bgcolor=#336633 style='height: 27px'><tr><td>&nbsp;</td></tr></table>";
          break;
        case 1: 								
          tabIn.innerHTML="<table width=100% border=0 bgcolor=#336633 style='height: 27px'><tr><td>&nbsp;</td></tr></table>";
          break;
        case 2: 							
          tabIn.innerHTML="<table width=100% border=0 bgcolor=#336633 style='height: 27px'><tr><td>&nbsp;</td></tr></table>";
          break;
        case 3: 						
          tabIn.innerHTML="<table width=100% border=0 bgcolor=#336633 style='height: 27px'><tr><td>&nbsp;</td></tr></table>";
          break;	
        case 4: 					
          doSomethingWithData(xmlReq.responseText);
          break;
        default:
          break;
      }
    }

    xmlReq.open ('GET', URL, true);
    xmlReq.send (null);


    function doSomethingWithData(datastr){
      tabIn.innerHTML=datastr;
      // tabIn.innerHTML="<table width=100% border=0 bgcolor=#336633 style='height: 27px'><tr><td>&nbsp;</td></tr></table>";
    }
  }
