var _gpSlideIn = _gpSlideIn || {};

_gpSlideIn = {
	major : 1,
	minor : 0,

	// ------------------------------------------------------------
	// Définie les différentes propriétés
	// ------------------------------------------------------------

	utc         	: '',
	id				: 6541,
	width       	: 0,
	height      	: 0,
	delay_first_open	: 20,
	delay_load			: 0.5,
	bOuvert 		: false,
	isIE 			: false, 
    isIE_nav		: false, 
	alignH			: 0,
	alignV			: 1,
	distanceBord	: 50,
	url_image		: 'http://mediatag.gestionpub.com/slidein/',
    
	init : function(utc, id, width, height, delay_first_open,delay_load, alignH,alignV,distanceBord) {
		this.utc        = utc;		
		this.width      = width;
		this.height     = height;
		this.delay_first_open	= delay_first_open;
		this.delay_load = delay_load;
		this.bOuvert	= false;
		this.alignH     = alignH;
		this.alignV     = alignV;
		this.distanceBord = distanceBord;
        this.bBoucler   = true;
		
		var useragent = navigator.userAgent;
		var pos = useragent.indexOf('MSIE');
		if (pos > -1) {
			ver = useragent.substring(pos + 5);
			var pos = ver.indexOf(';');
			var ver = ver.substring(0,pos);
		}
		isIE = ((pos > -1 && ver == "6.0")); // || (ver == "7.0" && document.compatMode == "BackCompat")
        isIE_nav = (pos > -1);

        //isIE = false;

		this.decompress();
		
		this.genererStyle();
		this.genererDiv();
		this.render(); 
	},
	prefixImage : function () {
		if (this.alignH == 0)
			return "_g";
		else
			return "_d";
	},
	decompress : function() {
		//*********************************************************
		eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('4 R(){}R.1h=4(o,f){8 a=w H();8 l=v.C;P(8 i=2;i<l;i++)a[i-2]=v[i];6 4(){8 1m=[].1L(v,a);f.1n(o,1m)}};O=4(n,u,j,h,z,x,k){3.1a(n,u,j,h,z,x,k)};8 t=O.1u;t.n=w 1v();t.u=\'\';t.j=4(t,b,c,d){6 c*t/d+b};t.h=0;t.G=0;t.1i=0;t.14=0;t.1p=Q;t.m=0;t.g=0;t.E=0;t.1w=0;t.N=0;t.1x=0;t.1y=\'\';t.k=\'\';t.D=w H();t.1j=4(t){3.1i=3.g;9(t>3.11()){9(3.1p){3.F(t-3.m);3.s();3.q(\'19\',{A:3,B:\'19\'})}y{3.g=3.m;3.s();3.T();3.q(\'1g\',{A:3,B:\'1g\'})}}y 9(t<0){3.F();3.s()}y{3.g=t;3.s()}};t.16=4(){6 3.g};t.X=4(d){3.m=(d==1c||d<=0)?1M:d};t.11=4(){6 3.m};t.1e=4(p){3.14=3.E;8 a=3.k!=\'\'?3.k:\'\';3.n[3.u]=1D.1F(p)+a;3.E=p;3.q(\'17\',{A:3,B:\'17\'})};t.1f=4(t){9(t==W)t=3.g;6 3.j(t,3.h,3.G,3.m)};t.V=4(f){3.G=f-3.h};t.1G=4(){6 3.h+3.G};t.1a=4(n,u,j,h,z,x,k){9(!v.C)6;3.D=w H();3.1l(3);9(k)3.k=k;3.n=n;3.u=u;3.h=h;3.E=h;3.X(x);9(j!=1c&&j!=\'\'){3.j=j};3.V(z)};t.Z=4(){3.F();3.M();3.q(\'1d\',{A:3,B:\'1d\'})};t.F=4(t){3.T();3.g=(t==W)?0:t;3.I();3.s()};t.1I=4(){3.g=3.m;3.I();3.s()};t.s=4(){3.1e(3.1f(3.g))};t.M=4(){3.S();3.U=15;3.L()};t.L=4(){9(3.U){3.12();1K(R.1h(3,3.L),0)}};t.12=4(){3.1j((3.Y()-3.N)/10)};t.T=4(){3.S();3.q(\'1k\',{A:3,B:\'1k\'})};t.S=4(){3.U=Q};t.1o=4(z,x){3.h=3.E;3.V(z);9(3.m!=W)3.X(x);3.Z()};t.1q=4(){3.I();3.M();3.q(\'18\',{A:3,B:\'18\'})};t.1s=4(){3.1o(3.h,3.g)};t.1l=4(o){3.13(o);6 3.D.1b(o)};t.13=4(o){8 a=3.D;8 i=a.C;1A(i--){9(a[i]==o){a.1E(i,1);6 15}};6 Q};t.q=4(){8 J=w H();P(8 i=0;i<v.C;i++){J.1b(v[i])}8 e=J.1H();8 a=3.D;8 l=a.C;P(8 i=0;i<l;i++){9(a[i][e])a[i][e].1n(a[i],J)}};t.I=4(){3.N=3.Y()-3.g*10};t.Y=4(){6 w 1B().16()-3.g};O.1J=4(t,b,c,d){9((t/=d)<(1/2.r)){6 c*(7.K*t*t)+b}y 9(t<(2/2.r)){6 c*(7.K*(t-=(1.5/2.r))*t+.r)+b}y 9(t<(2.5/2.r)){6 c*(7.K*(t-=(2.1t/2.r))*t+.1z)+b}y{6 c*(7.K*(t-=(2.1r/2.r))*t+.1C)+b}};',62,111,'|||this|function||return||var|if|||||||_time|begin||func|suffixe||_duration|obj|||broadcastMessage|75|update||prop|arguments|new|duration|else|finish|target|type|length|_listeners|_pos|rewind|change|Array|fixTime|arr|5625|onEnterFrame|startEnterFrame|_startTime|Tween|for|false|Delegate|stopEnterFrame|stop|isPlaying|setFinish|undefined|setDuration|getTimer|start|1000|getDuration|nextFrame|removeListener|prevPos|true|getTime|onMotionChanged|onMotionResumed|onMotionLooped|init|push|null|onMotionStarted|setPosition|getPosition|onMotionFinished|create|prevTime|setTime|onMotionStopped|addListener|aP|apply|continueTo|looping|resume|625|yoyo|25|prototype|Object|_position|_finish|name|9375|while|Date|984375|Math|splice|round|geFinish|shift|fforward|bounceEaseOut|setTimeout|concat|100000'.split('|'),0,{}))
		//*********************************************************
	},

    gp_getStyleObject  : function(objectId) {
    
	    if (document.getElementById && document.getElementById(objectId))
	    {
		    return document.getElementById(objectId).style;
	    } 
	    return false;
    },
    alignVertical : function() {
    

        try{

	        //clearTimeout(o_gp.gp_id_h);
            monID = 6228;
	        var t_st=document.getElementById('gp_slidein_' + monID).style;
	        var m=1;
	        var gp_avl_h = document.body.clientHeight;
	        var scrollz = document.body.scrollTop;	
	        var gp_avl_h_2 = document.documentElement.clientHeight;
	        var scrollz_2 = document.documentElement.scrollTop;
	        try {if ((top != self) && (gp_avl_h_2 != 0)) m=2;}
	        catch(e) {m=2;}
	        if (gp_avl_h_2 && gp_avl_h_2 < gp_avl_h) m=2;
	        if (gp_avl_h_2 > gp_avl_h && gp_avl_h_2 < screen.height) m=2;
	        if (gp_avl_h_2 > screen.height) m=1;	
	        if (scrollz_2 > 0 && scrollz == 0) m=2;
	        if (scrollz > 0 && scrollz_2 == 0) m=1;
        	
	        if (m == 2)
	        {
		        gp_avl_h = gp_avl_h_2;
		        scrollz = scrollz_2;				
	        }					
	        else {if (screen.height < gp_avl_h) {gp_avl_h=250;}}	
	        var gp_good_h=gp_avl_h+scrollz-350;    			
	        if (gp_good_h < 0) gp_good_h = 0;
        	
	        t_st.top=gp_good_h+"px";

        }
        catch(e) {}	    
    },
	genererStyle : function () {
		monStyle = '#gp_slidein_' + this.id + ' ' + 
		'{' +		
            ((isIE_nav)?"position: absolute;":"position: fixed;") + 
			((this.alignV==0)?('bottom: '):('top: ')) + this.distanceBord + 'px;' + 
			((this.alignH==0)?('left:' + '-' + (this.width + 100) + 'px;'):('right:' + (window.screen.width + 10) + 'px;'))+ 
			'margin:0;padding:0;' + 
			'width: ' + (this.width + 44) + 'px;' +
			'height: ' + (this.height + 71) + 'px;' + 
			'z-index: 2147483647 !important;' + 
		'}' + 
		'#GP_' + this.id + '' + 
		'{	' + 
		'	position: absolute;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 20 - 66) + 'px;' + 
		'	top: 9px;' + 
		'	width: 66px;' + 
		'	height: 10px;' + 
        ((isIE)?"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.url_image + "images/GP.png');background: none;":"background: url('" + this.url_image + "images/GP.png') no-repeat;") + 
		'}' + 
		'#gp_barre_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		'	top: 9px;' + 
		((this.alignH==0)?('left:'):('right:')) + '0px;' + 
		'	width: ' + (this.width + 36) + 'px;' + 
		'	height: 20px;' + 
		'	background: url(' + this.url_image + 'images/barre.png) repeat-x;    ' + 
		'}' + 
		'#gp_coin_haut_' + this.id + '' + 
		'{	' + 
		'	position: absolute;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 20) + 'px;' + 
		'	top: 1px;' + 
		'	width: 29px;' + 
		'	height: 28px;' + 
        ((isIE)?"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.url_image + "images/coin_haut" + this.prefixImage() + ".png');background: none;":"background: url('" + this.url_image + "images/coin_haut" + this.prefixImage() + ".png') no-repeat;") + 
		'}' + 
		'#gp_coin_bas_' + this.id + '' + 
		'{	' + 
		'	position: absolute;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 20) + 'px;' + 
		'	top: ' + (this.height + 49) + 'px;' + 
		'	width: 20px;' + 
		'	height: 20px;' + 
		((isIE)?"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.url_image + "images/coin_bas" + this.prefixImage() + ".png');background: none;":"background: url('" + this.url_image + "images/coin_bas" + this.prefixImage() + ".png') no-repeat;") + 
		'}' + 
		'#fond_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		'	background-color:#000000;' + 
		'	opacity:0.7;' + 
		'	KHTMLOpacity:0.7;'+
        '	filter:alpha(opacity:70);' + 
		((this.alignH==0)?('left:'):('right:')) + '0px;' + 
		'	top: 29px;' + 
		'	width: ' + (this.width + 20) + 'px;' + 
		'	height: ' + (this.height + 38) + 'px;' + 		
		'}' + 
		'#fond_' + this.id + '_cplmt' + 
		'{' + 
		'	position: absolute;' + 
		'	background-color:#000000;' + 
		'	opacity:0.7;' + 		
        '	KHTMLOpacity:0.7;'+
        '	filter:alpha(opacity:70);' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 20) + 'px;' + 
		'	top: 29px;' + 
		'	width: 18px;' + 
		'	height: ' + (this.height + 20) + 'px;' + 
		'}' + 
		'#filet_cote_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 38) + 'px;' + 
		'	top: 29px;' + 
		'	height: ' + (this.height + 20) + 'px;' + 
		'}' + 
		'#filet_bas_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		'	margin: 0;' + 
		((this.alignH==0)?('left:'):('right:')) + '0px;' + 
		'	top: ' + (this.height + 67) + 'px;' + 
		'	width: ' + (this.width + 20) + 'px;' + 
		'}' + 
		'#lueur_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 40 - 111)  + 'px;' + 
		'	top: 29px;' + 
		'	height: ' + (this.height + 40) + 'px;' + 
		'	width: 110px;' + 
		((isIE)?"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.url_image + "images/lueur" + this.prefixImage() + ".png');	background: none;":"background: url('" + this.url_image + "images/lueur" + this.prefixImage() + ".png') no-repeat;") + 
		'}' + 
		'#gp_bord_haut_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		((this.alignH==0)?('left:'):('right:')) + '0px;' + 
		'	top: 3px;' + 
		'	width:6px;' + 
		'	height:6px;' + 
		((isIE)?"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.url_image + "images/bord_haut" + this.prefixImage() + ".png');	background: none;":"background: url('" + this.url_image + "images/bord_haut" + this.prefixImage() + ".png') no-repeat;") + 
		'}' + 
		'#gp_bord_bas_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		((this.alignH==0)?('left:'):('right:')) + '0px;' + 
		'	top: ' + (this.height + 69) + 'px;' + 
		'	width:6px;' + 
		'	height:6px;' + 
		((isIE)?"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.url_image + "images/bord_bas" + this.prefixImage() + ".png');	background: none;":"background: url('" + this.url_image + "images/bord_bas" + this.prefixImage() + ".png') no-repeat;") + 
		'}' + 
		'#gp_iframe_' + this.id + 
		'{' + 
		'	position: absolute;' + 
		'	top: 49px;' + 
		((this.alignH==0)?('left:'):('right:')) + '20px;' + 
		'	padding: 0px;margin: 0px;background: transparent;' + 
		'}' + 
		'#gp_boutons_' + this.id + '' + 
		'{' + 
		'	position: absolute;' + 
		'	top: 39px;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 28) + 'px;' + 
		'	width:8px;' + 
		'	height:29px;' + 
		'	padding: 0px;margin: 0px;' + 
		((isIE)?"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.url_image + "images/boutons.png');background: none;":"background: url('" + this.url_image + "images/boutons.png') no-repeat;")+ 
		'}'+
		'#gp_close_' + this.id + ' ' + 
		'{' + 
		'	position: absolute;' + 
		'	top: 39px;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 28) + 'px;' + 
		'	width:7px;' + 
		'	height:7px;' + 
		'}'+
		'#gp_hide_' + this.id + ' ' + 
		'{' + 
		'	position: absolute;' + 
		'	top: 50px;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 28) + 'px;' + 
		'	width:7px;' + 
		'	height:7px;' + 
		'}'+
		'#gp_show_' + this.id + ' ' + 
		'{' + 
		'	position: absolute;' + 
		'	top: 0px;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width +28) + 'px;' + 
		'	width:23px;' + 
		'	height:' + (this.height + 61) + 'px;' + 
		'}'+
		'#gp_lien_' + this.id + ' ' + 
		'{' + 
		'	position: absolute;' + 
		'	top: 2px;' + 
		((this.alignH==0)?('left:'):('right:')) + (this.width + 24) + 'px;' + 
		'	width:21px;' + 
		'	height:22px;' + 
		'}'
		document.write('<st' + 'yle type="text/css" >' + monStyle + '</st' + 'yle>');
	},
	genererDiv : function () {
	
		document.write( "<div id='gp_slidein_" + this.id + "' style='" + ((this.alignH==0)?('left:'):('right:')) + "-" + (this.width + 200) + "px;' > " + 
					"<div id='gp_barre_" + this.id + "'></div> " + 
					"<div id='gp_coin_haut_" + this.id + "'></div>" + 
					"<div id='fond_" + this.id + "'></div>" + 
					"<div id='fond_" + this.id + "_cplmt'></div>" + 
					"<div id='gp_coin_bas_" + this.id + "'></div>" + 
                    "<a id='GP_" + this.id + "' href='http://www.gestionpub.com' title='Gestion Publicitaire' target='_blank' alt='GestionPub' ></a>" +                    
					"<img src='" + this.url_image + "images/filet_cote.png'  id='filet_cote_" + this.id + "' width='2' align='bottom' >" + 
					"<img src='" + this.url_image + "images/filet_bas.png'  id='filet_bas_" + this.id + "' height='2' align='right' >" + 
					"<div id='lueur_" + this.id + "' ></div>" + 
					//src='images/lueur.png'  height='110' width='110' align='right' 
					"<div id='gp_bord_bas_" + this.id + "'></div>" + 
					"<div id='gp_bord_haut_" + this.id + "'></div>" + 
					"<div id='gp_boutons_" + this.id + "'></div>" + 
					"<a id='gp_lien_" + this.id + "' href='http://www.gestionpub.com' title='Gestion Publicitaire' target='_blank' alt='GestionPub' ></a>" + 
					"<a id='gp_close_" + this.id + "' href='javascript:_gpSlideIn.gp_close()' title='Fermer'></a>" + 
					"<a id='gp_show_" + this.id + "' href='javascript:_gpSlideIn.gp_display()' onmouseover='_gpSlideIn.gp_display()' title='Afficher'></a>" + 
					"<a id='gp_hide_" + this.id + "' href='javascript:_gpSlideIn.gp_hides()' title='Cacher'></a>" + 
					"<iframe id='gp_iframe_" + this.id + "' width='" + this.width + "' height='" + this.height + "' frameborder='0' scrolling='no' style='border: 0px none ;' marginwidth='0' marginheight='0' vspace='0' hspace='0' src='http://display.gestionpub.com/23f11/43f68e32959f2a057/63f28e22989f3f/86f31c7a-7964-4e70-a9e4-fd20c6511fca'>" + 
					"</iframe>" + 
				"</div>");
		
		//document.write(mesDiv);
	
	},
    writeCookie : function(name, value)
	{					
		document.cookie = name + '=' + escape(value) + ';path=/';			
	},

	getCookieVal : function(offset)
	{
		var endstr = document.cookie.indexOf (';', offset);
		if (endstr == -1) endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	},
    readCookie : function(name)
	{
		var arg = name + '=';
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i<clen) {
			var j = i + alen;
			if (document.cookie.substring(i, j)==arg) return this.getCookieVal(j);
			i=document.cookie.indexOf(' ',i)+1;
			if (i==0) break;
		}
		return null;
	},
    isOpen : function()
    {
        if (navigator.userAgent.toLowerCase().indexOf('safari')>0)
		{
		    if (this.readCookie('_gpSlideIn_isOpen' +  this.id)!=null) 
                return true;    //a déjà étét ouvert --> on ne l'ouvre plus                       
            else
            {
                this.writeCookie('_gpSlideIn_isOpen' +  this.id,'1');
                return false;   //n'a jamais étét ouvert
            }
		}
        else
            return false;
    },
	render : function ()
    {
		
	    if (!this.isOpen())
        {
	        //Ouvre le slide après 1s
	        setTimeout("_gpSlideIn.gp_open(" + this.id + ")", this.delay_load * 1000);

            //Ajoute un timer pour l'alignement si besoin
            if (isIE_nav)
                window.onscroll = this.alignVertical;

            var monIframe = document.getElementById('gp_iframe_' + this.id);
            monIframe.src = monIframe.src;
        }
	},
	gp_show : function ()
	{
		if (o_gp._OPOK)
		{
			var owab = document.getElementById(o_gp._DIVID);
			if (owab != null && owab.filters) owab.filters.item(o_gp._FTR).opacity=100;
		}
	},

	gp_hide : function (){gp_getStyleObject(o_gp._DIVID).display='none';},

	gp_open : function (monID) {
		if (!this.bOuvert)
		{
         //      alert('iframe_' + monID);
  
			this.bOuvert = true;
			if (this.delay_first_open > 0)
				setTimeout("_gpSlideIn.gp_hides()", this.delay_first_open * 1000);
			
			if (this.alignH == 0)
			{
				gp_slidein_mc = document.getElementById('gp_slidein_' + monID);
				gp_slidein_mc.style.left = (-this.width-21) + "px";
				document.getElementById('gp_show_' + monID + '').style.display = "none";
				move = new Tween(gp_slidein_mc.style,'left','',parseInt(gp_slidein_mc.style.left),10,1,'px');
				move.func = Tween.bounceEaseOut;
			}
			else
			{
				gp_slidein_mc = document.getElementById('gp_slidein_' + monID);
				gp_slidein_mc.style.right = "0px";
				document.getElementById('gp_show_' + monID + '').style.display = "none";
				move = new Tween(gp_slidein_mc.style,'width',Tween.bounceEaseOut,25,this.width + 44,1,'px');
				
				//new Tween(elem.style,'width',Tween.bounceEaseOut,25,100,0.5,'px')
				
				//move.func = Tween.bounceEaseOut;
			}
			
			var a = new Object();
			a.onMotionFinished = function(){
				maDiv = 'gp_show_' + monID;
				if(document.getElementById(maDiv).style.display == "none") {
			   document.getElementById(maDiv).style.display = "block";
			}
			};
			move.addListener(a);
			move.continueTo(0,1);
		}
		return false;
	},

	gp_close : function () {
		gp_slidein_mc.style.display = "none";
		this.bOuvert = false;
	},

	gp_display : function () {
		document.getElementById('gp_show_' + this.id + '').style.display = "none";
		move.continueTo(0,1);
	},

	gp_hides : function () {
		document.getElementById('gp_show_' + this.id + '').style.display = "none";
		move.continueTo((-this.width-21),1);
		this.bOuvert = false;


//        if (this.bBoucler)
//        {
//            //Ouvre le slide après xs
//		    setTimeout("_gpSlideIn.gp_open(" + this.id + ")", this.delay_load * 1000);
//        }

	}
}
_gpSlideIn.init("http://display.gestionpub.com/23f11/43f68e32959f2a057/63f28e22989f3f/86f31c7a-7964-4e70-a9e4-fd20c6511fca", 6228,300,250,10,0,0,0,10);