




browsertest = 0;

if ((navigator.appName == 'Netscape') && (navigator.appVersion.substring(0,1) >= 3)) { browsertest = 1; }
if ((navigator.appCodeName == 'MSIE') && (navigator.appVersion.substring(0,1) > 3)) { browsertest = 1; }
if ((navigator.appCodeName == 'Mozilla') && (navigator.appVersion.substring(0,1) >= 4)) { browsertest = 1; }

if (browsertest == 1) {

  menu1On = new Image();
  menu1On.src = "/images/site/btn1_on.gif";

  menu2On = new Image();
  menu2On.src = "/images/site/btn2_on.gif";

  menu3On = new Image();
  menu3On.src = "/images/site/btn3_on.gif";

  menu4On = new Image();
  menu4On.src = "/images/site/btn4_on.gif";

  menu5On = new Image();
  menu5On.src = "/images/site/btn5_on.gif";

  menu6On = new Image();
  menu6On.src = "/images/site/btn6_on.gif";

  menu7On = new Image();
  menu7On.src = "/images/site/btn7_on.gif";

  menu8On = new Image();
  menu8On.src = "/images/site/btn8_on.gif";

  menu9On = new Image();
  menu9On.src = "/images/site/btn9_on.gif";

  menu10On = new Image();
  menu10On.src = "/images/site/btn10_on.gif";

  menu1Off = new Image();
  menu1Off.src = "/images/site/btn1.gif";

  menu2Off = new Image();
  menu2Off.src = "/images/site/btn2.gif";

  menu3Off = new Image();
  menu3Off.src = "/images/site/btn3.gif";

  menu4Off = new Image();
  menu4Off.src = "/images/site/btn4.gif";

  menu5Off = new Image();
  menu5Off.src = "/images/site/btn5.gif";

  menu6Off = new Image();
  menu6Off.src = "/images/site/btn6.gif";

  menu7Off = new Image();
  menu7Off.src = "/images/site/btn7.gif";

  menu8Off = new Image();
  menu8Off.src = "/images/site/btn8.gif";

  menu9Off = new Image();
  menu9Off.src = "/images/site/btn9.gif";

  menu10Off = new Image();
  menu10Off.src = "/images/site/btn10.gif";
}

function img_act(imgName) {
  if (browsertest == 1) {
    document [imgName].src = eval(imgName + "On.src");
  }
}

function img_inact(imgName) {
  if (browsertest == 1) {
    document [imgName].src = eval(imgName + "Off.src");
  }
}

function popupWindow(URL, w, h) {
 
	window.name = "main_window";
	// open the popup window
	var popupURL = URL;
	var popup = window.open(popupURL,"PopUp_FRM",'controlbox=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=2,resizable=0,width='+w+',height='+h);
	popup.focus();
	// set the opener if it's not already set.  it's set automatically
	// in netscape 3.0+ and ie 3.0+.
	if( navigator.appName.substring(0,8) == "Netscape" )
	{
		popup.location = popupURL;
		popup.opener = self;
		popup.focus();
	}
}


function OnSelect(select){
switch (select.selectedIndex) {
case 0:
with (document.searchform.bizid) {
options.length = 0;
options[options.length]=new Option(':: Казахстан  ','')
options[options.length]=new Option('Экибастуз','ekibastuz')
options[options.length]=new Option('ВК РЭК','ek_rek')
options[options.length]=new Option('Усть-Каменогорская ГЭС','uk_hydro')
options[options.length]=new Option('Усть-Каменогорская ТЭЦ','uk_chp')
options[options.length]=new Option('Семипалатинские TЭЦ','sem_chp')
options[options.length]=new Option('Лениногорская TЭЦ','len_chp')
options[options.length]=new Option('Шульбинская ГЭС','shulba_hydro')
options[options.length]=new Option('Согринская TЭЦ','sogrinsk_chp')
options[options.length]=new Option('Усть-Каменогорские ТС','heat_nets')

selectedIndex = 0;
}; break;
case 1:
with (document.searchform.bizid) {
options.length = 0;
options[options.length]=new Option(':: Украина  ','')
options[options.length]=new Option('Киевоблэнерго','kievoblenergo')
options[options.length]=new Option('Ривнеэнерго','rivneenergo')
selectedIndex = 0;
}; break;
case 2:
with (document.searchform.bizid) {
options.length = 0;
options[options.length]=new Option(':: Грузия  ','')
options[options.length]=new Option('Теласи','telasi')
options[options.length]=new Option('Мтквари','mtkvari')
options[options.length]=new Option('Храми','khrami')
options[options.length]=new Option('Трансэнэрджи','transenergy')
selectedIndex = 0;
}; break;
}
}



function OnSelectEng(select){
switch (select.selectedIndex) {
case 0:
with (document.searchform.bizid) {
options.length = 0;
options[options.length]=new Option(':: Kazakhstan ','')
options[options.length]=new Option('Ekibastuz','ekibastuz')
options[options.length]=new Option('EK REC','ek_rek')
options[options.length]=new Option('Ust-Kamenogorsk Hydro','uk_hydro')
options[options.length]=new Option('Ust-Kamenogorsk CHP','uk_chp')
options[options.length]=new Option('Semipalatinsk CHP','sem_chp')
options[options.length]=new Option('Leninogorsk CHP','len_chp')
options[options.length]=new Option('Shulbinsk Hydro','shulba_hydro')
options[options.length]=new Option('Sogrinsk CHP','sogrinsk_chp')
options[options.length]=new Option('Heat Nets','heat_nets')
selectedIndex = 0;
}; break;
case 1:
with (document.searchform.bizid) {
options.length = 0;
options[options.length]=new Option(':: Ukraine  ','')
options[options.length]=new Option('Kievoblenergo','kievoblenergo')
options[options.length]=new Option('Rivneenergo','rivneenergo')
selectedIndex = 0;
}; break;
case 2:
with (document.searchform.bizid) {
options.length = 0;
options[options.length]=new Option(':: Georgia  ','')
options[options.length]=new Option('Telasi','telasi')
options[options.length]=new Option('Mtkvari','mtkvari')
options[options.length]=new Option('Khrami','khrami')
options[options.length]=new Option('Transenergy','transenergy')
selectedIndex = 0;
}; break;
}
}



function FollowURL()
{
 if(document.searchform.countryid.options[document.searchform.countryid.selectedIndex].value!='')
  {
   var countryid = document.searchform.countryid.options[document.searchform.countryid.selectedIndex].value;   
   var bizid = document.searchform.bizid.options[document.searchform.bizid.selectedIndex].value;   
   document.location.href=('/srgroup/'+countryid+'/'+bizid);
  }
}


function FollowURLEng()
{
 if(document.searchform.countryid.options[document.searchform.countryid.selectedIndex].value!='')
  {
   var countryid = document.searchform.countryid.options[document.searchform.countryid.selectedIndex].value;   
   var bizid = document.searchform.bizid.options[document.searchform.bizid.selectedIndex].value;   
   document.location.href=('/eng/srgroup/'+countryid+'/'+bizid);
  }
}




function mnu_act(imgName, LayerLeftPos) {
  if (browsertest == 1) {
    show(imgName, LayerLeftPos);
  }
}

function mnu_inact(imgName, LayerLeftPos) {
  if (browsertest == 1) {
	if( navigator.appName.substring(0,8) == "Netscape" )
	{    hideAT();  }
	else
	{    hide(imgName, LayerLeftPos); }

  }
}



//А теперь меню второго уровня
//--------------------------------------------------------------------------------
var nav_ID="null";
var nav_ID_nmb="null";
var nav_layer_ID="null";
var time_of_showLayer;
var time_of_showLayer_;
var overlock = "null";
var xpos;
var ypos;

var load_check=0;
var layerRef="null"; var styleSwitch="null";

function initmenu()
{

 if (navigator.appName=="Netscape"){
  layerRef="document.layers";
  styleSwitch="";
 }
 else {
  layerRef="document.all";
  styleSwitch=".style";
 }
load_check=1;
}

function show (layerName, LayerLeftPos){
var lLeftPos;
 if(load_check==1){
  clearTimeout(time_of_showLayer);
  if (nav_layer_ID != "null"){hide(nav_layer_ID);}
  lLeftPos =Math.abs(LayerLeftPos + (document.body.clientWidth-784)/2);
 eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+lLeftPos);
 eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
        if (overlock == "null") {
        if (navigator.appName == "Netscape") {
                window.captureEvents(Event.MOUSEMOVE);
                window.onMouseMove = mouseMove;
                overlock = layerName;
        }
        else {
        ypos = window.event.y; 
        xpos = window.event.x+10;
        overlock = layerName;
        }
        }
 if (overlock == layerName) {
// eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left=xpos');
// eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top=ypos');
 }
 nav_layer_ID=layerName;}
 
 else {return;}
}


function mouseMove(evnt) {
        ypos = evnt.pageY; 
        xpos = evnt.pageX+10;
}

function hideAT(){
 if(load_check==1){
  time_of_showLayer=setTimeout("hide(nav_layer_ID)",3800);
 }
 else {return;}
}

function layerpos(layerName, LayerLeftPos)
{
var lLeftPos;
lLeftPos=Math.abs(LayerLeftPos + (document.body.clientWidth-780)/2);

eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+lLeftPos+';');

//alert(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+lLeftPos+';');
}



function hideALL(){
if(nav_layer_ID != "null"){
eval(layerRef+'["'+nav_layer_ID+'"]'+styleSwitch+'.visibility="hidden"');
overlock = "null";
}
 else {return;}
}


function hide(layerName){
if(load_check==1){
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
overlock = "null";
}
 else {return;}
}


function ci(imge,i){if(i==1){ref='#327AA4'}if(i==2){ref='#385190'};im='m'+imge;if(document.layers){document.im.bgColor=ref}else{document.all[im].style.backgroundColor=ref}}
function rp(init){if(init==true)with(navigator){if((appName=="Netscape")&&(parseInt(appVersion)==4)){document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;onresize=rp;}}else if(innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)location.reload();} //reloads the window if Nav4 resized
rp(true);
function fo(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=fo(n,d.layers[i].document);if(!x && document.getElementById)x=document.getElementById(n);return x;} //v4.0
function SHL(){var i,p,v,obj,a=SHL.arguments;for (i=0; i<(a.length-2); i+=3) if ((obj=fo(a[i]))!=null) { v=a[i+2];if(obj.style){obj=obj.style;v=(v=='show')?'visible':(v='hide')?'hidden':v;}obj.visibility=v;}}  //v3.0
function sr() {var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;} //v3.0
function sw_() {var i,j=0,x,a=sw.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=fo(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}} //v3.0
function sw() {}
var to = new Array();var act = new Array('','LL(1)','LL(2)','LL(3)','LL(4)','LL(5)','LL(6)','LL(7,71,72,73,74)','LL(8)','LL(9)','LL(10)','LL(11)','LL(12)');
Timeout=1000;
function LV(){a=LV.arguments;for(i=0;i<a.length;i++){clearTimeout(to[a[i]]);}} // delay #
function LU(){a=LU.arguments;for(i=0;i<a.length;i++){to[a[i]]=setTimeout(act[a[i]],Timeout);}} // delay #
function LL(){a=LL.arguments;for(i=0;i<a.length;i++){if(a[i]<0){actn='show';a[i]*=-1;}else{actn='hide';}SHL('Lmenu'+a[i],'',actn);}} // layer #
function LH(){a=LH.arguments;for(i=0;i<a.length;i++)SHL('Lmenu'+a[i],'','hide');} // layer #
function HA(){var i,j,pr;var b=new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14);var a=HA.arguments;for(j=0;j<b.length;j++){pr=false;if(a.length>0){for(i=0;i<a.length;i++){if(b[j]==a[i]){pr=true;}}}if (pr==false){LL(b[j]);}}LL();}

function positionmenu()
{
layerpos('Lmenu1', -1);
layerpos('Lmenu2', 84);
layerpos('Lmenu3', 165);
layerpos('Lmenu5', 291);
layerpos('Lmenu6', 340);
layerpos('Lmenu7', 398);
layerpos('Lmenu8', 495);
layerpos('Lmenu9', 584);
//layerpos('Lmenu10', 629);
//layerpos('Lmenu4', 687);
layerpos('Lmenu10', 398);
layerpos('Lmenu4', 456);
layerpos('Lmenu61', 189)
layerpos('Lmenu62', 189)
layerpos('Lmenu63', 189)
layerpos('Lmenu64', 119)
layerpos('Lmenu65', 189)
}



function emailvalidate()
{
if ((event.keyCode != 13) && (event.keyCode != 95) &&
   ((event.keyCode < 45) || (event.keyCode > 46)) &&
   ((event.keyCode < 48) || (event.keyCode > 57)) &&
   ((event.keyCode < 64) || (event.keyCode > 90)) &&
   ((event.keyCode < 97) || (event.keyCode > 122)) )
{
    alert('Не верный символ...');
    event.returnValue = false;
}
else
{
    event.returnValue = true;
}
}


function vcheck(vobj, vname)
{
  if (vobj.value == "")
  {
    alert('Пожалуйста введите значение для поля "' + vname + '".');
    vobj.focus();
    return (false);
  }
}


function xcheck(xobj, xname, okstr)
{
var checkOK = okstr;
  var checkStr = xobj.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert('Пожалуйста проверьте поле "' + xname + '", введены недопустимые символы, допустимые символы (' + okstr + ').');
    xobj.focus();
    return (false);
  }
}

