function cut(id,top,bottom,right,left) {
  if ( document.getElementById(id) ) {
    //document.getElementById(id).style.clip = "rect("+top+","+right+","+bottom+","+left+")";
    //document.getElementById('expanderholder').style.height = bottom+'px';
    document.getElementById('expander').style.height = bottom+'px';
    //document.getElementById(id).style.overflow = 'hidden';
    }
  // Netscape 4
  else if(ns4){
    document.layers[id].clip.top = top;
    document.layers[id].clip.bottom = bottom;
    document.layers[id].clip.right = right;
    document.layers[id].clip.left = left;	
    }
  // Explorer 4
  else if(ie4){
    document.all[id].style.clip ="rect("+top+","+right+","+bottom+","+left+")";
    }
  // W3C - Explorer 5+ and Netscape 6+
  else if(ie5 || ns6){
    document.getElementById(id).style.clip = "rect("+top+","+right+","+bottom+","+left+")";
    }
}

function RunPopup_() {
}
function ClosePopup_(popup) {
  document.getElementById(popup).style.display='none';
}

function GetWindowSize() {
  if ( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
    } 
  else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
    } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
    }
  return Array(myWidth,myHeight);
}


var detect = navigator.userAgent.toLowerCase(); 
var OS,browser,version,total,thestring; 

function checkIt(string) {
    place = detect.indexOf(string) + 1; thestring = string; 
	return place;
} 

function checkIt2(string) {
    place2 = detect.indexOf(string) + 2; thestring2 = string; 
	return place2;
} 

	
if (checkIt('opera')) {browser = "opera";}
else if (checkIt('mac_powerpc')) { browser = "mac";}
else if (checkIt('msie')) {browser = "explorer" ;}
else if (!checkIt('compatible')) { browser = "netscape";}
else browser = "An unknown browser";

	 
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

function ads_fixedbar(name,banner,left,right,top,bottom)
{
	if (name!='')
	{
		document.write('<style type="text/css">#'+name+' { position: absolute; left: 0px; bottom: 0px;} body > div#'+name+' { position: fixed; } </style><!--[if IE]><style type="text/css">div#'+name+' { right: auto; bottom: auto; left: expression( document.body.scrollLeft + \'px\' ); top: expression( ( -dzienchlopaka.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + \'px\' );} </style><![endif]--><div id="'+name+'">'+banner+'</div>');	
	}	
}

function ads_toplayer_popup(name,banner,width,height,popupW,popupH)
{

//if (browser!="mac") {
//  popupW = 220;
//  popupH = 308;
//	alert(rrr);
//	width=100;
//	popupW=200;
	if (document.getElementById(name))
	{
			size = GetWindowSize();
			wid = size[0];
			hei = size[1]
			posV = wid/2-popupW/2;
			posH = hei/2-popupH/2;
			if (posH<200) posH=200;
/*
			document.getElementById(name).style.width=width+'px';
//			alert(name+width+document.getElementById(name).style.width);
			document.getElementById(name).style.height=height+'px';			
			
			document.getElementById(name).style.left=posV+'px';
			document.getElementById(name).style.top=posH+'px';
			document.getElementById(name).style.display='block';
*/
//alert(document.getElementById(name).style.left);
//<div id="expanderholder" style="margin: 0 auto; width: 468px; height: 60px; position: relative; z-index: 20; text-align: left;">
			
		//  document.write('<div style="text-align: center; position: absolute;"><a style="display: block; width: 20px; background-color: #000; color: #FFF; font-weight: bold; font-size: 14px; padding: 2px;" href="http://www.wm.pl" onclick="ClosePopup(); return false;">X</a></div>'+banner);	
			document.getElementById(name).innerHTML='<div style="overflow: hidden; left: '+posV+'px;top: '+posH+'px; display: block; position: absolute;width: '+width+'px"; height: '+height+'px;"><div style="text-align: center; position: absolute;"><a style="display: block; width: 20px; background-color: #000; color: #FFF; font-weight: bold; font-size: 14px; padding: 2px;" href="http://www.wm.pl" onclick="ClosePopup_(\''+name+'\'); return false;">X</a></div>'+banner+'</div>';
		
			setTimeout("ClosePopup_('"+name+"')",10000);
			
	}
//  }

}

function ads_skyscraper(name,banner)
{
	if (browser!="mac") {
		pos = document.body.clientWidth-780;
		if (pos>=150) {
			if (pos<300) {
				document.getElementById('skyscraper').style.left=(780+(pos-150)+2)+'px';
				document.getElementById('skyscraper').style.display='block';
				
				//document.getElementById('bodycontent').style.marginLeft=(pos-150)+'px';
				document.write(banner);
			}
			else if (pos>=298) {
				document.getElementById('skyscraper').style.left=(780+(pos/2)+2)+'px';
				document.getElementById('skyscraper').style.display='block';
				document.write(banner);
			}
		}
	}
}