
//                                   BANNER DE SIMULACIÓN DE MESSENGER


//----------------------------------------------------------------------------------------------------------------------
//----------------------ESTE ARCHIVO SOLO ES VÁLIDO PARA UN AFILIADO Y UNA CREATIVIDAD----------------------------------
//----------------PARA APLICARLO A DIFERENTES AFILIADOS DEBE CREARSE UNA COPIA DE ESTE SCRIPT---------------------------
//-------------------------------MODIFICANDO LAS VARIABLES CORRESPONDIENTES---------------------------------------------
//----------------------------------------------------------------------------------------------------------------------

var WNZMSN = new Object();

//----------------------------------------URL DE DESTINO DEL BANNER-----------------------------------------------------
//Generalmente será un Tracking link extraído de netRefer a través del afiliado correspondiente
//----------------------------------------------------------------------------------------------------------------------

WNZMSN.destination = 'http://www.imdb.com/title/tt0063869/';


//-------------------------------------------CONTENIDO DEL BANNER-------------------------------------------------------
//JPG, SWF, GIF... creatividad que se mostrará al aparecer el popup de msn
//----------------------------------------------------------------------------------------------------------------------

WNZMSN.content = 'http://www.winzingo.com/data/scratch/superbanners/WNZmsn.png';


//--------------------------------------------TAMAÑO DEL BANNER---------------------------------------------------------
//Tamaño del banner desplegado, el banner es de proporción cuadrada
//----------------------------------------------------------------------------------------------------------------------

WNZMSN.size = 150;


//--------------------------------------------TIEMPO MINIMO DE ESPERA---------------------------------------------------
//Tiempo mínimo en segundos de espera entre la aparición de un pop-up y el siguiente
//----------------------------------------------------------------------------------------------------------------------

WNZMSN.minimo = 10;


//--------------------------------------------TIEMPO MINIMO DE ESPERA---------------------------------------------------
//Tiempo máximo en segundos de espera entre la aparición de un pop-up y el siguiente
//Ha de ser mayor que el tiempo mínimo, o igual si queremos definir una espera fija
//----------------------------------------------------------------------------------------------------------------------

WNZMSN.maximo = 10;


//--------------------------------------------TIEMPO DE VISIBILIDAD-----------------------------------------------------
//Tiempo que el pop-up es visible
//----------------------------------------------------------------------------------------------------------------------

WNZMSN.visible = 5;


//----------------------------------------------------------------------------------------------------------------------
//-----------------------------------------NO TOCAR A PARTIR DE AQUÍ----------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------

//-----------------------------------------------GENERIC BANNER METHODS-------------------------------------------------

function WNZgetWidth(){
	var pos;
	if (window.innerWidth){
		pos =window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth){
		pos= document.documentElement.clientWidth;
	}
	else if (document.body){
		pos= document.body.clientWidth;
	}
	return pos;
}

function WNZgetHeight(){
	var pos;
	if (window.innerWidth){
		pos =window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight){
		pos= document.documentElement.clientHeight;
	}
	else if (document.body){
		pos= document.body.clientHeight;
	}
	return pos;
}

function WNZgetTop(){
	var pos;
	if (document.body.scrollTop) pos = document.body.scrollTop;
	else if (window.pageYOffset) pos = window.pageYOffset;
	else pos = 0;
	return parseInt(pos);
}

function WNZgetLeft(){
	var pos;
	if (document.body.scrollLeft) pos = document.body.scrollLeft;
	else if (window.pageXOffset) pos = window.pageXOffset;
	else pos = 0;
	return parseInt(pos);
}

function WNZtest(input){
	alert('[TEST:] ' + input);
	return;
}

//-----------------------------------------------SPECIFIC BANNER METHODS------------------------------------------------

WNZMSN.small = 10;
WNZMSN.file = 'https://www.winzingo.com/data/scratch/superbanners/WNZmessenger.swf';
WNZMSN.timeout = null;
WNZMSN.securityright = 20;
WNZMSN.opened = false;

WNZMSN.inputflash = '';
WNZMSN.inputflash = WNZMSN.inputflash + 'clickTag=' + WNZMSN.destination;
WNZMSN.inputflash = WNZMSN.inputflash + '&contenido=' + WNZMSN.content
WNZMSN.inputflash = WNZMSN.inputflash + '&mintime=' + WNZMSN.minimo
WNZMSN.inputflash = WNZMSN.inputflash + '&maxtime=' + WNZMSN.maximo
WNZMSN.inputflash = WNZMSN.inputflash + '&showtime=' + WNZMSN.visible;

WNZMSN.init = function(){
	//alert('INIT');
	document.getElementById('WNZMSNp').style.left = '' + (WNZgetLeft() + WNZgetWidth() - WNZMSN.size - WNZMSN.securityright) + 'px';
	document.getElementById('WNZMSNp').style.top = '' + (WNZgetTop() + WNZgetHeight() - WNZMSN.small - WNZMSN.size) + 'px';
	document.getElementById('WNZMSNp').style.width = '' + WNZMSN.size + 'px';
	document.getElementById('WNZMSNp').style.height = '' + (WNZMSN.small + 1) + 'px';
	document.getElementById('WNZMSNc').style.top = '' + WNZMSN.small + 'px';
	WNZMSN.opened = false;
}

WNZMSN.big = function(){
	//alert('BIG');
	if (WNZMSN.timeout){
		clearTimeout(WNZMSN.timeout);
		WNZMSN.timeout = null;
	}
		
	document.getElementById('WNZMSNp').style.left = '' + (WNZgetLeft() + WNZgetWidth() - WNZMSN.size - WNZMSN.securityright) + 'px';
	document.getElementById('WNZMSNp').style.top = '' + (WNZgetTop() + WNZgetHeight() - WNZMSN.size) + 'px';
	document.getElementById('WNZMSNp').style.width = '' + WNZMSN.size + 'px';
	document.getElementById('WNZMSNp').style.height = '' + WNZMSN.size + 'px';
	document.getElementById('WNZMSNc').style.left = '0px';
	document.getElementById('WNZMSNc').style.top = '0px';
	WNZMSN.opened = true;
}

WNZMSN.scroll = function(){
	var popupsize;
	if (WNZMSN.opened) popupsize = WNZMSN.size;
	else popupsize = (WNZMSN.small + WNZMSN.size);;

	document.getElementById('WNZMSNp').style.left = '' + (WNZgetLeft() + WNZgetWidth() - WNZMSN.size - WNZMSN.securityright) + 'px';
	document.getElementById('WNZMSNp').style.top = '' + (WNZgetTop() + WNZgetHeight() - popupsize) + 'px';
	return;
}

document.write('<div id="WNZMSNp" style="position:absolute; top:0px; left:100px; width:' + WNZMSN.size + '; height:' + WNZMSN.small + '; overflow:hidden; text-align:right">');
document.write('	<div id="WNZMSNc" style="position:relative; width:' + WNZMSN.size + 'px; height:' + WNZMSN.size + 'px; left:' + 0 + 'px; top:' + (WNZMSN.small) + 'px">');
document.write('		<object wmode="transparent" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + WNZMSN.size + '" height="' + WNZMSN.size + '" id="WNZMSNcorner" align="middle">');
document.write('		<param name="allowScriptAccess" value="always" />');
document.write('		<param name="allowFullScreen" value="false" />');
document.write('		<param name="FlashVars" value="' + WNZMSN.inputflash + '"/>');
document.write('		<param name="movie" value="' + WNZMSN.file + '?' + WNZMSN.inputflash + '" />');
document.write('		<param name="quality" value="high" />');
document.write('		<param name="wmode" value="transparent" />');
document.write('		<param name="bgcolor" value="#ffffff" />');
document.write('		<embed wmode="transparent" src="' + WNZMSN.file + '?' + WNZMSN.inputflash + '" quality="high" bgcolor="#FF0000" width="' + WNZMSN.size + '" height="' + WNZMSN.size + '" name="video" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('		</object>');
document.write('	</div>');
document.write('</div>');

if (window.attachEvent) window.attachEvent('onload',WNZMSN.init);
else window.addEventListener("load",WNZMSN.init,false);

if (window.attachEvent) window.attachEvent('onresize',WNZMSN.scroll);
else window.addEventListener("resize",WNZMSN.scroll,false);

if (window.attachEvent) window.attachEvent('onscroll',WNZMSN.scroll);
else window.addEventListener("scroll",WNZMSN.scroll,false);
