
window.onload = function () {
	if(document.getElementById) {
		if(document.getElementById('csab')) {
			document.getElementById('csab').style.visibility="hidden";
		}
	}
}

function user(id) {
 url="user.php?tag="+id;
 window.open(url,"user"+id,"width=540,height=450,top=28,left=8,scrollbars=1,resizable=1");
}
 
function level(id,it) {
 url="level.php?tag="+id+"&targy="+it;
 window.open(url,"level"+id,"width=480,height=410,top=228,left=408,scrollbars=1,resizable=0");
}
 
function hdn(valaszt) {
    document.segedkereso.rejtett.value = valaszt; // átállítja a rejtett mezo értékét, ha a mezo neve: rejtett
    document.segedkereso.submit(); // elsubmitolja az oldalt, ezért már a linkbol csak ezt a fv-t kell meghívni
}

function feltolt(valaszt) {
    document.feltolto.hidden.value = valaszt; 
    document.feltolto.submit(); 
}
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function temanyit() {
 url="temanyito.php";
 window.open(url,"temanyito","width=727,height=139,top=53,left=40,scrollbars=1,resizable=0");
}
 
function hozzaszolas(id,valasz,kinek,kineknev,ido) {
 url="hozzaszolas.php?beirid="+id+"&valasz="+valasz+"&kinek="+kinek+"&kineknev="+kineknev+"&ido="+ido;
 window.open(url,"hozzaszolas"+id,"width=480,height=410,top=228,left=408,scrollbars=1,resizable=0");
}

function showpic(x,y,id) {
 url="kep.php?kepid="+id;
 window.open(url,"kep"+id,"width="+x+",height="+y+",top=228,left=408,scrollbars=0,resizable=1");
}
function showpic2(x,y,id) {
 url="kep2.php?kepid="+id;
 window.open(url,"kep"+id,"width="+x+",height="+y+",top=228,left=408,scrollbars=0,resizable=1");
}
function szabaly() {
 url="szabalyzat.html";
 window.open(url,"szabalyzat","width=540,height=450,top=28,left=8,scrollbars=1,resizable=1");
}

function forum(fej) {
	document.getElementById('tagnaktextarea').value=document.getElementById('tagnaktextarea').value+fej;
	document.getElementById('tagnaktextarea').focus();
}

function mezo(param,color) {
	document.getElementById(param).style.backgroundColor=color;
}


function aja() {
	if(document.getElementById) {
		if(document.getElementById('csab')) {
			document.getElementById('csab').style.visibility="hidden";
		}
	}
// gyumolcstarhely.hu modositas 2009.04.01
//	ido=setInterval('get()',1000); 
	ido=setInterval('get()',10000); 

}

var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
       if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
           http_request.overrideMimeType('text/xml');
            //http_request.overrideMimeType('text/html');
        }
      } else if (window.ActiveXObject) { // IE
         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 = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
     // alert(parameters);
	  http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //lert(http_request.responseXML.getElementsByTagName("level"));
			//alert(http_request.responseXML.getElementsByTagName("online"));
			erteke=http_request.responseText.split(","); 
			//alert(http_request.responseText);
			DisplayResults(erteke)
            //document.getElementById('myspan').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get() {
		var poststr="id="+document.getElementById("lev").value;
		//alert(poststr);
		makePOSTRequest('jelszo.php', poststr);
   }

   
function DisplayResults (erteke) {
	clearInterval(ido);
	setInterval('get()',900000);
	if (erteke[0]!="m") {
	if (erteke[0]==0) { document.getElementById('uzeneterk').firstChild.nodeValue=0;
				document.getElementById('boritek').src="img/envelopszurke.gif";
	} else {
		document.getElementById('uzeneterk').firstChild.nodeValue=erteke[0];
		document.getElementById('boritek').src="img/envelopanim.gif";
		document.getElementById('uzinek').href="?lev=bejov&tagsag=tagsag&page=0";
		document.title="1 uj uzenet - ::: HFF SOCIAL CLUB ::: ";
		
		}
		if (erteke[1]==0) document.getElementById('online').firstChild.nodeValue=0; else document.getElementById('online').firstChild.nodeValue=erteke[1];
		if (erteke[2]==0) document.getElementById('hscf').firstChild.nodeValue=0; else document.getElementById('hscf').firstChild.nodeValue=erteke[2];
	} else {	
		if (erteke[1]==0) document.getElementById('online').firstChild.nodeValue=0; else document.getElementById('online').firstChild.nodeValue=erteke[1];
		if (erteke[2]==0) document.getElementById('hscf').firstChild.nodeValue=0; else document.getElementById('hscf').firstChild.nodeValue=erteke[2];
	}
}
	
