function konyvjelzo(title,hsz,forum,b,c){
//  document.getElementById("bookmark_edit_area").style.visibility="visible"; 
  document.getElementById("bookmark_edit_area").style.display=""; 
  poststr = "forum=" +  escape(encodeURI(forum)) + "&title=" +  escape(encodeURIComponent(title)) + "&hsz=" + escape(encodeURIComponent(hsz));
  ajax_post(b,c,poststr);
  return false;
}


function get1(a,b,c) {
    var childElements=document.getElementById(a).childNodes;
    var poststr='';
    for(var i=0;i<childElements.length;i++){

     if ((childElements[i].nodeName=='SELECT' ||
         childElements[i].nodeName=='INPUT' ||
         childElements[i].nodeName=='HIDDEN' ||
         childElements[i].nodeName=='TEXTAREA') && childElements[i].name)
       poststr = poststr + "&" + childElements[i].name + "=" + escape(encodeURIComponent(childElements[i].value)) ;
//       poststr = poststr + "&" + childElements[i].name + "=" + escape(encodeURIComponent(document.getElementById(childElements[i].name).value)) ;
  
}
    ajax_post(b,c,poststr);
    return false;

}



var ajax_inp="";
var kill_inp="";
var ajax_pp="";
function ajax_wait(inp,pp,kill){
 // setTimeout("ajax(inp,pp)",100);
    ajax_inp=inp;
    ajax2_inp=inp;
    kill_inp=kill;
    ajax_pp=pp;
    setTimeout("ajax('--','--')",100);
    setTimeout('FieldKill("--")',180);
}

function FieldKill(xxx){
if (document.getElementById(ajax2_inp).innerHTML=='')
      document.getElementById(kill_inp).style.display='none';
ajax2_inp="";
kill_inp="";

}



function ajax_voks(inp,pp,c,mode,gr) {
 e=0;
 for(i=1;i<=21;i++)
 {
   d = document.getElementById('voks'+i+'-'+c+'-'+mode);
   if (d && d.checked ){
       e=d.value;
       break;
   }
 }
 htp = pp + 'vid=' + c + '&voks=' + e + '&mode=' + mode+ '&gr=' + gr
 if (e)
   ajax(inp,htp);
 else 
  alert("Szavazz!");
}


function sethtml(content) 
{ 
    var search = content; 
    var script; 
    while( script = search.match(/(<script[^>]+javascript[^>]+>\s*(<!--)?)/i)) 
    { 
      search = search.substr(search.indexOf(RegExp.$1) + RegExp.$1.length); 
       
      if (!(endscript = search.match(/((-->)?\s*<\/script>)/))) break; 
       
      block = search.substr(0, search.indexOf(RegExp.$1)); 
      search = search.substring(block.length + RegExp.$1.length); 
      
      var oScript = document.createElement('script'); 
      oScript.text = block; 
      document.getElementsByTagName("head").item(0).appendChild(oScript); 
    } 
}



function ajax(inp,pp,DoCache) {

DoCache = typeof(DoCache) != 'undefined' ? DoCache : "";

 var http_request=false;

 if (inp=='--'){
  inp=ajax_inp; pp=ajax_pp; ajax_inp=""; ajax_pp="";
 } 
 ori=$("#"+inp).html();
 if ($("#"+inp).height()<50){
   he=50; mi=15;}
 else{
   he=$("#"+inp).height(); mi=$("#"+inp).height()/2-10;}

 $("#"+inp).html('<div style="text-align : center; padding-top:'+mi+'px;  height : '+he+'px;"><img src=http://www.ophupic.com/ajax.gif></div>'); 
// $("#"+inp).html('<table style="background-color: black;" height='+$("#"+inp).height()+'><tr><td align=center><img src=http://www.ophupic.com/ajax.gif></td></table>'); 

 if (window.XMLHttpRequest) {
  http_request=new XMLHttpRequest();
  if (http_request.overrideMimeType) {
   http_request.overrideMimeType('text/html');
  }
 }
 else if (window.ActiveXObject) {
  try {
   http_request=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e) {
   try {
    http_request=new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch (e) {}
  }
 }

 if (!http_request) {
  alert("Feladtam :( Nem tudok XMLHTTP példányt létrehozni");
  return true;
 }
 http_request.onreadystatechange=function () { showContents(http_request,inp,DoCache,ori); };

// htp=pp+ '&' + Math.random();
 htp=pp+'&strPortal='+strPortal+'&klubID='+klubID+'&ajaxIndex='+ajaxIndex;
 if (typeof(title) != 'undefined')
   htp=htp+'&title='+title;
 htp=htp+'&' + Math.random();
 http_request.open("GET",htp,true);
 http_request.send(null);
 return false;
}

function ajax_post(inp,pp,parameters,DoCache) {
 var http_request=false;
 DoCache = typeof(DoCache) != 'undefined' ? DoCache : "";
 parameters = parameters + "&strPortal=" +  escape(encodeURIComponent(strPortal)) + "&klubID=" +  escape(encodeURIComponent(klubID)) + "&ajaxIndex=" +  escape(encodeURIComponent(ajaxIndex)) + "&oldal=" +  escape(encodeURIComponent(oldal));
 if (typeof(title) != 'undefined')
   parameters = parameters + '&title='+escape(encodeURIComponent(title));

 ori=$("#"+inp).html();
 $("#"+inp).html('<table width='+$("#"+inp).width()+' height='+$("#"+inp).height()+'><tr><td align=center><img src=http://www.ophupic.com/ajax.gif></td></table>'); 
 if (window.XMLHttpRequest) {
  http_request=new XMLHttpRequest();
  if (http_request.overrideMimeType) {
   http_request.overrideMimeType('text/html');
  }
 }
 else if (window.ActiveXObject) {
  try {
   http_request=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e) {
   try {
    http_request=new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch (e) {}
  }
 }

 if (!http_request) {
  alert("Feladtam :( Nem tudok XMLHTTP példányt létrehozni");
  return true;
 }
 http_request.onreadystatechange=function () { showContents(http_request,inp,DoCache,ori); };
 http_request.open("POST",pp,true);
 http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 http_request.setRequestHeader("Content-length", parameters.length);
 http_request.setRequestHeader("Connection", "close");
 http_request.send(parameters);
 
return false;
}



var cache=new Array();
var cache_time= new Array();

function showContents(http_request,inp,DoCache,ori) {
 if (http_request.readyState==4) {
  if (http_request.status==200) {
     if (http_request.responseText!='nope'){
          $('#'+inp).html(http_request.responseText);
          sethtml(http_request.responseText);
          if (DoCache!=""){
            var dt = new Date();
            cache[DoCache]=http_request.responseText;
            cache_time[DoCache]=dt.getTime()/1000;
          }
     } 
//     else
  //      $('#'+inp).html(ori);
  }
//  else {
  // alert("Valami gond van a kéréssel. ("+http_request.status+" --- "+ inp +")");
//  }
 }
}


function ajax4(inp,pp,id) {
 htp = pp + '&' + id + '=' + encodeURIComponent($('#'+id).val());
 ajax(inp,htp);
 return false;
}

function ajax_set(inp,pp,id){
 document.getElementById(inp).style.display=""; 
 ajax(inp,pp,id);
}

