// Определение долбанного браузера
IE = (document.all); // Internet Explorer?
NC = (document.layers); // Netscape?
Opera = (document.getElementById); // Opera?

function getHeight() { // Получаем высоту рабочей области браузера
        if (IE || Opera) send = document.body.clientHeight;
        if (NC) send = window.innerHeight;
        return send;
}
function getWidth() { // Получаем ширину рабочей области браузера
        if (IE || Opera) send = document.body.clientWidth;
        if (NC) send = window.innerWidth;
        return send;
}

//////////////////////////////////////////////////////////////////////////

function putLayer() {

height_all = getHeight();
width_all = getWidth();

// высота page = высоте страницы
getSizeHeight('page', height_all)

x_copy = getCopyHeight('copy');
x_pix = getCopyHeight('pix');

height_copy = x_pix - x_copy + 7;

height_ourcity = height_all - height_copy;

// высота ourcity = высоте страницы - высота copy
getSizeHeight('ourcity', height_ourcity)

width_header = width_all - 202;


if (width_header < 670) {
        width_header = 670;
}

height_text = height_all - 160;

getSizeHeight('text', height_text)

getSizeWidth('header', width_header)
getSizeWidth('text', width_header)

//alert (getHeight());

}

//////////////////////////////////////////////////////////////////////////

function putLayer2() {

height_all = getHeight();
width_all = getWidth();

// высота page = высоте страницы
getSizeHeight('page', height_all)

x_logo = getCopyHeight('logo');
x_copy = getCopyHeight('copy');
x_pix = getCopyHeight('pix');
x_search = getCopyHeight('search');
x_vacancies = getCopyHeight('vacancies');

height_copy = x_pix - x_copy + 7;

height_ourcity = height_all - height_copy;

// высота ourcity = высоте страницы - высота copy
getSizeHeight('ourcity2', height_ourcity)

width_header = width_all - 202;

if (width_header < 670) {
        width_header = 670;
}

height_text = height_all - 160;

getSizeHeight('text', height_text)

getSizeWidth('header', width_header)
getSizeWidth('text', width_header)


}




//////////////////////////////////////////////////////////////////////////

IE = (document.all); // Internet Explorer?
NC = (document.layers); // Netscape?
Opera = (document.getElementById); // Opera?

function getHeight() { // Получаем высоту рабочей области браузера
if (IE || Opera) send = document.body.clientHeight;
if (NC) send = window.innerHeight;
return send;
}

function getCopyHeight(pid) { // Получаем x блока
if (IE || Opera) send = document.getElementById(pid).offsetTop;
if (NC) send = document.getElementById(pid).offsetTop;
return send;
}
function getCopyWidth(pid) { // Получаем y блока
if (IE || Opera) send = document.getElementById(pid).offsetLeft;
if (NC) send = document.getElementById(pid).offsetLeft;
return send;
}
//////////////////////////////////////////////////////////////////////////
function getSizeHeight(pid, height) {
        if(IE) {
                eval('document.all["' + pid + '"].style.height = ' + height);
        }
        if(NC) {
                eval('document.layers["' + pid + '"].style.height ' + height);
        }
        if(Opera) {
                eval('document.getElementById("' + pid + '").style.height = ' + height);
        }
}
//////////////////////////////////////////////////////////////////////////
function getSizeWidth(pid, width) {
        if(IE) {
                eval('document.all["' + pid + '"].style.width = ' + width);
        }
        if(NC) {
                eval('document.layers["' + pid + '"].style.width ' + width);
        }
        if(Opera) {
                eval('document.getElementById("' + pid + '").style.width = ' + width);
        }
}

//////////////////////////////////////////////////////////////////////////

function WClose(pid) {
        document.getElementById(pid).style.display = 'none';
}
function WOpen(pid) {
        document.getElementById(pid).style.display = 'block';
}

//////////////////////////////////////////////////////////////////////////

function showMenu(pid) {
        document.getElementById(pid).style.display = 'block';

//        setTimeout('showMenu()', 5000);
}
function hiddenMenu(pid) {
        document.getElementById(pid).style.display = 'none';

}

//////////////////////////////////////////////////////////////////////////

function WClose(pid) {
        document.getElementById(pid).style.display = 'none';
}
function WOpen(pid) {
        document.getElementById(pid).style.display = 'block';
}


//elid-что отображать
//sid-относительно чего отображать
//absolpos-ширина того, относительно чего отображается
function show(elid,sid,absolpos){
if (document.getElementById(elid)){
position(elid,sid,absolpos);
document.getElementById(elid).style.visibility='';
document.getElementById(elid).style.display='block';
}
}
function show2(elid,sid,absolpos){
if (document.getElementById(elid)){
position2(elid,sid,absolpos);
document.getElementById(elid).style.visibility='';
document.getElementById(elid).style.display='block';
}
}

function hide(elid,sid){
if (document.getElementById(elid)){
document.getElementById(elid).style.visibility='hidden';
}}

function position(elid,sid,absolpos){
if (document.getElementById(elid)){
var offsettrail=document.getElementById(sid);
var offsetLeft=0;
var offsetTop=0;
while(offsettrail){//перебирая вложения дивов находим абсолютное положение верхнего левого угла.
offsetLeft+=offsettrail.offsetLeft;
offsetTop+=offsettrail.offsetTop;
offsettrail=offsettrail.offsetParent;
}
var t=document.getElementById(absolpos).style.width;
//alert(document.getElementById(absolpos).style.width);
var dt=parseInt(t.slice(0,3));//вырезаем px вконце и делаем из строки число
var d=offsetLeft+dt;
document.getElementById(elid).style.left=d-1+"px";//смещаем выводимый див на ширину меню
(navigator.appName=='Netscape')?document.getElementById(elid).style.top=offsetTop+10+"px" : document.getElementById(elid).style.top=offsetTop+25+"px";
}
}

function position2(elid,sid,absolpos){
if (document.getElementById(elid)){
var offsettrail=document.getElementById(sid);
var offsetLeft=0;
var offsetTop=0;
while(offsettrail){//перебирая вложения дивов находим абсолютное положение верхнего левого угла.
offsetLeft+=offsettrail.offsetLeft;
offsetTop+=offsettrail.offsetTop;
offsettrail=offsettrail.offsetParent;
}
var t=document.getElementById(absolpos).style.width;
//alert(document.getElementById(absolpos).style.width);
var dt=parseInt(t.slice(0,3));//вырезаем px вконце и делаем из строки число
var d=offsetLeft+dt;

document.getElementById(elid).style.left=d-8+"px";//смещаем выводимый див на ширину меню
document.getElementById(elid).style.top=offsetTop-0+"px";
}
}
