function ch_cl(id, cl){
if(document.all){document.all[id].style.color=cl;}
else{document.getElementById(id).style.color=cl;}
}
function bg_cl(id, cl){     //*
if(document.all){document.all[id].style.background=cl;}
else{document.getElementById(id).style.background=cl;}
}
function ch_img(id, cl){     //*
if(document.all){document.all[id].src=url+cl;}
else{document.getElementById(id).src=url+cl;}
}

function ch_dp(id, cl){   //*
if(cl==1){
if(document.all){document.all[id].style.display='';}
else{document.getElementById(id).style.display='';}
}
else{
if(document.all){document.all[id].style.display='none';}
else{document.getElementById(id).style.display='none';}
}
}

function menu_over(nb,f){
        t=t+1;
        menu_hideall();
        bg_cl('ln1_'+nb, '#00CCFF');bg_cl('ln2_'+nb, '#00CCFF');ch_img('i'+nb, imgs1[nb]);ch_img('n'+nb, imgs3[nb]);
        if(nb=='2' && f){ch_dp('m2', 1)}
        if(nb=='3' && f){ch_dp('m3', 1)}
        if(nb=='4' && f){ch_dp('m4', 1)}
}
function menu_out(nb){
        if(nb=='1'){t1=t;setTimeout("menu_out1()",1000);}
        if(nb=='2'){t2=t;setTimeout("menu_out2()",1000);}
        if(nb=='3'){t3=t;setTimeout("menu_out3()",1000);}
        if(nb=='4'){t4=t;setTimeout("menu_out4()",1000);}
        }
function menu_out1(){if(t1==t){menu_out_ok('1')}}
function menu_out2(){if(t2==t){menu_out_ok('2')}}
function menu_out3(){if(t3==t){menu_out_ok('3')}}
function menu_out4(){if(t4==t){menu_out_ok('4')}}
function menu_out5(){if(t5==t){menu_out_ok('5')}}

function menu_out_ok(nb){
       if(nb==pages[page]){menu_on(nb)}
        else{bg_cl('ln1_'+nb, '#7A7A7A');bg_cl('ln2_'+nb, '#7A7A7A');ch_img('i'+nb, imgs2[nb]);ch_img('n'+nb, imgs4[nb]);}
        if(nb=='2'){ch_dp('m2', 0)}
        if(nb=='3'){ch_dp('m3', 0)}
        if(nb=='4'){ch_dp('m4', 0)}
}


function menu_on(nb){//*
if(nb!=0){
        t=t+1;
        bg_cl('ln1_'+nb, '#00CCFF');bg_cl('ln2_'+nb, '#00CCFF');ch_img('i'+nb, imgs5[nb]);ch_img('n'+nb, imgs6[nb]);
        if(nb=='2'){ch_dp('m2', 0)}
        if(nb=='3'){ch_dp('m3', 0)}
        if(nb=='4'){ch_dp('m4', 0)}
    }
}



function tmr(){
        t=t+1;
}
function menu_hideall(){
for(i=1;i<7;i++){
if(i==pages[page]){menu_on(i)}
else{menu_out_ok(i)}
}
}

function pm_on(x, y){
ch_cl('pm_'+x+'_'+y, '#0099CC');
bg_cl('pm_'+x+'_'+y, '#FFFFFF');
ch_img('st_'+x+'_'+y, 'menu/on_str.gif');
}
function pm_off(x, y){
ch_cl('pm_'+x+'_'+y, '#FFFFFF');
bg_cl('pm_'+x+'_'+y, '');
ch_img('st_'+x+'_'+y, 'menu/off_str.gif');
}
 function clears(formName){
                  with(document.forms[formName]){
                    var size=length;
                    for(i=0;i < size; i++)
                    switch (elements[i].type){
                    case 'select-one': elements['tip'].selectedIndex=0; break;
                    case 'hidden': break;
                    default:elements[i].value=""; break;
                    } }
                  return false;
               }
function nasos_form(formName){
 with(document.forms[formName]){
if(!elements['podacha'].value && !elements['napor'].value) {alert('Не введён ниодин параметр поиска.'); return false;}
return true;
}}
function zakaz_form(formName){
 with(document.forms[formName]){
if(!elements['podacha'].value && !elements['napor'].value) {alert('Не введён ниодин параметр поиска.'); return false;}
return true;
}}

function lm_on(x){
ch_cl('lm_'+x, '#0099CC');
bg_cl('lm_'+x, '#FFFFFF');
ch_img('lst_'+x, 'menu/on_str.gif');
}
function lm_off(x, y){
ch_cl('lm_'+x, '#FFFFFF');
bg_cl('lm_'+x, '#81B9D5');
ch_img('lst_'+x, 'menu/off_str.gif');
}
function dm_on(x){
ch_img('dm_'+x, 'dil/on.gif');
}
function dm_off(x){
ch_img('dm_'+x, 'dil/off.gif');
}



function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor){
    var theCells = null;
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    }
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
        if (theAction == 'out') {
            newColor = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor = (thePointerColor != '')
                     ? thePointerColor
                     : theDefaultColor;
        }
    }
    if (newColor) {
        var c = null;
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            }
        }
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    }

    return true;
}