//функция меняющая картинки при наведении мышки
 browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)))
    if (browser)
    {
    im1on=new Image(34,34);
    im2on=new Image(34,34);
    im3on=new Image(34,34);
    im4on=new Image(34,34);

     im1off=new Image(34,34);
     im2off=new Image(34,34);
     im3off=new Image(34,34);
     im4off=new Image(34,34);

     im1on.src="images/ico/ico_home_on.gif";
     im2on.src="images/ico/ico_search_on.gif";
     im3on.src="images/ico/ico_sign_on.gif";
     im4on.src="images/ico/ico_help_on.gif";

     im1off.src="images/ico/ico_home.gif";
     im2off.src="images/ico/ico_search.gif";
     im3off.src="images/ico/ico_sign.gif";
     im4off.src="images/ico/ico_help.gif";
     }

//функция отщелкивания всех чекбоксов

function TurnAllCheckBoxes(kuku)
{
		for (var i = 0; i < document.mainn.elements.length; i++)
	{
		if (document.mainn.elements[i].type=='checkbox')
		{
		document.mainn.elements[i].checked=kuku;
		};
	}

}
	
function ChImg(imgID, imgName)
{
   if (browser) document.images[imgID].src = eval(imgName + ".src")
}

// Multi-Browser DOM operator
var isDHTML = 0;
var isLayers = 0;
var isAll = 0;
var isID = 0;

if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
   browserVersion = parseInt(navigator.appVersion);
   if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
   else {
     if (document.all) {isAll = 1; isDHTML = 1;}
}}

// Second_Level_Functions

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { 
    if(document.getElementById(objectID))
      return (document.getElementById(objectID).style);
    else
      return null;
    }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}

function changeleftmenu(menuNum){

	var idLeftMenu = 'leftmenu3level' + menuNum;
	var LeftMenu3 = findDOM(idLeftMenu,1);
	if (LeftMenu3.display == 'none'){
		LeftMenu3.display='';
	}
	else {
		LeftMenu3.display='none';
	}
}


// Popup Menu code for Secondary Navigation

var domSMenu = null;
var oldDomSMenu = null;
var t = 0;
var lDelay = 3;
var lCount = 0;
var pause = 100;

function popMenu(menuNum){

	if (isDHTML) {

///// Sets the previous menu's visibility to hidden
		t = 2;
		if (oldDomSMenu) {
			
			oldDomSMenu.visibility = 'hidden'; 
			oldDomSMenu.zIndex = '0'; 
			t = 2; 
			lCount = 0;
		}

///// Defines the DOMs	of the menu objects

		var idSMenu = 'snav' + menuNum;
		var domSMenu = findDOM(idSMenu,1);

///// Positions and shows the menu
		if (oldDomSMenu != domSMenu) {	
      VisibleElement(1);
			domSMenu.visibility = 'visible';
			domSMenu.zIndex = '100';
			oldDomSMenu = domSMenu;
		}

///// Resets oldDom if it is the same as the current DOM
		else { oldDomSMenu = null; }
	}

////// Returns a 'null' value for non-DHTML Browsers 
	else { return null; }
}

function delayHide() {
///// Checks to see if there is a menu showing and whether 
///// the global variable 't' has been set to 0

    if ((oldDomSMenu) && (t == 0)) {

///// Hides the old menu, resets menu conditions, 
///// and stops the function running
        VisibleElement(0);   
        oldDomSMenu.visibility = 'hidden'; 
        oldDomSMenu.zIndex = '0';
        oldDomSMenu = null;
        lCount = 0; 

        return false;
    }


///// Interupts the function if another menu is opened
    if (t == 2) { lCount = 0; return false; }

///// Repeats the function adding 1 to lCount each time until 
///// lCount is equal to lDelay and then sets 't' to 0 so that 
///// the menu will hide when it runs again
    if (t == 1) { 
        lCount = lCount + 1;
        if (lDelay <= lCount) { t = 0; }
        if (lDelay >= lCount) { setTimeout('delayHide(' + t + ')',pause); }
    }
}


//==========================================================================


// Second_Level_Functions

function findDOM3(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}



// Popup Menu code for Secondary Navigation

var domSMenu3 = null;
var styleMenu3 = null;
var oldDomSMenu3 = null;
var t3 = 0;
var lDelay3 = 3;
var lCount3 = 0;
var pause3 = 10;

function popMenu3(menuNum3){

	
	if (isDHTML) {

///// Sets the previous menu's visibility to hidden
		t3 = 2;
		if (oldDomSMenu3) {
			
			oldDomSMenu3.visibility = 'hidden'; 
			styleMenu3.background = '#FFFFFF';
			oldDomSMenu3.zIndex = '0'; 
			t3 = 2; 
			lCount3 = 0;
		}

///// Defines the DOMs	of the menu objects

		var idSMenu3 = 'snav3' + menuNum3;
		var domSMenu3 = findDOM3(idSMenu3,1);
		
		var MenuSt = 'style3' + menuNum3;
		styleMenu3 = findDOM3(MenuSt,1);
		
		
		
///// Positions and shows the menu
		if (oldDomSMenu3 != domSMenu3) {	
			domSMenu3.visibility = 'visible';
			domSMenu3.zIndex = '100';
			styleMenu3.background = '#EFEFEF';
			oldDomSMenu3 = domSMenu3;
		}

///// Resets oldDom if it is the same as the current DOM
		else { oldDomSMenu3 = null; }
	}

////// Returns a 'null' value for non-DHTML Browsers 
	else { return null; }
}

function delayHide3() {
///// Checks to see if there is a menu showing and whether 
///// the global variable 't' has been set to 0

    if ((oldDomSMenu3) && (t3 == 0)) {

///// Hides the old menu, resets menu conditions, 
///// and stops the function running
        styleMenu3.background = '#FFFFFF';
		oldDomSMenu3.visibility = 'hidden'; 
        oldDomSMenu3.zIndex = '0';
        oldDomSMenu3 = null;
        lCount3 = 0; 
        return false;
    }


///// Interupts the function if another menu is opened
    if (t3 == 2) { lCount3 = 0; return false; }

///// Repeats the function adding 1 to lCount each time until 
///// lCount is equal to lDelay and then sets 't' to 0 so that 
///// the menu will hide when it runs again
    if (t3 == 1) { 
        lCount3 = lCount3 + 1;
        if (lDelay3 <= lCount3) { t3 = 0; }
        if (lDelay3 >= lCount3) { setTimeout('delayHide3(' + t3 + ')',pause3);}
    }
}
