// Akrylon Basic Functions v1.2

// --------------------------------------------------------------------------------------  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,title)
{
 ukaz=window.open("","Ukazka","title=ggg,toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,copyhistory=0");
 ukaz.focus();
 ukaz.document.clear();
 ukaz.document.open("text/html");
 ukaz.document.write("<body bgcolor=#FFFFFF><table width=\"100%\" height=\"100%\"><tr><td align=center valign=center><img src=\""+pic+"\"></td></tr></table></body>");
 if(!is.ns) if(title) ukaz.document.title=title; else ukaz.document.title="Preview";
 ukaz.document.close();
}

//******************************************************************************************************

// Akrylon Cookie Handle 2004 v1.1


function SetCookie(name,value)
{
 var argv = SetCookie.arguments;
 var argc = SetCookie.arguments.length;
 var expires = (argc > 2) ? argv[2] : null;
 var path = (argc > 3) ? argv[3] : null;
 var domain = (argc > 4) ? argv[4] : null;
 var secure = (argc > 5) ? argv[5] : false;
 document.cookie = name + "=" + (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
}

function GetCookie(name)
{
 var cookieFound = false;
 var start = 0;
 var end = 0;
 var cookieString = document.cookie; 

 var i = 0;
 while(i<=cookieString.length)
  {start = i;
   end = start + name.length;
   if(cookieString.substring(start,end) == name)
     {cookieFound = true;
      break;
     }
   i++;
  } 

 if(cookieFound)
   {start=end+1;
    end=document.cookie.indexOf(";",start); 
    if(end<start) end=document.cookie.length; 
    return document.cookie.substring(start,end); 
   } 
 return "";
} 

function DeleteCookie(name)
{
 var exp = new Date();
 exp.setTime (exp.getTime() - 10000);
 var cval = GetCookie (name);
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}


//******************************************************************************************************

// Akrylon Layers Handle 2002 v1.3

// --------------------------------------------------------------------------------------  Get Layer Object
function getLayer(name)
{if(is.dom) {return document.getElementById(name);}
 if(is.ns) return eval('document.layers.'+name);
 if(is.ie) return eval('document.all.'+name);
 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()
{if(true)
   {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 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.MozOpacity=""+opacity+"%";
 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('created=(typeof('+LN+'tHandle)=="undefined")?0:1');
 //if(created) eval('clearTimeout('+LN+'tHandle)');
 eval (LN+'tHandle=setTimeout(LN+"_fader.Fade()",start)');
}


function MenuON(LN)
{
// if(loaded)
 do
 {L=getLayer(LN);
  LaySetZIndex(L,110);
  LayFade(LN,10,30,300);
//  setTimeout('LayFade("'+LN+'",10,30)',200);
  LN=LN.substring(0,(LN.length)-2);
 }while(LN.charAt(LN.length-1)!='x');
}


function MenuOFF(LN)
{
 // if(loaded)
 do
 {L=getLayer(LN);
  LaySetZIndex(L,100);
  LayFade(LN,10,-10,300);
//  setTimeout('LayFade("'+LN+'",10,-10)',200);
  LN=LN.substring(0,(LN.length)-2);
 }while(LN.charAt(LN.length-1)!='x');
}

