// UTF8 test: áéíóöőúüűÁÉÍÓÖŐÚÜŰ

function xmlhttpPost(strURL, strSubmit, strResultFunc) {
  var xmlHttpReq = false;
  // IE
  if (window.ActiveXObject) {
    xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  } else if (window.XMLHttpRequest) {
  // Mozilla/Safari
    xmlHttpReq = new XMLHttpRequest();
    xmlHttpReq.overrideMimeType('text/xml');
  }
  xmlHttpReq.open('POST', strURL, true);
  xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  xmlHttpReq.onreadystatechange = function() {
    if (xmlHttpReq.readyState == 4) {
      eval(strResultFunc + "(xmlHttpReq.responseText);");
    }
  }
  xmlHttpReq.send(strSubmit);
}

function urlEncode( _str ) {
  var url = '';
  for( i = 0; i < _str.length; i++ ) {
    url += escape(_str[i]);
  }
  return url;
}

function ajaxOpen(_content) {
  //document.getElementById('content').innerHTML = 'Loading...';
  xmlhttpPost('WSite/build.page.php', 'ajax=ok&content=' + _content, 'displayResult');
}

function displayResult(_innerHTML) {
  document.getElementById('content').innerHTML = _innerHTML;
  thumbHeight();
  document.html.body.onload();
}

function openBoxClick(_this) {
  if ( _this.parentNode.style.backgroundImage == 'url(userfiles/arrow_h.png)' )
    _this.parentNode.style.backgroundImage = 'url(userfiles/arrow_v.png)';
  else
    _this.parentNode.style.backgroundImage = 'url(userfiles/arrow_h.png)';
  openBox(_this.parentNode.nextSibling);
}

var DIV;
var STEP;
var HEIGHT;

function openBox(_div) {
  DIV = _div;
  HEIGHT = _div.childNodes[0].offsetHeight + 10;
  STEP = 20;
  if ( DIV.offsetHeight == 1 ) {
    t = setTimeout("openTimeOut()", 10);
  } else {
    t = setTimeout("closeTimeOut()", 10);
  }
}

function openTimeOut() {
  if ( DIV.offsetHeight < HEIGHT ) {
    DIV.style.height = ( DIV.offsetHeight + STEP ) + 'px';
    t = setTimeout("openTimeOut()", 10);
    positioning();
  } else {
    clearTimeout(t);
  }
}

function closeTimeOut() {
  if ( DIV.offsetHeight > 1 ) {
    DIV.style.height = ( DIV.offsetHeight - STEP ) + 'px';
    t = setTimeout("closeTimeOut()", 10);
    positioning();
  } else {
    clearTimeout(t);
  }
}

