// Akrylon Basic Functions v1.3

// --------------------------------------------------------------------------------------  Init basic data
var loaded=false;
is=new systemInfo();

// --------------------------------------------------------------------------------------  System info - browser, OS
function systemInfo()
{var b=navigator.appName; 
 if(b=="Netscape") {this.b = "ns"}
 else if (b=="Microsoft Internet Explorer") {this.b="ie"} 
 else if (b=="Opera") {this.b = "op"}
 else {this.b=b}
 this.version=navigator.appVersion;this.v=parseInt(this.version);
 //alert(navigator.appName+' - '+this.version);
 this.ns=(this.b=="ns"&&this.v>=4);this.ns4=(this.b=="ns"&&this.v==4);this.ns5=(this.b=="ns"&&this.v==5);this.ns6=(this.b=="ns"&&this.v==6);
 this.ie=(this.b=="ie"&&this.v>=4);this.ie4=(this.version.indexOf('MSIE 4')>0);this.ie5=(this.version.indexOf('MSIE 5')>0);this.ie6=(this.version.indexOf('MSIE 6')>0);
 this.op=(this.b=="op"&&this.v>=4);this.op5=(this.b=="op" && this.v==5);this.op6=(this.b=="op" && this.v==6);
 this.dom=document.getElementById?1:0;
 this.agent = navigator.userAgent.toLowerCase();
 if (this.agent.indexOf("mac")!=-1){this.os="mac"}
 else if (this.agent.indexOf("win")!=-1){this.os="win"} 	
 else this.os = "other"
}

// --------------------------------------------------------------------------------------  Inspect
// Requires text input tag "inspect"

function Inspect(mes)
{
 parent.parent.InspectF.document.forms.F.elements.inspect.value=mes;
}

// --------------------------------------------------------------------------------------  FirstTime
// Requires input tag "start", callable only once

function FirstTime()
{
 if(parent.parent.VarF.document.forms.F.elements.start.value==0)
   {parent.parent.VarF.document.forms.F.elements.start.value=1;return 1;}
 else return 0;  
}

// --------------------------------------------------------------------------------------  Marquee
function Marquee(content,delay,step,direction)
{
 if(direction=='undefined') direction='left';
 if(is.ie) document.writeln('<marquee direction='+direction+' scrollAmount='+step+' TRUESPEED="1" scrollDelay='+delay+' valign=bottom>'+content+'</marquee><br>');
}

// --------------------------------------------------------------------------------------  Show picture in new window

function Show(pic)
{
 ukaz=window.open("","Ukazka","toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=1,copyhistory=0,width=50,height=50,top=10,left=10");
 ukaz.focus();
 ukaz.document.clear();
 ukaz.document.open("text/html");
 ukaz.document.write("<body bgcolor=#FFFFFF onLoad=\"ResizeMe();\"><table width=100% height=100%><tr><td align=center valign=center><img src=\""+pic+"\"></table></body>");
 ukaz.document.write("<script>  var i=0;function ResizeMe() {if(navigator.appName==\"Netscape\") i=40;if(document.images[0]) window.resizeTo(document.images[0].width+50, document.images[0].height+70+i);self.focus();} </script>");
 if(!is.ns) ukaz.document.title="Preview";
 ukaz.document.close();
}

// --------------------------------------------------------------------------------------  Show picture in new window
function Video(vid)
{
 ukaz=window.open("","Ukazka","title=ggg,toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,copyhistory=0");
 ukaz.document.clear();
 ukaz.document.open("text/html");
 ukaz.document.write("<body bgcolor=#000000><table width=\"100%\" height=\"100%\"><tr><td align=center valign=center><embed src=\""+vid+"\"></td></tr></table></body>");
 if(!is.ns) ukaz.document.title="Preview";
 ukaz.document.close();
 ukaz.focus();
}


//******************************************************************************************************

// Akrylon Layers Handle 2005 v1.4

// --------------------------------------------------------------------------------------  Get Layer Object
function getLayer(name)
{if(is.dom) {return document.getElementById(name);}
 else if(is.ns) return eval('document.layers.'+name);
 else if(is.ie) return eval('document.all.'+name);
 else return eval('document.layers.'+name);
}


// --------------------------------------------------------------------------------------  Layer Visibility
function Fader(name,LN,delay,step,opacity)
              {this.Fade=Fade;this.name=name;this.LN=LN;this.delay=delay;this.step=step;this.opacity=opacity;}

function Fade()
{this.opacity+=this.step;
 if(this.opacity>100) this.opacity=100;
 else if(this.opacity<0) this.opacity=0;
 else setTimeout(this.name+".Fade()",this.delay);
 LayOpacity(this.LN,this.opacity);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 


function LayShow(L) {(is.ns4) ? L.visibility="show" : L.style.visibility="visible"}

function LayHide(L) {(is.ns4) ? L.visibility="hide" : L.style.visibility="hidden"}

//function LaySetZIndex(L,z) {(is.ns) ?  L.zIndex = z : L.style.zIndex = z}
function LaySetZIndex(L,z) {/*L.style.zIndex = z;*/}

function LayOpacity(LN,opacity)
{if(opacity<0) opacity=0;else if(opacity>100) opacity=100;
 L=getLayer(LN);
 if(opacity==0) LayHide(L); else LayShow(L);
 if(is.ns && is.v>4); L.style.MozOpacity=""+opacity/101;
 if(is.ie) L.style.filter="alpha(opacity="+opacity+")";
}

function LayFade(LN,delay,step,start)
{if(step<0) opacity=100;else opacity=0;
 eval('isnew=(typeof('+LN+'_fader)=="undefined")?1:0');
 if(isnew) eval( LN + '_fader=new Fader("' + LN + '_fader",LN,delay,step,opacity)' );
 else{
      eval (LN+'_fader.step=step;'+LN+'_fader.delay=delay;');
     }
 eval (LN+'tHandle=setTimeout(LN+"_fader.Fade()",start)');
}

var topLayer=0,nexLayer=1;

function SlideShow(LN,slDelay,slMaxIdx)
{
 if(topLayer)
   {L=getLayer(LN+topLayer);LaySetZIndex(L,100);
    LayFade(LN+topLayer,10,-100,1100);
   } 
 L=getLayer(LN+nexLayer);LaySetZIndex(L,110);
 LayFade(LN+nexLayer,5,20,10);
 topLayer=nexLayer;nexLayer++;
 if(nexLayer>slMaxIdx) nexLayer=1;
 setTimeout('SlideShow("'+LN+'",'+slDelay+','+slMaxIdx+')',slDelay);
}

function LayMoveToMouse(LN)
{ L=getLayer(LN);
  L.style.left=mouseX;
  L.style.top=mouseY;
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

mStat =new Array();

function MenuON(LN)
{
// if(loaded)
 do
 {if(!mStat[LN])
  {mStat[LN]=true
  L=getLayer(LN);
  LaySetZIndex(L,110);
  LayFade(LN,1,10,300);
  }
//  setTimeout('LayFade("'+LN+'",10,30)',200);
  LN=LN.substring(0,(LN.length)-2);
 }while(LN.charAt(LN.length-1)!='x');
}

function MenuOFF(LN,fast)
{
 // if(loaded)
 do
 {if(mStat[LN]); 
  {mStat[LN]=false;
  L=getLayer(LN);
  LaySetZIndex(L,100);
  if(fast) LayFade(LN,1,-100,10);
  else LayFade(LN,1,-10,300);
  }
//  setTimeout('LayFade("'+LN+'",10,-10)',200);
 LN=LN.substring(0,(LN.length)-2);
 }while(LN.charAt(LN.length-1)!='x');
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function CursorMenuON(LN)
{
// if(loaded)
 do
 {L=getLayer(LN);
  LaySetZIndex(L,110);
  LayFade(LN,10,33,100);
  L.style.left=mouseX;
  L.style.top=mouseY;
//  setTimeout('LayFade("'+LN+'",10,30)',200);
  LN=LN.substring(0,(LN.length)-2);
 }while(LN.charAt(LN.length-1)!='x');
}


function CursorMenuOFF(LN)
{
 // if(loaded)
 do
 {L=getLayer(LN);
  LaySetZIndex(L,100);
  LayFade(LN,1,-10,300);
//  setTimeout('LayFade("'+LN+'",10,-10)',200);
  LN=LN.substring(0,(LN.length)-2);
 }while(LN.charAt(LN.length-1)!='x');
}

//-----------------------------------------------------------------------------------------------------------------------------

function ShowLayOnMouse(LN) {LayFade(LN,10,10);LayMoveToMouse(LN);}
function HideLay(LN,fast) {if(fast) LayFade(LN,10,-100); else LayFade(LN,10,-100);}

function SetCellColor(cell, color)
{cell.style['background']=color;
}

function SetStyleClass(elem, cssClass)
{elem.className=cssClass;
}

//-----------------------------------------------------------------------------------------------------------------------------
// Akrylon Mouse Functions v 1.2
//-----------------------------------------------------------------------------------------------------------------------------

var mouseHandled=1;
var mousePositionInspected=0;
var mouseX;
var mouseY;

if (mouseHandled) InitMouse();

function InitMouse() 
{
 if(mousePositionInspected) document.write('<div id="LayInsp" style="position: absolute; height: 100; width: 100;z-index=10000;"><form id=Inspect><input type=text name=V size=10></form></div>');

 document.onmousemove = mouseMove;
 document.onmousedown = mouseDown;
 document.oncontextmenu=noContextMenu;
 if(navigator.appName == 'Netscape') window.captureEvents(Event.MOUSEUP | Event.MOUSEDOWN | Event.MOUSEMOVE);
}
  
function mouseMove(e) 
{
 mouseX = (navigator.appName == 'Netscape')? e.pageX : event.x+document.body.scrollLeft;
 mouseY = (navigator.appName == 'Netscape')? e.pageY : event.y+document.body.scrollTop;
 if(navigator.appName == 'Netscape' && e.target!=document) routeEvent(e);
         
 if(mousePositionInspected)
   {document.forms.Inspect.V.value=mouseX+','+mouseY;
    document.getElementById('LayInsp').style.left=mouseX+10;
    document.getElementById('LayInsp').style.top=mouseY;
   } 
 return(true);
}

function mouseDown(e) 
{
 if(navigator.appName=="Netscape") 
   {if(e.which>1) { alert('Hehe');return false;}
   }
 else if(event.button>1) {alert('Hehe'); event.cancelBubble=true; event.returnValue=false; }
}

function noContextMenu(e) 
{
 return false;
}

