var nn4=0, ie4=0, ie55=0, ie6=0, dom=0, opera=0;
var layerStyleRef, layerRef, styleSwitch;  

//function init(){

 nn4 = (document.layers)? 1 : 0; //true : false;
 ie4 = (document.all)? 1 : 0; //true : false;
 dom= (document.getElementById)? 1 : 0;
 opera = (navigator.userAgent.indexOf('Opera') >= 0)? 1 : 0;

 if (dom) {
      layerRef='document.getElementById(\"';
      styleSwitch='\").style';  
	  endTag='\")';
	  imageRef='document.getElementById(\"';
	  imageRefEnd='\").src=';  
  }
  if (nn4) { alert('Please, use NN_6+, Mozilla_1+ or IE_55+ for this site !!!')
      layerRef='document.layers[\"';
      styleSwitch='\"]'; 
	  imageRef="document.images.";
	  imageRefEnd=".src=";  
  }    
  if (ie4) {
      layerRef='document.all[\"';//  !!!! change to = document.all.xxx.style
      styleSwitch='\"].style';  
  	  endTag='\"]';
	  imageRef='document.images[\"';
	  imageRefEnd='\"].src=';
	  var apv=navigator.appVersion;
	  if(apv.indexOf("MSIE 5")>=0) {if(apv.substr(apv.indexOf("MSIE 5")+5,3)=="5.5") ie55=1; }
	  if(apv.indexOf("MSIE 6")>=0) {if(apv.substr(apv.indexOf("MSIE 6")+5,1)=="6") ie6=1; }
   }
// menu preload
//}// end init  

var wLayer;
function SetClassName(effect,className,layerName) 
{ 
	wLayer = layerName
	if (ie55 || ie6) {fadeIn(eval(layerRef+layerName+endTag),effect);}//10,9,4
	eval(layerRef+layerName+endTag+".className='"+className+"'");
}
function setActiveStyle(effect,id,styleHeader){
	currID=id.substr(0,id.length-1)+currentSubMenu;
	//alert('get current ID = '+currID);
	SetClassName(effect,styleHeader+'Act',currID);
	setHref(currID,'javascript:setActiveStyle(effectAbout,"'+currID+'","'+styleHeader+'");')
	SetClassName(effect,styleHeader+'Pas',id);
	setHref(id,'javascript:;');
	setOnMouse(id,'','');
	currentSubMenu=id.substr(id.length-1,1);
}
function setHref(id,hrefStr){
	//alert(id+'Href'+" & href= "+hrefStr);
	//document.getElementById(id).href=hrefStr;
	//alert("eval : "+layerRef+id+'Href'+endTag+".href='"+hrefStr+"'");
	eval(layerRef+id+'Href'+endTag+".href='"+hrefStr+"'");
}
function setOnMouse(id,overStr,outStr){
	//alert(id+'Href'+" & href= "+hrefStr);
	//document.getElementById(id).href=hrefStr;
	//alert("eval : "+layerRef+id+'Href'+endTag+".href='"+hrefStr+"'");
	eval(layerRef+id+endTag+".onmouseover='"+overStr+"'");
	eval(layerRef+id+endTag+".onmouseout='"+outStr+"'");
}
//-- work with Image
stored=null;
storedLocation=null;
  //img1=load("i/b_dotwhite.gif");
  function load(location){
    image=new Image();
    image.src=location;
    return image;
  }
  function show(where,what){
    stored=where;
    storedLocation=document.images[where].src;
    document.images[where].src=eval(what+".src");
  }
  function hide(){
    document.images[stored].src=storedLocation;
  }

function pri(idname,isrc){
  eval(idname+"=new Image()");
  eval(idname+'.src=\"'+isrc+'\"');
}
// --------------

function imgFind(doc, imgName)
{
  for (var i=0; i < doc.layers.length; i++)
  {
    var img = doc.layers[i].document.images[imgName];
    if (!img) img = imgFind(doc.layers[i], imgName);
    if (img) return img;
  }
  return null;
}

function setImg(imgName,isrc){
  if (nn4) {
      var img = document.images[imgName];
      if (!img) img = imgFind(document, imgName);
      if (img) img.src = isrc;
	  return true;
  }
  eval(imageRef+imgName+imageRefEnd+'isrc');
}

function showLayer(layerName){  eval(layerRef+layerName+styleSwitch+'.visibility="visible"');
}        

function hideLayer(layerName){	eval(layerRef+layerName+styleSwitch+'.visibility="hidden"');
}

function chStatusLayer(layerName){
if (eval(layerRef+layerName+styleSwitch+'.visibility=="visible"')) eval(layerRef+layerName+styleSwitch+'.visibility="hidden"')
else  eval(layerRef+layerName+styleSwitch+'.visibility="visible"');
}

function setZi(layerName,zi) {
	eval(layerRef+'d'+layerName+styleSwitch+'.zIndex='+zi);
	if(zi==10) eval(layerRef+layerName+styleSwitch+'.borderColor="Yellow"')
		else eval(layerRef+layerName+styleSwitch+'.borderColor="Aqua"');
	
}
//--------------- from FRX
function SetRedWh(boxID) {setColor("#f9f7f9","red",boxID);}
function SetWhRed(boxID) {setColor("#ffffff","red",boxID);}
function SetGrDGr(boxID) {setColor("#EBEBEB","#6B696B",boxID);}

function SP(boxID) {setColor("#C60820",boxID);}

function HP(boxID) {setColor("#7F7F7F",boxID);}


function setColor(bgColor,color,layerName) 
{
	if (nn4) 
	{
		document.layers[layerName].bgColor=bgColor;
		document.layers[layerName].color=color;
	}
	if (ie55 || ie6) 
	{
		fadeIn(eval(layerRef+layerName+'\"]'),10);//10,9,4
		eval(layerRef+layerName+styleSwitch+".backgroundColor='"+bgColor+"'");
		eval(layerRef+layerName+styleSwitch+".color='"+color+"'");		

	}
}

function preloadConsImg(){
var pa = new Array();
pa = [
"./images/constr/logosm.jpg",
"./images/constr/photoline.jpg",
"./images/constr/red30whitedotbg.gif",
"./images/constr/redCornTransdotbg.gif",
"./images/constr/redCornTransdotbg2.gif",
"./images/constr/redCornTransdotbg3.gif",
"./images/constr/reddot30transbg.gif",
"./images/constr/redgreydotbg.gif",
"./images/constr/redtransdotbg.gif",
"./images/constr/redwhitedotbg.gif",
"./images/constr/up_l.gif",
"./images/constr/up_lr.gif",
"./images/constr/up_lr_dn_l.gif",
"./images/constr/up_lr_dn_lr.gif",
"./images/constr/up_lr_dn_r.gif",
"./images/constr/up_l_dn_l.gif",
"./images/constr/up_r.gif",
"./images/constr/up_r_dn_r.gif",
"./images/constr/vline.gif",
"./images/constr/vline2.gif"
];
for (i=0; i< pa.length; i++) {img1=load(pa[i]);}
}



