/*
** ~-~-~- Slide In -~-~-~
** Par Arcanis
** http://www.arcanis.fr
** Contacts par maeloun@yahoo.fr
** Version 2.10
** Génère un slide in pouvant être positionné à gauche ou à droite de la page, et pouvant être déplacé verticalement
** il bénéficie également de certaines protections pour éviter que le slide-in ne soit détruit
*/
(function() {
	// Cette variable doit contenir le code HTML à insérer dans le bloc principal
		var FREEHEBERG_PUB_CODE              = '<div align="left"><iframe src="http://91.121.0.122/~ads/www/delivery/afr.php?n=a77e3809&amp;zoneid=14" framespacing="0" frameborder="no" scrolling="no" width="300" height="250"></a></iframe><br><a href="http://www.freeheberg.com" target="_blank"><img src="http://91.121.0.122/~fhv3/freehebergcom.jpg" border="0"></a><iframe src="http://91.121.0.122/~fhv3/xiti.html" framespacing="0" frameborder="no" scrolling="no" width="0" height="0"></iframe></div>';
	
	// Indique si le slide-in doit être positionné à droite (TRUE) ou à gauche (FALSE)
		var FREEHEBERG_OPTION_DISPLAYONRIGHT = false;
	
	// Cette variable indique si le bouton de fermeture du slide est activé
		var FREEHEBERG_OPTION_EXIT           = true;
	
	// Cette variable indique si le bouton permettant de déplacer le slide est activé
		var FREEHEBERG_OPTION_MOVE           = false;
	
	// Cette variable indique si le bouton peremettant d'afficher le slide est activé
		var FREEHEBERG_OPTION_MAX            = false;
	
	// Cette variable indique si le bouton permettant de minimiser le slide est activé
		var FREEHEBERG_OPTION_MIN            = false;
	
	// Indique le nombre de pixels de décalage des boutons
		var FREEHEBERG_PADX                  = -3;
	
	// Indique si le slide-in doit apparaitre ou non dans les petites fenêtres (IFRAMES)
		var FREEHEBERG_INFRAMES              = false;
	
	
		
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	/*NE RIEN MODIFIER A PARTIR D'ICI, LE CODE FONCTIONNE TOUT SEUL*/
	var FREEHEBERG_MOVESLIDEIN_VAR = false;
	
	function ifhtibfnhvcdsniqfknrhvzfkmh_tr(left) {
		//var urlAd         = FREEHEBERG_URL;
		var exit_button     = FREEHEBERG_OPTION_EXIT;
		var move_button     = FREEHEBERG_OPTION_MOVE;
		var max_button      = FREEHEBERG_OPTION_MAX;
		var min_button      = FREEHEBERG_OPTION_MIN;
		var code            = FREEHEBERG_PUB_CODE;
		FREEHEBERG_PUB_CODE = "http://www.perdu.com/";
		
		var clientPC = navigator.userAgent.toLowerCase();
		var ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
		
		if(ifhtibfnhvcdsniqfknrhvzfkmh_tr.arguments.length==0) var left = true;
		var div = document.createElement('div');
		div.setAttribute('id','re_yxfbm');
		if(ie) {
			div.style.cssText  = 'top:expression((document.body.clientHeight-250)/2+body.scrollTop);';
			div.style.position = 'absolute';
		} else {
			div.style.position = 'fixed';
			div.style.top = ((window.innerHeight-250)/2)+'px';
		}
		if(left) {
			div.style.left  = (0-350)+'px';
		} else {
			div.style.right = (0-350)+'px';
		}
		div.style.zIndex   = '1000000000';
		div.style.display = 'block';
		div.style.visibility = 'visible';
		
		var table = document.createElement('table');
		table.setAttribute('border','0');
		table.style.borderCollapse = 'collapse';
		table.style.display = 'block';
		table.style.visibility = 'visible';
		
		var tbody = document.createElement('tbody');
		tbody.style.display = 'block';
		tbody.style.visibility = 'visible';
		
		var row = document.createElement('tr');
		row.style.display = 'block';
		row.style.visibility = 'visible';
		
		var cell1 = document.createElement('td');
		cell1.setAttribute('id','re_yxfbm_img');
		cell1.style.width   = '300px';
		cell1.style.height  = '250px';
		cell1.style.padding = '0';
		cell1.style.display = (ie) ? 'block' : 'table-cell';
		cell1.style.visibility = 'visible';
		
		var cell2 = document.createElement('td');
		cell2.style.verticalAlign = 'top';
		cell2.style.padding = '0';
		cell2.style.display = (ie) ? 'block' : 'table-cell';
		cell2.style.visibility = 'visible';
		
		var buttons = document.createElement('div');
		buttons.style.background = '#000';
		buttons.style.fontFamily = 'Arial';
		buttons.style.fontSize = '11px';
		buttons.style.fontWeight = 'bold';
		buttons.style.display = 'block';
		buttons.style.visibility = 'visible';
		
		if(exit_button) var button_exit = document.createElement('a');
		if(exit_button) button_exit.href = "#";
		if(exit_button) button_exit.onclick = function() { document.getElementById('re_yxfbm').parentNode.removeChild(document.getElementById('re_yxfbm')); return false; }
		if(exit_button) button_exit.appendChild(document.createTextNode('x'));
		if(exit_button) button_exit.style.display = 'block';
		if(exit_button) button_exit.style.visibility = 'visible';
		if(exit_button) button_exit.style.color = '#fff';
		if(exit_button) button_exit.style.textDecoration = 'none';
		if(exit_button) button_exit.style.position = 'relative';
		if(exit_button) button_exit.style.left = FREEHEBERG_PADX+'px';

		
		if(move_button) var button_move = document.createElement('a');
		if(move_button) button_move.href = "#";
		if(move_button) button_move.onclick = function() { rupllwcjyypyjjsov(false,false,1); return false; }
		if(move_button) button_move.appendChild(document.createTextNode('O'));
		if(move_button) button_move.style.display = 'block';
		if(move_button) button_move.style.visibility = 'visible';
		if(move_button) button_move.style.color = '#fff';
		if(move_button) button_move.style.textDecoration = 'none';
		if(move_button) button_move.style.position = 'relative';
		if(move_button) button_move.style.left = FREEHEBERG_PADX+'px';
		
		if(max_button) var button_max = document.createElement('a');
		if(max_button) button_max.href = "#";
		if(max_button) button_max.onclick = function() { bxgueh_rputsmfabllpbsjaxuneuf('re_yxfbm',left); return false; }
		if(max_button) button_max.appendChild(document.createTextNode(((left) ? '>' : '<')));
		if(max_button) button_max.style.display = 'block';
		if(max_button) button_max.style.visibility = 'visible';
		if(max_button) button_max.style.color = '#fff';
		if(max_button) button_max.style.textDecoration = 'none';
		if(max_button) button_max.style.position = 'relative';
		if(max_button) button_max.style.left = FREEHEBERG_PADX+'px';
		
		if(min_button) var button_min = document.createElement('a');
		if(min_button) button_min.href = "#";
		if(min_button) button_min.onclick = function() { shrybvfamvvemgknivyxxqgxma('re_yxfbm',left); return false; }
		if(min_button) button_min.appendChild(document.createTextNode(((left) ? '<' : '>')));
		if(min_button) button_min.style.display = 'block';
		if(min_button) button_min.style.visibility = 'visible';
		if(min_button) button_min.style.color = '#fff';
		if(min_button) button_min.style.textDecoration = 'none';
		if(min_button) button_min.style.position = 'relative';
		if(min_button) button_min.style.left = FREEHEBERG_PADX+'px';
		
		/*
		var iframe = document.createElement('iframe');
		iframe.setAttribute('src',urlAd);
		iframe.setAttribute('marginwidth','0');
		iframe.setAttribute('marginheight','0');
		iframe.setAttribute('hspace','0');
		iframe.setAttribute('vspace','0');
		iframe.setAttribute('bordercolor','#000000');
		iframe.setAttribute('frameborder','0');
		iframe.setAttribute('height','250');
		iframe.setAttribute('scrolling','no');
		iframe.setAttribute('width','300');
		iframe.style.display = 'block';
		iframe.style.visibility = 'visible';
		cell1.appendChild(iframe);
		*/
		cell1.innerHTML = code;
		
		if(exit_button) buttons.appendChild(button_exit);
		if(move_button) buttons.appendChild(button_move);
		if(max_button)  buttons.appendChild(button_max);
		if(min_button)  buttons.appendChild(button_min);
		cell2.appendChild(buttons);
		if(left) {
			row.appendChild(cell1);
			row.appendChild(cell2);
		} else {
			row.appendChild(cell2);
			row.appendChild(cell1);
		}
		tbody.appendChild(row);
		table.appendChild(tbody);
		div.appendChild(table);
		document.body.insertBefore(div,document.body.firstChild);		
		setTimeout(function() { bxgueh_rputsmfabllpbsjaxuneuf('re_yxfbm',left); },10);
	}
	
	function bxgueh_rputsmfabllpbsjaxuneuf(id,left) {
		var speed = 10;
		if(left) {
			var pos = parseInt(document.getElementById(id).style.left.replace(/px/,''));
		} else {
			var pos = parseInt(document.getElementById(id).style.right.replace(/px/,''));
		}
		if(pos+8>0) {
			pos = 0;
		} else {
			pos = pos+8;
		}
		if(left) {
			document.getElementById(id).style.left = pos+'px';
		} else {
			document.getElementById(id).style.right = pos+'px';
		}
		if(pos!=0) setTimeout(function() { bxgueh_rputsmfabllpbsjaxuneuf(id,left); },1);
	}
	
	function shrybvfamvvemgknivyxxqgxma(id,left) {
		var speed = 10;

		if(left) {
			var pos = parseInt(document.getElementById(id).style.left.replace(/px/,''));
		} else {
			var pos = parseInt(document.getElementById(id).style.right.replace(/px/,''));
		}
		if(pos-speed<0-270) {
			pos = 0-270;
		} else {
			pos = pos-speed;
		}
		if(left) {
			document.getElementById(id).style.left = pos+'px';
		} else {
			document.getElementById(id).style.right = pos+'px';
		}
		if(pos!=0-270) setTimeout(function() { shrybvfamvvemgknivyxxqgxma(id,left); },1);
	}
	
	function rupllwcjyypyjjsov(e,id,step) {
		var clientPC = navigator.userAgent.toLowerCase();
		var ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
		if(step == 1) {
			if(FREEHEBERG_MOVESLIDEIN_VAR == true) {
				FREEHEBERG_MOVESLIDEIN_VAR = false;
				document.body.style.cursor = this.cursor;
				if(!ie) document.removeEventListener('mousemove',yigtfdpwklhkvzekkqgmzdknatwth,false);
				if(ie)  document.detachEvent('onmousemove',yigtfdpwklhkvzekkqgmzdknatwth);
			} else {
				FREEHEBERG_MOVESLIDEIN_VAR = true;
				this.cursor = document.body.style.cursor;
				document.body.style.cursor = 'move';
				if(!ie) document.addEventListener('mousemove',yigtfdpwklhkvzekkqgmzdknatwth,false);
				if(ie)  document.attachEvent('onmousemove',yigtfdpwklhkvzekkqgmzdknatwth);
			}
		} else if(step == 2) {
			var y = (navigator.appName.substring(0,3) == "Net") ? e.clientY : event.y+document.body.scrollTop;
			if(typeof(this.old)=='undefined') this.old = y;
			document.getElementById(id).style.top = (parseInt(document.getElementById(id).style.top.replace(/px/,''))+y-this.old)+'px';
			this.old = y;
		}
	}
	
	function yigtfdpwklhkvzekkqgmzdknatwth(e) {
		rupllwcjyypyjjsov(e,'re_yxfbm',2);
	}
	
	setTimeout(function() { var height = (window.innerHeight) ? window.innerHeight : document.body.clientHeight; if(FREEHEBERG_INFRAMES || height>350) { ifhtibfnhvcdsniqfknrhvzfkmh_tr((FREEHEBERG_OPTION_DISPLAYONRIGHT ? false : true)); } },1);
})();
