$(function(){function h(a){$('<div id="ajaxPanelLoad"><p id="ajaxload"><span id="ajaxloader"></span><strong> Loading:</strong> Please Wait...</p></div>').appendTo("#ajax-panel");setTimeout(function(){$("#ajax-panel").load(a+"/ajax/true",function(){$("#months").buttonset();$("#year").buttonset()})},600)}var b=new Date,d=b.getMonth()+1,e=b.getDate(),b=b.getFullYear(),f=(e>9?e:"0"+e)+"-"+(d>9?d:"0"+d)+"-"+b;$("form input#date").live("focus",function(){$(this).datepicker({dateFormat:"dd-mm-yy",numberOfMonths:2,
showButtonPanel:!0,showAnim:"show",defaultDate:f,minDate:f})});$("#months").buttonset();$("#year").buttonset();$("#year input[name=year], #months input[name=months]").live("change",function(a){var c=$("#months input[name=months]:checked").val(),b=$("#year input[name=year]:checked").val(),d=$("#jsTabs li > a.selected").attr("href");a.preventDefault();h(d+"/month/"+c+"/year/"+b)});$('<a href="#" class="scrolltop"></a>').hide().appendTo($("body"));jQuery.fn.topLink=function(a){a=jQuery.extend({min:1,
fadeSpeed:200,ieOffset:50},a);return this.each(function(){var c=$(this);$(window).scroll(function(){$(window).scrollTop()>=a.min?c.fadeIn(a.fadeSpeed):c.fadeOut(a.fadeSpeed)})})};$(".scrolltop").topLink({min:100,fadeSpeed:500});$(".scrolltop").click(function(a){a.preventDefault();$("html,body").bind("mousewheel",function(){$("html,body").stop(!0)});$("html,body").stop(!0).animate({scrollTop:0},800,function(){$("html,body").unbind("mousewheel")})});$(".flash_messenger").not(".notice, .error").delay(2E3).fadeTo("fast",
0.4).slideUp("slow");$("form#swap_formpositionswap");var g=$("select[name^=required]").first().parent().clone();$("select[name^=required]").first().parent().append('<a href="#" id="add_another" class="ui-icon ui-icon-plusthick"></a>');$("#add_another").click(function(a){a.preventDefault();var a=$("select[name^=required[]").length+1,c=$("select[name^=required[]").last(),b=$("select[name^=required[]").first().find("option").length;a>=b?$('<div id="dialog-message" title="More shifts"><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 10px 0;"></span>Sorry you cannot add more required fields, there are only '+
b+" available shifts.</p></div>").dialog({modal:!0,buttons:{Ok:function(){$(this).dialog("close")}}}):(g.find("select").attr({name:"required["+a+"]",id:"required-"+a+""}),$("<tr><td></td><td>"+g.html()+'<a href="#" class="removeshift ui-icon ui-icon-closethick"> </a></td></tr>').insertAfter(c.parents("tr")))});$(".removeshift").live("click",function(a){a.preventDefault();$(this).parents("tr").remove();$("select[name^=required]").each(function(a){a+=1;$(this).attr({name:"required["+a+"]",id:"required-"+
a+""})})});$("#magic_form input#search").quicksearch("table#shiftsTable tbody tr")});

