////////////////////////////////////////////////////////////////////////////////
/////////AJAX TECHNÓLIGIÁK PITBULL TORRENT TRACKER /////////////////////////////
////////////////////////////////////////////////////////////////////////////////
 function lep(id)
{
id = id.replace(/id_/g,"");

   var klappText = document.getElementById(""+id);

   var klappText2 = document.getElementById(""+(id-1));

   if (klappText.style.display == 'none') {

        klappText.style.display = 'block';

      klappText2.style.display = 'none';
   }

}
function lep_vissza(id)

{

id = id.replace(/id_/g,"");
id = parseInt(id);
//alert(id);
   var klappText = document.getElementById(""+(id-2));

   var klappText2 = document.getElementById(""+(id-1));
   if (klappText.style.display == 'none') {

        klappText.style.display = 'block';

      klappText2.style.display = 'none';
   }

}


function p_load(serverPage, objID){
var xmlhttp = false;
try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;}}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();}
var obj = document.getElementById(objID);
obj.innerHTML = "Betöltés...";
xmlhttp.open("GET", serverPage+"&"+new Date().getTime());
xmlhttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-2");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}

ScrollSpeed = 1000
ScrollChars = 1

function getpage(page, divname)
{
	document.getElementById(divname).innerHTML = loadtext;
	var myAjax = new Ajax.Updater( divname, page, { onFailure: this.reportError, evalScripts: true} );
}
function nyitzar(targetId) {
target = document.getElementById(targetId);
if (target.style.display == "none"){
target.style.display="";
} else {
target.style.display="none";
}
}
function postpage(page, poststr, divname)
{
	document.getElementById(divname).innerHTML = loadtext;
	var myAjax = new Ajax.Updater( divname, page, { method: 'post', parameters: poststr, onFailure: this.reportError, evalScripts: true} );
}
function felhasznalo_importalasa(felhasznalo_id)
{
location.href='userdetails.php?id='+felhasznalo_id;
}
function torrent_megnyitas(torrent_id)
{
location.href='details.php?id='+torrent_id;
}

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
   
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
////Pitbull ajax lenyillás///
function pitbullajax(id)
{
  
	var rejteni = '#' + id;
	var kep = '#' + id; 

	if ($(rejteni).css('display') == 'none') {
  		$(rejteni).show('slow',function(){$(rejteni).fadeTo('slow',1)});
  		$(kep).attr("src","pic/minus.gif");

	}
	else {
  		$(rejteni).fadeTo('slow',0,function(){$(rejteni).hide('slow');});
      $(kep).attr("src","pic/plus.gif");
	}
}
function lennylilo(){
	var link=document.getElementById(arguments[0])
	if (link.getAttribute("rel")){
		savedefaultcontent(link.getAttribute("rel"))
		var modifiedurl=link.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
		link.setAttribute("href", modifiedurl)
		link.onclick=function(){
			ajaxOldal(this.getAttribute("href")+"&sima_szoveg=true", this.getAttribute("rel"), this)
			loadobjs(this.getAttribute("rev"))
			return false
		}
	}
}
function lennylilas(mit,hova) {
	var cim = mit.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")+"&sima_szoveg=true";
	var cel = hova;
	var kert_oldal = false;
	var defaultcontentarray = new Object();
	if (typeof defaultcontentarray[cel]=="undefined") 
		defaultcontentarray[cel]=document.getElementById(cel).innerHTML;
	if (window.XMLHttpRequest)
		kert_oldal = new XMLHttpRequest();
	else if (window.ActiveXObject) {
		try {
			kert_oldal = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (kivetel) {
			try {
				kert_oldal = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (kivetel) {
				alert("Ajax hiba!");
			}
		}
	}
	else alert("Hiba!");
	document.getElementById(cel).innerHTML="<p align=\"center\"><img src='pic/ajax_loader.gif' /></p>";
	kert_oldal.onreadystatechange=function() {
		if (kert_oldal.readyState == 4 && (kert_oldal.status==200 || window.location.href.indexOf("http")==-1))
			document.getElementById(cel).innerHTML=kert_oldal.responseText;
	}
	bustcacheparameter = ((cim.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime());
	kert_oldal.open('GET', cim+bustcacheparameter, true);
	kert_oldal.send(null);
}
function PitbullTorrentAJAX(id){
var legordul_szoveg = '#obj_' + id;
var legordul_kep = '#pic_' + id; 
if ($(legordul_szoveg).css('display') == 'none') {
$(legordul_szoveg).show('slow',function(){$(legordul_szoveg).fadeTo('slow',1)});
$(legordul_kep).attr("src","pic/minus.gif");
$(legordul_kep).attr("alt","-");
$(legordul_kep).attr("title","Elrejt");
}
else {
$(legordul_szoveg).fadeTo('slow',0,function(){$(legordul_szoveg).hide('slow');});
$(legordul_kep).attr("src","pic/plus.gif");
$(legordul_kep).attr("alt","+");
$(legordul_kep).attr("title","Mutat");
}}
function cursors_wait(id){
  $('a').css('cursor', 'wait');
  document.body.style.cursor = 'wait';
}

function cursors_normal(id){
  $('a').css('cursor', 'pointer');
  document.body.style.cursor = 'default';
}

function lenyilo_egyeb(id)
{
var klappText = document.getElementById('k' + id);
var klappBild = document.getElementById('pic' + id);

if (klappText.style.display == 'none') {
klappText.style.display = 'block';
}
else {
klappText.style.display = 'none';
}
}
 function poster_mutat(id, link, meret1, meret2) {
    var e = document.getElementById('poster'+id);
    e.style.visibility = 'visible';
    var img = document.createElement('img');
    img.src = link;
	 img.width = meret1;
	 img.height = meret2;
    img.style.zIndex = '9999';
    e.appendChild(img);
  }
  function poster_elrejt(id) {
    var e = document.getElementById('poster'+id);
    e.innerHTML = '';
    e.style.visibility = 'hidden';
  }

var dofade=true;       // ENABLES FADE-IN EFFECT (FOR IE4+ AND NS6 ONLY)

var centertext=false;  // CENTERS THE TEXT INSIDE THE BOX. YOU CAN'T SIMPLY DO THIS VIA "STYLE" BECAUSE OF NS4.
                       // OTHERWISE, TEXT IS LEFT-JUSTIFIED.

var xoffset=9;         // HORIZONTAL PIXEL COUNT FROM CURSOR

var yoffset=25;        // VERTICAL PIXEL COUNT FROM CURSOR

var mousefollow=false; // ENABLES MOUSE FOLLOW MODE WHERE THE BOX CONTINUES TO FOLLOW THE MOUSE. SET TO false TO
                       // LOCK THE BOX WHEREVER IT INITIALLY APPEARS.

var hideDelay=300;     // DELAY IN MILLISECONDS ( 1 SECOND = 1000 MILLISECONDS) FROM WHEN YOU HOVER OUT OF LINK
                       // AND THE BOX DISAPPEARS ONLY WHEN "mousefollow" IS SET TO "false".
                       // THIS WILL GIVE THE USER TIME TO CLICK A LINK OR WHATEVER IN THE BOX BEFORE IT DISAPPEARS.

////////////////////////////// NO NEED TO EDIT BEYOND THIS POINT //////////////////////////////////////

function altProps(){
this.w3c=(document.getElementById)?true:false;
this.ns4=(document.layers)?true:false;
this.ie4=(document.all && !this.w3c)?true:false;
this.ie5=(document.all && this.w3c)?true:false;
this.ns6=(this.w3c && navigator.appName.indexOf("Netscape")>=0 )?true:false;
this.w_y=0;
this.w_x=0;
this.navtxt=0;
this.boxheight=0;
this.boxwidth=0;
this.ishover=false;
this.ieop=0;
this.op_id=0;
this.oktomove=false;
this.dy=0;
}

var AT=new altProps();

function toggle_centertext(){
centertext=!centertext;
}

function toggle_mousefollow(){
mousefollow=!mousefollow;
}

function toggle_dofade(){
dofade=!dofade;
if(!dofade)AT.ieop=100;
}


function getwindowdims(){
AT.w_y=(AT.ie5||AT.ie4)?document.body.clientHeight:window.innerHeight;
AT.w_x=(AT.ie5||AT.ie4)?document.body.clientWidth:window.innerWidth;
}

function getboxwidth(){
if(AT.ns4)AT.boxwidth=(AT.navtxt.document.width)? AT.navtxt.document.width : AT.navtxt.clip.width;
else if(AT.ie4)AT.boxwidth=(AT.navtxt.style.pixelWidth)? AT.navtxt.style.pixelWidth : AT.navtxt.offsetWidth;
else AT.boxwidth=parseInt(AT.navtxt.offsetWidth);
}

function getboxheight(){
if(AT.ns4)AT.boxheight=(AT.navtxt.document.height)? AT.navtxt.document.height : AT.navtxt.clip.height;
else if(AT.ie4)AT.boxheight=(AT.navtxt.style.pixelHeight)? AT.navtxt.style.pixelHeight : AT.navtxt.offsetHeight;
else AT.boxheight=parseInt(AT.navtxt.offsetHeight);
}

function movenavtxt(x,y){
if(AT.ns4)AT.navtxt.moveTo(x,y);
else{
AT.navtxt.style.left=x+'px';
AT.navtxt.style.top=y+'px';
}}

function getpagescrolly(){
if(AT.ie5||AT.ie4)return document.body.scrollTop;
else return window.pageYOffset;
}

function getpagescrollx(){
if(AT.ie5||AT.ie4)return document.body.scrollLeft;
else return window.pageXOffset;
}

function writeindiv(text){
if(AT.ns4){
AT.navtxt.document.open();
AT.navtxt.document.write(text);
AT.navtxt.document.close();
}
else AT.navtxt.innerHTML=text;
}

function writetxt(text){
if(dofade && (AT.ie4||AT.w3c))clearInterval(AT.op_id);
if(text!=0){
if(!mousefollow)clearTimeout(AT.dy);
AT.oktomove=true;
AT.ishover=true;
if(AT.ns4)text='<div class="navtext">'+((centertext)?'<center>':'')+text+((centertext)?'</center>':'')+'</div>';
if(AT.w3c||AT.ie4)AT.navtxt.style.textAlign=(centertext)?"center":"left";
writeindiv(text);
if(AT.ns4)AT.navtxt.visibility="show";
else{
AT.navtxt.style.visibility="visible";
AT.navtxt.style.display="block";
}
getboxheight();
if((AT.w3c||AT.ie4) && dofade){
if(AT.ie4||AT.ie5)AT.navtxt.style.filter="alpha(opacity=0)";
if(AT.ns6)AT.navtxt.style.MozOpacity=0;
AT.ieop=0;
AT.op_id=setInterval('incropacity()',50);
}}else{
if(mousefollow)hideAlttxt();
else AT.dy=setTimeout('hideAlttxt()',hideDelay);
}}

function hideAlttxt(){
if(AT.ns4)AT.navtxt.visibility="hide";
else{
AT.navtxt.style.display="none";
AT.navtxt.style.visibility="hidden";
}
movenavtxt(-AT.boxwidth-10,0);
writeindiv('');
}

function incropacity(){
if(AT.ieop<=100){
AT.ieop+=7;
if(AT.ie4||AT.ie5)AT.navtxt.style.filter="alpha(opacity="+AT.ieop+")";
if(AT.ns6)AT.navtxt.style.MozOpacity=AT.ieop/100;
}else clearInterval(AT.op_id);
}

function moveobj(evt){
mx=(AT.ie5||AT.ie4)?event.clientX:evt.pageX;
my=(AT.ie5||AT.ie4)?event.clientY:evt.pageY;
if(AT.ishover && AT.oktomove){
margin=(AT.ie4||AT.ie5)?5:25;
if(AT.ns6)if(document.height+27-window.innerHeight<0)margin=15;
if(AT.ns4)if(document.height-window.innerHeight<0)margin=10;
if(AT.ns4||AT.ns6)mx-=getpagescrollx();
if(AT.ns4)my-=getpagescrolly();
xoff=mx+xoffset;
yoff=(my+AT.boxheight+yoffset-((AT.ns6)?getpagescrolly():0)>=AT.w_y)? -5-AT.boxheight-yoffset: yoffset;
movenavtxt( Math.min(AT.w_x-AT.boxwidth-margin , Math.max(2,xoff))+getpagescrollx(), my+yoff+((!AT.ns6)?getpagescrolly():0));
if(!mousefollow)AT.oktomove=false;
}}


window.onload=function(){
  AT.navtxt=(AT.ns4)?document.layers['navtxt']:(AT.ie4)?document.all['navtxt']:(AT.w3c)?document.getElementById('navtxt'):null;
  getboxwidth();
  getboxheight();
  getwindowdims();
  if(AT.ie4||AT.ie5&&dofade)AT.navtxt.style.filter="alpha(opacity=100)";
  AT.navtxt.onmouseover=function(){
  if(!mousefollow)clearTimeout(AT.dy);
  }
  AT.navtxt.onmouseout=function(){
  if(!mousefollow)AT.dy=setTimeout('hideAlttxt()',hideDelay);
  }
  if(AT.ns4)document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove=moveobj;
  window.onresize=getwindowdims;
}
function konyvjelzo (id, nev) {
$.get('addkj.php?id='+id+'&name='+nev ,function(data){eval(data);});jAlert('A torrentet sikeresen hozzáadtad a könyvjelzőid közé!','Pitbull Rendszer üzenete:')
}
