if( -1 != navigator.userAgent.indexOf("Opera"))  { document.write( '<link rel="stylesheet" type="text/css" href="css/hack-opera.css" />' ); }

// dopiero pod tym funkcje ..
function HighLight( id, mode )  {
	var color = 'red';
	var lightColor;
	if( mode == 1 )  {
		lightColor = color;
	}
	else  {
		lightColor = '';
	}
	document.getElementById( id ).style.color = lightColor;
	return true;
}

// Inicjalizacja skryptow
function init()
{
  prepend();
//  initLightbox();
  winOnLoad();
}
function $( id )  {
  return document.getElementById( id );
}

function imgshow(url, width, height)
{
	LeftPosition=(screen.width)?(screen.width-width)/2:100;
	TopPosition=(screen.height)?(screen.height-height)/2:100;
	var win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top=' + TopPosition + ',left=' + LeftPosition + ',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no');
}



function ChangeAttribute( elem, attr, value )
{
	elem.attr = value;
}

function prepend()
{
  document.cookie = "screenWidth="+ screen.width;
  document.cookie = "screenHeight="+ screen.height;
  var leftMarg = (screen.width/2)-100;
  var topMarg = (screen.height/3);
  if( document.getElementById('error-layer') )  {
    document.getElementById( 'error-layer' ).style.left = leftMarg+'px';
    document.getElementById( 'error-layer' ).style.top = topMarg+'px';
    new Draggable( 'error-layer' );
  }
  if( document.getElementById('info-layer') )  {
		document.getElementById( 'info-layer' ).style.left = leftMarg+'px';
		document.getElementById( 'info-layer' ).style.top = topMarg+'px';
		new Draggable( 'info-layer' );
  }
}

// Zamykanie banera
function closeBanner()
{
  document.getElementById('floater').style.visibility="hidden";
  document.getElementById('floater').style.display="none";
  document.getElementById('topbanner').style.visibility="visible";
}

// Zamykanie banera
function closeSkyscraper()
{
  document.getElementById('floater2').style.visibility="hidden";
  document.getElementById('floater2').style.display="none";
  document.getElementById('towerbanner').style.visibility="visible";
}

// Zamykanie banera
function closeScroller()
{
  document.getElementById('floater3').style.display="none";
}

// Funkcje do "latajacych" banerow {{{
var slideTime = 700;
var topMargin1, topMargin2;
var height;
function winOnLoad()
{
  // do banera
  topMargin1 = xPageY('topbanner');
  topMargin1 = topMargin1 - 15;
  // do scrollera
  topMargin3 = 500;
  height = getHeight();
  topMargin3 = height - 55;
  winOnResize(); // set initial position
  xAddEventListener(window, 'resize', winOnResize, false);
  xAddEventListener(window, 'scroll', winOnScroll, false);
  return;
}

function winOnResize()
{
  height = getHeight();
  topMargin3 = height - 55;
  // do banera
  xMoveTo('floater', xPageX('topbanner'), topMargin1);
  xShow('floater');
  // do scrollera
  xMoveTo('floater3', 0, topMargin3);
  xShow('floater3');
  winOnScroll(); // initial slide
}

function winOnScroll()
{
  // do banera
  xSlideTo('floater', xLeft('floater'), xScrollTop() + topMargin1, slideTime);
  // do scrollera
  xSlideTo('floater3', xLeft('floater3'), xScrollTop() + topMargin3, slideTime);
}

function setSlideTime(st) {
  st = parseInt(st);
  if (!isNaN(st)) slideTime = st;
  var e = xGetElementById('st');
  e.value = st;
  return false;
}

function getWidth()
{
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}

function getHeight()
{
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

// pobieranie wartosci ciastka
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}




