
params = {type:'SWF',data:'http://oas.jvn.com/0/JeuxVideo/TEST_MPAVE_AVANT-VIDEO_depr_0509/KL_300x250_ROS_initial.swf ',click_url:' http://oas.jvn.com/5c/www.jvn.com/webtv/L17/691152901/x01/JeuxVideo/TEST_MPAVE_AVANT-VIDEO_depr_0509/mpave_flash_kane_hp.html/5475457051456f53326e67414142764e? ',count_url:'',target:'_blank',width:300,height:250,wide:false}

var ads= new Array();
var isOpera =navigator.userAgent.indexOf('Opera') > -1;

var isIe8 =navigator.userAgent.indexOf('MSIE 8.0') > -1;

function ouvrePub(params){

		if(!params)
			return;
		var standalone = params.standalone;
		var where = $('webtv_player');
		var webTv = true;
		if(!where){
				if(!standalone){
					where = $('player_light');
					webTv = false;
				}else{
					where = $(document.body);
				}
			}

		if(!where)
			return;

		if($("adShow"))
			fermePub();

		var mustBeSet = $A(new Array('type','data','click_url','count_url','width','height','target','wide'));
		try{
			mustBeSet.each(function(key)
			{
				if(params[key] === undefined ){
					throw "break";
				}
			})
		}catch(e){
			return;
		}
		
		
		
		var divM = new Element("div",{id:"divMAdShow"});

		var leftDivM = params.wide ? "196px" :"335px";
		var widthDivM = params.wide ? "558px" :"419px";
		var heightDivM =  '314px';
		var topDivM = '330px';

		if(!webTv){
		 leftDivM = params.wide ? "196px" :"158px";
		 widthDivM = params.wide ? "558px" :"480px";
		 heightDivM =  '361px';
		 topDivM = '395px';
		}else if(!standalone){
			divM.setStyle("top",topDivM);
			divM.setStyle('left',leftDivM);
		}else{
			divM.setStyle("top",0);
			divM.setStyle('left',0);
		}

		divM.setStyles({

			position:'absolute',
			width:widthDivM,
			height:heightDivM
		});

		var div = new Element("div",{id:"adShow"});
			var marginL = -(parseInt(params.width)/2);
			var marginT = -(parseInt(params.height)/2) ;
			
			
			var styles = {
			width:params.width,
			height:params.height,
			zIndex:'1000',
			left:  '50%',
			top:'50%',
			marginTop:marginT +"px",
			marginLeft : marginL+ "px",
			position:'absolute'
		};
		div.setStyles(styles);
		
		
		if(standalone){
		
			var left = (params.wide == "true"  ? "290px" :"210px");
			var top = "158px";

			div.setStyle('left',left );
			div.setStyle('top',top);
			
		}//standalone

		var type = params.type.toUpperCase();
		var a = new Element("a",{'href':params.click_url,'target':params.target})

		if(type == "GIF"){
			var img = new Element("img",{'src':params.data});
			img.inject(a);
			a.inject(div)

		}
		else if(type == "HTML"){
			div.set("html",params.data);
		}else if(type == "SWF")
		{
			 
			
			var bottom = (( parseInt(heightDivM) - parseInt(params.height))/2)- 10;
				
			
			
				var swfTag= '<embed ' ;
				swfTag  += 'src="'+params.data+'" ';
				swfTag  += ' width="'+params.width+'" ';
				swfTag  += ' height="'+params.height+'" ';
				swfTag  +='  allowfullscreen="true" wmode="transparent"/>';

				div.set('html',swfTag);
				a.set('html',"&nbsp;");
				a.setStyle("width",params.width+"px");
				a.setStyle("marginTop",0);
				a.setStyle("height",params.height+"px");
				a.setStyle("display",'block');
				
				var hackDivIe = new Element("div");
			
				hackDivIe.setStyles(styles)
				hackDivIe.setStyle("width",params.width+"px");
				hackDivIe.setStyle("marginTop",0);
				hackDivIe.setStyle("top","28px");
		
				hackDivIe.setStyle("height",params.height-28+"px");
				hackDivIe.setStyle("zIndex","100");
				hackDivIe.setStyle("background",'transparent url(../img/commun/ie.png) repeat')
				a.setStyle("zIndex","100");
				a.inject(hackDivIe,'top');
				
				var aClone = a.clone(true);
				
				var hackDivIeClone = new Element("div");
				
				hackDivIeClone.setStyles(styles)
				
				hackDivIeClone.setStyle("width",params.width-37+"px");
				hackDivIeClone.setStyle("marginTop",0);
				hackDivIeClone.setStyle("top","28px");
		
				hackDivIeClone.setStyle("height",params.height-28+"px");
				hackDivIeClone.setStyle("zIndex","100");
				hackDivIeClone.setStyle("background",'transparent url(../img/commun/ie.png) repeat')
				
				
				hackDivIe.inject(div,'top');
				hackDivIeClone.inject(div,'top');
				aClone.setStyle("marginTop",0);
				aClone.setStyle("height",params.height+"px");
				aClone.setStyle("display",'block');
				aClone.setStyle("margin","0");
				
				if(webTv )
					divM.setStyle("bottom",bottom+"px");
				
				a.setStyle("height",parseInt(params.height)-bottom+"px");
				hackDivIeClone.setStyle("position","absolute");
				hackDivIeClone.setStyle("top","-"+bottom+"px");
				hackDivIeClone.setStyle("cursor","pointer");
				
				if(isIe8){
					hackDivIeClone.onclick = function(){
						  window.open(a.href);
				}
				}
				
			
				aClone.setStyle("width",params.width-37+"px");
				aClone.setStyle("zIndex","10000");
				aClone.inject(hackDivIeClone,'top');
			
							

		}
		else return;

		var img = new Element("img",{'src':params.count_url,'width':'0px','height':'0px'});
		if(isOpera)
			where.getElement("embed").setStyle("visibility","hidden");

		divM.inject(where,'top');


		div.inject(divM,'top');


	}//ouvre_pub


	function fermePub(){
	var where = $('webtv_player');
		var webTv = true;
		if(!where){
			where = $('player_light');
			webTv = false;
			}

		if(!where)
			return;
		var div = $('divMAdShow');
		if(div)
			div.destroy();

		if(isOpera)
			where.getElement("embed").setStyle("visibility","visible");


	}//ferme_pub

	function beforeReloadAd(){
		
		 document.OAS_rns = String(Math.random()).substr(2,9);
		 urlScriptOas =  OAS_url + '4/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + OAS_query ;

		 var s = document.createElement('script');
		 s.src = urlScriptOas;
		 s.type = 'text/javascript';
		 document.body.appendChild(s);
	}
	


function reloadAd(){
	$('pub_col_right_iframe').contentWindow.location.reload(true);
	$('pub_top_menu_iframe').contentWindow.location.reload(true);
}//reloadAd



	



