function menu_clear(wte) {
wte.parentNode.style.background="none";
}



function WindowSize() {
  var myWidth = 0, myHeight = 0;
  var size = new Array;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
size[0] = myWidth;
size[1] = myHeight;

  return size;
}


function getScrollXY() {
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
//DOM compliant
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
return [ scrOfX, scrOfY ];
}


function menu_show(wte) {

wte.parentNode.style.background="url(images/menu_bg2.png)";
}


function close_pix() {
var div_out = document.getElementById('message_div');
div_out.innerHTML = '';
div_out.style.width = '10px';
div_out.style.height =  '10px';
div_out.style.top = '-1000px';
div_out.style.left = '-1000px';
}

function open_pix(pix_path, w_w, w_h) {
var div_out = document.getElementById('message_div');

var size_w  = WindowSize();
var size_s = getScrollXY();



var x_w = size_s[1] + (size_w[1]/2) - (w_h/2);
var y_w = size_s[0] + (size_w[0]/2) - (w_w/2);



div_out.innerHTML = '<IMG src="'+pix_path+'" style="border:1px solid #888888; cursor:pointer;" onClick="close_pix();" /><br/><div style="text-align:center; cursor:pointer;" onClick="close_pix();">Закрыть</div>';

div_out.style.width = 'auto';
div_out.style.height =  'auto';

if (x_w<0) x_w=0;
div_out.style.top = x_w+'px';
div_out.style.left = y_w+'px';

}



function absPosition(obj) {
      var x = y = 0;
      while(obj) {
            x += obj.offsetLeft;
            y += obj.offsetTop;
            obj = obj.offsetParent;
      }
      return {x:x, y:y};
}


function show_title(title_elem) {
var div_title_out = document.getElementById('title_div');
var x_w = absPosition(title_elem).x;
var y_w = absPosition(title_elem).y + title_elem.clientHeight + 1;

div_title_out.innerHTML = title_elem.title;
//div_title_out.innerHTML = x_w+'x'+y_w;

//alert(div_title_out.clientWidth);

//if (div_title_out.clientWidth >= '250') 
div_title_out.style.width = (title_elem.clientWidth - 20 ) + 'px';

div_title_out.style.top = y_w +'px';
div_title_out.style.left = x_w+'px';



}

function close_title() {
var div_title_out = document.getElementById('title_div');
div_title_out.innerHTML = '';
div_title_out.style.width = 'auto';

div_title_out.style.top = '-1000px';
div_title_out.style.left = '-1000px';
}
