/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////// Author : david.martin@webdesign-webdev.com - Jan 2009 ///////////////////////////////
/////////////////////// v.002 - upd 22 Dec 2010 ///////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //________ Native extensions
Array.prototype.indexOf = function(_item){
	if(typeof _item == "undefined")		return -1;
	for(var i = 0, lth = this.length; i < lth; i++){		if(this[i] == _item)	return i;}
	return -1;
}
Array.joinArgs = function(a, sep){// for join 'arguments' (that is NOT an actual Array :-/ )
	var res = a[0];
	if(sep == undefined)	sep = ',';
	for(var i = 1, len = a.length; i < len; i++){	res += sep+a[i];}
	return res;
}


 //________ WDWD
;(function($) {
	//_________________ globals
	var pngNComp = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent);// IE 5.5 or 6
	//_________________ tools
	$.tools = {
		isValid :function(val,type,strValid){
			//alert("isValid");
			if(String(val) == "undefined")	return false;
			switch(type){
				case "str" :
					val = String(val);
					//alert("isValid : " + (val == "undefined"));
					return val.length > 0;
					break;
			}
			if(strValid != undefined && strValid.length > 0 && !eval("val"+strValid+";"))	return false;
			return true;
		}
		,now :function(){	return new Date().getTime();}
		, timeElaps : function(tim){
			var now = this.now();
			if(tim == undefined){		if(this.__timeStart == undefined){ this.__timeStart = now;}	tim = this.__timeStart;}
			return this.now()-tim;
		}
		,cssBgd :function(str, mod){
			var res = str.replace(/^url\('?(.*)'?\)$/g,"$1");
			switch(mod){
				default:	return res; break;
				case 1 :	return $.tools.fileName(res); break;
			}
		}
		,fileName :function(str){	return str.replace(new RegExp(".*/([^/]+)$","g"),"$1");}// extract file name from full path
		,bodyHeight :function(){	return jQuery.support.cssFloat ? window.innerHeight : $(window).height();}
		,IEsize :function(obj){
			//alert("IEsize : "+obj+"|"+obj.tagName+"|"+$(obj).attr("class"));
			if(!pngNComp)	return;
			$(".ieh",obj).IEheight();
			$("div.iesize",obj).IEwidth();
		}
		,formCheck:function(formId, fctCallback, fctCallback2){
			var f = document[formId];
			var regMail = /^.*(mail|login).*$/i;
			var tabFieldMand = $("input,textarea,select",f);//$(".mand",f);
			//alert("formCheck : "+f+"|"+tabFieldMand.size());
			//console.log('form
			for(var i = 0, tl = tabFieldMand.length; i < tl; i++){
				var field = tabFieldMand[i];
				// check required fields
				var nd = field.nodeName.toLowerCase(), typ = $(field).attr("type").toLowerCase();
				if(/hidden/i.test(typ))	continue;// check if input['hidden']
				//alert("check field : "+field.nodeName+"|"+$(field).attr("id")+"|"+$(field).attr("type"));
				//console.log('____checkField : '+nd+' | '+$(field).attr('id'));
				if($(field).hasClass("mand")){// if required
					//console.log('mandatory');
					//alert("isMand: : "+$(field).attr("id")+ " : "+/hidden/i.test(typ)+" | "+isMand);
					if((nd == "input" && (typ == "text" || typ == "password")) || nd == "textarea"){// check text fields
						if(!$.tools.isValid($(field).val(),"str")){
							alert("Vous avez oublié de remplir un champ nécessaire.");
							field.focus();
							return false;
						}
					}
				}
				// check mail
				//console.log('checkMail : '+nd+' | '+typ + ' | '+regMail.test($(field).attr("id")));
				if((nd == "input" && typ == "text") && regMail.test($(field).attr("id"))){// if field id contains 'mail'
					if(!$.tools.checkEmail($(field).val())){// check email
						alert("Cet email semble invalide, merci de le vérifier.");
						field.select();
						return false;
					}
				}

				// field check callback for custom 
				if(fctCallback && !fctCallback(field,f,fctCallback2))		return false;// callback check
			}
			
			return true;
		}
		,checkEmail:function(str){	return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(str);}
	}

	//_________________ noop
	if($.noop == undefined)	$.noop = function(){ return true;};
	
	//_________________ debug
	
/*	$.debugInit = false;
	$._setDebugMode = function(mod){
		if(isNaN(mod))	return;
		if(!$.debugInit){
			$.debugInit = true;
			if(window.loadFirebugConsole != undefined){
				loadFirebugConsole();// try to load firebug console
				if(window.console != undefined){	$._consoleAv = true; window.console._log = window.console.log; window.console._warn = window.console.warn;}// store native methods
			}
		}
		
		if($._consoleAv){
			if(mod){	window.console.log = window.console._log; window.console.warn = window.console._warn;}// retrieve original methods
			else{			window.console.log = window.console.warn = $.noop;}// overide console methods for no calls errors
		}else{
			window.console = mod == 2 ? {'log':function(){ alert(Array.joinArgs(arguments));},'warn':function(){ alert('#warn : '+Array.joinArgs(arguments));}} : window.console = {'log':$.noop, 'warn':$.noop};
		}
	}*/


	//________ New Debug 12 sept. 2011
	if(typeof window.loadFirebugConsole == 'function')			window.loadFirebugConsole();// try to load firebug console for firefox
	if(typeof window.console != 'undefined'){// store console native methods
		window.console._log = window.console.log;
		window.console._warn = window.console.warn;
	}
	if(typeof window.console == 'undefined')		window.console = {};
	window.setDebugMode = function(mode){// mod 0 : no debug at all, mod 1 : debug only if console, mod 2 : debug with alert if no console
		if(typeof mode != 'number')	mode = 1;// this is the default mode
		if(typeof window.console._log == 'function'){// check if native console
			if(mode == 1 || mode == 2){	window.console.log = window.console._log; window.console.warn = window.console._warn;}
			else{		window.console.log = window.console.warn = $.noop;}
		}else if(mode == 2){// debug with alert
			window.console = {
				'log':function(){		alert(Array.joinArgs(arguments));}
				, 'warn':function(){	alert('#warn : '+Array.joinArgs(arguments));}
			}
		}	else {	window.console.log = window.console.warn = $.noop;}// prevent call errors if no console
	}
	setDebugMode(1);// set default debug mode : from this point, console.log won't trow errors in not supporting browsers


	//_________________ extend
	$.fn.extend({
		//_______________________ Tooltip
		// tabProd, idContent, tabIdField
		// ".content", ["name","id","desc","price"]
		toolTip:function(bindLink, idContent, tabIdField, idBoxImg, options){
			var me = $(this);
			if(me.length > 1)	return;
			options = $.extend({speed:250
							   ,xDec:0
							   ,yDec:0
							   }, options || {});
			//___ vars
			var $tim, $isShow, curBt, $curId;
			var domTlp = this;
			var jTlp = $(this);
			var xScroll, yScroll;
			var $follow = false;
			var mousePos = {x:0,y:0};
			var boxImg = $(idBoxImg, jTlp);
			var boxCont = $(idContent, jTlp);
			var curFnsr = null;
			var curPic;
			
			//___ methods
			function followMouse(ev){
				if(!$follow)	return;
				var margin = 5;
				var dw = $("body").width()-margin;
				var dh = $.tools.bodyHeight()-margin;
				var ow = jTlp.outerWidth();
				var oh = jTlp.outerHeight();
				var y = yScroll+Math.max(margin,Math.min(dh-oh, mousePos.y-Math.floor(oh/2)));
				var x = mousePos.x+options.xDec;
				if(x > dw-ow){		x = mousePos.x-ow-options.xDec;}
				x = Math.max(margin,x);
				jTlp.css({"left":x,"top":y});
				
			}
			//___ init
			$(document).mousemove(function updateMousePos(ev){	mousePos.x = ev.pageX; mousePos.y = ev.pageY; followMouse(ev);});
			// build div of properties
			boxCont.empty();
			/*
			for(var i = 0; i < tabIdField.length; i++){
				var idF = tabIdField[i];
				if(idF != 'TM')		$(idContent,jTlp).append('<div class="pdt-'+idF+'"></div>');
				//alert("kk : "+$(idContent,jTlp).html());
			}
			*/
			//___ return
			return this.each(function(){
				function w_show(ev){
					//alert("w_show : " + $(this).is(bindLink));
					if(!$(this).is(bindLink))	return;
					//alert("w_show : " + $(this).is(bindLink));
					var id = $(this).attr("id").substring(3);
					//alert("w_show : " + id);
					if($.tools.isValid(id,"str")){
						if($tim > 0)	clearTimeout($tim);
						xScroll = $(document).scrollLeft();		yScroll = $(document).scrollTop();
						jTlp.data("w",jTlp.outerWidth());		jTlp.data("h",jTlp.outerHeight());
						$follow = true;
						followMouse();
						if(id != $curId){
							$curId = id;
							setDetail($(this));
						}
						jTlp.stop(true, true).fadeIn("normal",onShow);
					}else{	// non valid id
						$curId = null;
					}
				}
				
				function w_hide(ev){
					//___ check if mouseover tooltip
					var evn = ev.relatedTarget;
					var evn_c = $(evn);
					var k = evn_c.childOf($.params.idDivTlp);
					//alert("hide : "+k+"|"+evn_c.attr("id")+"|"+evn_c.attr("class"));
					if(k)	return;
					$follow = false;
					$tim = setTimeout(function(){jTlp.stop(true,true).fadeOut("normal",onHide);}, 200);
				}
				
				function setDetail(prod){	// set product details
					//alert("setDetail :"+prod.attr("id"));
					if(typeof prod == 'undefined')		return;
					var domProps = $('.properties', prod).eq(0);// get dom of properties
					//console.log('setDetail : ', domProps);
					
					// set avalaible properties
					boxCont.empty();
					$('div', domProps).each(function(index){
						var id = $(this).attr('class').split('-')[1];
						if(typeof id == 'undefined')	return false;
						if(id != 'TM' && id != 'uimg' && id != 'utb'){
							//console.log('parser : ', id, $(this).html());//id, idContent, $(this).html());
							boxCont.append('<div class="pdt-'+id+'">'+$(this).html()+'</div>');
						}
					});
					
					/*
					for(var i = 0; i < tabIdField.length; i++){
						//alert("setDetail : "+tabIdField[i]+"|"+prod.data(tabIdField[i])+"|"+$(idContent+" .pdt-"+tabIdField[i], jTlp));
						var tf = tabIdField[i];
						//$(idContent+" .pdt-"+tf, jTlp).html($(".properties",prod).attr("p-"+tf));
						$(idContent+" .pdt-"+tf, jTlp).html($(".properties .p-"+tf, prod).html());
					}
					*/

					// load main picture
					$('.picA', boxImg).remove();// remove picture
					boxImg.addClass('bgLoading');// set loading
					curPic = $.params.pathImgProducts+$('.p-uimg', domProps).html();
					boxImg.loadImg(curPic, onImgLoaded, {'class':'picA'});
					// load trademark logo
					var fnsr = $('.p-TM', domProps);
					if(typeof fnsr != 'undefined' && fnsr.html() != null){
						fnsr = fnsr.html().toLowerCase();
						if(fnsr != curFnsr){
							curFnsr = fnsr;
							var boxTM = $('.pdt-TM', boxImg);
							boxTM.empty();// remove picture
							switch(curFnsr){
								case 'shi' :	boxTM.loadImg($pathImgSkin+'logo-evads.png'); setTimeout(function(){$('img', boxTM).IEpng();},500); break;
							}
						}
					}
				}
				
				function onImgLoaded(err,img,ev){
					//alert("onImgLoaded: "+arguments);
					if(img.attr('src') != curPic)	return img.remove();// if another pic start loaded before this loading finish, remove
					boxImg.removeClass("bgLoading");
					boxImg.css({zoom:1});// IE6 hack
					followMouse(ev);
					$.tools.IEsize(domTlp);
					//setTimeout(function(){boxImg.removeClass("bgLoading");},100);
					if(err){
						boxImg.html("Aucune image disponible");
					}
				}
				function onHide(){				$curId = null;}
				function onShow(){				}
				
				$(bindLink).bind("mouseenter",w_show); $(bindLink).bind("mouseleave",w_hide);
				jTlp.bind("mouseenter",w_show); jTlp.bind("mouseleave",w_hide);
			});
    }
		//_______________________ pager
		, pager:function(idPageScroll, idPage, idPager, idPageSel, idPagePrev, idPageNext, idProdBox, idProdImg){
			var me = $(this);
			if(me.length > 1)	return;
			var numPage, indProd, decProd, curPage, oldPage, pageImgs, curImgLoad, timL;
			var nbPageIt = 10;// nb prod per page
			var viewer = this.eq(0);// viewer pages
			var tabPage = $(idPage, viewer);// pages
			var pageW = tabPage.eq(0).outerWidth();// page width
			var pager = $(idPager);// pager (navigation)
			var pageSels = $(idPageSel, pager);// page selection links
			var pageProds;
			var contRemove;
			
			//_________________ methods
			function setPage(num){
				num = Math.max(0,Math.min(tabPage.length-1,num));
				if(num == numPage)	return;
				numPage = num;
				if(timL > 0)	clearTimeout(timL);
				//alert("setPage : "+numPage+"|"+p.size());
				oldPage = curPage;
				curPage = tabPage.eq(numPage);
				//alert("setPage : "+numPage+"|"+p.length+"|"+pageW);
				// check prev and next enable
				$(idPagePrev,pager).css({visibility:(numPage<=0?"hidden":"visible")});
				$(idPageNext,pager).css({visibility:(numPage>=tabPage.length-1?"hidden":"visible")});
				pageSels.removeClass("selected");// unselect all 
				pageSels.eq(numPage).addClass("selected");// select current
				pageProds = $(idProdBox, curPage);
				//alert("setPage : "+pageProds.size());
				pageImgs = $(idProdImg, curPage);// img loaders
				decProd = numPage*nbPageIt;// offset index
				$(idPageScroll).stop(true);// scroll to page
				$(idPageScroll).animate({left:-numPage*pageW}, 500, "swing",onPageScrolled);// scroll to page
				
			}
			function onPageScrolled(){
				//alert("onPageScrolled : ");
				indProd = -1;
				if(timL > 0)	clearTimeout(timL);
				timL = setTimeout(function(){ loadTbImg(0);},200);
				if(oldPage != undefined){// remove all img of old page
					$(idProdBox, oldPage).each(function(i,el){
						//$(idProdImg, this).html("<span>"+$(".name",this).html()+"</span>");
						$(idProdImg, this).eq(0).html("<span>"+$(".properties .p-name",this).html()+"</span>");
					});
				}
			}
							
			function loadTbImg(ind){
				if(ind == indProd || ind < 0 || ind >= pageProds.size())	return;
				var pi = pageImgs.eq(ind);
				if(pi == undefined)	return;
				indProd = ind;
				curImgLoad = pi;
				//alert("loadTbImg : "+indProd);$(".properties",prod).attr("p-"+tf)
				//$(".properties", pageProds.eq(indProd)).attr("p-utb")
				//alert("loadTbImg : "+$(".properties",pageProds.eq(indProd)).attr("p-utb"));
				var props = $(".properties", pageProds.eq(indProd));
				var alt = $(".p-name",props).html();
				contRemove = curImgLoad.children();
				curImgLoad.loadImg($.params.pathImgProducts + $(".properties .p-utb", pageProds.eq(indProd)).html(), onTbImgLoad, {'alt':alt,'title':alt});
			}
			
			function onTbImgLoad(err,img,ev){
				//alert("onTbImgLoad : "+err);
				if(err){		curImgLoad.html("<span>aucune image</span>");}
				else{
					// center img vertical & horizontal
					var ji = $(img);
					ji.css({position:"absolute",left:Math.round((ji.parent().width()-ji.width())/2),bottom:0});
					curImgLoad.hide();
					curImgLoad.fadeIn("fast");
					contRemove.remove();
				}
				if(timL > 0)	clearTimeout(timL);
				timL = setTimeout(function(){ loadTbImg(indProd+1);},50);
			}
			setPage(0);

			//_________________ 
			//alert("nbLoad : " +tabProdImg.length);
			return this.each(function(){
				pageSels.click(function(){				setPage(pageSels.index(this));});// set nav page click handler
				$(idPagePrev,pager).click(function(){	setPage(numPage-1);});// set prev page click handler
				$(idPageNext,pager).click(function(){	setPage(numPage+1);});// set next page click handler
				pager.css({left:(pager.parent().innerWidth()-pager.outerWidth())/2});// center pager horizontal
				tabPage.each(function(i,el){	$(this).css({left:i*pageW});});// set x of each page
				//alert("yooo : "+$(idPageNext,pager).size());
			});
		}
		//_______________________ Load img
		, loadImg:function(uImg,fct, objAttr){
			if($(this).length > 1)	return;
			var loader = $(this);
			var img = $("<img/>");//new Image();
			//if($.tools.isValid(alt,"str")){	$(img).attr("alt",alt);}
			if(typeof objAttr != 'undefined')	$(img).attr(objAttr);
			$(img).load(function(ev){
				loader.append(this);
				if(fct != undefined)	fct(false,img,ev);
			}).error(function(ev){
				if(fct != undefined)	fct(true,img,ev);
			}).attr("src", uImg);
			return img;
		}
		//_______________________ misc
		, childOf:function(str){		return $(this).parents(str).length > 0;}
		//_______________________ IE hacks
		,IEheight : pngNComp ? function(){		return $(this).each(function(){ $(this).css("height",$(this).parent().height());});} : function(){ return this;}
		,IEwidth : pngNComp ? function(){		return $(this).each(function(){	$(this).css("width",$(this).parent().width());});} : function(){ return this;}
		//_______________________ titles
		,imgRotator:function(tabImg, delayRot, pathImg){
			var me = $(this);
			if(me.length < 1)	return;
			//console.log("fct imgRotator ! : "+$(this).length);
			if(!$.tools.isValid(pathImg,"str"))	pathImg = $.params.pathImgIllus;
			if(delayRot == undefined)	delayRot = 2000;
			var tim = 0;
			var indImg = 0;
			var boxImgA = me.find("div#boxA").eq(0);
			var boxImgB = me.find("div#boxB").eq(0);
			//console.log("boxImg : "+boxImgA);
			//alert("box : "+boxImgA.attr("id")+"|"+boxImgB.attr("id"));
			var curBoxImg = boxImgA;
			var oldBoxImg;
			var curDepth = 10;
			// store initial img at the end of array
			var initImgName = me.find("img").eq(0).attr("src");
			if($.tools.isValid(initImgName,"str"))	tabImg[tabImg.length] = initImgName;// add current background image file name in at end of array
			//alert("tabImg :\n"+tabImg.join("\n"));
			function rotStart(){	setImg(0);}
			function setImg(i){
				indImg = i;
				var u = tabImg[indImg];
				//alert("setImg : "+i+":"+u);
				if(!$.tools.isValid(u,"str")){	/*alert("le nom d'image est vide !");*/ return nextImg();}
				if(u != initImgName)	u = pathImg+u;
				curBoxImg = curBoxImg == boxImgA ? boxImgB : boxImgA;
				//console.log("setImg : "+curBoxImg);
				if(!$.tools.isValid(curBoxImg))		return;
				curBoxImg.css({opacity:0});
				imgLoad = curBoxImg.loadImg(u, onImgLoaded);
			}
			function onImgLoaded(err,img){
				if(err){	return nextImg();}
				curBoxImg.css({zIndex:++curDepth}).fadeTo(1000,1,function(){setTimeout(nextImg,delayRot);});
			}
			/* // test avec background-image
			var bgd = $.tools.cssBgd(me.css("background-image"), 1);// extract clean file name without url('path/...')
			if($.tools.isValid(bgd,"str"))	tabImg[tabImg.length-1] = bgd;// add current background image file name in at end of array
			function rotStart(){	setImg(0);}
			function setImg(i){
				indImg = i;
				var u = pathImg+tabImg[indImg];
				me.css("background-image","url("+u+")");
			}
			*/
			function nextImg(){		setImg((indImg>=tabImg.length-1)?0:(indImg+1));}
			//_________ start rotation
			setTimeout(rotStart,5000);// first delay
		}
		//_______________________ titles
		,titleSwf:function(){
			var me = $(this);
			if(me.length < 1)	return;
			var tId = [];
			var idAuto = 0;
			return this.each(function(ind){
				if(!SWFObject)	return;
				var t = $("h2",this).text();
				//__ replace substr
				t = t.replace(/(&)/gi,"¤");
				t = t.replace(/\s/gi," ");
				
				//alert("titleSwf : "+t);
				//__ /replace substr
				$(this).css({height:36});
				//$("h2",this).text("");
				var id = $(this).attr("id");
				if(!$.tools.isValid(id,"str")){
					id = "title-"+(idAuto++);
				}else{
					var k = tId.indexOf(id);
					if(k == -1)	tId.push(id);
					else{	id = "title-"+(idAuto++);}
				}
				$(this).attr("id",id);
				//alert("titleSwf : "+id);
				//alert("qfqfd : "+$.params.pathFlash+"dialog-title.swf");
				var mySwf = new SWFObject($.params.pathFlash+"dialog-title.swf", id, "680", "36", "6", "#333333");
				mySwf.addParam("wmode", "transparent");
				mySwf.addParam("scale", "noborder");
				mySwf.addParam("salign", "TL");
				mySwf.addParam("menu", "false");
				//alert("setTItle : "+t);
				mySwf.addVariable("$title", t);
				$(this).css({overflow:"hidden"});
				setTimeout(function(){	mySwf.write(id);},200*ind);
				//mySwf.write(id);
			});
			
		}
		,test :function(){	console.log("do test");}
		,IEpng : pngNComp ? function(){
			var rxUrlImg = /^url\(["']?(.*\.png)["']?\)$/i;
			$(this).each(function(){
				if(this.tagName.toLowerCase() == "img"){
					var bgd = $(this).attr("src");
					if(!bgd.match(/.*\.png$/gi))	return;
					this.bgdOut = bgd;
					$(this).attr("src", "blank.gif");
				}else{
					var bgd = $(this).css("background-image");
					//if(!bgd.match(/.*\.png["]?\)$/gi))	return;
					var bgdImg = bgd.match(rxUrlImg);
					if(!bgdImg)	return;
					//______ set IE filter
					var bgdCol = $(this).css("background-color");
					$(this).css("background","none");
					if($.tools.isValid(bgdCol, "str", "!='none'")){			$(this).css("background-color", bgdCol);}
					this.bgdOut = bgdImg[1];		// store initial value without 'url("]...[")'
				}
				if($pathBase && !this.bgdOut.match(/^http:\/\//gi))	this.bgdOut = $pathBase + this.bgdOut;
				//alert('bgd : '+this.bgdOut);
				
				$(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.bgdOut+"',sizingMethod='crop')");
			});
		} : function(){ return this;}
	});

	//____________ global params
	$.params = {
				debugMode:true
				,pathImgProducts:""
				,pathImgSkin:$pathImgSkin
				,pathImgIllus:$pathImgSkin+"illus/"
				,pathFlash:$pathFlash
				,ltIE6:$.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent)// // IE 5.5 or 6
				,idDivTlp:"#tlp-pdt-detail"
				,uProdDetail:"product-detail.php"
				,idAuto:0
				,htmToolTip:'<div id="tlp-pdt-detail" class="tooltip">'
								+'<div class="body">'
									+'<div class="content"></div>'
									+'<div class="box-img">'
										+'<div class="pdt-TM"></div>'
									+'</div><div class="clearer"></div>'
								+'</div>'
							+'<div class="tl"></div><div class="t iesize"></div><div class="tr"></div><div class="l ieh"></div><div class="r ieh"></div><div class="bl"></div><div class="b iesize"></div><div class="br"></div>'
							+'</div>'
						};

})(jQuery);


//______________________ init
$(function(){
	//console.log('wdwd.js on dom ready');
	//______________ prevent error with console.log call, for Firebug with no supporting browsers
	//________ debug
	setDebugMode(0);// must be called one or more times

	//@cc_on document.execCommand("BackgroundImageCache", false, true);// don't remove : prevent IE6 cursor blinking
	
	$(".c-title").titleSwf();//_______ titles swf
	//_______ anim cadeau
	//console.log('zzz : '+$("#spl-cadeau").length);
	if($('#spl-cadeau').length){
		var mySwf = new SWFObject($pathFlash+"offrir-un-cadeau.swf", "anim-cadeau", "200", "100", "6", "#333333");
		mySwf.addParam("wmode", "transparent"); mySwf.addParam("menu", "false"); mySwf.addVariable("$linkURL", "offrir-un-bijou");
		mySwf.write("spl-cadeau");
	}
	//__ img-rotator
	//console.log("rotator : "+$("#rotator-home").length);
	$("#rotator-home").imgRotator(["pendentif-amethyste-labradorite.jpg","colliers-ambre.jpg","colliers-marcassites.jpg"
						   ,"colliers-nacre.jpg","colliers-pierres-2.jpg"
						   ,"bagues-pierres.jpg","bagues-nacre.jpg","pendentif-agathe.jpg"
							,"bracelets-ambre.jpg","bracelets-argent-femme.jpg","bracelets-nacre.jpg","collier-touareg.jpg"
							,"bracelets-acier.jpg","chaines-argent-homme.jpg","bagues-college.jpg","boucles-d-oreilles-navajo.jpg"]
							,3000,$.params.pathImgSkin+"intro/");
	//__ pager
	$(".cat-viewer").pager(".cat-pages",".page-tb",".pager",".page-sel","#bt-prev","#bt-next",".tb-box",".box-img");
	//__ tooltip
	var tlpSel = ".tb-box,.tb-ecard";
	if($(tlpSel).size() > 0){
		$("body").append($.params.htmToolTip);
		$(".tooltip").css({display:"none"});
		//alert("tooltip : "+$("#box-head").size());
		$("#tlp-pdt-detail").toolTip(tlpSel,".content",["name","ref","weight","desc","TM"],".box-img",{xDec:40,yDec:20});
	}
	//___ menu maine
	$("#menu-main").droppy();
	
	//___ ie hacks
	//$('img,div,span,a,input').IEpng(); //$.tools.IEsize();
	setTimeout("$('img').IEpng(); $('div').IEpng(); $('span').IEpng(); $('a').IEpng(); $('input').IEpng(); $.tools.IEsize();",300);
	
	// fix IE widths & heights
	//alert("kqkfd : "+$(".iez").bgiframe);
});



