var _swf = 'ML.01.55-kampan-korytnacky-umbrella-960x90-v01-big.swf?clickthru=http://preklik'
var _width = 600;
var _height = 300;

var small_swf = 'ML.01.55-kampan-korytnacky-umbrella-960x90-v01-small.swf?clickthru=http://preklik'
var small_width = 960;
var small_height = 90;

var align = 'center';



var myWinWidth = 0;
var myWinHeight = 0;
function getWinHeight() {
  if( typeof( window.innerWidth ) == 'number' ) {
    myWinWidth = window.innerWidth;
    myWinHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      myWinWidth = document.documentElement.clientWidth;
      myWinHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        myWinWidth = document.body.clientWidth;
        myWinHeight = document.body.clientHeight;
      }
    }
  }

  myWinWidth += (ns ? -20 : 0)
}

var myScrLeft = 0;
var myScrTop = 0;
function getScrollXY() {
  if( typeof( window.pageYOffset ) == 'number' ) {
    myScrTop = window.pageYOffset;
    myScrLeft = window.pageXOffset;
  } else {
    if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      myScrTop = document.body.scrollTop;
      myScrLeft = document.body.scrollLeft;
    } else {
      if( document.documentElement &&
          ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        myScrTop = document.documentElement.scrollTop;
        myScrLeft = document.documentElement.scrollLeft;
      } else {myScrLeft = 0; myScrTop = 0;}
    }
  }
}

var brOK=false;
var mie=false;
var leftPos,topPos;
var change=0;
var destTop;
var initialized = false;
var chipName = "chip1";

var aver=parseInt(navigator.appVersion.substring(0,1));
var aname=navigator.appName;
var ns4=document.layers?1:0
var opera = typeof opera != 'undefined';
var ie=document.all && !opera
var ns6=document.getElementById&&!document.all?1:0
var ns = ns4 || ns6

getWinHeight();
getScrollXY();

//destLeft = myScrLeft + (myWinWidth/2) - (_width/2);
//destTop = myScrTop + (myWinHeight/2) - (_height/2);
destLeft = getLeft(_width, align);
destTop = getTop(_height, align);

var chip1;
var chip2;
function pagestart()
{ chip1=new Chip("chip1",_width,_height);}

function checkbrOK()
{if(aname.indexOf("Internet Explorer")!=-1)
   {if(aver>=4) brOK=navigator.javaEnabled();
    mie=true;
   }
 if(aname.indexOf("Netscape")!=-1)
   {if(aver>=4) brOK=navigator.javaEnabled();}
}

function Chip(chipname,width,height) {
  this.named=chipname;
  this.w=width;
  this.h=height;
  this.xx=leftPos;
  this.yy=topPos;

  document.getElementById(this.named).style.left=destLeft;
  document.getElementById(this.named).style.pixelLeft=destLeft;
  document.getElementById(this.named).style.top =destTop;
  document.getElementById(this.named).style.pixelTop =destTop;
  document.getElementById(this.named).style.visibility ="visible";
  //regenerate();
}

//return top coordinate depending on height of object and its align
function getTop(h, align){
  
  var ret = myScrTop;
  
  switch(align){
    
    //middle of the screen
    case 'center':
    case 'C':
    case 'left':
    case 'L':
    case 'right':
    case 'R':
      ret += (myWinHeight/2 - h/2);
      break;
    
    case 'bottom':
    case 'B':
    case 'bottomleft':
    case 'BL':
    case 'bottomright':
    case 'BR':
      ret += (myWinHeight - h) - 5;
      break;
    
    //top of the screen
    case 'topleft':
    case 'TL':
    case 'topright':
    case 'TR':
    case 'top':
    case 'T':
      //do nothing
      break;
  
  }
  return ret;

}

//return left coordinate depending on width of object and its align
function getLeft(w, align){
  
  var ret = myScrLeft;
  
  switch(align){
    
    //middle of the screen
    case 'center':
    case 'C':
    case 'top':
    case 'T':
    case 'bottom':
    case 'B':
      ret += (myWinWidth/2 - w/2);
      break;
    
    //right
    case 'right':
    case 'R':
    case 'bottomright':
    case 'BR':
    case 'topright':
    case 'TR':
      ret += (myWinWidth - w) - 5;
      break;
    
    //left
    case 'topleft':
    case 'TL':
    case 'bottomleft':
    case 'BL':
    case 'left':
    case 'L':
      //do nothing
      break;
  
  }
  
  return ret;

} 


function O2_changeLayer() {
  _width = small_width;
  _height = small_height;
  align = 'bottom';

  chipName = "chip2";

  document.getElementById("chip1").style.visibility = "hidden";
  document.getElementById("chip2").style.visibility = "visible";

  if (mie || !(ns4 || ns6)) regenerate();
}

function O2_closeLayer() {
  chipName = "chip2";

  document.getElementById("chip1").style.visibility = "hidden";
  document.getElementById("chip2").style.visibility = "hidden";

  if (mie || !(ns4 || ns6)) regenerate();
}

regenerateTime = 100;

function regenerate() {

  getWinHeight();
  getScrollXY();

  var destLeft = getLeft(_width, align);
  var destTop = getTop(_height, align);

  document.getElementById(chipName).style.left=destLeft+"px";
  document.getElementById(chipName).style.pixelLeft=destLeft;
  document.getElementById(chipName).style.top = destTop+"px";
  document.getElementById(chipName).style.pixelTop = destTop;

  if((ns4 || ns6 ) && !mie){setTimeout('regenerate()',300);}
  //setTimeout('regenerate()',regenerateTime);
}



flashText = '<div id="chip1" STYLE="position:absolute; width:'+_width+'px; height:'+_height+'px; z-index:998; top:-250; visibility:hidden;"> ' +
  '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' +
  'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ' +
  'WIDTH="'+_width+'" HEIGHT="'+_height+'" id="NALEPKA01" ALIGN=""> ' +
  '<PARAM NAME=movie VALUE="'+_swf+'"> <PARAM NAME=allowScriptAccess VALUE=always> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <PARAM NAME=wmode VALUE=transparent> <param name=scale value=noscale /> '+
  '<EMBED src="'+_swf+'" quality=high bgcolor=#FFFFFF  WIDTH="'+_width+'" HEIGHT="'+_height+'" NAME="NALEPKA01" ALIGN="" wmode="transparent"' +
  'TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> ' +
  '</OBJECT> ' +
  '</div>';
flashText += '<div id="chip2" STYLE="position:absolute; width:'+small_width+'px; height:'+small_height+'px; z-index:998; top:-250; visibility:hidden;"> ' +
  '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' +
  'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ' +
  'WIDTH="'+small_width+'" HEIGHT="'+small_height+'" id="NALEPKA02" ALIGN=""> ' +
  '<PARAM NAME=movie VALUE="'+small_swf+'"> <PARAM NAME=allowScriptAccess VALUE=always> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <PARAM NAME=wmode VALUE=transparent> '+
  '<EMBED src="'+small_swf+'" quality=high bgcolor=#FFFFFF  WIDTH="'+small_width+'" HEIGHT="'+small_height+'" NAME="NALEPKA02" ALIGN="" wmode="transparent"' +
  'TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> ' +
  '</OBJECT> ' +
  '</div>';
document.write(flashText);

window.onload=pagestart;
window.onresize=regenerate;
window.onscroll=regenerate;
if((ns4 || ns6 )&& !mie){setTimeout('regenerate()',200);}