window.google_analytics_uacct = "UA-436236-4";
//var mm=open("","mm");
function debuger(obj){for(var i in obj){mm.document.write(i+"="+obj[i]+"<br>");}mm.document.write("<hr>");}
var ZoneUrl="http://www.zonecss.fr/";

$(document).ready(function(){
		 var d = new Date()
		 window.timerStat=d.getTime();
		// initestat();
		 initBLocCode()	;
		 initInfoBulle();
		 initZoneLink();
		 initLinkInfobulle();
});
function initBLocCode(){
	$("#contenu .bloccodehtml").each(function(index){
		var child = $(this).children();
		var childA = child.get(0);
		var childB = child.get(1);
		if(childA.className == "titre"  && childB.className =="codehtml" ){
			childB = $(childB);
			if(childB.css("maxHeight")!=undefined){
				var h = childB.height();
				if(childB.height()-7>50){
					 childA = $(childA)
					 childA.css({'display':"block"}).click(
						function (event){
							if(childB.css("maxHeight")!="100%"){
								$(this).css({backgroundImage:"url(../images/charte_v4/contenu/bt_replier.gif)"});
								childB.css({maxHeight:"100%"});
							}else{
								$(this).css({backgroundImage:"url(../images/charte_v4/contenu/bt_deplier.gif)"});
								childB.css({maxHeight:"65px"});
							}
						}
					);
				}
			}
		}															
	});		
}

function reportbug(lien){
	var form=document.forms.thebug;
	if(form){
		form.useragent.value=navigator.userAgent.toLowerCase();
		form.submit();
	}
}
function valideSondage(objformss){
	var texte="";
	var age = $(objformss.age);
		age.removeClass('error');
	if(jQuery.trim(age.val())=="" || isNaN(jQuery.trim(age.val()))){texte+="- votre age\n";age.addClass('error')}
	var couleur = $(objformss.couleur);
		couleur.removeClass('error');
	if(jQuery.trim(couleur.val())==""){texte+="- votre couleur\n";couleur.addClass('error')}
	var sexe = $(objformss.sexe);
		sexe.removeClass('error');
	if(couleur.val()==0){texte+="- votre sexe\n";sexe.addClass('error')}
	if(texte!=""){alert("Veuillez remplir le champ :\n"+texte);
	}else{objformss.submit();}
}
function valideMoteur(objForm){
	var result = true;
	var mot = $(objForm.mot);
	if(jQuery.trim(mot.val())==""){mot.addClass('error');
		alert("Veuilez saisir un mot de recherche");
		result = false;}
	return result;
}
var plugInfoBulle  =new Object();
plugInfoBulle._selected = null;
plugInfoBulle._timer= null;
plugInfoBulle._timeout= 1500;
plugInfoBulle.stoptimer = function(){
	clearTimeout(this._timer);
};
plugInfoBulle.cacher = function(){
	this._timer = setTimeout(function(){plugInfoBulle.fermer()},plugInfoBulle._timeout);
};
plugInfoBulle.fermer=function(){
	if(this._selected){
		$(this._selected).css({display:"none"});
		this._selected=null;
	}
};
function initInfoBulle(){

	$("#contenu .infobulle").each(function(index){								   
		var declanche = $(this);
		var valeur= "";
		//debuger(this.firstChild)
		if(this.firstChild.tagName=="A"){
			valeur = this.firstChild.firstChild.nodeValue;
		}else{
			valeur = this.firstChild.nodeValue;
		}
		
		declanche.mouseout(function(){plugInfoBulle.cacher()});
		declanche.mouseover(function(event){
			if(plugInfoBulle._selected!=null){
					plugInfoBulle.stoptimer();
					$(plugInfoBulle._selected).css({display:"none"});
					plugInfoBulle._selected=null;
			}
			var e = $("#infobulle"+valeur.toLowerCase());
			if(e){
			 e.css({display:"block",position:"absolute",
				   left:(event.pageX+15)+"px",
				   top:((event.pageY)-parseInt(e.css("height")))+"px"});
			 	   plugInfoBulle._selected=e;
				  e.mouseover(function(event){plugInfoBulle.stoptimer();});
				  e.mouseout(function(event){plugInfoBulle.cacher()});
			}
		});							   
	});
}
var plugDefinition=new Object();
plugDefinition.position=null;
plugDefinition.ordre=null;
plugDefinition.getPosition=function(id){
	for(var i=0;i<this.ordre.length;i++){
		if(this.ordre[i]==id){
			this.position=i;
			break;
		}
	}
}
function moveDef(id,ancre,lien){
	var allresume= document.getElementById("allresume");
	if(plugDefinition.ordre==null){
		plugDefinition.ordre = new Array();
		$(allresume).children().each(function(){
			if((this.id).indexOf('-css')!=-1){
				plugDefinition.ordre.push(this.id);
			}
		});
	}else {
		if(plugDefinition.ordre[plugDefinition.position]!=ancre){
			var selection = $("#"+plugDefinition.ordre[plugDefinition.position]);
			var selectionTemp =  selection.clone(true);
			selection.remove();
			if(plugDefinition.position<plugDefinition.ordre.length-1){
				$(selectionTemp).insertBefore($("#"+plugDefinition.ordre[plugDefinition.position+1])).removeClass('selectedblock');
			}else{
				$(selectionTemp).insertAfter($("#"+plugDefinition.ordre[plugDefinition.position-1])).removeClass('selectedblock');
			}
		}
	}	
	
	if(allresume){
		var first = $(allresume).children()[0];
	
		if(first){
			if(first.id!=ancre){
				$(first).removeClass('selectedblock');
				var selection = $("#"+ancre);
				plugDefinition.getPosition(ancre);
				if(selection.length>0){
					var selectionTemp =  selection.clone(true);
					selection.remove();
					$(selectionTemp).insertBefore(first);
					$(selectionTemp).addClass('selectedblock')
				}
			}else{
				$(first).addClass('selectedblock');
			}
		}
	}else{
			document.location=document.location.pathname+"#"+ancre;
	}

}
function voirstats(mois){document.location="index.php?mois="+mois+"";}
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '/';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};




function setMenuGauche(nom){
	if("dmcpub"==nom){
	document.write("<div id=\"blocface\"><dl>");
	document.write(pubGauche["dmcfacebook"]);
	document.write("</dl></div>");
	document.write("<div><dl id=\"dmcemploi\">");
	document.write(pubGauche["dmcemploi"]);
	document.write("</dl></div>");

		document.write("<div id=\"blockpub\"><dl id=\"dmcpub\">");
	document.write(pubGauche["dmcpub"]);
	document.write("</dl></div>");
		if($.cookie('sondage')!='2'){
			document.write("<div><dl id=\"dmcsondage\">");
			document.write(pubGauche["dmcsondage"]);
			document.write("</dl></div>");
		}
	}
}

var pubGauche = {dmcpub:"",dmcsondage:"",dmcemploi:"",dmcfacebook:""};
 
//pubGauche.dmcpub ='<div id=\"blockpub\"><dt><strong>Bien se référencer</strong></dt>';
//pubGauche.dmcpub +='<dd><a href=\"http://action.metaffiliation.com/suivi.php?mclic=S316443351121\" target=\"_blank\">Téléchargez gratuitement le guide du référencement.<br/>Pour devenir aussi bien référencé que la ZONE CSS ;-)</a></dd></div>';
var type=parseInt(Math.random()*(12));
					if(type<2){
pubGauche.dmcpub ='<dt><strong>Micro application</strong></dt>';
pubGauche.dmcpub +='<dd><a onclick="eventTracking(\'pub\', \'menug\', \'S431FD43351121\')" href="http://action.metaffiliation.com/suivi.php?mclic=S431FD43351121" target="_blank">Micro application, achat et téléchargement de logiciels, jeux, livres et papiers</a></dd>';
           }  else if(type==2 || type<4){
pubGauche.dmcpub ='<dt><strong>Micro application</strong></dt>';
pubGauche.dmcpub +='<dd><a onclick="eventTracking(\'pub\', \'menug\', \'S431FD43351122\')" href="http://action.metaffiliation.com/suivi.php?mclic=S431FD43351122" target="_blank">Micro Application, le partenaire de votre PC !</a></dd>';
           } else if(type==4 || type<6){
pubGauche.dmcpub ='<dt><strong>Easy-Hebergement</strong></dt>';
pubGauche.dmcpub +='<dd><a onclick="eventTracking(\'pub\', \'menug\', \'S462C543351111\')" href="http://action.metaffiliation.com/suivi.php?mclic=S462C543351111" target="_blank">Hébergement mutualisé haute disponibilité à partir de 0.99€HT/mois</a></dd>';
           } else if(type==6 || type<8){
pubGauche.dmcpub ='<dt><strong>Micromania</strong></dt>';
pubGauche.dmcpub +='<dd><a onclick="v(\'pub\', \'menug\', \'S3CB043351125\')" href="http://action.metaffiliation.com/suivi.php?mclic=S3CB043351125" target="_blank">PSP 3000 + VOD + Memory stick 4 Go pour 199.99€ !</a> </dd>';
					}else if(type==8 || type<10){
pubGauche.dmcpub ='<dt><strong>Micromania</strong></dt>';
pubGauche.dmcpub +='<dd><a onclick="eventTracking(\'pub\', \'menug\', \'S3CB043351121\')" href="http://action.metaffiliation.com/suivi.php?mclic=S3CB043351121" target="_blank">Micromania vous offre les frais de ports sur tous les jeux !</a></dd>';
					} else{
pubGauche.dmcpub ='<dt><strong>1001Bijoux</strong></dt>';
pubGauche.dmcpub +='<dd><a onclick="eventTracking(\'pub\', \'menug\', \'S385743351128\')"   href="http://action.metaffiliation.com/suivi.php?mclic=S385743351128" target="_blank">Pour les soldes, 1001 Bijoux vous propose une sélection étincelante...</a></dd>';
					}
pubGauche.dmcsondage ='<dt><strong>Mieux vous connaître</strong></dt>';
pubGauche.dmcsondage  +='<dd><form method="post" action="'+ZoneUrl+'sondage/index.php" id="sondagea" style="margin:0;padding:0">';
if($.cookie('sondage')===null){
		pubGauche.dmcsondage +='<input type="hidden" name="action" value="3"/>';
		pubGauche.dmcsondage +='<input type="hidden" name="url" value="'+ZoneUrl+page+'"/>';
		pubGauche.dmcsondage +='<label title="Sexe">Sexe :</label><br /><select name="sexe">';
		pubGauche.dmcsondage +='<option value="" selected=\"selected\">Sélection</option>';
		pubGauche.dmcsondage +='<option value="h">Homme</option>';
		pubGauche.dmcsondage +='<option value="f">Femme</option>';
		pubGauche.dmcsondage +='</select><br/>';
		pubGauche.dmcsondage +='<label title="Age">Age&nbsp;:</label><br><input type="text" name="age" size="5" maxlength="3" class="recheinput" /><br />';
		pubGauche.dmcsondage +='<label title="Couleur préférée">Couleur préférée :</label><br/>';
		pubGauche.dmcsondage +='<input type="text" name="couleur" size="10" class="recheinput"/>&nbsp;';
		pubGauche.dmcsondage +='<input type="button" name="Submit" value="Ok" onclick="valideSondage(this.form)" class="brecheinput" /><br/>';
		pubGauche.dmcsondage +='<a href="'+ZoneUrl+'sondage/index.php?url='+ZoneUrl+page+'" class="gdsondage" title="Faire le grand sondage">Faire le grand sondage</a>';
}else{
	pubGauche.dmcsondage +='<a href="'+ZoneUrl+'sondage/index.php?url='+ZoneUrl+page+'" class="gdsondage" style="margin-left:5px" title="Faire le grand sondage">Vous avez déja fait le petit sondage, oser le grand ;-)</a>';
}

pubGauche.dmcsondage +='</form></dd>';

pubGauche.dmcemploi = '<dt><strong>Gadget ZONE DMC</strong></dt>';
pubGauche.dmcemploi += '<dd><a onclick="eventTracking(\'gadget\', \'menug\', \'allresume\')" href="http://www.zonecss.fr/#allresume" target="_blank" onclick="nbClick(\'gadget\')">ajouter le Gadget ZONE DMC sur votre iGoogle<br/>';
pubGauche.dmcemploi += '<b>Voir le Gadget</b></a>';
pubGauche.dmcemploi += '</dd>';

pubGauche.dmcfacebook = '<dt><strong>FaceBook</strong></dt>';
pubGauche.dmcfacebook += '<dd><iframe scrolling="no" frameborder="0" allowtransparency="false" hspace="0" marginwidth="0" style="border: medium none ;margin-left:-5px; overflow: hidden; width: 160px; height:60px;" src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FZone-CSS%2F105951019435508&amp;width=154&amp;colorscheme=light&amp;connections=0&amp;stream=false&amp;header=true&amp;height=60"></iframe>';
////<a onclick="pageTracker._trackEvent(\'facebook\', \'menug\', \'105951019435508\')" href="http://www.facebook.com/pages/Zone-CSS/105951019435508" target="_blank" onclick="nbClick(\'facebook\')">Découvrir la ZONE DMC sur Facebook<br/>';
////pubGauche.dmcfacebook += '</a>';
pubGauche.dmcfacebook += '</dd>';

function initestat(){
	var b = $('body');
	var d = new Date();
	if(d.getTime()-window.timerStat<5000){
		if(b.length>0){
			var f = b[0].firstChild;
			if(f.id=="webo_pub"){
				wbo_hides();
			}else{
				setTimeout("initestat()",1500);
			}
		}else{
			setTimeout("initestat()",1500);
		}
	}
}

function generateur(type){

}


function pageTracking(lien,path,url){
	var lieu = '';if(typeof(lien)!='undefined'){if(typeof(lien.className)!='undefined' && lien.className!=''){var t =  (lien.className).split(" ");for(var i = 0;i<t.length;i++){if(t[i].indexOf('track-')!=-1){lieu=t[i]+'/';break;}}}}
	if(typeof(_gaq)!='undefined'){_gaq.push(['_trackPageview',"/"+path+"/"+lieu+url]);}
	 /*alert("/"+path+"/"+lieu+url); */
	}
function socialTracking(network, action, url){if(typeof(_gaq)!='undefined'){var aConf = ['_trackSocial', network, action, url];_gaq.push(aConf);
 /*alert(aConf);*/}
}
function eventTracking(category, action, opt_label ){if(jQuery.trim(category)!='' && jQuery.trim(action)!='' && jQuery.trim(opt_label)!='' ){if(typeof(_gaq)!='undefined'){_gaq.push(['_trackEvent',category, action, opt_label]);}}
/*alert(category+'/'+action+'/'+ opt_label );*/
}



function addBookmark(){
	$(document).ready(function(){
		var href= $("#link-rss").attr("href");
		var sFlux = '';
		var addthis='<div class="addthis_toolbox addthis_default_style addthis_16x16_style">'
			+'    <a class="addthis_button_facebook"></a>'
			+'    <a class="addthis_button_twitter"></a>' 
			+'    <a class="addthis_button_delicious"></a>'
			+'    <a class="addthis_button_yoolink"></a>'
			+'    <a class="addthis_button_digg"></a>'
			+'	<a class="addthis_button_email"></a>'
			+'</div>'
			+'</li>'
			/*+'<li style="margin-top:3px"><div class="addthis_toolbox addthis_default_style addthis_16x16_style">'
	+'	<a class="addthis_button_live"></a>'
	+'    <a class="addthis_button_google"></a>'
	+'    <a class="addthis_button_googlebuzz"></a>'
	+'    <a class="addthis_button_delicious"></a>'
	+'    <a class="addthis_button_netvibes"></a>'
	+'</div></li>' */
			+'<li style="margin-top:3px"><div class="addthis_toolbox addthis_default_style addthis_16x16_style">'
			+'    <a class="addthis_button_compact"></a>'
			+'	<a class="addthis_counter addthis_bubble_style"></a>' 
			+'<a class="addthis_button_google_plusone"></a>'
			+  '</div></li>'

			;
		var sCode = '<li id="additious">';
		if(href != undefined  &&  href !=''){
			sFlux+='<div id="rssdeux"><a href="'+href+'" target="_blank" rel="nofollow" title="fils RSS 2.0" onclick="socialTracking(\'rss-2.0\',\'share\',this.href)"><img src="/images/rss/rss-2.gif" border="0" alt="fils RSS 2.0"/></a></div></li>'
			+'<li><div id="rssgoogle"><a href="http://fusion.google.com/add?feedurl='+encodeURIComponent(href)+'" target="_blank" rel="nofollow" title="fils RSS Google" onclick="socialTracking(\'google-rss\',\'share\',this.href)"><img src="/images/rss/rss-google.gif" border="0" alt="fils RSS Google"/></a></div></li>'
			+'<li><div id="rssyahoo"><a href="http://add.my.yahoo.com/rss?url='+encodeURIComponent(href)+'" target="_blank" rel="nofollow" title="fils RSS Yahoo" onclick="socialTracking(\'yahoo-rss\',\'share\',this.href)"><img src="/images/rss/rss-yahoo.gif" border="0" alt="fils RSS Yahoo"/></a></div></li>'
			+'<li><div id="rssnetvibes"><a href="http://www.netvibes.com/subscribe.php?url='+encodeURIComponent(href)+'" target="_blank" rel="nofollow" title="fils RSS Netvibes" onclick="socialTracking(\'netvibes-rss\',\'share\',this.href)"><img src="/images/rss/rss-netvibes.gif" border="0" alt="fils RSS Netvibes"/></a></div>';
		}
		



		if(document.location.toString().indexOf('rechercher/recherche') !=-1){
			if(sFlux!=''){	sFlux = '<li style="margin-top: 3px;">'+sFlux;}
		}else{
			if(sFlux!=''){	addthis ='';}
		}	
		sCode  +=addthis+sFlux+'</li>';
		$("#bloc-sousmenu").prepend(sCode);
	});
}

function addShareFooter(url){
	var addthis = '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">'
+'    <a class="addthis_button_facebook"></a>'
+'    <a class="addthis_button_twitter" tw:via="zonexhtml"></a>'
+'	<a class="addthis_button_yahoobkm"></a>'
+'	<a class="addthis_button_live"></a>'
+'    <a class="addthis_button_google"></a>' 
+'    <a class="addthis_button_delicious"></a>'
+'    <a class="addthis_button_netvibes"></a>'
+'    <a class="addthis_button_yoolink"></a>'
+'    <a class="addthis_button_digg"></a>'
+'    <a class="addthis_button_viadeo"></a>'
+'    <a class="addthis_button_linkedin"></a>'
+'	<a class="addthis_button_email"></a>'
+'    <a class="addthis_button_compact"></a>' 
+'<a class="addthis_button_google_plusone"></a>'
+'</div>';
document.write(addthis);
}
function shareProperty(){
	var addthis = '<div class="resume share-property">'
		+'<span class="lib"> Partager cet article :&nbsp;</span>'
		+'<div class="addthis_toolbox addthis_default_style addthis_16x16_style">'
		+'    <a class="addthis_button_facebook"></a>'
		+'    <a class="addthis_button_twitter" tw:via="zonexhtml"></a>'
		+'	<a class="addthis_button_yahoobkm"></a>'
		+'	<a class="addthis_button_live"></a>'
		+'    <a class="addthis_button_google"></a>' 
		+'    <a class="addthis_button_delicious"></a>'
		+'    <a class="addthis_button_netvibes"></a>'
		+'    <a class="addthis_button_yoolink"></a>'
		+'    <a class="addthis_button_digg"></a>'
		+'    <a class="addthis_button_viadeo"></a>'
		+'    <a class="addthis_button_linkedin"></a>'
		+'	<a class="addthis_button_email"></a>'
		+'    <a class="addthis_button_compact"></a>'
		+'	<a class="addthis_counter addthis_bubble_style"></a>'
		+'<a class="addthis_button_google_plusone"></a>'
	+'</div></div>';
	
	
	
	document.write(addthis);
}
function getStats(url,rubrique){
	//if(((typeof(dmc)=="object") && (dmc.utilisateur.Nom=="dmc")) || Dmc_GetChamp("nom")=="dmc"){ }else{if(_UJS) _estat('415015183494',url,rubrique);}
}

function initZoneLink(){
	$(".linkzone,.dmchtml,.dmcannuaire,.dmcflash,.dmcsearch").click(function(event){ 
		var value = event.currentTarget;
		if(typeof (value.href) !='undefined'){
			var url = ((value.href).toString()).replace('http://',"");
			var reg=new RegExp("(\\.)", "g");
			 url = url.replace(reg,"-");
			 if(url.lastIndexOf("/") == url.length-1){
				 url = url.substring(0, url.length-1)
			 }
			 var path = 'menu-gauche';
			 if(value.className == "linkzone"){
				 path = 'footer';
			 }
			 if(url !=''){
				 pageTracking(undefined,'liensortant/'+path,url+'.ls');
			 }
		}
	});
	$("#formgetbalise").submit(function(event){
		 
		//_gaq.push(['_linkByPost', this]);
		
	}); 
}
function initLinkInfobulle(){
	/*	
	$("#infobulle dfn a").click(function(event){ 
				var lien = event.currentTarget;
				alert(lien.href)
			 _gaq.push(['_link', lien.href]); return false;
		 });
		 */
}
