/*-----------------------------------------------------------------------------
	[Helpers et code exécuté sur toutes les pages]
-----------------------------------------------------------------------------*/
/**
 * jQuery-Plugin "preloadCssImages"
 * by Scott Jehl, scott@filamentgroup.com
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';e.16=n(b){b=e.17({x:N,o:N,O:18,P:2},b);3 19=[],8=0,4=[],d,y;n p(){1a(y);5(4&&4.9&&4[8]){8++;5(b.x){3 Q=(4[8])?\'1b R: <c>\'+4[8].q(\'/\')[4[8].q(\'/\').9-1]:\'R S\';e(b.x).1c(\'<c r="1d">\'+8+\'</c> 1e <c r="1f">\'+4.9+\'</c> 8 (<c r="1g">\'+(8/4.9*1h).T(0)+\'%</c>) <c r="1i">\'+Q+\'</c></c>\')}5(b.o){3 z=e(b.o).1j();e(b.o).1k(\'1l-1m\',-(z-(z*8/4.9).T(0))+\'1n 1o%\')}A()}}n A(){5(4&&4.9&&4[8]){3 s=1p 1q();s.1r=4[8];5(!s.S){e(s).1s(\'1t 1u 1v\',p)}B{p()}y=U(p,b.O)}}n C(7,t){3 D=V,k=[],E=[],f;3 6=7.9;u(6--){3 F=\'\';5(t&&t[6]){f=t[6]}B{3 W=(7[6].v)?7[6].v:\'1w.1x.v\';3 G=W.q(\'/\');G.X();f=G.Y(\'/\');5(f){f+=\'/\'}}5(7[6].H||7[6].Z){d=(7[6].H)?7[6].H:7[6].Z;3 h=d.9;u(h--){5(d[h].I&&d[h].I.10){3 J=d[h].I.10;5(J.1y().1z(\'1A\')!=-1){F+=J}}B 5(d[h].11){k.w(d[h].11);D=1B}}}3 j=F.K(/[^\\("]+\\.(1C|1D|1E|1F)/g);5(j){3 i=j.9;u(i--){3 L=(j[i].12(0)==\'/\'||j[i].K(\'://\'))?j[i]:f+j[i];5(e.1G(L,4)==-1){4.w(L)}}}5(!D&&7[6].l&&7[6].l.9){1H(3 m=0,13=7[6].l.9;m<13;m++){3 a=7[6].l[m].v;a=a.q(\'/\');a.X();a=a.Y(\'/\');5(a){a+=\'/\'}3 14=(a.12(0)==\'/\'||a.K(\'://\'))?a:f+a;E.w(14);k.w(7[6].l[m])}}}5(k.9){C(k,E);15 V}3 M=b.P;u(M--){U(A,M)}}C(1I.1J);15 4};',62,108,'|||var|imgUrls|if|sheetIndex|sheets|loaded|length|iHref|settings|span|thisSheetRules|jQuery|baseURL||ruleIndex||tmpImage|imported|imports|iImport|function|statusBarEl|onImgComplete|split|class|img|urls|while|href|push|statusTextEl|errorTimer|barWidth|loadImgs|else|parseCSS|w3cImport|importedSrc|cssPile|baseURLarr|cssRules|style|text|match|imgSrc|downloads|null|errorDelay|simultaneousCacheLoading|nowloading|Loading|complete|toFixed|setTimeout|false|csshref|pop|join|rules|cssText|styleSheet|charAt|importLen|iSrc|return|preloadCssImages|extend|999|allImgs|clearTimeout|Now|html|numLoaded|of|numTotal|percentLoaded|100|currentImg|width|css|background|position|px|50|new|Image|src|bind|error|load|onreadystatechange|window|location|toLowerCase|indexOf|url|true|gif|jpg|jpeg|png|inArray|for|document|styleSheets'.split('|'),0,{}))


/*-----------------------------------------------------------------------------
	[Code commun]
*/

$(document).ready(function() {
 	imgTool();
$.preloadCssImages();
	activeHover('.block');
	activeHover('.widget');
	activeHover('.widget div:first-child');
	activeHover('.form-button');
	activeHover('.block a');
	activeHover('#boutique-menu-internet');
	activeHover('#boutique-menu-television');
	activeHover('#boutique-menu-telephone');
	activeHover('#boutique-menu-freebox');
	activeHover('#boutique-menu-aide');
	activeHover('#boutique-panier-annuler');
	activeHover('#boutique-panier-valider');
	
	var eva = $("#eva-ask-input");
	if (eva != null) {
		eva.defaultvalue("Entrez votre question ici...");
	}
	
	var abo = $("#abo-num-input");
	if (abo != null) {
		abo.defaultvalue("Entrez le numéro ici...");
	}
	
	var widgets = $('.widget');
	if (widgets != null && widgets.length > 0) {
		widgets.each(function() {
			var link = $(this).find('a');
			if(link != null && link.length > 0) {
				var href = link[0].href;
				
				$(this).css('cursor', 'pointer');
				$(this).click(function() {
					if (href.substr(0, 10) == 'javascript') {
						eval(href.substring(11));
					}
					else {
						document.location = href;
					}
				});
				$(this).mouseover(function() {
					$(this).addClass('widget-hover');
				});
				$(this).mouseout(function() {
					$(this).removeClass('widget-hover');
				});
				link.replaceWith($('<span class="link">' + link.html() + '</span>'));
			}
		});
	}
});

/*-----------------------------------------------------------------------------
	[Helpers]
*/

/**
 * Fonction qui permet de récupérer le code HTML d'un élément
 */
jQuery.fn.outerHTML = function() {
	return $('<div>').append( this.eq(0).clone() ).html();
};

/**
 * Fonction qui enléve les / au début et à la fin des strings
 */
String.prototype.trimSlashes = function(ch) {
	return this.replace(/^\/+|\/+$/g, ''); 
};

/**
 * Fonction qui permet d'ajouter la classe hover sur n'importe quel élément 
 *
 * @param selector Seleteur jquery
 */
function activeHover(selector) {
	var el = $(selector);
	if (el != null && el.length > 0) {
		el.hover(
			function() {
				$(this).addClass('hover');
			},
			function() {
				$(this).removeClass('hover');
			}
		);
	}
}
/*preview sur link*/
this.imgTool = function(){depX = 72;$("a.capt").hover(function(e){this.t = this.title;this.title = "";var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<div id='capt'><img src='/im/global/arrow.png' class='arrow'><div class='inner'><img src='/im/data/shots/"+ this.rel +"' />"+ c +"</div></div>");	
		$("#capt").css("left",(e.pageX - depX) + "px").slideDown("slow");	},
	function(){	this.title = this.t;	$("#capt").remove(); });	
	$("a.capt").mousemove(function(e){$("#capt").css("left",(e.pageX - depX) + "px");});};


