$(function () {
	$('a.cms-link-media[href*="youtube.com/watch"]').each(function(){
		var $t=$(this), pattW=/.+width:/i, pattH=/.+height:/i, pattN=/[0-9]+/i;
		$t.vId=$t.attr('href').replace(/.+\?v\=/i,'').replace(/\&.+/i,'');
		
		$t.vWidth=0;
		$t.vHeight=0;
		if(pattW.test($t.attr('class'))) $t.vWidth=Number($t.attr('class').replace(pattW,'').match(pattN)[0]);
		if(pattH.test($t.attr('class'))) $t.vHeight=Number($t.attr('class').replace(pattH,'').match(pattN)[0]);
		if($t.vWidth<10) $t.vWidth=620;
		if($t.vHeight<10) $t.vHeight=465;
		
		$t.replaceWith('<iframe title="YouTube video player" width="'+$t.vWidth+'" height="'+$t.vHeight+'" src="http://www.youtube.com/embed/'+$t.vId+'" frameborder="0" allowfullscreen="allowfullscreen"></iframe>')
		
	});
	
	$('a.cms-link-media[href*="dailymotion.com/video"]').each(function(){
		var $t=$(this), pattW=/.+width:/i, pattH=/.+height:/i, pattN=/[0-9]+/i;
		$t.vId=$t.attr('href').replace(/.+\//i,'').replace(/_.+/i,'');
		$t.vWidth=0;
		$t.vHeight=0;
		if(pattW.test($t.attr('class'))) $t.vWidth=Number($t.attr('class').replace(pattW,'').match(pattN)[0]);
		if(pattH.test($t.attr('class'))) $t.vHeight=Number($t.attr('class').replace(pattH,'').match(pattN)[0]);
		if($t.vWidth<10) $t.vWidth=620;
		if($t.vHeight<10) $t.vHeight=465;
		
		$t.replaceWith('<object width="'+$t.vWidth+'" height="'+$t.vHeight+'"><param name="movie" value="http://www.dailymotion.com/swf/video/'+$t.vId+'?theme=none"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/'+$t.vId+'?theme=none" width="'+$t.vWidth+'" height="'+$t.vHeight+'" allowfullscreen="true" allowscriptaccess="always"></embed></object>');
	});
	
	$.fn.extend({
		ieHover: function() {
			if($.browser.msie) {
				$(this).hover(
					function(){ $(this).addClass("hover"); },
					function(){ $(this).removeClass("hover"); }
				);
			}
		}
	});

	var vPlayerCtrlsH = 20;
	var vPlayerDefW = 320;
	var vPlayerDefH = 240;



	if ($.fn.media) {

		// auto addition of media players
//		$.fn.media.defaults.skin ='/swf/crij_skin.swf';


/*		$('a.cms-link[href$=.flv]').each(function(){
			var data = $(this).metadata();
			var autoplay = data.autoplay||0;
			var imgW = data.width||vPlayerDefW;
			var imgH = data.height||vPlayerDefH;
			var vidW = imgW;
			var vidH = imgH + vPlayerCtrlsH;
			$(this).media({width: vidW + 'px', height: vidH + 'px', autoplay: autoplay, flashvars: {autostart: autoplay}});
		});

		$('a.cms-link[href$=.mp3]').each(function() {
			var data = $(this).metadata();
			var autoplay = data.autoplay;
			$(this).media({width: '200px', height: '20px', params: {allowscriptaccess: 'sameDomain'}});
		});
		$('a.cms-link[href$=.swf]').media({width: vPlayerDefW + 'px', height: vPlayerDefH + 'px'});
*/
		$(".watchVideo").each(function(){
			var $t=$(this);
			$image = $t.children('img:first');
			var className = $t.attr('class');
			var mediaUrl = $t.attr('href');
			if(mediaUrl.indexOf('popup=true')<0) mediaUrl=mediaUrl.replace('?','?popup=true&');
			if(($.browser.msie)&&(($.browser.version == '6.0')||($.browser.version == '7.0'))){
				$d=$('<div class="mediaContainer fLeft" href="'+mediaUrl+'"><a href="javascript:;" class="mediaLink '+className+'"></a></div>');
				$d.css("background","url("+$image.attr('src')+") center no-repeat").css("width",$image.width()).css("height",$image.height());
				$t.replaceWith($d)
				$d.click(function(){
					$d.nyroModalManual({
						url: mediaUrl,
						minWidth: 100,
						minHeight: 100,
						autoSizable: true,
						endFillContent: function (){
						$('a.popup-link-media[href*="youtube.com/watch"]').each(function(){
							var $t=$(this);
							$t.vId=$t.attr('href').replace(/.+\?v\=/i,'').replace(/\&.+/i,'');
							$t.vWidth=Number($t.attr('class').replace(/.+width:/i,'').match(/[0-9]+/i)[0]);
							$t.vHeight=Number($t.attr('class').replace(/.+height:/i,'').match(/[0-9]+/i)[0]);
							if(!$t.vWidth) $t.vWidth=320;
							if(!$t.vHeight) $t.vHeight=240;
							$.nyroModalSettings({width: $t.vWidth, height: $t.vHeight});
							$t.replaceWith('<iframe title="YouTube video player" width="'+$t.vWidth+'" height="'+$t.vHeight+'" src="http://www.youtube.com/embed/'+$t.vId+'" frameborder="0" allowfullscreen="allowfullscreen"></iframe>')
						});
						$('a.popup-link-media[href*="dailymotion.com/video"]').each(function(){
							var $t=$(this);
							console.log($t);
							$t.vId=$t.attr('href').replace(/.+\//i,'').replace(/_.+/i,'');
							$t.vWidth=Number($t.attr('class').replace(/.+width:/i,'').match(/[0-9]+/i)[0]);
							$t.vHeight=Number($t.attr('class').replace(/.+height:/i,'').match(/[0-9]+/i)[0]);
							if(!$t.vWidth) $t.vWidth=620;
							if(!$t.vHeight) $t.vHeight=465;
							$.nyroModalSettings({width: $t.vWidth, height: $t.vHeight});
							$t.replaceWith('<object width="'+$t.vWidth+'" height="'+$t.vHeight+'"><param name="movie" value="http://www.dailymotion.com/swf/video/'+$t.vId+'?theme=none"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/'+$t.vId+'?theme=none" width="'+$t.vWidth+'" height="'+$t.vHeight+'" allowfullscreen="true" allowscriptaccess="always"></embed></object>');
						});
							$(".popup-link-media[href$=.flv]").each(function(){
								var metadata = $(this).metadata();
								$.nyroModalSettings({width: metadata.width, height: metadata.height});
								var options={width: metadata.width, height: metadata.height, flashvars:{autostart: metadata.autostart, name: metadata.name, title: metadata.title}, params: {allowfullscreen: 'true', allowscriptaccess: 'always'}};
								$(this).text('');
								$.fn.media.defaults.skin ='/swf/crij_skin.swf';
								$(this).media(options);
							})
							$('.popup-link-media[href$=.mp3]').each(function() {
								var data = $(this).metadata();
								$.nyroModalSettings({width: 400, height: 115});
								data.width = '400';
								data.height = '115';
								$(this).text('');
								$.fn.media.defaults.skin = '/swf/crij_radio.swf';
								$(this).media({flashvars:{autostart: data.autostart, name: data.name, title: data.title}, params: {allowscriptaccess: 'always'}});
							});
							$('.popup-link-media[href$=.swf]').each(function() {
								var data = $(this).metadata();
								$.nyroModalSettings({width: 400, height: 115});
								data.width = '320';
								data.height = '240';
								$.fn.media.defaults.skin ='/swf/crij_skin.swf';
								$(this).media({width: '320px', height: '240px'});
							});
						}
					})
				})
			}else{
				$d=$('<div class="mediaContainer fLeft"><a href="'+mediaUrl+'" class="mediaLink '+className+'"></a></div>');
				$d.append('<img src="'+$image.attr('src')+'" />');
				$t.replaceWith($d);
				$('.mediaLink').nyroModal({
					url: mediaUrl,
					minWidth: 100,
					minHeight: 100,
					autoSizable: true,
					endFillContent: function (){
						$('a.popup-link-media[href*="youtube.com/watch"]').each(function(){
							var $t=$(this);
							$t.vId=$t.attr('href').replace(/.+\?v\=/i,'').replace(/\&.+/i,'');
							$t.vWidth=Number($t.attr('class').replace(/.+width:/i,'').match(/[0-9]+/i)[0]);
							$t.vHeight=Number($t.attr('class').replace(/.+height:/i,'').match(/[0-9]+/i)[0]);
							if(!$t.vWidth) $t.vWidth=320;
							if(!$t.vHeight) $t.vHeight=240;
							$.nyroModalSettings({width: $t.vWidth, height: $t.vHeight});
							$t.replaceWith('<iframe title="YouTube video player" width="'+$t.vWidth+'" height="'+$t.vHeight+'" src="http://www.youtube.com/embed/'+$t.vId+'" frameborder="0" allowfullscreen="allowfullscreen"></iframe>')
						});
						$('a.popup-link-media[href*="dailymotion.com/video"]').each(function(){
							var $t=$(this);
							console.log($t);
							$t.vId=$t.attr('href').replace(/.+\//i,'').replace(/_.+/i,'');
							$t.vWidth=Number($t.attr('class').replace(/.+width:/i,'').match(/[0-9]+/i)[0]);
							$t.vHeight=Number($t.attr('class').replace(/.+height:/i,'').match(/[0-9]+/i)[0]);
							if(!$t.vWidth) $t.vWidth=620;
							if(!$t.vHeight) $t.vHeight=465;
							$.nyroModalSettings({width: $t.vWidth, height: $t.vHeight});
							$t.replaceWith('<object width="'+$t.vWidth+'" height="'+$t.vHeight+'"><param name="movie" value="http://www.dailymotion.com/swf/video/'+$t.vId+'?theme=none"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/'+$t.vId+'?theme=none" width="'+$t.vWidth+'" height="'+$t.vHeight+'" allowfullscreen="true" allowscriptaccess="always"></embed></object>');
						});
						$(".popup-link-media[href$=.flv]").each(function(){
							var metadata = $(this).metadata();
							$.nyroModalSettings({width: metadata.width, height: metadata.height});
							var options={width: metadata.width, height: metadata.height, flashvars:{autostart: metadata.autostart, name: metadata.name, title: metadata.title}, params: {allowfullscreen: 'true', allowscriptaccess: 'always'}};
							$(this).text('');
							$.fn.media.defaults.skin ='/swf/crij_skin.swf';
							$(this).media(options);
						})
						$('.popup-link-media[href$=.mp3]').each(function() {
							var data = $(this).metadata();
							$.nyroModalSettings({width: 400, height: 115});
							data.width = '400';
							data.height = '115';
							$(this).text('');
							$.fn.media.defaults.skin = '/swf/crij_radio.swf';
							$(this).media({flashvars:{autostart: data.autostart, name: data.name, title: data.title}, params: {allowscriptaccess: 'always'}});
						});
						$('.popup-link-media[href$=.swf]').each(function() {
							var data = $(this).metadata();
							$.nyroModalSettings({width: 400, height: 115});
							data.width = '320';
							data.height = '240';
							$.fn.media.defaults.skin ='/swf/crij_skin.swf';
							$(this).media({width: '320px', height: '240px'});
						});
					}
				});
			}
		})



		$(".cms-link-media[href$=.flv]").each(function(){
			var i=this.getElementsByTagName("img")[0];
			var md=this.className.match(/\{.*\}/);
			var metad=$(this).metadata();
			md=(md&&md.length)?md[0]:"";
			var d=$('<div class="mediaContainer" href="'+this.href+'"><a href="javascript:;" class="mediaLink"></a></div>');
            var mediaClass = d.attr('class');
            mediaClass = mediaClass + ' ' + md;
            d.attr('class', mediaClass);
			d.click(function(){
				var div=$(this);
				var m=div.metadata();
				var options={width:this.offsetWidth, height:this.offsetHeight, params: {allowfullscreen: 'true', allowscriptaccess: 'always'}};
				$.fn.media.defaults.skin ='/swf/crij_skin.swf';
				$.extend(options,div.metadata());
				div.media(options);
			})
			d.css("backgroundImage","url("+i.src+")");
			if(Number(i.offsetHeight)>5) d.css("width",i.offsetWidth+"px").css("height",i.offsetHeight+"px");
			d.css("backgroundPosition","center");
			$(this).replaceWith(d);
			var mdHash=md.charAt("0")=="{"?eval("("+md+")"):{};
			if(mdHash.autostart)d.click();
		})
		$('a.cms-link-media[href$=.mp3]').each(function() {
			$.fn.media.defaults.skin = baseUrl + '/swf/crij_radio.swf';
			var data = $(this).metadata();
			var options={width: '400', height: '115', flashvars:{autostart: data.autostart, name: data.name, title: data.title}, params: {allowscriptaccess: 'always'}}
			$(this).media(options);
		});
		$('a.cms-link-media[href$=.swf]').each(function() {
			$.fn.media.defaults.skin ='/swf/crij_skin.swf';
			var i=this.getElementsByTagName("img")[0]
			imageWidth = $(i).attr('width')
			imageHeight = $(i).attr('height')
			if (!imageWidth) {
				imageWidth = vPlayerDefW
			}
			if (!imageHeight) {
				imageHeight = vPlayerDefH
			}
			$(this).media({width: imageWidth, height: imageHeight});
		});
	}

	$('.open-flash-radio').click(function() {
		window.open($(this).attr('href'), 'FlashRadio', 'status=1,toolbar=0,menubar=0,resizable=0,width=400,height=180');
		return false;
	});

	// toogle serch result
	if($('a.search_toggle').length){
		$('a.search_toggle').click(function(event){
			event.preventDefault();
			$(this).toggleClass('closed').prev('ul').slideToggle("slow");
		});
	}



	// auto addition of special style to external and email links
	// commented because used only to force style of external links. But this style
	// is now the default style for all links...
	//$('a[href^=http://], a[href^=mailto:]').addClass("external-link");

	// auto addition of icons to links where admin request it
	$('a.cms-link[href$=.pdf], .rich a.with-icon[href$=.pdf]').addClass("cms-pdf");
	$('.rich a.with-icon[href^=http://]').addClass("cms-url");

	// auto addition of target blank if no target defined
	if ($.browser.msie) {
		$("a.cms-link[href$='.pdf']").each(function() {
			if (!$(this).attr("target") || (("" + $(this).attr("target")) == "")) $(this).attr("target", "_blank");
		});
		$(".rich a").each(function() {
			if($(this).attr("href") && $(this).attr("href").match('.pdf')!=null){
				if (!$(this).attr("target") || (("" + $(this).attr("target")) == "")) $(this).attr("target", "_blank");
			}
		});
		$("a").each(function() {
			if($(this).attr("href") && $(this).attr("href").match('http://')!=null){
				if (!$(this).attr("target") || (("" + $(this).attr("target")) == "")) $(this).attr("target", "_blank");
			}
		});
	} else {
		$('a.cms-link[href$=.pdf], .rich a[href$=.pdf], a[href^=http://]').each(function() {
			if (!$(this).attr("target") || (("" + $(this).attr("target")) == "")) $(this).attr("target", "_blank");
		});
	}

	// fake truncation of content for short versions: keep first paras only
	$('.short-version .pcontent').each(function() {
		var slice = 1;
		var data = $(this).parent('.short-version').metadata();
		if (data) {
			if (data.shortParasCount) {
				slice = data.shortParasCount;
			}
		}

		$(this).children().not('a').not('div').not('empty').slice(0,slice).each(function() {
			$(this).css('display','block');
		});
	});

	$('.short-version .rich').each(function() {
		var slice = 1;
		var data = $(this).parent('.short-version').metadata();
		if (data) {
			if (data.shortParasCount) {
				slice = data.shortParasCount;
			}
		}

		$(this).children().not('a').not('div').not('empty').slice(0,slice).each(function() {
			$(this).css('display','block');
		});
	});

	if ($.datepicker) {
		$.datepicker.regional['fr'] = {clearText: 'Effacer', clearStatus: '',
			closeText: 'Fermer', closeStatus: 'Fermer sans modifier',
			prevText: '&lt;Préc', prevStatus: 'Voir le mois précédent',
			nextText: 'Suiv&gt;', nextStatus: 'Voir le mois suivant',
			currentText: 'Aujour\'hui', currentStatus: 'Voir le mois courant',
			monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
			monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'],
			monthStatus: 'Voir un autre mois', yearStatus: 'Voir une autre année',
			weekHeader: 'Sm', weekStatus: '',
			dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
			dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
			dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
			dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d',
			dateFormat: 'dd/mm/yy', firstDay: 0,
			yearRange: '-2:+10',
			showOn: 'button',
			buttonImage: baseUrl+'/css/admin/img/calendar.gif',
			buttonImageOnly: true,
			buttonText: '',
			initStatus: 'Choisir la date', isRTL: false};
		$.datepicker.setDefaults($.datepicker.regional['fr']);

		$('.datepicker_trigger').hover(
			function(){$(this).attr({src:'css/admin/img/calendar_h.gif'}); },
			function(){$(this).attr({src:'css/admin/img/calendar.gif'}); }
		);
	}

	doDateFields();
	doRequiredLabels();
	doCheckUncheck();
	doNiceNotestyles();
	doOverLabels();
	$('ul.lvl1 li').ieHover();
	$('ul#menuleft li').ieHover();

	if ($.validator) {
		$.validator.addMethod("checked", function(value, element) {
			var result = false;
			$("input:checked").each(function(){
				if($(this).attr('name') == element.name){
					result = true;
				}
			});
			return result;
		}, "Champ obligatoire.");

		// Validator methods
		$.validator.addMethod("lettersDigits", function(value, element) {
			return this.optional(element) || ( /^\w+$/i.test(value) && /^[^\_]+$/i.test(value) );
		}, "Ce champ est uniquement alphanumérique.");

		$.validator.addMethod("notEqualTo", function(value, element) {
				return value !== jQuery(param).val();
		}, "Ce champ doit être différent du précédent.");

		$.validator.addMethod("login", function (value,element) {
			  return /^[a-zA-Z0-9\.\-@]+$/.test(value);
			}, 'Cet identifiant contient des caractères invalides.');

		//Url validation enchanted
		$.validator.addMethod("url",function (value,element) {
			if(value == ''){
				return true;
			}

			if(!/^(https?|ftp):\/\/(.?)+$/i.test(value)){
				value = "http://" + value;
			}

			return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([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])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
		});

		//	Default french method messages
		$.validator.messages = {
			required: "Champ obligatoire.",
			remote: "Veuillez corriger ce champ.",
			email: "Veuillez indiquer une adresse mail valide.",
			url: "Veuillez indiquer une URL valide.",
			date: "Veuillez indiquer une date valide.",
			dateISO: "Veuillez indiquer une date valide (ISO).",
			dateDE: "Bitte geben Sie ein gültiges Datum ein.",
			number: "Veuillez indiquer un numéro valide.",
			numberDE: "Bitte geben Sie eine Nummer ein.",
			digits: "Seuls les chiffres sont autorisés",
			creditcard: "Veuillez indiquer un numéro valide de la carte bleue.",
			equalTo: "Veuillez ressaisir la même information.",
			accept: "Veuillez indiquer une extension valide.",
			maxlength: $.format("Le contenu ne doit pas excéder {0} caractères."),
			maxLength: $.format("Le contenu ne doit pas excéder {0} caractères."),
			minlength: $.format("Veuillez entrer au minimum {0} caractères."),
			minLength: $.format("Veuillez entrer au minimum {0} caractères."),
			rangelength: $.format("Veuillez indiquer une valeur entre {0} et {1} caractères de long."),
			rangeLength: $.format("Veuillez indiquer une valeur entre {0} et {1} caractères de long."),
			rangeValue: $.format("Veuillez indiquer une valeur entre {0} et {1}."),
			range: $.format("Veuillez indiquer une valeur entre {0} et {1}."),
			maxValue: $.format("Veuillez indiquer une valeur inférieure ou égale à {0}."),
			max: $.format("Veuillez indiquer une valeur inférieure ou égale à {0}."),
			minValue: $.format("La valeur doit être supérieure ou égale à to {0}."),
			min: $.format("La valeur doit être supérieure ou égale à {0}.")
		};
		//	Custom french method messages
		$.validator.messages.lettersDigits = "Seuls les caractères alphanumériques sont autorisés.";
		$.validator.messages.notEqualTo = "Indiquez une valeur, différente du champ précédent.";
		$.validator.messages.login = "Le pseudo contient des caractères interdits.";
		$.validator.messages.checked = "Champ obligatoire.";
	}

	var tabContainers = $('div.tab');

	if (tabContainers.length > 0) {
		tabContainers.hide().filter(':first').show();

		$('div.tabmenu ul a').click(function () {
			tabContainers.hide();
			tabContainers.filter(this.hash).show();
			$('div.tabmenu ul li').removeClass('selected');
			$(this).parent('li').addClass('selected');
			return false;
		}).filter(':first').click();
	}

/* to activate once code is cleant regarding this
	$('.time-field').mask('99:99').clockpick({
		starthour: 0,
		endhour: 23,
		showminutes: true,
		minutedivisions: 12,
		military: true,
		event: 'Click',
		layout: 'vertical',
		useBgiframe: true
	});
/**/

/*
  //Get our elements for faster access and set overlay width
  var div = $('div.blogslist'),
               ul = $('ul.blogslist_menu'),
               // unordered list's left margin
               ulPadding = 15;

  //Get menu width
  var divWidth = div.width();

  //Remove scrollbars
  div.css({overflow: 'hidden'});

  //Find last image container
  var lastLi = ul.find('li:last-child');

  //When user move mouse over menu
  div.mousemove(function(e){

    //As images are loaded ul width increases,
    //so we recalculate it each time
    var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

    var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
    div.scrollLeft(left);
  });



	//if($.fn.jCarouselLite){
		//$('.blogslist').jCarouselLite({
			//auto: 1000,
			//speed: 300
	   // });
	   // $('.blogslist').css('width', '235px');
	   // $('.blogslist').css('height', '155px');
//	    $('#blog').css('width', '235px');
//	    $('#blog').css('height', '155px');
	//}

*/
});

function doDateFields() {
	if (($.mask) && ($.datepicker)) {
		$('input.date-field').not('.hasMask').mask('99/99/9999').addClass("hasMask").datepicker();
		$('input.birthdate-field').not('.hasMask').mask('99/99/9999').addClass("hasMask");
		$('input.free-date').datepicker();
	}
}

function doRequiredLabels() {
	$('label.required').append('<span>*</span>');
}

function doCheckUncheck() {
	$("input[name='check_uncheck']").click(function() {
		var checked_status = this.checked;
		$("input:checkbox[@class=check_uncheck]").each(function(){
			this.checked = checked_status;
		});
	});
}

function doOverLabels() {
	$('.overlabel input').focus( function () {
		$('label[@for='+ this.id +']', '.overlabel').hide();
	}).blur( function () {
		if(!this.value)
			$('label[@for='+ this.id +']', '.overlabel').show();
	});

	$('.overlabel label').hover(
		function () { this.style.cursor = 'text'; },
		function () { this.style.cursor = 'default'; }
	);
}

function doNiceNotestyles() {
	$('.cms p.a_noter').each(function() {
		$(this).prepend('<img class="picto" src="/img/p_a_noter.png" alt=""/>');
	});
	$('.cms p.plus').each(function() {
		$(this).prepend('<img class="picto" src="/img/p_plus.png" alt=""/>');
	});
	$('.cms p.interro').each(function() {
		$(this).prepend('<img class="picto" src="/img/p_interro.png" alt=""/>');
	});
	$('.cms p.atten').each(function() {
		$(this).prepend('<img class="picto" src="/img/p_atten.png" alt=""/>');
	});
}

