var data = new Date();
function go(id){
return document.getElementById(id);
}
function hidep(id){
var obj=go('panel_'+id);
if(obj.style.display=="")obj.style.display="none";
else obj.style.display="";
}
function show(id){
var obj=go(id);
if(obj.style.display=="none") obj.style.display="";
}
function show2(id,idi){
var obj=go(id);
var obji=go(idi);
if(obj.style.display=="none") obj.style.display="";
else obji.style.display='';
}

function showhide(id){
var obj=go(id);
if(obj.style.display=="none") obj.style.display="";
else obj.style.display='none';
}

function hide(id){
var obj=go(id);
if(obj.style.display=="") obj.style.display="none";
}
   var http_request = false;
   function makeRequestMain(url, parameters,par2) {
      http_request = false;
      if (window.XMLHttpRequest) { 
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/html; charset=ISO-8859-2');
         }
      } else if (window.ActiveXObject) {
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContentsMain;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
   }

/*
function stayHome(){ 
if(go('popup_bg').style.display==''){
var nTop=0;
var nTop2=100;
var iV = document.body.scrollTop; 
go('popup_bg').style.top = iV+nTop;
go('chat_info').style.top = iV+nTop2;
}
}
//window.onscroll = stayHome;
//window.onload=stayHome;
*/
   function alertContentsMain() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            var result = http_request.responseText;
            if(result!='' && result!=undefined && result!='undefined'){
            var nowy=result.split('|||',4);
            if(nowy[1]==1){
            go('panel_friends').innerHTML = '';  
            go('chat_inf').innerHTML=nowy[2];
            go("popup_bg").style.opacity="0.5";
			go("popup_bg").style.display='';
			go("chat_info").style.display='';
            }
            else {
            if(nowy[2]!='blank||blank' && nowy[2]!='undefined' && nowy[2]!=undefined && nowy[2]!='' && nowy.length>3){
            var chaty=nowy[2].split('||');
            for(var y=1;y<=chaty.length;y++){
            if(chaty[y]!='' && chaty[y]!=' ' && chaty[y]!='undefined' && chaty[y]!=undefined){
            var tmpx=chaty[y].split('|');
            if(tmpx[0]!='' && tmpx[1]!=''){
            chat(tmpx[0],'',tmpx[1],'1');  
            }          
            }
            }
            }
            go('panel_friends').innerHTML = nowy[3];
            go('tb_friends_list').innerHTML = nowy[3];    
            }
            }        
         } else {
            //alert('There was a problem with the request.');
            //alert(http_request.status);
         }
      }
   }
   
   function getMain(url,par2) {
      var getstr = "?";
      var dod2 = data.getMinutes()+''+data.getSeconds()+''+data.getMilliseconds();
      makeRequestMain(url,'/?'+dod2,par2);
   }
function onlineMain(){
getMain('/send/friends/online','panel_friends');
setTimeout("onlineMain()", 10000);
}


var popupStatus = 0;

function loadPopup(id_name){
	if(popupStatus==0){
		go("popup_bg").style.opacity="0.5";
		go("popup_bg").style.display='';
		go("chat_info").style.display='';
		popupStatus = 1;
	}
}

function closePopup(){
		go("popup_bg").style.display='none';
		go("chat_info").style.display='none';
}




function quoting(id,content){
	var val=go('forumans').value;
go('forumans').value=val+' [quote='+id+']'+content+'[/quote]';
}