var x=0,y=0;
function __addFlash(src, width, height, wmode, bgcolor){
if (!bgcolor) bgcolor='';
var _f='';
_f = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ';
_f += 'WIDTH='+width+' HEIGHT='+height+'>';
_f += '<PARAM NAME=movie VALUE="'+src+'"><PARAM NAME=quality VALUE=high>';
_f += '<param name="AllowScriptAccess" value="always">';
_f += '<param name="wmode" value="transparent">';
_f +='<PARAM NAME="scale" VALUE="noscale">';
_f += '<EMBED scale="noscale" AllowScriptAccess="always" src="'+src+'" WIDTH='+width+' HEIGHT='+height+' quality=high ';
if (wmode && !window.chrome) _f += 'wmode='+wmode+' ';
if (bgcolor) _f += 'bgcolor='+bgcolor+' ' ;
_f += 'TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>';
_f += '</OBJECT>';
return _f;
}
function __addLayer(width, height, left, top, visibility,position, zIndex, name,text,background){
if(!name) name='_mainWindow';
if (zIndex==null) zIndex=101;
if (!visibility) visibility='visible';
var _l='';
_l = '<div ';
_l += 'id="'+name+'" name="'+name+'" style="';
_l += 'position: '+position+'; ';
_l += 'background: '+background+'; ';
_l += 'width: '+width+'px; height: '+height+'px; ';
if (top!=null) _l += 'top: '+top+'px; '
if (left!=null) _l += 'left: '+left+'px; ';
_l += 'z-index: '+zIndex+'; ';
_l += '">';
if(text!=null)_l +=text;
_l += '</div>';
return _l;
}
function __closeBanerWindow(windowId){
var element=document.getElementById(windowId);
if(element==null)alert('Nie ma.');
var c=element.childNodes.length;
for( i=0;i<c;i++ ){
element.childNodes[i].style.visibility='hidden';
}
element.style.visibility='hidden';
}
function __startDrag(elem,ev) {
var mover,upper,dx=0,dy=0;
if (x!= -1) dx = ev.clientX - x;
if (y != -1) dy = ev.clientY - y;
document.addEventListener('mousemove',mover=function(ev) {
x= Math.max(0,ev.clientX - dx);
y = Math.max(0,ev.clientY - dy);
elem.style.left = x+ 'px';
elem.style.top = y + 'px';
ev.stopPropagation();
ev.preventDefault();
},true);
document.addEventListener('mouseup',upper=function(ev) {
document.removeEventListener("mousemove",mover,true);
document.removeEventListener("mouseup",upper,true);
ev.stopPropagation();
ev.preventDefault();
},false);
ev.stopPropagation();
ev.preventDefault();
}
function __ieStartDrag(target,ev) {
var mover,upper,dx=0,dy=0;
if( x!= -1 ) dx = ev.clientX - x;
if( y != -1 ) dy = ev.clientY - y;
document.attachEvent('onmousemove',mover=function(ev) {
x= Math.max(0,ev.clientX - dx);
y = Math.max(0,ev.clientY - dy);
target.style.left = x+ 'px';
target.style.top = y + 'px';
});
document.attachEvent('onmouseup',upper=function(ev) {
document.detachEvent("onmousemove",mover);
document.detachEvent("onmouseup",upper);
});
}
function __createEventListener(target, event) {
if ( typeof target.addEventListener != "undefined" ){
target.addEventListener(event,function(ev){ __startDrag(target,ev)},false );
}else if ( typeof target.attachEvent != "undefined" ){
event ='on'+event;
target.attachEvent(event,function(ev){__ieStartDrag(target,ev)});
}
}
function __resizeBanerWindow(windowId,width,height){
var element=document.getElementById(windowId);
if(element==null)return 0;
var c=element.childNodes.length;
for( i=0;i<c;i++ ){
element.childNodes[i].style.clip='rect(0,'+element.style.width+','+(height)+',0)';
}
element.style.clip='rect(0,'+element.style.width+','+(height)+',0)';
}
function __BanerWindow(fwidth,fheight,fSrc,dName){
var left = (screen.width/2)-(fwidth/2);
var top=(screen.height/2)-(fheight);
if( left<50 )left=100;
if( top>40 )top=50;
x=left; y=top;
var _mf = __addFlash(fSrc,fwidth,fheight,'transparent');
var _m2 = __addLayer(fwidth, fheight, left, top, 'visible','absolute',96, dName,_mf,'transparent');
document.write(_m2);
var element=document.getElementById(dName);
if( element == null )return 0;
__createEventListener(element, "mousedown");
}