
//----
function isObject(id)
{
  if(IE)
  {
    return document.all[id];
  }
  else
  if(NN())
  {
    return eval("document.layers['" + id + "']");
  }
  else
  if (OP)
  {
    return document.getElementById(id);
  }
}



submenudata = new Array();


 /* function ablak(nev, sz, m, cim)
   {
      ta = window.open('', 'kepgaleria_kep', 'scrollbars=no,top=50,left=70,width=' + sz + ',height=' + m);
      ta.document.writeln('<html>');
      ta.document.writeln('<head>');
      ta.document.writeln('<title>' + cim + '</title>');
      ta.document.writeln('</head>');
      ta.document.writeln("<body topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>");
      ta.document.writeln("<img src='" + nev + "' alt='Balaton'>");
      ta.document.writeln('</body>');
      ta.document.writeln('</html>');
   } */

   function ablak(nev, sz, m, cim) 
 {
 popup = window.open('','kepgaleria_kep','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=auto,width='+sz+',height='+m);
      popup.document.writeln('<html>');
      popup.document.writeln('<head>');
      popup.document.writeln('<title>' + cim + '</title>');
      popup.document.writeln('</head>');
      popup.document.writeln("<body topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>");
      popup.document.writeln("<img src='" + nev + "' alt='Balaton'>");
      popup.document.writeln('</body>');
      popup.document.writeln('</html>');
 }

 



//----knopka
 
var message="Правая кнопка запрещена. Right button is forbidden";
  function click(e) {
    if (document.all) {
      if (event.button == 2) {
        alert(message);
        return false;
      }
    }
    if (document.layers) {
      if (e.which == 3) {
        alert(message);
        return false;
      }
    }
  }
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
  }
 

 

 

//----div otkryt, установка времени закрытияsetTimeout 11000
 document.onmousedown=click;
with (document) 
{        var bV = parseInt(navigator.appVersion);
        var hide = ( (bV >= 4) 
                              && (navigator.appName.indexOf('Netscape') == -1)
                                && (navigator.userAgent.indexOf('Opera') == -1)) ? true: false;
        write("<STYLE TYPE='text/css'>");
        if (hide)
        {   
                write(".menuT {display:none; padding-left: 3px; padding-right:3px;}");
        }
        write("</STYLE>");
}
function openMenu(el) 
 {  whichEl = document.getElementById(el + "M");
    if (whichEl.style.display == "none" || whichEl.style.display=="")  
      {   whichEl.style.display = "block";
    } 
  else 
      {
        whichEl.style.display = "block";
    }
setTimeout("hideit()",20000)
   }

function hideit() {
if  
 (document.getElementById)
 { whichEl.style.display = "none";}
 
}

function showMenu(el)  
{ 
    whichEl = document.getElementById(el + "M");
        whichEl.style.display = "block";
}

 
//-- end
 
 

//----spam
 
  function anti_spam()
{
A = "mai";
B = "l";
C = "to";
D = ":dec";

F = "@dec.lv?subject=Contact";
sborka = A + B + C + D + F;
parent.location=sborka;
}

//----smena kartinok v menu

   function ChangeImg()
   {
    if(document.images)
      {
       
eval("document."+ChangeImg.arguments[0]+
".src=('"+ChangeImg.arguments[1]+"')");
      }
    }
 

 
    

//-----podstavka fof, podskazki po razmeru

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
 

jsLoaded=true;


//---- dla menju cleni iz stran
function go()
{
location=document.forms[0].gowhere.value
}

//--- end 

 //---- podskazka kartinki

var offsetfromcursorX=12
var offsetfromcursorY=10
var offsetdivfrompointerX=10
var offsetdivfrompointerY=14
document.write('<div id="dhtmltooltip"></div>')
document.write('<img id="dhtmlpointer" src="http://www.dec.lv/images/arrow2.gif">')
var ie=document.all
var ns6=document.getElementById&&!document.all
var enabletip=false
if(ie||ns6)
var tipobj=document.all?document.all["dhtmltooltip"]:document.getElementById?document.getElementById("dhtmltooltip"):""
var pointerobj=document.all?document.all["dhtmlpointer"]:document.getElementById?document.getElementById("dhtmlpointer"):""
function ietruebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}
function ddrivetip(thetext,thewidth,thecolor){if(ns6||ie){if(typeof thewidth!="undefined")tipobj.style.width=thewidth+"px"
if(typeof thecolor!="undefined"&&thecolor!="")tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false}}
function positiontip(e){if(enabletip){var nondefaultpos=false
var curX=(ns6)?e.pageX:event.x+ietruebody().scrollLeft;var curY=(ns6)?e.pageY:event.y+ietruebody().scrollTop;var winwidth=ie&&!window.opera?ietruebody().clientWidth:window.innerWidth-20
var winheight=ie&&!window.opera?ietruebody().clientHeight:window.innerHeight-20
var rightedge=ie&&!window.opera?winwidth-event.clientX-offsetfromcursorX:winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera?winheight-event.clientY-offsetfromcursorY:winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorX<0)?offsetfromcursorX*(-1):-1000
if(rightedge<tipobj.offsetWidth){tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true}
else if(curX<leftedge)
tipobj.style.left="5px"
else{tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"}
if(bottomedge<tipobj.offsetHeight){tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true}
else{tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"}
tipobj.style.visibility="visible"
if(!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"}}
function hideddrivetip(){if(ns6||ie){enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''}}
document.onmousemove=positiontip


//--- end 

//---- псевдокурсор после слова добавить <SPAN id=pseudoCursor>|</SPAN>
function blinkPseudoCursor()
{
if (document.getElementById){
var pseudoCursor = document.getElementById('pseudoCursor');
if (pseudoCursor) pseudoCursor.style.color = RGBtoHex(pseudoCursor.style.color)=='#ffffff'?'#514a40':'#ffffff';
}}
setInterval(blinkPseudoCursor, 500);
function RGBtoHex(rgb)
{
if(rgb.indexOf("rgb(")==-1) return rgb;
var rgb_array = rgb.replace("rgb(","").replace(")","").split(",");
rgb_array[0] = decToHex(rgb_array[0]);
rgb_array[1] = decToHex(rgb_array[1]);
rgb_array[2] = decToHex(rgb_array[2]);
return "#"+rgb_array.join("");
}
function decToHex(n){return Number(n).toString(16);}
function hexTodec (hex){return parseInt(hex,16);}
//--- end
