var
 ajax_busy=0;
 
function wg7_boxrefresh(id) {
   var obj=window.opener.document.getElementById('wg7_box_'+id);
   if (typeof(obj)=='object') {
     obj.innerHTML='<div style="clear:both"><em>Betöltés...</em></div>';
     if (window.XMLHttpRequest) { 
       x = new XMLHttpRequest(); 
     } else if (window.ActiveXObject) { 
       x = new ActiveXObject("Microsoft.XMLHTTP"); 
     }
     x.open("GET",'/wg7/weblap/box.php?id='+id);
     x.onreadystatechange= function() {
          if (x.readyState == 4 && x.status == 200) {   
              obj.innerHTML = x.responseText;   
              ajax_busy=0;
          }           
     } 
     x.send(null);     
   } else {
     alert("Hova tűnt a tartalom ablak?");
   }
}


function wg7_send(url,datasend) {
  if (window.XMLHttpRequest) { 
     x = new XMLHttpRequest(); 
  } else if (window.ActiveXObject) { 
    x = new ActiveXObject("Microsoft.XMLHTTP"); 
  }
  x.open("POST",url,false);
  x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  x.setRequestHeader("Content-Type", "text/html; charset=iso-8859-2");
  x.setRequestHeader("Accept-Ranges", "bytes");
  x.setRequestHeader("Content-Length", "" + datasend.length);
  x.send(datasend);
  document.body.style.cursor = 'default';
  return x.responseText;
}


function wg_rnd() { 

 var most = new Date();

 var x = Math.floor(Math.random()*100000*10000 + (most.getTime()%(1e5))/10);
 return x;
}


function wg_ujablak(url,szelesseg,magassag) {
   window.open(url,'ujablak'+wg_rnd(), 'toolbar=no,location=0,resizable=1,status=0,scrollbars=auto,menubar=no,width='+szelesseg+',height='+magassag+',left=' + ((screen.width-szelesseg)*0.5) + ',top=' + ((screen.height-magassag)*0.5));
}

function wg_ujablak_menu(url,szelesseg,magassag) {
   window.open(url,'ujablak'+wg_rnd(), 'toolbar=no,location=0,resizable=1,status=0,scrollbars=auto,menubar=yes,width='+szelesseg+',height='+magassag+',left=' + ((screen.width-szelesseg)*0.5) + ',top=' + ((screen.height-magassag)*0.5));
}

function wg_ujablak_menu(url,szelesseg,magassag,sc) {
   if (sc=='') {
      window.open(url,'ujablak'+wg_rnd(), 'toolbar=no,location=0,resizable=1,status=0,scrollbars=auto,menubar=yes,width='+szelesseg+',height='+magassag+',left=' + ((screen.width-szelesseg)*0.5) + ',top=' + ((screen.height-magassag)*0.5));
   } else {
      window.open(url,'ujablak'+wg_rnd(), 'toolbar=no,location=0,resizable=1,status=0,scrollbars=yes,menubar=yes,width='+szelesseg+',height='+magassag+',left=' + ((screen.width-szelesseg)*0.5) + ',top=' + ((screen.height-magassag)*0.5));
   }   
}

function wg_ujablak_confirm(url,szoveg,szelesseg,magassag) {
   if (!confirm(szoveg)) { return false; }
   window.open(url,'ujablak'+wg_rnd(), 'toolbar=no,location=0,resizable=1,status=0,scrollbars=auto,menubar=no,width='+szelesseg+',height='+magassag+',left=' + ((screen.width-szelesseg)*0.5) + ',top=' + ((screen.height-magassag)*0.5));
   return true;
}

function wg_ujablak_scroll(url,szelesseg,magassag) {
   window.open(url,'ujablak'+wg_rnd(), 'toolbar=no,location=0,resizable=1,status=0,scrollbars=yes,menubar=no,width='+szelesseg+',height='+magassag+',left=' + ((screen.width-szelesseg)*0.5) + ',top=' + ((screen.height-magassag)*0.5)); 
}


