var URL = 'http://83.13.214.170/tytanpol/';
function $(el){
return typeof(el) == 'string' ? document.getElementById(el) : el;
}
function getChildren(el, a, v) {
	var ar = new Array();
	var ac = $(el).getElementsByTagName('*');
	var s = '';
	for (c=0; c<ac.length; c++){
	  if (v? (ac[c][a] == v || ac[c].getAttribute(a) == v) : (ac[c][a] || ac[c].getAttribute(a))) {
		ar.push(ac[c]);
	  }
	}
	return ar;
}
function d(){
   console.debug(arguments);
}
function addEvent(obj, type, fn) {
  if (obj.addEventListener) {
    obj.addEventListener(type, fn, false);
  } else if (obj.attachEvent) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() {obj["e"+type+fn](window.event); }
    obj.attachEvent("on"+type, obj[type+fn]);
  }
}
function eventHander(e) {
   var el;
   if(window.event && window.event.srcElement) el = window.event.srcElement;
   if(e && e.target) el = e.target;
   if(!el)  return;
   (e.preventDefault) ? e.preventDefault() : (e.returnValue = false);
   return el;
}
function shell(){
   var x,y,h,w;

   //How much the page has scrolled.
   if (self.pageYOffset){
	  x = self.pageXOffset;
	  y = self.pageYOffset;
   }
   else if (document.documentElement && document.documentElement.scrollTop) {
      x = document.documentElement.scrollLeft;
	   y = document.documentElement.scrollTop;
   }
   else if (document.body){
       // all other Explorers
      x = document.body.scrollLeft;
	   y = document.body.scrollTop;
   }


   //Inner width
     // all except Explorer
   if (self.innerHeight){
      w= self.innerWidth;
	   h = self.innerHeight;
   }
   else if (document.documentElement && document.documentElement.clientHeight){
      // Explorer 6 Strict Mode
	   w = document.documentElement.clientWidth;
	   h = document.documentElement.clientHeight;
   }
   else if (document.body){
      // other Explorers
	   w = document.body.clientWidth;
	   h = document.body.clientHeight;
   }
   //Page height
   var test1 = document.body.scrollHeight;
   var test2 = document.body.offsetHeight
   var test3 = document.documentElement.offsetHeight;
   var maxY = test1;
   if(maxY < test2){
      maxY = test2;
   }
   if(maxY < test3){
      maxY = test3;
   }

   if (test1 > test2) {
     // all but Explorer Mac
	  px = document.body.scrollWidth;
   }
   else
   // Explorer Mac;
     //would also work in Explorer 6 Strict, Mozilla and Safari
   {
	  px = document.body.offsetWidth;
   }

   var screen = {x:x,y:y,h:h,w:w,pw:px,ph:maxY};
   return screen;
}
POPUP = {
   obj: null,
   width: 280,
   height: 563,
   isOpen : false,
   elPath : 'flash/banEaster.swf',
   open : function(src){
      if(this.isOpen)
         return;
      if(!this.obj){
         this.obj = document.createElement('DIV');
   	   this.obj.setAttribute('id','baner');
         document.body.appendChild(this.obj);
         this.obj.style.position = 'absolute';
      }
      this.obj.style.top = (114+(shell().y) ) + 'px';
      //this.obj.style.left = (shell().w - this.width)/2 + 'px';
      ///////////////////////////////////
      if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}

if (navigator.appName=="Netscape") {
winW=winW/2+140;
}

      //////////////////////////////////
      //console.debug(winW);
      //console.debug(this.width);
      //console.debug((winW/2 - this.width));
      
      
      this.obj.style.left = (winW - this.width)/2 + 'px';
      this.obj.style.visibility = 'visible';
      POPUP.loadEl();
      this.isOpen = true;
   },
   close : function(){
	   if(!this.obj)
		   return;
	   this.obj.innerHTML = ' ';
      this.obj.style.visibility = 'hidden';
      this.obj.style.display = 'none';
      this.isOpen = false;
   },
   loadEl : function(){
      
      
      
      //////////////////////////////                         TUTAJ WRZUCAĆ BANERY
      
      
      var so = new SWFObject(this.elPath, "banner", this.width, this.height, "8", "#fff");
		//so.addVariable("flashVarText", "if ju"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
	  so.addParam("wmode", "transparent");
      so.write("baner");
   }
}

addEvent(window,'load',function(){
  //POPUP.open();
}

);


function closeWindow(){
   POPUP.close();
}
