function createRequestObject(){
    var req;
    try{
        req=new ActiveXObject("Microsoft.XMLHTTP");
    }catch(e){
        req=new XMLHttpRequest();
    }
    return req;
}
function addIsmeros(usr){
    var http=createRequestObject();
    http.open("get","/_add_ismeros.php?usr="+usr,true);
    http.onreadystatechange=function(){
        if(http.readyState==4){
            showText(http.responseText);
        }
    }
    http.send(null);
}
function addFav(zeneid){
    var http=createRequestObject();
    http.open("get","/_addfav.php?zeneid="+zeneid,true);
    http.onreadystatechange=function(){
        if(http.readyState==4){
            showText(http.responseText);
        }
    }
    http.send(null);
}
function remFav(zeneid){
    var http=createRequestObject();
    http.open("get","/_remfav.php?zeneid="+zeneid,true);
    http.onreadystatechange=function(){
        if(http.readyState==4){
            showText(http.responseText);
        }
    }
    http.send(null);
}
function showText(text){
    var retval;
    var tholder=document.getElementById("textholder");
    var fdiv=document.getElementById("fade");
    fdiv.style.top=0;
    fdiv.style.left=0;
    fdiv.style.width="100%";
    fdiv.style.height=pageSize()[1]+"px";
    fdiv.style.visibility="visible";
    tholder.style.width="300px";
    tholder.style.left=((wSize()[0]-300)/2)+"px";
    tholder.style.top=(getScrollXY()[1]+200)+"px";
    tholder.style.visibility="visible";
    retval='<table width="100%" cellpadding="10" cellspacing="0">';
    retval+='<tr><td height="70">&nbsp;</td></tr>';
    retval+='<tr><td align="center">'+text+'</td></tr>';
    retval+='<tr><td align="center"><a href="javascript:;" onclick="hideText();return false;"><img src="images/button-ok4.gif" border="0"></a></td></tr>';
    retval+='</table>';
    tholder.innerHTML=retval;
}
function hideText(){
    var tholder=document.getElementById("textholder");
    var fdiv=document.getElementById("fade");
    tholder.innerHTML='';
    tholder.style.visibility="hidden";
    fdiv.style.visibility="hidden";
}
function flashfix(swf,w,h,name,bgcolor,flashvars){
    var retval="";
    retval+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="'+name+'" align="middle">';
    retval+='<param name="allowScriptAccess" value="sameDomain">';
    retval+='<param name="movie" value="'+swf+'">';
    retval+='<param name="quality" value="high">';
    retval+='<param name="wmode" value="opaque">';
    retval+='<param name="flashVars" value="'+flashvars+'">';
    retval+='<param name="bgcolor" value="'+bgcolor+'">';
    retval+='<embed src="'+swf+'" flashvars="'+flashvars+'" wmode="opaque" quality="high" bgcolor="'+bgcolor+'" width="'+w+'" height="'+h+'" name="'+name+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
    retval+='</object>';
    document.write(retval);
}
function varosnev(mezo,f){
    if(f.irsz.value.charAt(0)=="1"){
        mezo.value="Budapest";
    }
    return true;
}
var newablak;
function winOpen(url,n,width,height){
    var sw=screen.width;
    var sh=screen.height;
    var left=sw?(sw-width)/2:0;
    var top=sh?(sh-height)/2:0;
    newablak=window.open("http://www.momu.hu/"+url,n,"width="+width+",height="+height+",top="+top+",left="+left+",directories=no,resizable=1,location=no,status=no,toolbar=no,scrollbars=yes");
}
var newablak2;
function winOpen2(url,n,width,height){
    var sw=screen.width;
    var sh=screen.height;
    var left=sw?(sw-width)/2:0;
    var top=sh?(sh-height)/2:0;
    newablak2=window.open(url,n,"width="+width+",height="+height+",top="+top+",left="+left+",directories=no,resizable=1,location=no,status=no,toolbar=no,scrollbars=yes");
}
function findPosX(obj){
    var curleft=0
    if(obj.offsetParent){
        while(obj.offsetParent){
            curleft+=obj.offsetLeft;
            obj=obj.offsetParent;
        }
    }else if(obj.x) curleft+=obj.x;
    return curleft;
}
function findPosY(obj){
    var curtop=0;
    if(obj.offsetParent){
        while(obj.offsetParent){
            curtop+=obj.offsetTop;
            obj=obj.offsetParent;
        }
    }else if(obj.y) curtop+=obj.y;
    return curtop;
}
function wSize(){
    var myWidth=0,myHeight=0;
    if(typeof(window.innerWidth)=="number"){
        myWidth=window.innerWidth;
        myHeight=window.innerHeight;
    }else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
        myWidth=document.documentElement.clientWidth;
        myHeight=document.documentElement.clientHeight;
    }else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){
        myWidth=document.body.clientWidth;
        myHeight=document.body.clientHeight;
    }
    return [myWidth,myHeight];
}
function getScrollXY() {
    var scrOfX=0,scrOfY=0;
    if(typeof(window.pageYOffset)=="number"){
        scrOfY=window.pageYOffset;
        scrOfX=window.pageXOffset;
    }else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){
        scrOfY=document.body.scrollTop;
        scrOfX=document.body.scrollLeft;
    }else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){
        scrOfY=document.documentElement.scrollTop;
        scrOfX=document.documentElement.scrollLeft;
    }
    return [scrOfX,scrOfY];
}
function pageSize(){
    var xWithScroll=0,yWithScroll=0;
    if(window.innerHeight&&window.scrollMaxY){
        xWithScroll=window.innerWidth+window.scrollMaxX;
        yWithScroll=window.innerHeight+window.scrollMaxY;
    }else if(document.body.scrollHeight>document.body.offsetHeight){
        xWithScroll=document.body.scrollWidth;
        yWithScroll=document.body.scrollHeight;
    }else{
        xWithScroll=document.body.offsetWidth;
        yWithScroll=document.body.offsetHeight;
    }
    return [xWithScroll,yWithScroll];
}
function regNeeded(){
    showText("A funkció használatához előbb be kell jelentkezned!");
}
function showHozzaszolas(divid){
    if(divid=="loginNeeded"){
        regNeeded();
    }else{
        if(document.getElementById(divid).style.display=='none'){
            document.getElementById(divid).style.display='block';
        }else{
            document.getElementById(divid).style.display='none';
        }
    }
}
function selectAll(f){
    for(i=0;i<f.length;i++){
        if(f.elements[i].type=="checkbox"){
            if(f.elements[i].checked==true){
                f.elements[i].checked=false;
            }else{
                f.elements[i].checked=true;
            }
        }
    }
}
