
/* jquery.tinysort.min.js */
(function(b){b.tinysort={id:"TinySort",version:"1.0.4",defaults:{order:"asc",attr:"",place:"start",returns:false}};b.fn.extend({tinysort:function(h,j){if(h&&typeof(h)!="string"){j=h;h=null}var e=b.extend({},b.tinysort.defaults,j);var p={};this.each(function(t){var v=(!h||h=="")?b(this):b(this).find(h);var u=e.order=="rand"?""+Math.random():(e.attr==""?v.text():v.attr(e.attr));var s=b(this).parent();if(!p[s]){p[s]={s:[],n:[]}}if(v.length>0){p[s].s.push({s:u,e:b(this),n:t})}else{p[s].n.push({e:b(this),n:t})}});for(var g in p){var d=p[g];d.s.sort(function k(t,s){var i=t.s.toLowerCase?t.s.toLowerCase():t.s;var u=s.s.toLowerCase?s.s.toLowerCase():s.s;if(c(t.s)&&c(s.s)){i=parseFloat(t.s);u=parseFloat(s.s)}return(e.order=="asc"?1:-1)*(i<u?-1:(i>u?1:0))})}var m=[];for(var g in p){var d=p[g];var n=[];var f=b(this).length;switch(e.place){case"first":b.each(d.s,function(s,t){f=Math.min(f,t.n)});break;case"org":b.each(d.s,function(s,t){n.push(t.n)});break;case"end":f=d.n.length;break;default:f=0}var q=[0,0];for(var l=0;l<b(this).length;l++){var o=l>=f&&l<f+d.s.length;if(a(n,l)){o=true}var r=(o?d.s:d.n)[q[o?0:1]].e;r.parent().append(r);if(o||!e.returns){m.push(r.get(0))}q[o?0:1]++}}return this.pushStack(m)}});function c(e){var d=/^\s*?[\+-]?(\d*\.?\d*?)\s*?$/.exec(e);return d&&d.length>0?d[1]:false}function a(e,f){var d=false;b.each(e,function(h,g){if(!d){d=g==f}});return d}b.fn.TinySort=b.fn.Tinysort=b.fn.tsort=b.fn.tinysort})(jQuery);



/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: info@pupunzi.com
 site: http://pupunzi.com
 Licences: MIT, GPL
 ******************************************************************************/

/*
 * Name:jquery.mb.scrollable
 * Version: 1.5.7
*/
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}('(8($){$.q={1D:"1E.1F",1G:"1H",1I:"1.0",1l:{1m:"1n",j:1J,k:4,t:2,N:B,r:"14",O:"#O",u:1K,P:B,1o:1L,15:8(){},16:8(){}},1p:8(f){Y h.1q(8(){h.3={};$.1r(h.3,$.q.1l);$.1r(h.3,f);9 a=h;a.D=a.3.1m!="1n";9 b=$(a.3.O);a.l=1;a.6=0;a.m=$(a).17();a.m.G("1s");b.1t();$(a).17().1q(8(){$(h).1M("<18 19=\'1N\'></18>")});7(a.3.N){$(a.m).I("-1O-1u-N",a.3.N);$(a.m).I("-1P-1u-N",a.3.N)}a.m=$(a).17();9 c=a.3.k<h.m.J()?a.3.k:a.m.J();7(a.D){a.E=(a.3.r/c)-a.3.t;$(a.m).I({1Q:a.3.t,r:a.E,j:a.3.j})}v{a.E=(a.3.j/c)-a.3.t;$(a.m).I({1R:a.3.t,j:a.E,1S:"1T-1U",1V:"1W"})}h.o=(a.E*a.m.J())+(a.3.t*a.m.J());a.F=1a.1X(a.m.J()/a.3.k);9 d=$.1b.1c&&a.3.k>2?a.3.t/(a.3.k):0;7(a.D)$(a).I({1v:"1w",r:a.3.r-d,j:a.3.j,1Y:5,1d:"1e"});v $(a).I({1v:"1w",j:a.3.j-d,r:a.3.r,1Z:5,1d:"1e"});9 e=$("<18 19=\'1x\'/>").I({j:a.o,1d:"1e"});$(a.m).20(e);a.w=$(a).g(".1x");$(a.m).21(8(){7(a.z)$(a).A()},8(){7(a.z)$(a).Q()});7(a.3.P&&a.m.J()>a.3.k){a.z=V;$(a).Q()}$(a).Z();$(a).10();22(8(){$(".1s").1y()},23);$(a).s()})},W:8(a){9 b=$(h).C(0);7(!a)b.z=B;7(b.l==b.F){$(b).s();Y}7(b.3.15)b.3.15();9 c=$.1b.1c&&b.3.k>2?b.3.t/b.3.k:0;b.6-=((b.E+b.3.t)*b.3.k)-c;7(b.D){7((b.6<-b.o+b.3.r))b.6=-b.o+b.3.r;$(b.w).x({R:b.6},b.3.u)}v{7((b.6<-b.o+b.3.j))b.6=-b.o+b.3.j;$(b.w).x({S:b.6},b.3.u)}b.l+=1;$(h).s()},X:8(a){9 b=$(h).C(0);7(!a)b.z=B;7(b.l==1){$(b).s();Y}7(b.3.16)b.3.16();9 c=$.1b.1c&&b.3.k>2?b.3.t/b.3.k:0;b.6+=((b.E+b.3.t)*b.3.k)+c;7(b.D){7(b.6>=0)b.6=0;$(b.w).x({R:b.6},b.3.u)}v{7(b.6>=0)b.6=0;$(b.w).x({S:b.6},b.3.u)}b.l-=1;$(h).s()},11:8(){9 a=$(h).C(0);a.z=B;a.6=0;7(a.D){$(a.w).x({R:a.6},a.3.u)}v{$(a.w).x({S:a.6},a.3.u)}a.l=1;$(h).s();$(a).A()},12:8(){9 a=$(h).C(0);a.z=B;7(a.D){a.6=-a.o+a.3.r;$(a.w).x({R:a.6},a.3.u)}v{a.6=-a.o+a.3.j;$(a.w).x({S:a.6},a.3.u)}a.l=a.F;$(a).s();$(a).A()},Z:8(){9 a=$(h).C(0);9 b=$(a.3.O);9 c=b.g(".24");7(c){8 1z(i){a.6=-((a.E+a.3.t)*(a.3.k*(i-1)));7(a.D){7(a.6<-a.o+a.3.r)a.6=-a.o+a.3.r;$(a.w).x({R:a.6},a.3.u)}v{7(a.6<-a.o+a.3.j)a.6=-a.o+a.3.j;$(a.w).x({S:a.6},a.3.u)}a.l=1a.1A(i);$(a).s()}9 n=0;25(9 i=1;i<=a.F;i++){n++;9 p=$("<1B 19=\'1f\'> "+n+" <\\/1B>").K("L",8(){1z($(h).1C());$(a).A();a.z=B});c.26(p)}}},Q:8(){9 a="T";9 b=$(h).C(0);b.z=V;7(b.P)Y;9 c=b.3.1o+b.3.u;b.P=V;b.14=27(8(){a=b.l==1?"T":b.l==b.F?"13":a;7(a=="T")$(b).W(V);v $(b).X(V)},c);$(b).s()},A:8(){9 a=$(h).C(0);a.P=B;28(a.14);$(a).s()},10:8(){9 a=$(h).C(0);9 b=$(a.3.O);b.g(".1g").K("L",8(){$(a).11()});b.g(".13").K("L",8(){$(a).A();$(a).X()});b.g(".T").K("L",8(){$(a).A();$(a).W()});b.g(".1h").K("L",8(){$(a).12()});b.g(".1i").K("L",8(){$(a).Q()});b.g(".1j").K("L",8(){$(a).A();a.z=B})},s:8(){9 a=$(h).C(0);9 b=$(a.3.O);7(a.m.J()<=a.3.k){b.1t()}v{b.1y()}7(a.l==a.F){b.g(".1h").G("H");b.g(".T").G("H")}v{b.g(".1h").M("H");b.g(".T").M("H")}7(a.l==1){b.g(".1g").G("H");b.g(".13").G("H")}v{b.g(".1g").M("H");b.g(".13").M("H")}7(a.P){b.g(".1i").G("U");b.g(".1j").M("U")}v{b.g(".1i").M("U");b.g(".1j").G("U")}b.g(".1f").M("U");b.g(".1f").29(a.l-1).G("U");b.g(".l").1C(a.l+" / "+a.F)},1k:8(i,a){9 b=$(h).C(0);9 c=a?0:b.3.u;7(i>b.F)i=b.F;b.6=-((b.E+b.3.t)*(b.3.k*(i-1)));7(b.D){7(b.6<-b.o+b.3.r)b.6=-b.o+b.3.r;$(b.w).x({R:b.6},c)}v{7(b.6<-b.o+b.3.j)b.6=-b.o+b.3.j;$(b.w).x({S:b.6},c)}b.l=1a.1A(i);$(b).s();$(b).A();b.z=B}};$.y.q=$.q.1p;$.y.W=$.q.W;$.y.X=$.q.X;$.y.11=$.q.11;$.y.12=$.q.12;$.y.Z=$.q.Z;$.y.2a=$.q.2b;$.y.Q=$.q.Q;$.y.A=$.q.A;$.y.10=$.q.10;$.y.s=$.q.s;$.y.1k=$.q.1k})(2c);',62,137,'|||options|||scrollTo|if|function|var|||||||find|this||width|elementsInPage|idx|elements||elementsDim||mbScrollable|height|mbManageControls|elementMargin|slideTimer|else|mbscrollableStrip|animate|fn|autoScrollActive|mbStopAutoscroll|false|get|isVertical|singleElDim|totalPages|addClass|disabled|css|size|bind|click|removeClass|shadow|controls|autoscroll|mbAutoscroll|marginTop|marginLeft|next|sel|true|mbNextPage|mbPrevPage|return|mbPageIndex|mbActivateControls|mbFirstPage|mbLastPage|prev|auto|nextCallback|prevCallback|children|div|class|Math|browser|safari|position|relative|page|first|last|start|stop|goToPage|defaults|dir|horizontal|scrollTimer|buildMbScrollable|each|extend|scrollEl|hide|box|overflow|hidden|scrollableStrip|fadeIn|getPage|floor|span|html|plugin|mb|scroller|author|MB|version|950|600|6000|wrap|SECont|moz|webkit|marginBottom|marginRight|display|inline|block|float|left|ceil|paddingRight|paddingBottom|wrapAll|hover|setTimeout|1000|pageIndex|for|append|setInterval|clearInterval|eq|mbgotoPage|gotoPage|jQuery'.split('|'),0,{}))






/*rechercheintuitive.js*/

		$(function() {
		function log( message ) {
			$("<div/>").text( message ).prependTo( "#log" );
			$("#log").attr( "scrollTop", 0 );
		}
				
				
				
		function closeimgRechIntuitive( ) {
			$( "#imgRechIntuitive-icon" )[0].style.display = 'none';
			$( "#imgRechIntuitive-icon" ).attr( "src", "/images/transparent_1x1.png" );
			$( "#imgRechIntuitive" )[0].style.display = 'none';
		}
		function openimgRechIntuitive( ) {
			$( "#imgRechIntuitive-icon" )[0].style.display = 'block';
			$( "#imgRechIntuitive" )[0].style.display = 'block';
		}
		

		function textinbold( text, repl ) {
		
			return text.replace(
				new RegExp(
					"(?![^&;]+;)(?!<[^<>]*)(" +
					$.ui.autocomplete.escapeRegex(repl) +
					")(?![^<>]*>)(?![^&;]+;)", "gi"
				), "<strong>$1</strong>" );
				
		
		}
		

		
		$("#city").autocomplete({

			
			source: function( request, response ) {
				$.ajax({
					//url: "http://ws.geonames.org/searchJSON",
					url: "search.asp",
					dataType: "json",
					data: { 
						q: request.term 
					},
					success: function( data ) {
					openimgRechIntuitive( );
						response( $.map( data, function( item ) {

						var text = item.cname + " (" + item.ccode + ")" + item.cprice + "€ ";
 
							var tableau=request.term.split(" ");

							for (var i=0; i<tableau.length; i++) {
								text = textinbold(text, tableau[i]);
							}	

							text = "<span title='<img src="+item.xsimageurl+" />'>" + text + "</span>";

							return {
								label: text,
								value: item.catalogid,
								url:item.xsimageurl
							}
						}));
					}
				});

			},
		

			minLength: 2,
			
			focus: function( event, ui ) {
				$( "#imgRechIntuitive-icon" ).attr( "src", "http://scootmotoshop.com/" + ui.item.url );
				//$( this ).attr( "title", "http://preprod.scootmotoshop.com/" + ui.item.url );
				$( "#rechIntuitiveHidden" )[0].value =  ui.item.value ;
			},
				
			select: function( event, ui ) {
				window.location.replace("http://scootmotoshop.com/shopexd.asp?catalogid=" + $( "#rechIntuitiveHidden" )[0].value);
			},
			
			open: function() {
				$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
			},
			close: function() {
				closeimgRechIntuitive();
				$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
			}
		})
		
		/* */
		
		.data( "autocomplete" )._renderItem = function( ul, item ) {
			return $( "<li></li>" )
				.data( "item.autocomplete", item )

				.append( "<a>" + item.label + "</a>" )
				.appendTo( ul );
		};
		


		
	});






	



/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: info@pupunzi.com
 site: http://pupunzi.com

 Licences: MIT, GPL
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

/**
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 * in the JSON will become a property of the element itself.
 *
 * There are three supported types of metadata storage:
 *
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 *          
 *   class: Inside the class attribute, wrapped in curly braces: { }
 *   
 *   elem:  Inside a child element (e.g. a script tag). The
 *          name parameter indicates *which* element.
 *          
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 *
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 * 
 * @name $.metadata.setType
 *
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("class")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from the class attribute
 * 
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("attr", "data")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a "data" attribute
 * 
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 * @before $.metadata.setType("elem", "script")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a nested script element
 * 
 * @param String type The encoding type
 * @param String name The name of the attribute to be used to get metadata (optional)
 * @cat Plugins/Metadata
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 * @type undefined
 * @see metadata()
 */

(function($) {

$.extend({
	metadata : {
		defaults : {
			type: 'class',
			name: 'metadata',
			cre: /({.*})/,
			single: 'metadata'
		},
		setType: function( type, name ){
			this.defaults.type = type;
			this.defaults.name = name;
		},
		get: function( elem, opts ){
			var settings = $.extend({},this.defaults,opts);
			// check for empty string in single property
			if ( !settings.single.length ) settings.single = 'metadata';
			
			var data = $.data(elem, settings.single);
			// returned cached data if it already exists
			if ( data ) return data;
			
			data = "{}";
			
			if ( settings.type == "class" ) {
				var m = settings.cre.exec( elem.className );
				if ( m )
					data = m[1];
			} else if ( settings.type == "elem" ) {
				if( !elem.getElementsByTagName )
					return undefined;
				var e = elem.getElementsByTagName(settings.name);
				if ( e.length )
					data = $.trim(e[0].innerHTML);
			} else if ( elem.getAttribute != undefined ) {
				var attr = elem.getAttribute( settings.name );
				if ( attr )
					data = attr;
			}
			
			if ( data.indexOf( '{' ) <0 )
			data = "{" + data + "}";
			
			data = eval("(" + data + ")");
			
			$.data( elem, settings.single, data );
			return data;
		}
	}
});

/**
 * Returns the metadata object for the first member of the jQuery object.
 *
 * @name metadata
 * @descr Returns element's metadata object
 * @param Object opts An object contianing settings to override the defaults
 * @type jQuery
 * @cat Plugins/Metadata
 */
$.fn.metadata = function( opts ){
	return $.metadata.get( this[0], opts );
};

})(jQuery);


/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: info@pupunzi.com
 site: http://pupunzi.com

 Licences: MIT, GPL
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*	interval: 100,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) {
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
})(jQuery);



/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: info@pupunzi.com
 site: http://pupunzi.com

 Licences: MIT, GPL
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

/*
 * Name:jquery.mb.menu
 * Version: 2.8.5rc5
 *
 * added: boxMenu menu modality by: Sven Dowideit http://trunk.fosiki.com/Sandbox/WebSubMenu
 */
// to get the element that is fireing a contextMenu event you have $.mbMenu.lastContextMenuEl that returns an object.

(function($) {
  $.mbMenu = {
    name:"mbMenu",
    author:"Matteo Bicocchi",
    version:"2.8.5rc5",
    actualMenuOpener:false,
    options: {
      template:"yourMenuVoiceTemplate",// the url that returns the menu voices via ajax. the data passed in the request is the "menu" attribute value as "menuId"
      additionalData:"",
      menuSelector:".menuContainer",
      menuWidth:400,
      openOnRight:false,
      containment:"window",
      iconPath:"ico/",
      hasImages:true,
      fadeInTime:0,
      fadeOutTime:100,
      menuTop:0,
      menuLeft:0,
      submenuTop:0,
      submenuLeft:4,
      opacity:1,
      openOnClick:true,
      closeOnMouseOut:false,
      closeAfter:500,
      minZindex:"auto", // or number
      hoverIntent:0, //if you use jquery.hoverIntent.js set this to time in milliseconds; 0= false;
      submenuHoverIntent:200, //if you use jquery.hoverIntent.js set this to time in milliseconds; 0= false;
      onContextualMenu:function(){} //it pass 'o' (the menu you clicked on) and 'e' (the event)
    },
    buildMenu : function (options){
      return this.each (function ()
      {
        var thisMenu =this;
        thisMenu.id = !this.id ? "menu_"+Math.floor (Math.random () * 1000): this.id;
        this.options = {};
        $.extend (this.options, $.mbMenu.options);
        $.extend (this.options, options);

        $(".mbmenu").hide();
        thisMenu.clicked = false;
        thisMenu.rootMenu=false;
        thisMenu.actualOpenedMenu=false;
        thisMenu.menuvoice=false;
        var root=$(this);
        var openOnClick=this.options.openOnClick;
        var closeOnMouseOut=this.options.closeOnMouseOut;

        //build roots
        $(root).each(function(){

          /*
           *using metadata plugin you can add attribute writing them inside the class attr with a JSON sintax
           * for ex: class="rootVoice {menu:'menu_2'}"
           */
          if ($.metadata){
            $.metadata.setType("class");
            thisMenu.menuvoice=$(this).find(".rootVoice");
            $(thisMenu.menuvoice).each(function(){
              if ($(this).metadata().menu) $(this).attr("menu",$(this).metadata().menu);
              if ($(this).metadata().disabled) $(this).attr("isDisable",$(this).metadata().disabled);
            });
          }

          thisMenu.menuvoice=$(this).find("[menu]").add($(this).filter("[menu]"));
          thisMenu.menuvoice.filter("[isDisable]").addClass("disabled");

          $(thisMenu.menuvoice).css("white-space","nowrap");

          if(openOnClick){
            $(thisMenu.menuvoice).bind("click",function(){
              $(document).unbind("click.closeMbMenu");                              
              if (!$(this).attr("isOpen")){
                $(this).buildMbMenu(thisMenu,$(this).attr("menu"));
                $(this).attr("isOpen","true");
              }else{
                $(this).removeMbMenu(thisMenu,true);
                $(this).addClass("selected");
              }

              //empty
              if($(this).attr("menu")=="empty"){
                if(thisMenu.actualOpenedMenu){
                  $("[isOpen]").removeAttr("isOpen");
                }
                $(this).removeMbMenu(thisMenu);
              }
              $(document).unbind("click.closeMbMenu");
            });
          }
          var mouseOver=$.browser.msie?"mouseenter":"mouseover";
          var mouseOut=$.browser.msie?"mouseleave":"mouseout";

          $(thisMenu.menuvoice).mb_hover(
                  this.options.hoverIntent,
                  function(){
                    if(!$(this).attr("isOpen"))
                      $("[isOpen]").removeAttr("isOpen");
                    if (closeOnMouseOut) clearTimeout($.mbMenu.deleteOnMouseOut);
                    if (!openOnClick) $(thisMenu).find(".selected").removeClass("selected");
                    if(thisMenu.actualOpenedMenu){ $(thisMenu.actualOpenedMenu).removeClass("selected");}
                    $(this).addClass("selected");
                    if((thisMenu.clicked || !openOnClick) && !$(this).attr("isOpen")){
                      $(this).removeMbMenu(thisMenu);
                      $(this).buildMbMenu(thisMenu,$(this).attr("menu"));
                      if ($(this).attr("menu")=="empty"){
                        $(this).removeMbMenu(thisMenu);
                      }
                      $(this).attr("isOpen","true");
                    }
                  },
                  function(){
                    if (closeOnMouseOut)
                      $.mbMenu.deleteOnMouseOut= setTimeout(function(){
                        $(this).removeMbMenu(thisMenu,true);
                        $(document).unbind("click.closeMbMenu");
                      },$(root)[0].options.closeAfter);

                    if ($(this).attr("menu")=="empty"){
                      $(this).removeClass("selected");
                    }
                    if(!thisMenu.clicked)
                      $(this).removeClass("selected");
                    $(document).one("click.closeMbMenu",function(){
                      $("[isOpen]").removeAttr("isOpen");
                      $(this).removeClass("selected");
                      $(this).removeMbMenu(thisMenu,true);
                      thisMenu.rootMenu=false;thisMenu.clicked=false;
                    });
                  }
                  );
        });
      });
    },
    buildContextualMenu:  function (options){
      return this.each (function ()
      {
        var thisMenu = this;
        thisMenu.options = {};
        $.extend (thisMenu.options, $.mbMenu.options);
        $.extend (thisMenu.options, options);
        $(".mbmenu").hide();
        thisMenu.clicked = false;
        thisMenu.rootMenu=false;
        thisMenu.actualOpenedMenu=false;
        thisMenu.menuvoice=false;

        /*
         *using metadata plugin you can add attribut writing them inside the class attr with a JSON sintax
         * for ex: class="rootVoice {menu:'menu_2'}"
         */
        var cMenuEls;
        if ($.metadata){
          $.metadata.setType("class");
          cMenuEls= $(this).find(".cmVoice");
          $(cMenuEls).each(function(){
            if ($(this).metadata().cMenu) $(this).attr("cMenu",$(this).metadata().cMenu);
          });
        }
        cMenuEls= $(this).find("[cMenu]").add($(this).filter("[cMenu]"));

        $(cMenuEls).each(function(){
          $(this).css({"-webkit-user-select":"none","-moz-user-select":"none"});
          var cm=this;
          cm.id = !cm.id ? "menu_"+Math.floor (Math.random () * 100): cm.id;
          $(cm).css({cursor:"default"});
          $(cm).bind("contextmenu","mousedown",function(event){
            event.preventDefault();
            event.stopPropagation();
            event.cancelBubble=true;

            $.mbMenu.lastContextMenuEl=cm;

            if ($.mbMenu.options.actualMenuOpener) {
              $(thisMenu).removeMbMenu($.mbMenu.options.actualMenuOpener);
            }
            /*add custom behavior to contextMenuEvent passing the el and the event
             *you can for example store to global var the obj that is fireing the event
             *mbActualContextualMenuObj=cm;
             *
             * you can for example create a function that manipulate the voices of the menu
             * you are opening according to a certain condition...
             */

            thisMenu.options.onContextualMenu(this,event);

            $(this).buildMbMenu(thisMenu,$(this).attr("cMenu"),"cm",event);
            $(this).attr("isOpen","true");

          });
        });
      });
    }
  };
  $.fn.extend({
    buildMbMenu: function(op,m,type,e){
      var msie6=$.browser.msie && $.browser.version=="6.0";
      var mouseOver=$.browser.msie?"mouseenter":"mouseover";
      var mouseOut=$.browser.msie?"mouseleave":"mouseout";
      if (e) {
        this.mouseX=$(this).getMouseX(e);
        this.mouseY=$(this).getMouseY(e);
      }

      if ($.mbMenu.options.actualMenuOpener && $.mbMenu.options.actualMenuOpener!=op)
        $(op).removeMbMenu($.mbMenu.options.actualMenuOpener);
      $.mbMenu.options.actualMenuOpener=op;
      if(!type || type=="cm")	{
        if (op.rootMenu) {
          $(op.rootMenu).removeMbMenu(op);
          $(op.actualOpenedMenu).removeAttr("isOpen");
          $("[isOpen]").removeAttr("isOpen");
        }
        op.clicked=true;
        op.actualOpenedMenu=this;
        $(op.actualOpenedMenu).attr("isOpen","true");
        $(op.actualOpenedMenu).addClass("selected");
      }

      //empty
      if($(this).attr("menu")=="empty"){
        return;
      }

      var opener=this;
      var where=(!type|| type=="cm")?$(document.body):$(this).parent().parent();

      var menuClass= op.options.menuSelector.replace(".","");

      if(op.rootMenu) menuClass+=" submenuContainer";
      if(!op.rootMenu && $(opener).attr("isDisable")) menuClass+=" disabled";

      where.append("<div class='menuDiv'><div class='"+menuClass+" '></div></div>");
      this.menu  = where.find(".menuDiv");
      $(this.menu).css({width:0, height:0});
      if (op.options.minZindex!="auto"){
        $(this.menu).css({zIndex:op.options.minZindex++});
      }else{
        $(this.menu).mb_bringToFront();
      }
      this.menuContainer  = $(this.menu).find(op.options.menuSelector);

      $(this.menuContainer).bind(mouseOver,function(){
        $(opener).addClass("selected");
      });
      $(this.menuContainer).css({
        position:"absolute",
        opacity:op.options.opacity
      });
      if (!$("#"+m).html()){
        $.ajax({
          type: "POST",
          url: op.options.template,
          cache: false,
          async: false,
          data:"menuId="+m+(op.options.additionalData!=""?"&"+op.options.additionalData:""),
          success: function(html){
            $("body").append(html);
            $("#"+m).hide();
          }
        });
      }
      $(this.menuContainer).attr("id", "mb_"+m).hide();

      //LITERAL MENU SUGGESTED BY SvenDowideit
      var isBoxmenu=$("#"+m).hasClass("boxMenu");

      if (isBoxmenu) {
        this.voices = $("#"+m).clone(true);
        this.voices.css({display: "block"});
        this.voices.attr("id", m+"_clone");
      } else {
        //TODO this will break <a rel=text> - if there are nested a's
        this.voices= $("#"+m).find("a").clone(true);
      }

      /*
       *using metadata plugin you can add attribut writing them inside the class attr with a JSON sintax
       * for ex: class="rootVoice {menu:'menu_2'}"
       */
      if ($.metadata){
        $.metadata.setType("class");
        $(this.voices).each(function(){
          if ($(this).metadata().disabled) $(this).attr("isdisable",$(this).metadata().disabled);
          if ($(this).metadata().img) $(this).attr("img",$(this).metadata().img);
          if ($(this).metadata().menu) $(this).attr("menu",$(this).metadata().menu);
          if ($(this).metadata().action) $(this).attr("action",$(this).metadata().action);
        });
      }


      // build each voices of the menu
      $(this.voices).each(function(i){

        var voice=this;
        var imgPlace="";

        var isText=$(voice).attr("rel")=="text";
        var isTitle=$(voice).attr("rel")=="title";
        var isDisabled=$(voice).is("[isdisable]");
        if(!op.rootMenu && $(opener).attr("isDisable"))
          isDisabled=true;

        var isSeparator=$(voice).attr("rel")=="separator";

        // boxMenu SUGGESTED by Sven Dowideit
        if (op.options.hasImages && !isText && !isBoxmenu){

          var imgPath=$(voice).attr("img")?$(voice).attr("img"):"blank.gif";
          imgPath=(imgPath.length>3 && imgPath.indexOf(".")>-1)?"<img class='imgLine' src='"+op.options.iconPath+imgPath+"'>":imgPath;
          imgPlace="<td class='img'>"+imgPath+"</td>";
        }

        var line="<table id='"+m+"_"+i+"' class='line"+(isTitle?" title":"")+"' cellspacing='0' cellpadding='0' border='0' style='width:100%;' width='100%'><tr>"+imgPlace+"<td class='voice' nowrap></td></tr></table>";

        if(isSeparator)
          line="<p class='separator' style='width:100%;'></p>";

        if(isText)
          line="<div style='width:100%; display:table' class='line' id='"+m+"_"+i+"'><div class='voice'></div></div>";

        // boxMenu SUGGESTED by Sven Dowideit
        if(isBoxmenu)
          line="<div style='width:100%; display:inline' class='' id='"+m+"_"+i+"'><div class='voice'></div></div>";

        $(opener.menuContainer).append(line);

        var menuLine = $(opener.menuContainer).find("#" + m + "_" + i);
        var menuVoice = menuLine.find(".voice");
        if(!isSeparator){
          menuVoice.append(this);
          if($(this).attr("menu") && !isDisabled){
            menuLine.find(".voice a").wrap("<div class='menuArrow'></div>");
            menuLine.find(".menuArrow").addClass("subMenuOpener");
            menuLine.css({cursor:"default"});
            this.isOpener=true;
          }
          if(isText){
            menuVoice.addClass("textBox");
            if ($.browser.msie) menuVoice.css({maxWidth:op.options.menuWidth});
            this.isOpener=true;
          }
          if(isDisabled){
            menuLine.addClass("disabled").css({cursor:"default"});
          }

          if(!(isText || isTitle || isDisabled ||isBoxmenu)){
            menuLine.css({cursor:"pointer"});

            menuLine.bind("mouseover",function(){
              clearTimeout($.mbMenu.deleteOnMouseOut);
              $(this).addClass("selected");
            });

            menuLine.bind("mouseout",function(){
              $(this).removeClass("selected");
            });

            menuLine.mb_hover(
                    op.options.submenuHoverIntent,
                    function(event){
                      if(opener.menuContainer.actualSubmenu && !$(voice).attr("menu")){
                        $(opener.menu).find(".menuDiv").remove();
                        $(opener.menuContainer.actualSubmenu).removeClass("selected");
                        opener.menuContainer.actualSubmenu=false;
                      }
                      if ($(voice).attr("menu")){
                        if(opener.menuContainer.actualSubmenu && opener.menuContainer.actualSubmenu!=this){
                          $(opener.menu).find(".menuDiv").remove();
                          $(opener.menuContainer.actualSubmenu).removeClass("selected");
                          opener.menuContainer.actualSubmenu=false;
                        }
                        if (!$(voice).attr("action")) $(opener.menuContainer).find("#"+m+"_"+i).css("cursor","default");
                        if (!opener.menuContainer.actualSubmenu || opener.menuContainer.actualSubmenu!=this){
                          $(opener.menu).find(".menuDiv").remove();

                          opener.menuContainer.actualSubmenu=false;
                          $(this).buildMbMenu(op,$(voice).attr("menu"),"sm",event);
                          opener.menuContainer.actualSubmenu=this;
                        }
                        $(this).attr("isOpen","true");
                        return false;
                      }
                    },
                    function(){}
                    );
          }
          if(isDisabled || isTitle || isText || isBoxmenu){
            $(this).removeAttr("href");
            menuLine.bind(mouseOver,function(){
              if (closeOnMouseOut) clearTimeout($.mbMenu.deleteOnMouseOut);
              if(opener.menuContainer.actualSubmenu){
                $(opener.menu).find(".menuDiv").remove();
                opener.menuContainer.actualSubmenu=false;
              }
            }).css("cursor","default");
          }
          menuLine.bind("click",function(){
            if (($(voice).attr("action") || $(voice).attr("href")) && !isDisabled &&  !isBoxmenu && !isText){
              var target=$(voice).attr("target")?$(voice).attr("target"):"_self";
              if ($(voice).attr("href") && $(voice).attr("href").indexOf("javascript:")>-1){
                $(voice).attr("action",$(voice).attr("href").replace("javascript:",""));
              }
              var link=$(voice).attr("action")?$(voice).attr("action"):"window.open('"+$(voice).attr("href")+"', '"+target+"')";
              $(voice).removeAttr("href");
              eval(link);
              $(this).removeMbMenu(op,true);
            }else{
              $(document).unbind("click.closeMbMenu");
            }
          });
        }
      });

      // Close on Mouseout

      var closeOnMouseOut=$(op)[0].options.closeOnMouseOut;
      if (closeOnMouseOut){
        $(opener.menuContainer).bind("mouseenter",function(){
          clearTimeout($.mbMenu.deleteOnMouseOut);
        });
        $(opener.menuContainer).bind("mouseleave",function(){
          var menuToRemove=$.mbMenu.options.actualMenuOpener;
          $.mbMenu.deleteOnMouseOut= setTimeout(function(){$(this).removeMbMenu(menuToRemove,true);$(document).unbind("click.closeMbMenu");},$(op)[0].options.closeAfter);
        });
      }

      //positioning opened
      var t=0,l=0;
      $(this.menuContainer).css({
        minWidth:op.options.menuWidth
      });
      if ($.browser.msie) $(this.menuContainer).css("width",$(this.menuContainer).width()+2);

      switch(type){
        case "sm":
          t=$(this).position().top+op.options.submenuTop;

          l=$(this).position().left+$(this).width()-op.options.submenuLeft;
          break;
        case "cm":
          t=this.mouseY-5;
          l=this.mouseX-5;
          break;
        default:
          if (op.options.openOnRight){
            t=$(this).offset().top-($.browser.msie?2:0)+op.options.menuTop;
            l=$(this).offset().left+$(this).outerWidth()-op.options.menuLeft-($.browser.msie?2:0);
          }else{
            t=$(this).offset().top+$(this).outerHeight()-(!$.browser.mozilla?2:0)+op.options.menuTop;
            l=$(this).offset().left+op.options.menuLeft;
          }
          break;
      }

      $(this.menu).css({
        position:"absolute",
        top:t,
        left:l
      });

      if (!type || type=="cm") op.rootMenu=this.menu;
      $(this.menuContainer).bind(mouseOut,function(){
        $(document).one("click.closeMbMenu",function(){$(document).removeMbMenu(op,true);});
      });

      if (op.options.fadeInTime>0) $(this.menuContainer).fadeIn(op.options.fadeInTime);
      else $(this.menuContainer).show();

      var wh= (op.options.containment=="window")?$(window).height():$("#"+op.options.containment).offset().top+$("#"+op.options.containment).outerHeight();
      var ww=(op.options.containment=="window")?$(window).width():$("#"+op.options.containment).offset().left+$("#"+op.options.containment).outerWidth();

      var mh=$(this.menuContainer).outerHeight();
      var mw=$(this.menuContainer).outerWidth();

      var actualX=$(where.find(".menuDiv:first")).offset().left-$(window).scrollLeft();
      var actualY=$(where.find(".menuDiv:first")).offset().top-$(window).scrollTop();
      switch(type){
        case "sm":
          if ((actualX+mw)>= ww && mw<ww){
            l-=((op.options.menuWidth*2)-(op.options.submenuLeft*2));
          }
          break;
        case "cm":
          if ((actualX+(op.options.menuWidth*1.5))>= ww && mw<ww){
            l-=((op.options.menuWidth)-(op.options.submenuLeft));
          }
          break;
        default:
          if ((actualX+mw)>= ww && mw<ww){
            l-=($(this.menuContainer).offset().left+mw)-ww+18;
          }
          break;
      }
      if ((actualY+mh)>= wh-10 && mh<wh){
        t-=((actualY+mh)-wh)+10;
      }

      $(this.menu).css({
        top:t,
        left:l
      });
    },

    removeMbMenu: function(op,fade){
      if(!op)op=$.mbMenu.options.actualMenuOpener;
      if(!op) return;
      if (op.rootMenu) {
        $(op.actualOpenedMenu)
                .removeAttr("isOpen")
                .removeClass("selected");
        $("[isOpen]").removeAttr("isOpen");
        $(op.rootMenu).css({width:1, height:1});
        if (fade) $(op.rootMenu).fadeOut(op.options.fadeOutTime,function(){$(this).remove();});
        else $(op.rootMenu).remove();
        op.rootMenu=false;
        op.clicked=false;
      }
    },

    //mouse  Position
    getMouseX : function (e){
      var mouseX;
      if ($.browser.msie)mouseX = e.clientX + document.documentElement.scrollLeft;
      else mouseX = e.pageX;
      if (mouseX < 0) mouseX = 0;
      return mouseX;
    },
    getMouseY : function (e){
      var mouseY;
      if ($.browser.msie)	mouseY = e.clientY + document.documentElement.scrollTop;
      else mouseY = e.pageY;
      if (mouseY < 0)	mouseY = 0;
      return mouseY;
    },
    //get max z-inedex of the page
    mb_bringToFront: function(){
      var zi=10;
      $('*').each(function() {
        if($(this).css("position")=="absolute" || $(this).css("position")=="fixed" ){
          var cur = parseInt($(this).css('zIndex'));
          zi = cur > zi ? parseInt($(this).css('zIndex')) : zi;
        }
      });

      $(this).css('zIndex',zi+=10);
    },
    mb_hover:function(hoverIntent, fn1, fn2){
      if(hoverIntent==0)
        $(this).hover(fn1,fn2);
      else
        $(this).hoverIntent({
          sensitivity: 30,
          interval: hoverIntent,
          timeout: 0,
          over:fn1,
          out:fn2
        });
    }
  });
  $.fn.buildMenu = $.mbMenu.buildMenu;
  $.fn.buildContextualMenu = $.mbMenu.buildContextualMenu;
})(jQuery);










		
		
		    $(function(){


	
	 $("#myScroll1").mbScrollable({
        dir:"vertical",
        width:180,
        height:400,
        elementsInPage:3,
        elementMargin:6,
        shadow:"#999 2px 2px 2px",
        controls:"#controls1",
        slideTimer:600,
        autoscroll:true,
        scrollTimer:4000
      });


	 
	 $("#myScroll12").mbScrollable({
        dir:"vertical",
        width:200,
        height:80,
        elementsInPage:1,
        elementMargin:6,
        slideTimer:0,
        autoscroll:true,
        scrollTimer:6000
      });	  
	  
	  
	  
	  $("#myScroll").mbScrollable({
   width:400,
   elementsInPage:1,
   elementMargin:5,
   shadow:"#999 2px 2px 2px",
   height:"auto",
   controls:"#MainControls",
   slideTimer:300,
   autoscroll:true,
   scrollTimer:4000
 }); 
 
          
      setTimeout(function(){$("#wrapper").fadeIn();},200);
    });
	
	
	
		
	
//---------------------------------------------------------------------
//---Fait clignoter l'élément d'id IdOHtml un certain nombre de fois---
//---IsVisibleOnBegin : l'élément est visible au départ-----------------
//---IsInvisibleInEnd : l'élément doit est invisible à la fin-----------
//---------------------------------------------------------------------
function BlinkTemporary(IdOHtml, NbClignotant, IntervalleInMs, IsVisibleOnBegin, IsInvisibleInEnd)
{
var NewNbClignotant;
var OHTML;          
var IsVisible;      
var IsFirstChangeIsBlink=1;

if(NbClignotant<=0) return;

if(!IntervalleInMs) IntervalleInMs=350;

NewNbClignotant = NbClignotant;
OHTML           = document.getElementById(IdOHtml);
IsVisible       = (OHTML.style.visibility=="hidden") ? false : true;

if(IsVisibleOnBegin && IsInvisibleInEnd)
    {
      NewNbClignotant++;
    }

if((IsInvisibleInEnd && IsVisible) ||
    (!IsInvisibleInEnd && !IsVisible))
    {
      NewNbClignotant--;
    }

OHTML.style.visibility = (IsVisible) ? "hidden" : "visible";

setTimeout("BlinkTemporary('"+IdOHtml+"', "+NewNbClignotant+", "+IntervalleInMs
                          +", 0, "+IsInvisibleInEnd+")",IntervalleInMs);
}



//---------------------------------------------------------------------
//---Iconification du cadre d'information lors du clique sur la croix--
//---------------------------------------------------------------------
function OnCIBtnSuppr(IdCadreInfo)
{
var CadreInfo = document.getElementById(IdCadreInfo);
var IdCadreImg= "IdImgCI"+IdCadreInfo.substr(4);
var CadreImg  = document.getElementById(IdCadreImg);

$(CadreInfo).effect("transfer", { to: "span."+IdCadreImg }, 1000);
$(CadreInfo).hide();
BlinkTemporary(IdCadreImg, 4, 350, true, false);

$.get("vidersession.asp")

}


//---------------------------------------------------------------------
//---Affichage du cadre d'information lors du clique sur son icône-----
//---------------------------------------------------------------------
function OnCIImgClick(ObjHTML)
{
var CadreImg  = ObjHTML;
var IdCadreInfo= "IdCI"+CadreImg.id.substr(7);
var CadreInfo  = document.getElementById(IdCadreInfo);

$(CadreInfo).show();
CadreImg.style.visibility="hidden";
}

	
	
	
	
// mise automatique en majuscule formulaire client
function upperCase(x)
{
var y=document.getElementById(x).value;
document.getElementById(x).value=y.toUpperCase();
}
	
	

	
  $(function(){
  
    $(".myMenu").buildMenu(
    {
      template:"menuVoices.html",
      additionalData:"pippo=1",
      menuWidth:200,
      openOnRight:false,
      menuSelector: ".menuContainer",
      iconPath:"ico/",
      hasImages:true,
      fadeInTime:100,
      fadeOutTime:300,
      adjustLeft:2,
      minZindex:"auto",
      adjustTop:10,
      opacity:.99,
      shadow:false,
      shadowColor:"#ccc",
      hoverIntent:0,
      openOnClick:true,
      closeOnMouseOut:false,
      closeAfter:1000,
      submenuHoverIntent:200
    });


    $(document).buildContextualMenu(
    {
      template:"menuVoices.html",
      menuWidth:200,
      overflow:2,
      menuSelector: ".menuContainer",
      iconPath:"ico/",
      hasImages:false,
      fadeInTime:100,
      fadeOutTime:100,
      adjustLeft:0,
      adjustTop:0,
      opacity:.99,
      closeOnMouseOut:false,
      onContextualMenu:function(o,e){}, //params: o = the contextual menu,e = the event
      shadow:false
    });
  });

  
  
  
  
  
  
  
  
  
  
 

 
