/* Author: 

*/
/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
};
$.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);
    });
}

$("#search").focus(function() { $(this).animate({ width: '175px' }) });
$("#search").blur(function() {
  if($(this).val() == "") { // Only go back to normal when nothing's filled in
    $(this).animate({ width: '140px' })
  }
});

$(".dock_menue").mouseenter(function(){
	$(this).animate( { "marginLeft":'10px' }, 300);
});
$(".dock_menue").mouseleave(function(){
	$(this).animate( { "marginLeft":'0px' }, 300);
});

var $container = $('#container_sort');
$container.isotope({
	  // options
	  itemSelector : '.event_item',
	  layoutMode : 'fitRows'
	});
$('.dock_menue').click(function(){
	 value = $(this).attr('data-option-value');
	 $container.isotope( { filter : value });
});

$('document').ready(function() {
	if($('.selectsytle').length > 0){
		$('.selectsytle').selectbox();
	}
	$('#datepicker_wizard').datepicker({ 
		dateFormat: 'dd.mm.yy',
		defaultDate: '15.06.2012',
		minDate: '15.06.2012',
		maxDate: "17.06.2012",
		create: function() {$('#ui-datepicker-div').css('z-index','99999'); },
			},$.datepicker.regional[ "de" ]);
	if($('#timepicker').length > 0){
		$('#timepicker').timepicker({
	    hourText: 'Stunden',
	    minuteText: 'Minuten',
	    showPeriodLabels: false,
	    
		});
		};
	if($('#timepicker_2').length > 0){
			$('#timepicker_2').timepicker({
		    hourText: 'Stunden',
		    minuteText: 'Minuten',
		    showPeriodLabels: false,
		    
			});
			};
	$('#search_submit').click(function(){
		$('#search_form').submit();
	});
	$('.dock_menue').tipsy({gravity: 'w'});
	$('#expand_footer').click(function(){
		$('#extended_footer').slideToggle('slow');
	});

	
});
   

