﻿//------------------------------
//   DrUGS Team init for
//	bogarasok.hu
//------------------------------

function dTinit() {
 dTpos();
 dTresetBars('list',0);
 dTresetBars('cont',465);
 dTo('list','list','1');
 dTshOwit('headF','head2',10000,100,5);
 dTimAgine();
}

function dTresize() {
 d=document;
 dTpos();
 dTresetBars('list',0);
 dTresetBars('cont',465);
}

function dTpos() {
 if (dTnav.id()=='IE') {
  d.body.style.paddingLeft = (dTnav.width()-730)/2 +'px';
  d.getElementById('listB').style.height = dTnav.height()-168-20 + 'px';
  d.getElementById('listB').style.width  = '250px';
  d.getElementById('contB').style.height = dTnav.height()-168-20 + 'px';
  d.getElementById('contB').style.width  = '480px';
 }
 d.getElementById('listB').style.left = d.getElementById('head2').offsetLeft +'px';
 d.getElementById('contB').style.left = d.getElementById('listB').offsetLeft+250 +'px';
 d.getElementById('sh_l').style.left  = d.getElementById('listB').offsetLeft-10 +'px';
 d.getElementById('sh_r').style.left  = d.getElementById('listB').offsetLeft+730 +'px';
}

function jumpMenu(num) { 
  num = num+"";
  dTo("list","list",num);
}

function dToReg() { dTo("list","list","24"); }
function dToReg2() { dTo("list","list","28"); }

function dTo(place, init, data) {
 dTloadXML(place, init, data);
 d.getElementById(place).scrollTop = 0;
}

function dTp(place, init, obj) {
 if (init=='fEnter') data = 'name=' + encodeURI( d.getElementById('name').value ) +
	'&pass=' + encodeURI( d.getElementById('pass').value );
 if (init=='fCode') data = 'name=' + encodeURI( d.getElementById('name').value ) +
	'&code=' + encodeURI( d.getElementById('code').value );
 if (init=='fReg') data = 'name=' + encodeURI( d.getElementById('name').value ) +
	'&pass=' + encodeURI( d.getElementById('pass').value ) +
	'&pass2=' + encodeURI( d.getElementById('pass2').value ) +
	'&mail=' + encodeURI( d.getElementById('mail').value ) +
	'&mail2=' + encodeURI( d.getElementById('mail2').value ) +
	'&comm=' + encodeURI( d.getElementById('comm').value );
 dTpostXML(place, init, data);
 d.getElementById(place).scrollTop = 0;
}

function dTloadXML(dplace, init, data) {
 place = dplace;
 xmlhttp = null;
 if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
 else if (window.ActiveXObject) xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
 if (xmlhttp!=null) {
  xmlhttp.onreadystatechange = dTsetXML;
  url = 'n.site.php?rnd=' + Math.random();
  if (init!=undefined) url += '&a=' + init;
  if (data!=undefined) url += '&b=' + data;
  xmlhttp.open('GET',url,true);
  xmlhttp.send(null);
 } else alert('Ez a böngésző nem támogatja az XMLHTTP-t!');
}

function dTpostXML(dplace, init, data) {
 place = dplace;
 xmlhttp = null;
 if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest();
  if (xmlhttp.overrideMimeType) { xmlhttp.overrideMimeType('text/html'); }
 } else if (window.ActiveXObject) {
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) {
   try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
   catch (e) {}
 }}
 if (xmlhttp!=null) {
  xmlhttp.onreadystatechange = dTsetXML;
  url = 'n.site.php?rnd=' + Math.random();
  if (init!=undefined) url += '&a=' + init;
  xmlhttp.open('POST', url, true);
  xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  xmlhttp.setRequestHeader('Content-length', data.length);
  xmlhttp.setRequestHeader('Connection', 'close');
  xmlhttp.send(data);
 } else alert('Ez a böngésző nem támogatja az XMLHTTP-t!');
}

function dTsetXML() {
 if (xmlhttp.readyState==4) {
  if (xmlhttp.status==200) {
   result = xmlhttp.responseText;
   d.getElementById(place).innerHTML = result;
   if (place=='list') { 
    dTresetBars('list',0);
    eval(d.getElementById('dTbackJS1').value);
    eval(d.getElementById('dTbackJS2').value);
   }
   if (place=='cont') dTresetBars('cont',465);
  }
  else alert('Hiba a visszatérő adatokban:' + xmlhttp.statusText);
}}
