// Java Document
var xmlhttp=false;
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    try {
         xmlhttp = new XMLHttpRequest();
    } catch (e) {
         xmlhttp=false;
    }
}
if (!xmlhttp && window.createRequest) {
    try {
        xmlhttp = window.createRequest();
    } catch (e) {
        xmlhttp=false;
    }
}

/* Ultimater's edited version of:
   http://javascript.internet.com/ajax/ajax-navigation.html */

var please_wait = "<img src=\"images/loading/working.gif\" border=\"0\" alt=\"Loading...\">";
//chat1
function reqChan(url,targetId,name) {

  if(!xmlhttp)return false;
var chan = document.getElementById(name).value;

var queryString = "&channame=" + chan;

    var e=document.getElementById(targetId);if(!e)return false;
    if(please_wait)e.innerHTML = please_wait;
    xmlhttp.open("POST", url, true);

    xmlhttp.onreadystatechange = function() { responsecus(url, e); }
    try{
	  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
      xmlhttp.send(queryString);
    }catch(l){
    while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
    e.appendChild(document.createTextNode("request failed"));
  }
}



function responsecus(url, e) {

  if(xmlhttp.readyState != 4)return;
    var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the following error code: " + xmlhttp.status+" "+xmlhttp.statusText;
    var d=document.createElement("div");
    d.innerHTML=tmp;
    setTimeout(function(){
      while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
      e.appendChild(d);
    },10)
}



   function mibbitInput(mib) {
     var mibbitid = document.getElementById('appstyle').value;
     var mibId = mib;
     if  (mibId == '0' || !mibId)  {
      mibId = '';
     }
    if (mibbitid == '3') {
     var eMessage = document.getElementById('mibbitDiv');
     var MSG = "<br><br><hr><b>Mibbit Setting ID</b>: <input type='text' name='mibbitid' value='" + mibId + "' id='mibbitid' maxlength='120'><small>(optional)*The Settings ID can be found in your account in the [prefs] tab on <a href='http:\/\/widget.mibbit.com\/manager\/' target='_blank'>Mibbit Web site<\/a><\/small><hr><br><br>";
     eMessage.innerHTML = MSG;
    }
    else {
    var eMessage = document.getElementById('mibbitDiv');
     var MSG = "<input type='hidden' name='mibbitid' value='' id='mibbitid'>";
     eMessage.innerHTML = MSG;
    }
   }

function ircInput(mib) {
     var mibId = mib;
     if  (mibId == '0' || !mibId)  {
      mibId = '';
     }

     var eMessage = document.getElementById('ircNet');
     var MSG = "<br><br><hr><b>IRC Port</b>: <input type='text' name='ircPort' value='" + mibId + "' id='ircPort' maxlength='10'> Default (6667)<hr><br><br>";
     eMessage.innerHTML = MSG;
   }

