//Check if configuration array is present
if (typeof MurThumbsCD == 'undefined') var MurThumbsCD = new Array();
var imagesBase = 'http://tools.pornattitude.com/thumbs_generator/images/';

//Variabes used by mailcatchers
var config_synergie 	= null;
var config_niche 		= null;
var config_tracked 		= null;
var config_id			= null;

function murThumbs(MurThumbsCD) {
	//Functions
	this.randStr 			= murThumbsRandStr;
	this.updateProgress 	= murThumbsUpdateProgress;
	this.buildThumbs 		= murThumbsBuildThumbs;
	this.loadContent 		= murThumbsloadContent;
	this.popHandle			= 2;
	if (typeof MurThumbsCD['pophtml'] != 'undefined') {
		this.popHandle = parseInt(MurThumbsCD['pophtml']);
	}

	//Fill the options by default or read from user input
	this.instance 					= typeof MurThumbsCD['rand'] != 'undefined' ? MurThumbsCD['rand'] : this.randStr();;
	this.murThumbsOptions			= new Array();
	this.murThumbsImages			= new Array();


	this.murThumbsOptions['id'] 			= typeof MurThumbsCD['id'] != 'undefined' ? MurThumbsCD['id'] : 10000;
	this.murThumbsOptions['tracker'] 		= typeof MurThumbsCD['tracker'] != 'undefined' ? MurThumbsCD['tracker'] : '';
	this.murThumbsOptions['lines'] 			= typeof MurThumbsCD['lines'] != 'undefined' ? parseInt(MurThumbsCD['lines']) : 1;
	this.murThumbsOptions['cols'] 			= typeof MurThumbsCD['cols'] != 'undefined' ? parseInt(MurThumbsCD['cols']) : 1;
	this.murThumbsOptions['count']			= this.murThumbsOptions['cols'] * this.murThumbsOptions['lines'];
	this.murThumbsOptions['synergy'] 		= typeof MurThumbsCD['synergy'] != 'undefined' ? MurThumbsCD['synergy'] : 'hetero';
	this.murThumbsOptions['niche'] 			= typeof MurThumbsCD['niche'] != 'undefined' ? MurThumbsCD['niche'] : 173;
	this.murThumbsOptions['niche_letter']	= 'H';
	this.murThumbsOptions['size'] 			= typeof MurThumbsCD['size'] != 'undefined' ? MurThumbsCD['size'] : '120x90';
	this.murThumbsOptions['popunder'] 		= typeof MurThumbsCD['popunder'] != 'undefined' ? MurThumbsCD['popunder'] : true;
	this.murThumbsOptions['rand'] 			= this.instance;
	this.murThumbsOptions['opacity'] 		= typeof MurThumbsCD['opacity'] != 'undefined' ? MurThumbsCD['opacity'] : 50;
	this.murThumbsOptions['dhtmlpop'] 		= typeof MurThumbsCD['dhtmlpop'] != 'undefined' ? MurThumbsCD['dhtmlpop'] : 0;

	//Update mailcatchers variables
	config_synergie = this.murThumbsOptions['synergy'];
	config_niche	= this.murThumbsOptions['niche'];
	config_tracked	= this.murThumbsOptions['tracker'];
	config_id		= this.murThumbsOptions['id'];

	//Create div holder
	document.write('<div class="MurThumbsCD_'+this.instance+'" id="MurThumbsCD_'+this.instance+'"></div>');

	//Define progress bar sizes
	this.murThumbsPlayerSizes = {
		small: {p_height: 15, p_left:"small_left", p_left_width: 23, p_center: "small_center", p_right: "small_right", p_right_width: 43, p_slider_top: 6, p_slider_height: 3, p_slider_fix: 0, p_play: "small_play", p_play_size: 33},
		big: {p_height: 25, p_left:"left", p_left_width: 59, p_center: "center", p_right: "right", p_right_width: 71, p_slider_top: 10, p_slider_height: 5, p_slider_fix: 0, p_play: "play", p_play_size: 51}
	}

	//Split sizes
	this.murTempSizes 				= this.murThumbsOptions['size'].split("x");
	this.murThumbsOptions['width'] 	= parseInt(this.murTempSizes[0]);
	this.murThumbsOptions['height'] = parseInt(this.murTempSizes[1]);

	//Check if using webmaster thumbs or CD thumbs
	//Change: always load pa thumbs for the catchers
	/*if (typeof MurThumbsCD['thumbs'] == 'undefined') {*/
		//Read from server
		var time 	= new Date();
		var head	= document.getElementsByTagName('head')[0];
		var script	= document.createElement('SCRIPT');
		script.type	= 'text/javascript';
		script.id	= this.instance;
		script.src	= 'http://www.pornattitude.com/index.php/module_client_pornofolies_thumbs_helper?size='+this.murThumbsOptions['size']+'&niche='+this.murThumbsOptions['niche']+'&synergie='+this.murThumbsOptions['synergy']+'&limit='+this.murThumbsOptions['count']+'&r='+time.getTime()+'&rand='+this.instance;
		head.appendChild(script);
	/*}else*/ if (typeof MurThumbsCD['thumbs'] != 'undefined') {
		//Read from configuration
		this.murThumbsImages = MurThumbsCD['thumbs'];

		//Build layout
		this.buildThumbs();
	}
}

function murThumbsloadContent() {
	this.murThumbsOptions['niche_letter'] = eval('niche_letter_'+this.instance);
	if (typeof this.murThumbsImages == 'undefined' || this.murThumbsImages == false) {
		this.murThumbsImages = thumbs;
		this.buildThumbs();
	}
}

function murThumbsRandStr() {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = 8;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}

function murThumbsUpdateProgress(id, step) {
	var maxWidth = this.murThumbsOptions['width'] - this.murThumbsPlayerSizes[this.plsize].p_left_width - this.murThumbsPlayerSizes[this.plsize].p_right_width  + this.murThumbsPlayerSizes[this.plsize].p_slider_fix ;
	document.getElementById('MurThumbsCD_play_'+id+'_'+this.instance).style.visibility='visible';
	var elem = document.getElementById('MurThumbsCD_progress_'+id+'_'+this.instance);
	var width = parseInt((parseInt(elem.style.width.replace("px", "")) + parseInt(step)));
	elem.style.width = width + 'px';

	if (width > maxWidth) {
		elem.style.width = maxWidth;
	}

	if (width < maxWidth) {
		setTimeout("murThumb"+this.instance+".updateProgress('" + id + "', '" + step + "')", 50);
	}
}

function murThumbsBuildThumbs () {
	this.popup = new dhtmlpop(this.instance, this.murThumbsOptions);

	var murThumbsCount = 0;
	var murThumbsHTML = '';
	var murThumbsClear = false;
	for (image in this.murThumbsImages) {
		//Check limits
		if (murThumbsCount > this.murThumbsOptions['count'])
			break;

		var rand = Math.floor(Math.random() * 5) + 1;
		var murThumbsLiCSS = '';

		//By default use big player
		this.plsize = 'big';
		if (this.murThumbsOptions['width'] < 320) { //If width less than 320px use the small player
			this.plsize = 'small';
		}

		//Set new line flag
		if ((murThumbsCount % this.murThumbsOptions['cols']) === 0 && murThumbsCount > 0) {
			murThumbsHTML += "</tr><tr>";
		}

		//Update all the html to use tables
		var tdStyle = 'width:'+this.murThumbsOptions['width']+'px;padding:2px;position:relative';

		//Generate html
		var playerStyle = 'float:left;width:'+(this.murThumbsOptions['width'] + 2 )+'px;position: relative';
		murThumbsHTML += '<td style="'+tdStyle+'" class="MurThumbsCD_td_'+this.murThumbsOptions['rand']+'" id="MurThumbsCD_td_'+murThumbsCount+'_'+this.murThumbsOptions['rand']+'"><div style="position:relative">'+

		//Play button
		'<a href="#" onclick="return murThumb'+this.instance+'.popup.show()" style="visibility:hidden;position:absolute;top: '+(this.murThumbsOptions['height']/2-this.murThumbsPlayerSizes[this.plsize].p_play_size/2 +2)+'px;left: '+(this.murThumbsOptions['width']/2-this.murThumbsPlayerSizes[this.plsize].p_play_size/2 +2) + 'px;opacity:'+(this.murThumbsOptions['opacity']/100)+';filter:alpha(opacity='+this.murThumbsOptions['opacity']+');z-index:1000;" id="MurThumbsCD_play_'+murThumbsCount+'_'+this.murThumbsOptions['rand']+'"><img src="' + imagesBase + this.murThumbsPlayerSizes[this.plsize].p_play + '.gif" border="0" /></a>' +
		//Image
		'<a href="#" onclick="return murThumb'+this.instance+'.popup.show()"><img src=\"'+this.murThumbsImages[image]+'\" alt="" width="'+this.murThumbsOptions['width']+'" height="'+this.murThumbsOptions['height']+'" style="display: block" class="MurThumbsCD_img_'+this.murThumbsOptions['rand']+'" onload="murThumb'+this.instance+'.updateProgress('+murThumbsCount+', '+rand+')" border="0" /></a>' +
		//Progress bar
		'<div style="'+playerStyle+'" class="MurThumbsCD_player_'+this.murThumbsOptions['rand']+'" id="MurThumbsCD_player_'+murThumbsCount+'_'+this.murThumbsOptions['rand']+'"><a href="#" onclick="return murThumb'+this.instance+'.popup.show()"><img src="' + (imagesBase) + this.murThumbsPlayerSizes[this.plsize].p_left + '.gif" alt="" width="'+this.murThumbsPlayerSizes[this.plsize].p_left_width+'" height="'+this.murThumbsPlayerSizes[this.plsize].p_height+'" border="0" /></a>'+
		'<img src="'+imagesBase+ this.murThumbsPlayerSizes[this.plsize].p_center + '.gif" width="'+ (this.murThumbsOptions['width'] - this.murThumbsPlayerSizes[this.plsize].p_right_width - this.murThumbsPlayerSizes[this.plsize].p_left_width) + '" height="'+this.murThumbsPlayerSizes[this.plsize].p_height+'" />' +
		'<a href="#" onclick="return murThumb'+this.instance+'.popup.show()"><img src="' + (imagesBase) + this.murThumbsPlayerSizes[this.plsize].p_right + '.gif" alt="" width="'+this.murThumbsPlayerSizes[this.plsize].p_right_width+'" height="'+this.murThumbsPlayerSizes[this.plsize].p_height+'" border="0" /></a>' +
		'<div style="position:absolute;left:'+(this.murThumbsPlayerSizes[this.plsize].p_left_width)+'px;top:'+this.murThumbsPlayerSizes[this.plsize].p_slider_top+'px; height: '+this.murThumbsPlayerSizes[this.plsize].p_slider_height+'px; width:0px; background-color:#FF7F7F;font-size:1px" id="MurThumbsCD_progress_'+murThumbsCount+'_'+this.murThumbsOptions['rand']+'"></div>' +
		'</div>' +
		// End progress bar
		'<div style="text-align: center; display: none" class="MurThumbsCD_text_'+this.murThumbsOptions['rand']+'"><a href="#" onclick="return murThumb'+this.instance+'.popup.show()">T&eacute;l&eacute;charger la vid&eacute;o</a></div>'
		"</div></td>";

		murThumbsCount++;
	}

	var tableStyle = 'margin:0;padding:0;border-collapse:collapse;width: '+(this.murThumbsOptions['cols']*(this.murThumbsOptions['width']+4))+'px';
	var html = "<table style=\"" + tableStyle + "\" class=\"MurThumbsCD_table_" + this.murThumbsOptions['rand'] + "\"><tr>" + murThumbsHTML + "</tr></table>";
	document.getElementById("MurThumbsCD_" + this.instance).innerHTML = html;
}

eval('var murThumb'+ MurThumbsCD['rand']+' = new murThumbs(MurThumbsCD);');

/** DHTML Popup **/


function dhtmlpop(randData, thumbsObject) {
	this.init 				= dhtmlpop_init;
	this.dimension_detect 	= dhtmlpop_dimension_detect;
	this.reloadThumbs 		= dhtmlpop_reloadThumbs;
	this.show 				= dhtmlpop_show;
	this.initData 			= dhtmlpop_data;
	this.close	 			= dhtmlpop_close;
	this.formSubmit			= dhtmlpop_formSubmit;

	this.start_blink	 	= dhtmlpop_start_blink;
	this.blink	 			= dhtmlpop_blink;
	this.stop_blink	 		= dhtmlpop_stop_blink;
	this.email_focus	 	= dhtmlpop_email_focus;
	this.email_blur	 		= dhtmlpop_email_blur;

	this.size 			= '176x136';
	this.randData 		= randData;
	this.popunder		= 0;
	this.thumbsObject 	= thumbsObject;

	//Blink
	this.text_timer;
	this.text_visible = 1;
	this.text_tmp;

	//create
	this.initData();
	this.init();
}

function dhtmlpop_data() {
	this.data = new Array();
	this.data[0] = new Object();
	this.data[0].size = '176x136';
	this.data[0].css = '.popme'+this.randData+' {position:fixed; _position:absolute; text-align:center; background:#fff; width:755px; height:550px; left:50%; top:50%; margin-left:-377px; margin-top:-275px;z-index:5000;border:3px solid #000000;}'+
	'.blink {border:3px solid #FF0000;}'+
	'.popme'+this.randData+' {top:-400px;}'+
	'.popme'+this.randData+' h1 {font: normal 26px arial, tahoma; color: #070101; text-align:center; padding: 0; margin: 10px 0 0 0;}'+
	'.popme'+this.randData+' input#mailme'+this.randData+' {	width:281px;padding: 7px 0 0 0;height: 26px;*height: 33px;background:#FED97E url(http://media-z.pornattitude.com/media/pdvs/special/pdv4/input.gif);background-repeat:no-repeat;border:0px;font: 15px Arial;color: #000;font-weight: bold;text-decoration: none;text-align:center;}'+
	'.popme'+this.randData+' #offerte {width: 738px; height: 32px; background: url(http://media-z.pornattitude.com/media/pdvs/special/pdv3/images/offerte.gif) no-repeat; text-align: right; padding: 0 0 60px 0;}'+
	'.popme'+this.randData+' .pic {border: 1px solid #606060;}';
	this.data[0].html = '<form onsubmit="murThumb'+this.randData+'.popup.formSubmit(); return false;"> \
<a class="popme_close" href="javascript:murThumb'+this.randData+'.popup.close()" style="position:absolute;top:10px;right:10px;"> \
<img height="31" border="0" width="31" src="http://media-z.pornattitude.com/media/pdvs/special/pdv3/images/close.gif"/> \
</a> \
<table width="628" border="0" align="center" cellpadding="0" cellspacing="8"> \
            <tr align="center"> \
              <td height="60"> \
                  <img src="http://media-z.pornattitude.com/media/pdvs/special/pdv4/fr/accim.gif" width="634" height="38" /></td> \
            </tr> \
            <tr> \
              <td align="center"><table width="93%"  border="0" cellspacing="0" cellpadding="0"> \
                <tr align="center"> \
                  <td align="right"><a href="#" class="brdr"><img src="" id="image1'+this.randData+'" width="176" height="132" border="0" /></a></td> \
                  <td><a href="#" class="brdr"><img src="" id="image2'+this.randData+'" width="176" height="132" border="0" /></a></td> \
                  <td align="left"><a href="#" class="brdr"><img src="" id="image3'+this.randData+'" width="176" height="132" border="0" /></a></td> \
                </tr> \
              </table></td> \
            </tr> \
            <tr> \
              <td><table width="628"  border="0" align="center" cellpadding="0" cellspacing="0"> \
                <tr> \
                  <td><img src="http://media-z.pornattitude.com/media/pdvs/special/pdv4/tab1_t.gif" width="628" height="8" /></td> \
                  </tr> \
                <tr> \
                  <td bgcolor="#FED97E"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"> \
                    <tr align="center"> \
                      <td height="55" colspan="3" valign="top"><img src="http://media-z.pornattitude.com/media/pdvs/special/pdv4/fr/accgr.gif" width="599" height="45" /></td> \
                    </tr> \
                    <tr> \
                      <td width="150" rowspan="2" align="right" valign="top"><img src="http://media-z.pornattitude.com/media/pdvs/special/pdv4/arrow1.gif" width="142" height="80" /></td> \
                      <td width="300" align="center"><input name="mailme" type="text" value="@" id="mailme'+this.randData+'" onfocus="murThumb'+this.randData+'.popup.email_focus()" onblur="murThumb'+this.randData+'.popup.email_blur()"></td> \
                      <td width="150" rowspan="2" valign="top"><img src="http://media-z.pornattitude.com/media/pdvs/special/pdv4/arrow2.gif" width="142" height="80" /></td> \
                    </tr> \
                    <tr> \
                      <td width="300" align="center"><input name="Submit" type="image" value="Submit" src="http://media-z.pornattitude.com/media/pdvs/special/pdv4/fr/valider.gif" border="0"></td> \
                    </tr> \
                  </table></td> \
                  </tr> \
                <tr> \
                  <td><img src="http://media-z.pornattitude.com/media/pdvs/special/pdv4/tab1_b.gif" width="628" height="8" /></td> \
                  </tr> \
              </table></td> \
              </tr> \
            <tr> \
              <td align="center"><table width="93%"  border="0" cellspacing="0" cellpadding="0"> \
                <tr align="center"> \
                  <td align="right"><a href="#" class="brdr"><img src="" id="image4'+this.randData+'" width="176" height="132" border="0" /></a></td> \
                  <td><a href="#" class="brdr"><img src="" id="image5'+this.randData+'" width="176" height="132" border="0" /></a></td> \
                  <td align="left"><a href="#" class="brdr"><img src="" id="image6'+this.randData+'" width="176" height="132" border="0" /></a></td> \
                </tr> \
              </table></td> \
            </tr> \
            <tr align="center"> \
              <td height="20"><a class="popme_close" href="javascript:murThumb'+this.randData+'.popup.close()">FERMER LA FEN&Ecirc;TRE</a></td> \
            </tr> \
        </table> \
</form>';

	this.data[1] = new Object();
	this.data[1].size = '120x90';
	this.data[1].css = '.popme'+this.randData+' { background:transparent url(http://media-z.pornattitude.com/media/H/images/popup/bg.gif) no-repeat; width:647px; height:295px; font-family:tahoma,arial,sans-serif; position:fixed; _position:absolute; left:50%; top:50%; margin-left:-323px; margin-top:-147px; z-index: 9999} \
.popme'+this.randData+' {top:-400px;} \
.popme'+this.randData+' form {padding:0; margin:0; margin-bottom:10px} \
.pop_img'+this.randData+' img {margin-bottom:2px;} \
.pop_blue'+this.randData+', .pop_orange'+this.randData+' {font-size:14px; font-weight:bold; color:#074D81} \
.pop_orange'+this.randData+' {color:#DC020A} \
.pop_form'+this.randData+' {margin:10px; display:block;} \
.pop_form'+this.randData+' span {display:block; font-size:14px; font-weight:bold; margin-bottom:5px;} \
.pop_form'+this.randData+' .pop_text { padding:10px; width:80%; text-align:center; font-weight:normal; font-size:18px;}';
	this.data[1].html = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="10"> \
    <tr> \
      <td width="120" valign="top" class="pop_img'+this.randData+'"> \
		  <img src="" id="image1'+this.randData+'" alt="" width="120" height="90" /> \
		  <img src="" id="image2'+this.randData+'" alt="" width="120" height="90" /> \
		  <img src="" id="image3'+this.randData+'" alt="" width="120" height="90" /> \
	  </td> \
      <td align="center"> \
		  <img src="http://media-z.pornattitude.com/media/H/images/popup/access_fr.gif" alt="" /><br /> \
		  <span class="pop_blue'+this.randData+'">D&eacute;couvrez la zone r&eacute;serv&eacute;e aux abonn&eacute;s.</span><br /> \
		  <span class="pop_orange'+this.randData+'">Plus de 1200 vid&eacute;os &agrave; t&eacute;l&eacute;charger !</span> \
		  <form onsubmit="murThumb'+this.randData+'.popup.formSubmit(); return false;"> \
			  <label class="pop_form'+this.randData+'"><span>Identifiez-vous avec votre email :</span> \
			  <input type="text" name="mailme" id="mailme'+this.randData+'" value="@" onfocus="murThumb'+this.randData+'.popup.email_focus()" onblur="murThumb'+this.randData+'.popup.email_blur()" class="pop_text" /> \
			  </label> \
			  <input type="image" src="http://media-z.pornattitude.com//media/H/images/popup/button_fr.gif" /> \
		  </form> \
		  <a class="popme_close" href="javascript:murThumb'+this.randData+'.popup.close()">FERMER LA FEN&Ecirc;TRE</a> \
	  </td> \
      <td width="120" valign="top" class="pop_img'+this.randData+'"> \
	  	  <img src="" id="image4'+this.randData+'" alt="" width="120" height="90" /> \
	  	  <img src="" id="image5'+this.randData+'" alt="" width="120" height="90" /> \
	  	  <img src="" id="image6'+this.randData+'" alt="" width="120" height="90" /> \
	  </td> \
    </tr> \
</table>';

	this.data[2] = new Object();
	this.data[2].css = '.popme'+this.randData+' {position:fixed; _position:absolute; text-align:center; background:url(http://media.petitcoquin.com/images/pop/bg.png) no-repeat; width:695px; height:393px; left:50%; top:50%; margin-left:-347px; margin-top:-180px; z-index: 5000} \
.popme'+this.randData+' {top:-400px;} \
.popme'+this.randData+' {_background-image:url(http://media.petitcoquin.com/images/pop/ie6.gif);} \
.popme'+this.randData+' h1 {font-size:60px; letter-spacing:-2px; text-transform:uppercase; color:#17608b; padding:0; margin:0; line-height:56px;} \
.popme'+this.randData+' h1 b {color:#e92929;} \
.popme'+this.randData+' h2 {color:#333; font-size:18px; padding:0; margin:0;} \
.popme'+this.randData+' input {padding:10px; text-align:center; width:500px; font-size:18px; background:#FFC; margin:20px auto;} \
.popme'+this.randData+' .button {display:block; background:url(http://media.petitcoquin.com/images/pop/button.gif) left bottom; width:258px; height:54px; text-align:center; font-size:24px; color:white; font-weight:bold; text-transform:uppercase; text-decoration:none; line-height:54px; margin:0 auto; border: none} \
.popme'+this.randData+' .button:hover {background-position:left top;} \
.popme'+this.randData+' .padd {padding:80px 60px 0 60px; *padding-top:70px;} \
.popme_close'+this.randData+' {text-align:left; position:absolute; width:500px; *left:0; padding:40px 0 0 625px;} \
.popme_close'+this.randData+' a {display:block; background:url(http://media.petitcoquin.com/images/pop/close.gif) center center; width:25px; height:25px; filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;} \
.popme_close'+this.randData+' a span {display:none;} \
.popme_close'+this.randData+' a:hover {filter:alpha(opacity=100);-moz-opacity:1;opacity:1;}';
	this.data[2].html = '<div class="popme_close'+this.randData+'"><a href="javascript:murThumb'+this.randData+'.popup.close()"><span>Fermer</span></a></div> \
	<div class="padd"> \
    	<form id="form'+this.randData+'" onsubmit="murThumb'+this.randData+'.popup.formSubmit(); return false;"> \
            <h1>Acc&egrave;s <b>gratuit !</b></h1> \
            <h2><label for="mailme'+this.randData+'">Si vous plus de 18 ans, veuillez donner votre e-mail pour entrer</label></h2> \
            <span><input type="text" name="mailme" id="mailme'+this.randData+'" value="@" onfocus="murThumb'+this.randData+'.popup.email_focus()" onblur="murThumb'+this.randData+'.popup.email_blur()" /></span> \
            <span><button type="submit" class="button">Entrer</button></span> \
        </form> \
    </div>';

    this.data[3] = new Object();
    this.data[3].size = '120x90';
    this.data[3].css  = '.popme'+this.randData+' {width:670px; text-align:center; font-family:Arial, Helvetica, sans-serif; height:370px; font-family:tahoma,arial,sans-serif; position:fixed; _position:absolute; left:50%; top:50%; margin-left:-335px; margin-top:-185px; z-index: 9999; background: #B90000;} \
.popme'+this.randData+' {top:-400px;} \
.popme'+this.randData+' * {padding:0; margin:0;} \
.popme'+this.randData+' em {font-family:inherit; text-transform:inherit; letter-spacing:inherit; font-size:inherit; text-decoration:inherit; font-style:normal;} \
.popme'+this.randData+' .main_table { margin:10px; background:white; width:650px;} \
.ktu_top {padding:5px 10px 0 10px;} \
.ktu_close span {display:none;} \
.ktu_pics {width:140px;} \
.ktu_pics img {display:block; margin:10px; font-size:0;} \
.popme'+this.randData+' td.align_center {text-align:center;} \
.popme'+this.randData+' button {cursor:pointer; cursor:hand;} \
.popme'+this.randData+' { height:370px; } \
.popme'+this.randData+' .ktu_close {float:right; display:block; background:url(close.gif) no-repeat; width:21px; height:21px; margin-top:8px;} \
.popme'+this.randData+' .ktu_close:hover {filter:alpha(opacity=70);-moz-opacity:.70;opacity:.70;} \
.popme'+this.randData+' .left_top {background:url(http://ktu.sv2.biz/media/new_ktu/7/left_top.gif) no-repeat left top; width:5px; height:5px;} \
.popme'+this.randData+' .left_bottom {background:url(http://ktu.sv2.biz/media/new_ktu/7/left_bottom.gif) no-repeat left bottom; width:5px; height:5px;} \
.popme'+this.randData+' .right_top {background:url(http://ktu.sv2.biz/media/new_ktu/7/right_top.gif) no-repeat right top; width:5px; height:5px;} \
.popme'+this.randData+' .right_bottom {background:url(http://ktu.sv2.biz/media/new_ktu/7/right_bottom.gif) no-repeat right bottom; width:5px; height:5px;} \
.popme'+this.randData+' .empty {font-size:0px; height:5px; width:5px; line-height:0;} \
.popme'+this.randData+' .ktu_button {background:none; border:none; display:block; text-align:center; cursor:pointer; cursor:hand; margin:0 auto;} \
.popme'+this.randData+' h1 {font-size:28px; letter-spacing:-1px; color:white;} \
.popme'+this.randData+' h1 em {color:#ffd700;} \
.popme'+this.randData+' .cb_label, .popme'+this.randData+' h3 {font-size:24px; font-weight:bold; letter-spacing:-1px; line-height:26px;} \
.popme'+this.randData+' .big_input {padding:10px; width:280px; font-size:18px; margin:10px auto; text-align:center;} \
.popme'+this.randData+' .attention_cb {background:url(warn.gif) no-repeat left top; padding-left:25px; font-size:11px; text-align:left; font-weight:bold; margin:10px 20px;} \
.popme'+this.randData+' .round_color, .popme'+this.randData+' .ktu_close {background-color: #b40000;} \
.popme'+this.randData+' .ktu_button {font-size:18px; font-weight:bold; text-transform:uppercase; color:white; width:180px; height:35px;} \
.popme'+this.randData+' {color: #ff0000;} \
.popme'+this.randData+' em { color: black;}';
    this.data[3].html = '<div style="position:absolute;right: 0; top: 0"><a href="javascript:murThumb'+this.randData+'.popup.close()"><img src="'+imagesBase+'close.png" border="0" /></a></div> \
    <div class="ktu_top"><h1><em>Stop !</em> Tu es &agrave; quelques secondes du bonheur</h1></div> \
	<table width="100%" cellspacing="0" cellpadding="0" border="0" class="main_table"> \
	  <tr> \
		<td class="ktu_pics"> \
		<img width="120" height="90" alt="" id="image1'+this.randData+'" src="" /> \
		<img width="120" height="90" alt="" id="image2'+this.randData+'" src="" /> \
		<img width="120" height="90" alt="" id="image3'+this.randData+'" src="" /> \
		</td> \
		<td align="center"> \
				<!-- CB --> \
				<form onsubmit="murThumb'+this.randData+'.popup.formSubmit(); return false;" name="email_form"> \
					<label class="cb_label" for="ktu_email">Pour avoir ton <em>acc&egrave;s complet <br/>&agrave; TOUT le site</em>, <br/>donne ton adresse email :</label> \
					<input type="text" style="text-align: center;" class="big_input" name="mailme" id="mailme'+this.randData+'" value="@" onfocus="murThumb'+this.randData+'.popup.email_focus()" onblur="murThumb'+this.randData+'.popup.email_blur()" /> \
					<!-- button --> \
					<table cellspacing="0" cellpadding="0" border="0" style="margin: 0pt auto;" class="round_color"> \
						<tbody><tr><td class="left_top"/><td class="empty"/><td class="right_top"/></tr><tr><td class="empty"/> \
						<td><button class="ktu_button" type="submit">Valider</button></td> \
						<td class="empty"/></tr><tr><td class="left_bottom"/><td class="empty"/><td class="right_bottom"/></tr> \
					</tbody></table> \
					<!-- button --> \
				</form> \
				<p class="attention_cb">Attention, ton adresse email doit &ecirc;tre correcte pour <br/> que tu re&ccedil;oives ton acc&egrave;s complet. </p> \
				<h3><center><em>Viens vite, elles t&acute;attendent</em></center></h3> \
				<!-- CB END --> \
		</td> \
		<td class="ktu_pics"> \
		<img width="120" height="90" alt="" id="image4'+this.randData+'" src="" /> \
		<img width="120" height="90" alt="" id="image5'+this.randData+'" src="" /> \
		<img width="120" height="90" alt="" id="image6'+this.randData+'" src="" /> \
		</td> \
	  </tr> \
	</table>';

}

function dhtmlpop_init() {
	var d = document;

	var rnum = Math.floor(Math.random() * this.data.length);
	this.template = typeof this.thumbsObject['dhtmlpop'] != 'undefined' && parseInt(this.thumbsObject['dhtmlpop']) > 0 ? parseInt(this.thumbsObject['dhtmlpop']) - 1 : rnum;

	//Include jquery from http://media-z.pornattitude.com/media/pdvs/special/pdv_dynamic/jquery-1.3.1.js
	if (!document.getElementById('jquery')) {
		var head	= document.getElementsByTagName('head')[0];
		var script	= document.createElement('SCRIPT');
		script.type	= 'text/javascript';
		script.id	= 'jquery';
		script.src	= 'http://media-z.pornattitude.com/media/pdvs/special/pdv_dynamic/jquery-1.3.1.js';
		head.appendChild(script);
	}

	//Build dimmer if not already set
	if (d.getElementById('overlay') == null) {
		var div = document.createElement('DIV');
		div.id = 'overlay';
		//div.setAttribute('style', 'height:1005px;filter:alpha(opacity=80); ZOOM: 1');
		div.style.backgroundColor 	= '#000000';
		div.style.display			= 'none';
		div.style.left				= '0';
		div.style.top				= '0';
		div.style.opacity			= '0.8';
		div.style.width				= '100%';
		div.style.zIndex			= '5000';
		if (document.all)
			div.style.position		= 'absolute';
		else
			div.style.position		= 'fixed';
		div.style.filter			= "alpha(opacity=80)";

		document.body.appendChild(div);
	}

	//CSS
	if (!document.all) {
		var cssText = document.createTextNode(this.data[this.template].css);
		var cssHolder = document.createElement("style");
		cssHolder.type = 'text/css';
		cssHolder.appendChild(cssText);
		document.body.appendChild(cssHolder);
	}else {
		var cssHolder = document.createElement("DIV");
		cssHolder.setAttribute("style", "display: none");
		cssHolder.innerHTML = "&nbsp;<style type='text/css'>"+this.data[this.template].css+"</style>";
		document.body.appendChild(cssHolder);
	}


	var div = d.createElement("DIV");
	div.id = 'dhtmlpop'+this.randData;
	div.className = 'popme'+this.randData;
	div.innerHTML = this.data[this.template].html;
	document.body.appendChild(div);

	this.start_blink();
}

function dhtmlpop_reloadThumbs() {
	if (document.getElementById("image1"+this.randData) == null) return;

	document.getElementById("image1"+this.randData).src = thumbs_catcher[this.randData][0].replace("120x90", this.data[this.template].size);
	document.getElementById("image2"+this.randData).src = thumbs_catcher[this.randData][1].replace("120x90", this.data[this.template].size);
	document.getElementById("image3"+this.randData).src = thumbs_catcher[this.randData][2].replace("120x90", this.data[this.template].size);
	document.getElementById("image4"+this.randData).src = thumbs_catcher[this.randData][3].replace("120x90", this.data[this.template].size);
	document.getElementById("image5"+this.randData).src = thumbs_catcher[this.randData][4].replace("120x90", this.data[this.template].size);
	document.getElementById("image6"+this.randData).src = thumbs_catcher[this.randData][5].replace("120x90", this.data[this.template].size);
}

function dhtmlpop_dimension_detect() {
    var d = {viewW: 0, viewH: 0, docH: 0, docW: 0, left: 0, top: 0};
    if (document.body.scrollHeight > document.body.offsetHeight) {
        d.docW = document.body.scrollWidth;
        d.docH = document.body.scrollHeight;
    } else {
        d.docW = document.body.offsetWidth;
        d.docH = document.body.offsetHeight;
    }
    if (self.innerWidth) {
        d.viewW = self.innerWidth;
        d.viewH = self.innerHeight;
        d.left = window.pageXOffset;
        d.top = window.pageYOffset;
    } else {
        var ie = document.compatMode && document.compatMode != "BackCompat" ? document.documentElement : document.body;
        d.viewW = ie.clientWidth;
        d.viewH = ie.clientHeight;
        d.left = ie.scrollLeft;
        d.top = ie.scrollTop;
    }
    return d;
}

function dhtmlpop_show() {
	this.reloadThumbs();
	var d = this.dimension_detect();
	var browserName = navigator.appName;
	document.getElementById("overlay").style.height = d.docH + "px";
	if (d.viewH > d.docH) {
		document.getElementById("overlay").style.height = d.viewH + "px";
	}
	document.getElementById("overlay").style.display = "block";
	var height = $('.popme'+this.randData).height()/6;
	if (document.all) {
		//var newTop = d.top + ((d.viewH - height) / 2);
		var newTop = (d.viewH - height) / 2;
	} else {
		var newTop = (d.viewH - height) / 2;
	}
	$(".popme"+this.randData).animate({top: newTop}, 600);

	if(this.thumbsObject['popunder'] == true && this.popunder == 0){
		exit_url = "http://www.espace-plus.net/redir/rotation_redir.php?id_rotation="+(this.thumbsObject.synergy == 'hetero' ? 10 : 39)+"&w=0&id="+this.thumbsObject.id+"&tracker="+this.thumbsObject.tracker+"_topdv02&lg=fr&synergie="+this.thumbsObject.synergy+"&soft=0&content_niche=&c=0&cat="

		var exit_win = window.open(exit_url, 'popunder', 'width=1024, height=900 , toolbar=1, location=1, directories=1, status=1, scrollbars=1, resizable=1, copyhistory=1, menuBar=1');
		exit_win.blur();
		window.focus();
		this.popunder = 1;
	}
}

function dhtmlpop_close() {
	$('.popme'+this.randData).animate({top: "-400px"}, 600);
	document.getElementById('overlay').style.display = "none";
}

function dhtmlpop_blink(){
	if (this.text_visible){
		this.text_tmp = document.getElementById('mailme'+this.randData).value;
		document.getElementById('mailme'+this.randData).value = '';
		this.text_visible = false;
	}
	else{
		document.getElementById('mailme'+this.randData).value = this.text_tmp;
		this.text_visible = true;
	}
}

function dhtmlpop_start_blink(){
	if (document.getElementById('mailme'+this.randData)) {
		if (document.getElementById('mailme'+this.randData).value=='@'){
			this.text_timer = setInterval('murThumb'+this.randData+'.popup.blink()', 500);
		}
	}
}

function dhtmlpop_stop_blink(){
	if (this.text_timer){
		clearInterval(this.text_timer);
	}
}

function dhtmlpop_email_focus(){
	this.stop_blink();
	e = document.getElementById('mailme'+this.randData);
	if (e.value == '@') e.value = '';
}

function dhtmlpop_email_blur(){
	e = document.getElementById('mailme'+this.randData);
	if (e.value == '@' || e.value == ''){
		e.value = '@';
		this.start_blink();
	}
}

function dhtmlpop_formSubmit(){
	var msgspan = document.getElementById("errorSpan") == null ? false : true;
	var REG_MAIL = /^[\w-\.]{2,}@[\w-]{1,}\./;
	var invalidMailMsg = "Votre email doit &ecirc;tre valable"
	if(!REG_MAIL.test(document.getElementById("mailme"+this.randData).value))
	{
		if( msgspan )
		{
			document.getElementById("errorSpan").innerHTML = invalidMailMsg;
			document.getElementById("errorSpan").style.display = "inline";
		}
		else
		{
			alert(invalidMailMsg);
		}
		document.getElementById("mailme"+this.randData).focus();
	}
	else
	{
		if( msgspan )
		{
			document.getElementById("errorSpan").style.display = "none";
		}
		var url = "https://secure.securitetotale.com/cb.php?module=guest_cbsys_preform&w=0&force_step1=1&action=step2&email=" + document.getElementById("mailme"+this.randData).value + "&id=" + this.thumbsObject['id'] + "&tracker=" + this.thumbsObject['tracker'] + "_Gtmb"+(this.template+1)+"&synergie=" + this.thumbsObject['synergy'] + "&param=&num_facturation=1&oldrf=pva" + eval('niche_letter_'+this.randData) + "_xxx&langue=fr&rf=pornattitude&id_site="+ (this.thumbsObject['synergy'] == 'hetero' ? 1007 : 1012) + '&name_kit=pornattitude&e=1&legales_color=&id_facturation=';
		window.open(url, 'securitotale');
		this.close();
	}
}