/*
** SARL Custom Project
** Copyright Custom Project - 2011
** http://www.customproject.fr
**
**
** Scripts publics
**
*/

//----------------------------------------------------------------------
// Initialisation
//----------------------------------------------------------------------

jQuery(document).ready(function() 
{
	$('.carousel').each(function()
	{
		if ($(this).children('.carousel_container').children('.slide').size() > 1)
		{
			$(this).slides(
			{
				container: 'carousel_container',
				play: 5000,
				pause: 2500,
				hoverPause: true,
				generatePagination: true
			});
		}
		else
		{
			$(this).children('.carousel_container').css('display','block');
		}
	});
	$('.galerie').each(function()
	{
		if ($(this).children('.galerie_container').children('.slide').size() > 1)
		{
			$(this).slides({
				container: 'galerie_container',
				play: 5000,
				pause: 2500,
				hoverPause: true,
				generatePagination: true
			});
		}
		else
		{
			$(this).children('.galerie_container').css('display','block');
		}
	});
	$('.minicarousel').each(function()
	{
		if ($(this).children('.galerie_container').children('.slide').size() > 1)
		{
			$(this).slides({
				container: 'galerie_container',
				generateNextPrev: true,
				generatePagination: false
			});
		}
		else
		{
			$(this).children('.galerie_container').css('display','block');
		}
	});
	$('a.nyroModal').nyroModal({width:900,height:650});

$.maxZIndex = $.fn.maxZIndex = function(opt) {
    /// <summary>
    /// Returns the max zOrder in the document (no parameter)
    /// Sets max zOrder by passing a non-zero number
    /// which gets added to the highest zOrder.
    /// </summary>    
    /// <param name="opt" type="object">
    /// inc: increment value, 
    /// group: selector for zIndex elements to find max for
    /// </param>
    /// <returns type="jQuery" />
    var def = { inc: 10, group: "*" };
    $.extend(def, opt);
    var zmax = 0;
    $(def.group).each(function() {
        var cur = parseInt($(this).css('z-index'));
        zmax = cur > zmax ? cur : zmax;
    });
    if (!this.jquery)
        return zmax;

    return this.each(function() {
        zmax += def.inc;
        $(this).css("z-index", zmax);
    });
}

	$(".datepicker").datepicker({
		beforeShow: function() {$('#ui-datepicker-div').css("z-index", 10000); }
	});
	$("select").selectmenu({style:'dropdown',width:'100'});

});
