var thick_offset = 100;
var thick_redim = false;
//########################################################
//					Fonction porno
//########################################################
function porn(){
	//
}
function goacces(bool){
	if(bool){
		$.cookie('session_js_bp', 'true', {path: '/'});
		tb_remove();
		
	}else{
		$.cookie('session_js_bp', 'false', {path: '/'});
		window.location.href = basewp;
	}
}
function adulte(){


	if ($.cookie('session_js_bp') != 'true') {

		
		var madiv = '<div style="position: relative; width: 500px; height: 300px; background-image: url(' + basewp + '/wp-content/themes/sandbox/images/alerte.jpg)">';
		madiv += '<a href="#" class="a-nostyle" onclick="goacces(false); return false;" style="display: block; position: absolute; width: 150px; height: 35px; top: 237px; left: 285px;">&nbsp</a>';
		madiv += '<a href="#" class="a-nostyle" onclick="goacces(true); return false;" style="display: block; position: absolute; width: 150px; height: 35px; top: 237px; left: 65px;">&nbsp</a>';
		madiv += '</div>';
		tb_show();
		$(document).ready(function(){
			tb_show(null,'#TB_inline?height=305&width=505&modal=true&inlineId=false',madiv);
		});
	}
	

}
//########################################################
//					Fonction aleatoire
//########################################################
function aleatoire(i) {
	if (!i) { i = 100 ; }
	return Math.round(Math.random()*i);
}
//########################################################
//					Fonction pub 300x250 aléatoire
//########################################################
function pubaleatoire() {
	var resultat = new Array;
	resultat[0]='<iframe src="http://banners.adultfriendfinder.com/go/page/flv_player?flv=/flash/flv/nicoleangel_aff&eos_button=1&pid=g949056-pct&no_click=1&popunder_off=1〈=french&page=reg&win=blank" width="300" height="250" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no"></iframe>';
   	resultat[1]='<iframe src="http://banners.adultfriendfinder.com/go/page/flv_player?flv=/flash/flv/campuscoed_aff&eos_button=1&pid=g949056-pct&no_click=1&popunder_off=1&lang=french&page=reg&win=blank" width="300" height="250" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no"></iframe>';
   	resultat[2]='<iframe src="http://banners.adultfriendfinder.com/go/page/flv_player?flv=/flash/flv/nikitaxxx_aff&eos_button=1&pid=g949056-pct&no_click=1&popunder_off=1&lang=french&page=reg&win=blank" width="300" height="250" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no"></iframe>';
	resultat[3]='<iframe src="http://banners.adultfriendfinder.com/go/page/flv_player?flv=/flash/flv/ahhvicky_aff&eos_button=1&pid=g949056-pct&no_click=1&popunder_off=1&lang=french&page=reg&win=blank" width="300" height="250" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no"></iframe>';
	resultat[4]='<iframe src="http://banners.adultfriendfinder.com/go/page/flv_player?flv=/flash/flv/EliAnne_aff&eos_button=1&pid=g949056-pct&no_click=1&popunder_off=1&lang=french&page=reg&win=blank" width="300" height="250" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no"></iframe>';
	//resultat[5]='';
	//resultat[6]='';
	var num = resultat.length-1;
	var ale = aleatoire(num);
	return resultat[ale];
}
//########################################################
//					Fonction escape
//########################################################
function encodd(texte){
	texte = texte.split('"').join('&quot;');
	return texte;
}
//########################################################
//					Fonction pour mail
//########################################################
function mailpage(){
	chaine_mail = "mailto:?subject= Sur Actu Séries TV : " + titre;
	chaine_mail += "&amp;body= Je recommande cette page : " + titre; 
	chaine_mail += ". Consultable à l'adresse : " + url;
	return chaine_mail;
}
//########################################################
//					Fonction pour les favoris
//########################################################
function favoris() {
	var url = window.location.href;
	var titre = $('title').text();
	if (!$.browser.msie){ 
		window.sidebar.addPanel(titre,url,""); 
	}else { 
		window.external.AddFavorite(url,titre); 
	} 
}
function gofav(){
	$('#go-fav').click(function(){
		favoris();
		return false;
	});
}
//########################################################
//					Variables
//########################################################
var url = window.location.href;
var titre = $('title').text();

//########################################################
//					Ready ?
//########################################################
$(document).ready(function(){

	//$('div.sidebar ul li ul,div.sidebar li.widget_top5 ul li a,div.sidebar ul li#mynew ul li a,.wall-single ul,.wall-promo ul,div.sidebar li.widget_mycoms ul li,div.sidebar li.widget_myabo ul li.abomail, div.sidebar li.widget_myabo ul li.aborss a').corners();

	//.mysingle #content h3

	
	/*$("#best-cat a[href$='/sexy/']").hover(
	    	function () {
				alert('ok');
			},
	      	function () {
				alert('ko');
	      	}
	    );*/
	
	
	if($(".mysingle").length){
		//$('.wall-single').corner("cc:#000 10px");
		
		//__________________( Spoiler )________________
		$('.mysingle p code').wrap("<span class='jqSpoiler'></span>");
		//$('div.alt p code').wrap("<span class='jqSpoiler'></span>");
		$('.jqSpoiler').initSpoilers({method:'click'});
		
		//__________________( Affichage des billets similaires )________________
		$(".mysingle .mysimilaire").hide();
		$(".mysingle .mysimilaire").css('list-style-type', 'square');
		$(".mysingle li.mydesc").hide();
		$(".mysingle a.mylink").each(function (i) {
			$(this).hoverIntent(
	      		function () {
					$(".mysingle .mysimilaire:hidden").show();
	        		$('.mysingle li.mydesc:eq('+i+')').show('normal');
	      		}, 
	      		function () {
	        		$('.mysingle li.mydesc:eq('+i+')').hide('normal');
	      		}
	    	);
		});
		
		//__________________( Cacher les meta js )________________
		
		$(".mysingle .myjs-meta").hover(
	    	function () {},
	      	function () {
				$(".mysingle .entry-metatags:visible").slideUp('normal');
				$(".mysingle .js-myliens:visible").slideUp('normal');
	      	}
	    );
		
		//__________________( Affichage des tags )________________
		$(".mysingle .entry-meta").append(' &bull; <a href="#" id="myshowtags" title="Afficher les tags de cet article">Tags</a>');
		$(".mysingle #myshowtags").hover(
	    	function () {
				$(".mysingle .entry-metatags").slideDown('normal');
				$(".mysingle .js-myliens:visible").slideUp('normal');
	      	},function(){}
	    );
		
		//__________________( Affichage de Faire un lien )________________
		var construct_div_myliens = '<div class="sous-meta js-myliens">';
		construct_div_myliens += 'Lien HTML <input value="'+encodd('<a href="'+url+'">'+titre+'</a>')+'" readonly="readonly" onclick="this.select()" class="inputread" type="text" />';
		construct_div_myliens += '<br />Lien BBCODE (forum) <input value="'+encodd('[url="'+url+'"]'+titre+'[/url]')+'" readonly="readonly" onclick="this.select()" class="inputread" type="text" />';
		construct_div_myliens += '<br /><span style="border: 1px dotted #C3DADF; padding: 2px 4px 2px 4px; display: block; text-align: center"><strong>Résultat:</strong> <a href="'+url+'">'+titre+'</a></span>';
		construct_div_myliens += '</div>';
		$(".mysingle .entry-metatags").after(construct_div_myliens);
		$(".mysingle #myjs-lien").hover(
	      	function () {
				$(".mysingle .js-myliens").slideDown('normal');
				$(".mysingle .entry-metatags:visible").slideUp('normal');
	      	},function(){}
	    );
		
		//__________________( Lien pour email )________________
		$(".mysingle .entry-meta").append(' &bull; <a rel="nofollow" href="'+mailpage()+'">Mail</a>');
		
		//
		$(".mysingle .sous-meta").hide();
		
		//__________________( recup pub blogbang )________________
		$("#promocont").append($("#bbcache").children());
		
		if($("body.s-category-sexy").length){
			$("#pbtop").css({width: "510px", height: "110px", padding: '0px', overflow: "hidden"});
			$("#pbtop").html($("#bbcache2").children());
		}
	}
	
	if($(".mysingle").length || $(".myattachement").length){//myattachement 
	
	
	//__________________( lightbox )________________

		
		
		$('a[href*=.jpg]').addClass('thickbox');
		tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
		//adulte();
		imgLoader = new Image();// preload image
		imgLoader.src = tb_pathToImage;


	}
	
	
	//__________________( Listing archives )________________
	if ($(".archivethumb").length) {
		//.archive-list
		/*$(".myarchive .archive-list a.nostyle").bind("click", function(e){
			if($(this).next(".entry-hide").css('display') == 'block'){
				$(this).unbind('click', aClick);
			}
			$(".entry-hide:visible").slideUp('normal');
			$("a.nostyle").removeClass('js-ahover');
			$(this).next(".entry-hide").addClass('js-hover').slideDown('normal');
			$(this).addClass('js-ahover');
			return false;
    	});*/
		$('.archivethumb .entry-desc').hide();
		$('.archivethumb .archive-list').each(function (i) {		
			var temp = $(this).children('.entry-desc').text();
			$(this).children('a').attr('title',temp);
		});
	}
	
	if ($(".myarchive").length) {
		//.archive-list
		$(".myarchive .archive-list a.nostyle").bind("click", function(e){
			if($(this).next(".entry-hide").css('display') == 'block'){
				$(this).unbind('click', aClick);
			}
			$(".entry-hide:visible").slideUp('normal');
			$("a.nostyle").removeClass('js-ahover');
			$(this).next(".entry-hide").addClass('js-hover').slideDown('normal');
			$(this).addClass('js-ahover');
			return false;
    	});
	}
		
	//__________________( Fonction pour l'affichage du flash )________________
	if($(".mysingle").length){
		$('a[@href^="http://www.youtube.com"]').not($(".flash")).not($(".ontop")).flash(
	        { height: 370, width: 450 },
	        { version: 8 },
	        function(htmlOptions) {
	            $this = $(this);
	            htmlOptions.src = $this.attr('href');
	            $this.hide().before($.fn.flash.transform(htmlOptions));						
	        }
	    );
		
		$('a[@href^="http://www.wat.tv"]').not($(".flash")).not($(".ontop")).flash(
	        { height: 390, width: 456 },
	        { version: 8 },
	        function(htmlOptions) {
	            $this = $(this);
	            htmlOptions.src = $this.attr('href');
	            $this.hide().before($.fn.flash.transform(htmlOptions));						
	        }
	    );
		//<div class="myswf" class="abp-objtab-04207596855868909 visible ontop"
		$('a[@href^="http://www.buzzandpeople.com/mediaplayer.swf"]').not($(".flash")).not($(".ontop")).flash(
	        { height: 335, width: 425 },
	        { version: 8 },
	        function(htmlOptions) {
	            $this = $(this);
	            htmlOptions.src = $this.attr('href');
	            $this.hide().before($.fn.flash.transform(htmlOptions));						
	        }
	    );
		
		$('a[@href^="http://www.dailymotion.com"]').not($(".flash")).not($(".ontop")).flash(
	        { height: 335, width: 425 },
	        { version: 8 },
	        function(htmlOptions) {
	            $this = $(this);
	            htmlOptions.src = $this.attr('href');
	            $this.hide().before($.fn.flash.transform(htmlOptions));						
	        }
	    );
		
		$('a[@href^="http://www.collegehumor.com"]').not($(".flash")).not($(".ontop")).flash(
	        { height: 300, width: 400 },
	        { version: 8 },
	        function(htmlOptions) {
	            $this = $(this);
	            htmlOptions.src = $this.attr('href');
	            $this.hide().before($.fn.flash.transform(htmlOptions));						
	        }
	    );
	
	
		$('a.flash').flash(null, { version: 8 }, function(htmlOptions) {
	        var $this = $(this);
	        var params = $this.attr('rel').split(':');
	        htmlOptions.src = $this.attr('href');
	        htmlOptions.width = params[0];
	        htmlOptions.height = params[1];
	        $this.hide().before($.fn.flash.transform(htmlOptions));
	    });
	}

});

/*$(".mysingle #myshowtags").bind("click", function(e){
    });*/
	/*$(".mysingle #myshowtags").toggle(
	);*/