function addElement() {
  var ni = document.getElementById('myDiv');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'my'+num+'Div';
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = '<input type="file" name="pic_'+num+'" id="pic['+num+']"><a href=\'#mydiv\' onclick=\'removeElement("'+divIdName+'")\'>Törlés</a>';
  ni.appendChild(newdiv);
}


function removeElement(divNum) {
  var d = document.getElementById('myDiv');
  var olddiv = document.getElementById(divNum);
  d.removeChild(olddiv);
}


function openDivById(id){
    document.getElementById(id).style.display= "block";
    document.getElementById( id ).style.top = (document.documentElement.scrollTop + 150) +'px';
}

function closeDivById( id ){
    document.getElementById(id).style.display = "none";
}

function konyvReszletes( konyv_id ){ 
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url="kategoria/konyv_reszletek_js.php";
  url=url+"?konyv_az="+konyv_id;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=stateChangedKonyvReszletek;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedKonyvReszletek() 
{ 
    
    if (xmlHttp.readyState==4){ 
        document.getElementById("konyv_reszletek").innerHTML=xmlHttp.responseText;
        document.getElementById("konyv_reszletek").style.display="block"; 
        document.getElementById("konyv_reszletek").style.top = (document.documentElement.scrollTop + 150) +'px';
    }
}



function arrow(id){
    var body = document.getElementById(id+'_body');
    var arrow_icon = document.getElementById(id+'_arrow');
    if (body.style.display == "block"){
        body.style.display = "none";
        arrow_icon.style.background = "transparent url('pic/iconsett_h.png') -0px -29px no-repeat";
    }else{  
        body.style.display = "block";
        arrow_icon.style.background = "transparent url('pic/iconsett_h.png') -0px -5px no-repeat";
    }
}

function addBookmark(title, url) {
    if (window.sidebar) { // firefox
        window.sidebar.addPanel(title, url,"");
    } else if( document.all ) { //MSIE
        window.external.AddFavorite( url, title);
    } else {
        alert("Sorry, your browser doesn't support this");
    }
}
