
var dh=0;
var ch=0;
var dif=0;
var mzg=0;
var sth='';

function Kinyit(fej){
    if (mzg==1) { return; }

    if (document.getElementById(fej).style.display == "none") {
      document.getElementById(fej).style.display = "block";
      document.getElementById(fej+'f').style.backgroundImage = "url(img/close.gif)";
    }else{
      document.getElementById(fej+'f').style.backgroundImage = "url(img/open.gif)";
    }
   
    ch = document.getElementById(fej+'t').offsetHeight;
    dh = document.getElementById(fej).offsetHeight;

    dif = 18;
    if (ch > 60) {dif = 20;}
    if (ch > 100) {dif = 25;}
    if (ch > 200) {dif = 30;}
    if (ch > 300) {dif = 35;}

    if (dh > 40) { dif = dif * -1; }
    HeadId = setInterval(function(){SOpen(fej);}, 50);
    mzg=1;
}

function SOpen(x){
    dh+=dif;
    if (dh>ch)
	{ clearInterval(HeadId);  
          dh = ch;
	  mzg = 0; }
    else if (0>dh)
        { clearInterval(HeadId);
	  dh = 0;
	  mzg = 0; }

    if (dh==0) {
      document.getElementById(x).style.display = "none";
    }else{
      document.getElementById(x).style.height = dh + "px";
    }
}

function indul() {
    var str=document.URL;
    var ao='';
    var param=str.split('&');
    for (i=0; param.length>i; i++){
       if (param[i].substr(0,2) == 'ao')
        { ao=param[i].substr(3,2); }
     }
    if (ao!='') {Kinyit(ao);}
    else if (sth!='') {Kinyit(sth); sth='';}
}



