<!--
	//--------------------------------- Lib techniques
	/*
	 * Décodage Base 64
	 */
	var END_OF_INPUT = -1;
	var base64Chars = new Array(
		'A','B','C','D','E','F','G','H',
		'I','J','K','L','M','N','O','P',
		'Q','R','S','T','U','V','W','X',
		'Y','Z','a','b','c','d','e','f',
		'g','h','i','j','k','l','m','n',
		'o','p','q','r','s','t','u','v',
		'w','x','y','z','0','1','2','3',
		'4','5','6','7','8','9','+','/'
	);

	var reverseBase64Chars = new Array();
	for (var i=0; i < base64Chars.length; i++){
		reverseBase64Chars[base64Chars[i]] = i;
	}

	var base64Str;
	var base64Count;
	function setBase64Str(str){
		base64Str = str;
		base64Count = 0;
	}

	function readReverseBase64(){   
		if (!base64Str) return END_OF_INPUT;
		while (true){      
			if (base64Count >= base64Str.length) return END_OF_INPUT;
			var nextCharacter = base64Str.charAt(base64Count);
			base64Count++;
			if (reverseBase64Chars[nextCharacter]){
				return reverseBase64Chars[nextCharacter];
			}
			if (nextCharacter == 'A') return 0;
		}
		return END_OF_INPUT;
	}

	function ntos(n){
		n=n.toString(16);
		if (n.length == 1) n="0"+n;
		n="%"+n;
		return unescape(n);
	}

	function decodeBase64(str){
		setBase64Str(str);
		var result = "";
		var inBuffer = new Array(4);
		var done = false;
		while (!done && (inBuffer[0] = readReverseBase64()) != END_OF_INPUT
			&& (inBuffer[1] = readReverseBase64()) != END_OF_INPUT){
			inBuffer[2] = readReverseBase64();
			inBuffer[3] = readReverseBase64();
			result += ntos((((inBuffer[0] << 2) & 0xff)| inBuffer[1] >> 4));
			if (inBuffer[2] != END_OF_INPUT){
				result +=  ntos((((inBuffer[1] << 4) & 0xff)| inBuffer[2] >> 2));
				if (inBuffer[3] != END_OF_INPUT){
					result +=  ntos((((inBuffer[2] << 6)  & 0xff) | inBuffer[3]));
				} else {
					done = true;
				}
			} else {
				done = true;
			}
		}
		return result;
	}
	
	
    /*
     * Add Multiple BodyOnLoad Elements
     * source : http://simonwillison.net/2004/May/26/addLoadEvent/
     */
    function addLoadEvent(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                if (oldonload) {
                    oldonload();
                }
                func();
            }
        }
    }

	
	//--------------------------------- Lib Métier
	
	/*
	 * Enregistrement de l'action Enter
	 */
	function DisclaimerEntrer()
	{	
		setCookie("disclaimer_enter",1,3);			
		if(document.getElementById) document.getElementById("disclaimer").style.display='none';
	}

	/*
	 *  Affichage Disclaimer du site
	 */
	function DisclaimerDisplay()
	{	
		if(getCookie('disclaimer_enter') != '1')
		{	
			var str='';
			str+='<div id=disclaimer><div id=disclaimer-bg><\/div><div id=disclaimer-container><div id=disclaimer-frame>';
			str+='<img src="http://img.clubdessens.fr/pub/cds/logos/logo_fonce_220x280.gif" height="280" width="220" border="0" align="right">';
			str+='<b>BIENVENUE AU CLUB DES SENS,<br>MERCI DE LIRE ATTENTIVEMENT<br>L\'AVERTISSEMENT SUIVANT :<\/b><br>';
			str+='<div align="justify">';
			str+='<br><em>Le Club des Sens « le Guide Communautaire Sexy »<\/em> est un espace de discussions et de partage d’expériences ';
			str+='visant à améliorer les connaissances relatives aux jouets pour adultes, à la sexualité et à la culture érotique. <br><br>';
			str+='Le contenu de ce site ne convient pas à un public mineur. Les textes, photos et vidéos disponibles ici ';
			str+='peuvent choquer certaines sensibilités. <br>';
			str+='<br>';
			str+='<strong>En entrant, vous certifiez être majeur et déclarez prendre vos responsabilités vis-à-vis de ce contenu.<\/strong> <br>';
			str+='<\/div>';
			str+='<br><br>';
			str+='<ul><li><a href="#" onclick="DisclaimerEntrer(); return(false)" style="background-color:#67ae24;">Entrer<\/a><\/li><li><a href="http:\/\/www.google.fr\/" style="background-color:#7284a1;">Sortir<\/a><\/li><\/ul>					';
			str+='<br><br>';
			str+='<hr>';
			str+='<div align="justify" style="font-size:11px">';
			str+='Le Club des Sens est étiqueté grâce au système de l\'ICRA, organisme indépendant ';
			str+='qui permet l\'utilisation de logiciels de filtrage destinés à bloquer l\'accès ';
			str+='aux sites sensibles. Il est conseillé aux parents d\'installer <a href="/site/minors-safety.html#SOFTWARES" style="font-size:11px">un de ces logiciels</a>';
			str+=', tous compatibles avec le système ICRA. ';
			str+='En savoir plus sur <a href="/site/minors-safety.html" style="font-size:11px">la protection des mineurs</a>'
			str+='.<\/div><\/div><\/div><\/div>';
			str+='<style>embed,object,iframe { visibility:hidden; display:none;  }<\/style>';
			document.write(str);
		}
	}
	
	
	/*
	 *  Gestion du footer toujours en base de fenetre / page
	 *  source : http://www.pompage.net/pompe/pieds/ (exemple 4)
	 */ 
    function getWindowHeight() {
        var windowHeight = 0;
        if (typeof (window.innerHeight) == 'number') {
            windowHeight = window.innerHeight;
        }
        else {
            if (document.documentElement && document.documentElement.clientHeight) {
                windowHeight = document.documentElement.clientHeight;
            }
            else {
                if (document.body && document.body.clientHeight) {
                    windowHeight = document.body.clientHeight;
                }
            }
        }
        return windowHeight;
    }
    
    function setFooter() {
        if (document.getElementById) {
            var windowHeight = getWindowHeight();
            if (windowHeight > 0) {
                var contentHeight = document.getElementById('content').offsetHeight;
                var footerElement = document.getElementById('footer');
                var footerHeight = footerElement.offsetHeight;
                if (windowHeight - (contentHeight + footerHeight) >= 0) {
                    footerElement.style.position = 'relative';
                    footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
                }
                else {
                    footerElement.style.position = 'static';
                }
            }
        }
    }

	/*
	 * Enregistre un Cookie Côté Client
	 */
	function setCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	/*
	 * Lit un Cookie côté Client
	 */
	function getCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	/*
	 *	Supprime un cookie
	 */
	function delCookie(name) {
		setCookie(name,"",-1);
	}
	
	/*
	 *	Affiche un coupon masqué et une pop-under du marchand
	 */
	function PromotionCouponDisplay(url, couponcodecontainer, couponbuttoncontainer )
	{
		winmerchant = window.open(url,'merchant','toolbar=1,location=1,directories=1,status=1,scrollbars=1,resizable=1,copyhistory=1,menuBar=1');
		winmerchant.blur();
		window.focus();

		document.getElementById(couponcodecontainer).style.display='block';
		document.getElementById(couponbuttoncontainer).style.display='none';
	}
	
	/*
	 * Met en avant le coupon la fenetre du marchand ou en ouvre une nouvelle
	 */
	function PromotionCouponGoToMerchant(url)
	{
		if(winmerchant.closed)
			window.open(url);
		else
			winmerchant.focus();					
	}
	

	/*
	 * Change le contenu d'une image
	 */
	function movepic(img_name,img_src) {
		document.getElementById(img_name).src=img_src;
	}
	
	/*
	 * Renvoi le nombre de mots dans un champ
	 */
	function CountWords(this_field) {
		var fullStr = this_field.value + " ";
		var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
		var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
		var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
		var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
		var splitString = cleanedStr.split(" ");
		var word_count = splitString.length -1;
		
		if (fullStr.length <2) {
			word_count = 0;
		}
		return word_count;
	}
	
	/*
	 * Si le texte dépasse la taille maximum on le Slice
	 */
	function CheckMaxSize(input, MaxSize)
	{
		if(input.value.length > MaxSize)
		{
			input.value = input.value.slice(0, MaxSize);
		}	
	}

	/*
	 * Met en surimpression la boite de recherche
	 */
	function HighlightSearchBox()
	{
		var SearchBoxQ	= document.getElementById('SearchBoxQ');
		
		SearchBoxQ.style.background='#67AE24';
		SearchBoxQ.style.color='#ffffff';
		SearchBoxQ.focus();
	}
	
	/*
	 * Renvoi vers une page du site --- DEPRECATED
	 */
	function goLink() 
	{
		var myLink = '';

		for (i = 0; i < arguments.length; i++) { 
			myLink = myLink + arguments[i];
		}
		document.location=myLink;
	}
	
	/*
	 * Ouvre la popup d'affichage des membres en Live version longue
	 */
	function OpenLiveMembers()
	{
		var LiveMemberWin = window.open('/members/live.html','LiveMember','toolbar=0,menubar=0,location=0,scrollbars=1,width=270,height=600');
		LiveMemberWin.focus();		
	}
	
	/*
	 * Process GetBackUrls
	 */
	function __doGetBack()
	{
		if(arguments.length > 1)
			window.open(decodeBase64(arguments[0]));			
		else
			document.location=decodeBase64(arguments[0]);		
	}	
	
	
	/*
	 * Insertion de tags dans un champ texte
	 */
	function TAGinsert(taid, text1, text2) {
			
		var ta = document.getElementById(taid)
	
		if (document.selection) {
			var str=document.selection.createRange().text;
			ta.focus();
			var sel=document.selection.createRange();
			
			if (text2!="") {
				if (str=="") {
					var instances=countInstances(ta, text1,text2);
					if (instances%2 !=0) sel.text=sel.text + text2;
					else sel.text=sel.text + text1;
				} else sel.text=text1 + sel.text + text2;
			} else sel.text=sel.text + text1;
			
		} else if (ta.selectionStart || ta.selectionStart ==0) {
			if (ta.selectionEnd > ta.value.length) ta.selectionEnd=ta.value.length;
			var firstPos=ta.selectionStart;
			var secondPos=ta.selectionEnd+text1.length;
			var contenuScrollTop=ta.scrollTop;
			
			ta.value=ta.value.slice(0,firstPos)+text1+ta.value.slice(firstPos);
			ta.value=ta.value.slice(0,secondPos)+text2+ta.value.slice(secondPos);
			
			ta.selectionStart=firstPos+text1.length;
			ta.selectionEnd=secondPos;
			ta.focus();
			ta.scrollTop=contenuScrollTop;
			
		} else { // Opera
			var sel=document.myTextAreaEditor;
			var instances=countInstances(ta, text1,text2);
			if (instances%2 !=0 && text2 !="") sel.value=sel.value + text2;
			else sel.value=sel.value + text1;
		}
	}
	
	/*
	 *		Insertion de Tags
	 *
	 */
	function countInstances(ta, open, closed) {
		var opening=ta.value.split(open);
		var closing=ta.value.split(closed);
		return opening.length + closing.length - 2;
	}	

	/*
	 * affiche/masque un element
	 */
	function DisplayAltern(value) {
		var actual=document.getElementById(value).style.display;
		if (actual=='block' || actual == '') 
			document.getElementById(value).style.display='none';
		else 
			document.getElementById(value).style.display='block';
	}
	
	/*
	 * Bascule l'affichage des produits secondaires (même marchand)
	 */
	function ToggleSecondaryProducts(mid)
	{
		var i			= 1;
		var productTR	= document.getElementById('mproducts' + mid + '-' + i);
		
		while(productTR != null)
		{
			if(productTR.style.display == 'none')
				productTR.style.display = '';
			else
				productTR.style.display = 'none';
			
			i++;
			productTR	= document.getElementById('mproducts' + mid + '-' + i);	
		}
	}
	
	//------------------------------------------------------------------ Lib Carousel (métier)
	var crslpos		= 0;
	var crslmax		= 3;
	var crsllen		= 300;
	
	//--- Carousel Automation
	function crsl_rotate_init()	{
		timeout = setTimeout('crsl_rotate_go();', 5000);	
	}

	function crsl_rotate_go() {
		crsl_show_next();
		crsl_rotate_init();
	}	
	
	function crsl_rotate_stop() {		
		clearTimeout(timeout);
	}

	//--- Carousel button
	function crsl_show_next(){
		var crslfrom	= crslpos;
		
		if(crslpos < crslmax)
			crslpos++;
		else
			crslpos=0;

		dw_scrollObj.scrollBy('crslwn', (crslfrom-crslpos)*crsllen , 0);

		crsl_update_nav(crslpos);
	}

	function crsl_show_prev(){
		var crslfrom	= crslpos;

		if(crslpos > 0)
			crslpos--;
		else
			crslpos=crslmax;
			
		dw_scrollObj.scrollBy('crslwn', (crslfrom-crslpos)*crsllen , 0);
		
		crsl_update_nav(crslpos);
	}
	
	
	function crsl_show_pos(crslnpos){	
		crsl_rotate_stop();

		dw_scrollObj.scrollBy('crslwn', (crslpos-crslnpos)*crsllen , 0);
		crslpos			= crslnpos
		crsl_update_nav(crslpos);
	}
	
	function crsl_update_nav(crslnpos){

		//-- Recup des liens pos (+1 -1 pour ne pas prendre les 2 bouts)
		var elements = document.getElementById("crslnav").getElementsByTagName("a");
		for (var i=1; i < elements.length-1; i++ ) 
		{
			var element = elements[i];
			if (element.id == "")
			{
				if(i != crslnpos+1)
					element.className = "crsloff";
				else
					element.className = "crslon";
			}
		}
	}

	function crsl_init() {
		// arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
		// if horizontal scrolling, id of element containing scrolling content (table?)
		var crslwndo = new dw_scrollObj('crslwn', 'crsllyr', '');
		  
		// pass id('s) of scroll area(s) if inside table(s)
		dw_scrollObj.GeckoTableBugFix(''); 
		
		crsl_rotate_init();		
	}
	
	//------------------------------------------------------------------ Lib Carousel (Scroll)

	/* 
		dw_scrollObj.js  version date: March 2005
		GeckoTableBugFix algorithm revised, and now excludes Safari and Konqueror.
	    
		dw_scrollObj.js contains constructor and basic methods for scrolling layers.
		Use with dw_hoverscroll.js and/or dw_glidescroll.js,
		and when including scrollbars: dw_scroll-aux.js and dw_slidebar.js
	*/

	dw_scrollObjs = {};
	dw_scrollObj.speed=100;

	function dw_scrollObj(wnId, lyrId, cntId)
	{
		this.id=wnId;
		dw_scrollObjs[this.id]=this;
		this.animString="dw_scrollObjs."+this.id;this.load(lyrId,cntId);
	};
	
	dw_scrollObj.loadLayer=function(wnId,id,cntId)
	{
		if(dw_scrollObjs[wnId])dw_scrollObjs[wnId].load(id,cntId);
	};

	dw_scrollObj.prototype.load=function(lyrId,cntId)
	{
		if(!document.getElementById)
			return;
			
		var wndo,lyr;
		if(this.lyrId)
		{
			lyr=document.getElementById(this.lyrId);
			lyr.style.visibility="hidden";
		}
		lyr=document.getElementById(lyrId);
		
		wndo=document.getElementById(this.id);
		lyr.style.top=this.y=0;
		lyr.style.left=this.x=0;
		this.maxY=(lyr.offsetHeight-wndo.offsetHeight>0)?lyr.offsetHeight-wndo.offsetHeight:0;
		this.wd=cntId?document.getElementById(cntId).offsetWidth:lyr.offsetWidth;
		this.maxX=(this.wd-wndo.offsetWidth>0)?this.wd-wndo.offsetWidth:0;
		this.lyrId=lyrId;
		lyr.style.visibility="visible";
		
		this.on_load();
		this.ready=true;		
	};

	dw_scrollObj.prototype.on_load=function(){};

	dw_scrollObj.prototype.shiftTo=function(lyr,x,y)
	{
		if(!lyr.style)
			return;
		lyr.style.left=(this.x=x)+"px";lyr.style.top=(this.y=y)+"px";
	};

	dw_scrollObj.GeckoTableBugFix=function()
	{
		var ua=navigator.userAgent;
		if(ua.indexOf("Gecko")>-1&&ua.indexOf("Firefox")==-1&&ua.indexOf("Safari")==-1&&ua.indexOf("Konqueror")==-1)
		{
			dw_scrollObj.hold=[];
					
			for(var i=0;arguments[i];i++)
			{	
				if(dw_scrollObjs[arguments[i]])
				{
					var wndo=document.getElementById(arguments[i]);
					var holderId=wndo.parentNode.id;
					var holder=document.getElementById(holderId);document.body.appendChild(holder.removeChild(wndo));wndo.style.zIndex=1000;
					var pos=getPageOffsets(holder);
					wndo.style.left=pos.x+"px";wndo.style.top=pos.y+"px";
					dw_scrollObj.hold[i]=[arguments[i],holderId];
				}
			}
			
			window.addEventListener("resize",dw_scrollObj.rePositionGecko,true);
		}
	};

	dw_scrollObj.rePositionGecko=function()
	{
		if(dw_scrollObj.hold){
			for(var i=0;dw_scrollObj.hold[i];i++){
				var wndo=document.getElementById(dw_scrollObj.hold[i][0]);
				var holder=document.getElementById(dw_scrollObj.hold[i][1]);
				var pos=getPageOffsets(holder);wndo.style.left=pos.x+"px";wndo.style.top=pos.y+"px";}
				}
	};

	function getPageOffsets(el)
	{	
		var left=el.offsetLeft;
		var top=el.offsetTop;
		if(el.offsetParent&&el.offsetParent.clientLeft||el.offsetParent.clientTop)
		{	
			left+=el.offsetParent.clientLeft;
			top+=el.offsetParent.clientTop;
		}
		while(el=el.offsetParent)
		{
			left+=el.offsetLeft;top+=el.offsetTop;
		}
		return{x:left,y:top};
	};

	/* dw_glidescroll.js  version date: June 2004 
	glide onclick scrolling for dw_scrollObj (in dw_scrollObj.js)  */

	dw_scrollObj.slideDur = 500; // duration of glide

	// intermediary functions needed to prevent errors before page loaded 
	dw_scrollObj.scrollBy = function(wnId, x, y, dur) {
	if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].glideBy(x, y, dur);
	}

	dw_scrollObj.scrollTo = function(wnId, x, y, dur) {
	if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].glideTo(x, y, dur);
	}

	// Resources for time-based slide algorithm: 
	//  DHTML chaser tutorial at DHTML Lab - www.webreference.com/dhtml	
	//  and cbe_slide.js from	www.cross-browser.com by Mike Foster
	dw_scrollObj.prototype.glideBy = function(dx, dy, dur) {
	if ( !document.getElementById || this.sliding ) return;
	this.slideDur = dur || dw_scrollObj.slideDur;
	this.destX = this.destY = this.distX = this.distY = 0;
	this.lyr = document.getElementById(this.lyrId);
	this.startX = this.x; this.startY = this.y;
	if (dy < 0) this.distY = (this.startY + dy >= -this.maxY)? dy: -(this.startY  + this.maxY);
	else if (dy > 0) this.distY = (this.startY + dy <= 0)? dy: -this.startY;
	if (dx < 0) this.distX = (this.startX + dx >= -this.maxX)? dx: -(this.startX + this.maxX);
	else if (dx > 0) this.distX = (this.startX + dx <= 0)? dx: -this.startX;
	this.destX = this.startX + this.distX; this.destY = this.startY + this.distY;
	this.slideTo(this.destX, this.destY);
	}

	dw_scrollObj.prototype.glideTo = function(destX, destY, dur) {
	if ( !document.getElementById || this.sliding) return;
	this.slideDur = dur || dw_scrollObj.slideDur;
	this.lyr = document.getElementById(this.lyrId); 
	this.startX = this.x; this.startY = this.y;
	this.destX = -Math.max( Math.min(destX, this.maxX), 0);
	this.destY = -Math.max( Math.min(destY, this.maxY), 0);
	this.distY = this.destY - this.startY;
	this.distX =  this.destX - this.startX;
	this.slideTo(this.destX, this.destY);
	}

	dw_scrollObj.prototype.slideTo = function(destX, destY) {
	this.per = Math.PI/(2 * this.slideDur); this.sliding = true;
		this.slideStart = (new Date()).getTime();
		this.aniTimer = setInterval(this.animString + ".doSlide()",10);
	this.on_slide_start(this.startX, this.startY);
	}

	dw_scrollObj.prototype.doSlide = function() {
		var elapsed = (new Date()).getTime() - this.slideStart;
		if (elapsed < this.slideDur) {
			var x = this.startX + this.distX * Math.sin(this.per*elapsed);
			var y = this.startY + this.distY * Math.sin(this.per*elapsed);
		this.shiftTo(this.lyr, x, y); this.on_slide(x, y);
		} else {	// if time's up
		clearInterval(this.aniTimer); this.sliding = false;
			this.shiftTo(this.lyr, this.destX, this.destY);
		this.lyr = null; this.on_slide_end(this.destX, this.destY);
		}
	}

	dw_scrollObj.prototype.on_slide_start = function() {}
	dw_scrollObj.prototype.on_slide = function() {}
	dw_scrollObj.prototype.on_slide_end = function() {}


//-->


