function AjaxGetMethode(){
 var Ajax = null; 
 if(window.XMLHttpRequest)
  Ajax = new XMLHttpRequest(); 
 else if(window.ActiveXObject){ 
  try {
   Ajax = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   Ajax = new ActiveXObject("Microsoft.XMLHTTP");
  }
 } else {
  Ajax = false; 
 } 
 return Ajax
}

function Cluser(){
 var Ajax = AjaxGetMethode();
 Ajax.onreadystatechange = function(){
  if(Ajax.readyState == 4 && Ajax.status == 200){ 
   document.getElementById('cluster').innerHTML = Ajax.responseText;
   Start_Cluser();
  }
 }
 Ajax.open("GET","ajax.php?type=cluster&" + Math.random(),true);
 Ajax.send(null);
}

function Chat(){
 var Ajax = AjaxGetMethode();
 Ajax.onreadystatechange = function(){
  if(Ajax.readyState == 4 && Ajax.status == 200){ 
   document.getElementById('chat').innerHTML = Ajax.responseText;
  }
 }
 Ajax.open("GET","ajax.php?type=chat&" + Math.random(),true);
 Ajax.send(null);
}


function RmRm(Type, ID){
 var Ajax = AjaxGetMethode();
 Ajax.open("GET","admin.php?type=" + Type + "&id=" + ID + "&" + Math.random(),true);
 Ajax.send(null);
 Chat();
 Cluster();
}


function Spot(Call, Freq, Mode, Wrk, RST, Com){
 document.getElementById('bstop').disabled = "disabled";
 var Ajax = AjaxGetMethode();
 Ajax.onreadystatechange = function(){
  if(Ajax.readyState == 4 && Ajax.status == 200){ 
   document.getElementById('bstop').disabled = "";
   if(Ajax.responseText == "SOK"){
    document.getElementById('call').value = "";
    document.getElementById('freq').value = "27.";
    document.getElementById('r1').value = "1";
    document.getElementById('r2').value = "0";
    document.getElementById('com').value = "";
   }
  }
 }
 var Message = Com.replace("+", "%2B");
 Ajax.open("GET","ajax.php?type=spot&call=" + Call + "&freq=" + Freq+ "&mode=" + Mode + "&wrk=" + Wrk + "&rst=" + RST + "&com=" + Message + "&" + Math.random(),true);
 Ajax.send(null);
}

function ChatR(Msg){
 document.getElementById('cstop').disabled = "disabled";
 var Ajax = AjaxGetMethode();
 Ajax.onreadystatechange = function(){
  if(Ajax.readyState == 4 && Ajax.status == 200){ 
   document.getElementById('cstop').disabled = "";
   if(Ajax.responseText == "COK"){
    document.getElementById('chatmsg').value = "";
	document.getElementById('chatmsg').focus();
	Chat();
   }
  }
 }
 var Message = Msg.replace("+", "%2B");
 Ajax.open("GET","ajax.php?type=chate&msg=" + Message + "&" + Math.random(),true);
 Ajax.send(null);
}

function Update(){
 var Ajax = AjaxGetMethode();
 Ajax.onreadystatechange = function(){
  if(Ajax.readyState == 4 && Ajax.status == 200){ 
   document.getElementById('nbuser').innerHTML = Ajax.responseText;
  }
 }
 Ajax.open("GET","ajax.php?type=update&" + Math.random(),true);
 Ajax.send(null);
}

function Statistique(){
 var Ajax = AjaxGetMethode();
 Ajax.onreadystatechange = function(){
  if(Ajax.readyState == 4 && Ajax.status == 200){ 
   document.getElementById('statou').innerHTML = Ajax.responseText;
   Start_Membre();
  }
 }
 Ajax.open("GET","ajax.php?type=membre&" + Math.random(),true);
 Ajax.send(null);
}

var Timer_Chat = "";

var Update_Item = window.setInterval('Update()' , 3000);

function Start_Cluser(){
 Timer_Item = window.setTimeout('Cluser()' , 3000);
}

function Start_Chat(){
 Timer_Chat = window.setInterval('Chat()' , 2000);
}

function Start_Membre(){
 var Timer_Membre = window.setTimeout('Statistique()' , 3000);
}


function Tab_Over(Over){
 document.getElementById(Over).style.background = "#88CFFF";
}

function Tab_Out(Out){
 document.getElementById(Out).style.background = "#FAFAFA";
}

function Tab_Out2(Out){
 document.getElementById(Out).style.background = "#F2F2F2";
}


function cTab_Over(Over){
 document.getElementById(Over).style.background = "#88CFFF";
 window.clearInterval(Timer_Chat);
 document.getElementById('chatalert').innerHTML = " - (EN PAUSE)";
}

function cTab_Out(Out){
 document.getElementById(Out).style.background = "#FAFAFA";
 Start_Chat();
 document.getElementById('chatalert').innerHTML = "";
}

function cTab_Out2(Out){
 document.getElementById(Out).style.background = "#F2F2F2";
 Start_Chat();
 document.getElementById('chatalert').innerHTML = "";
}

function show(id, msg) {
 document.getElementById('tooltip').innerHTML = "&nbsp;" + msg + "&nbsp;";
 document.getElementById('tooltip').style.visibility = "visible";
}
function hide(id) {
 document.getElementById('tooltip').style.visibility = "hidden";
}

function position(e) {
 x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
 y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
 if(document.getElementById('tooltip').style.visibility == "visible"){
  document.getElementById('tooltip').style.left = x - 60;
  document.getElementById('tooltip').style.top = y + 20;
 }
}
if (navigator.appName.substring(0,3) == "Net") document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = position;

