$(document).ready(function() {
	
	$(document).pngFix(); 

    if(typeof markErrors == 'function') markErrors();
    if(typeof fillData == 'function') fillData();
    
    window.Common.init({baseUrl : base});
    
    $('.delete').bind('click', function() {
        return confirm('Ar tikrai norite ištrinti?');
    });
});


var Common ={
    init: function(params){
        this.params = params;
        var $Common = this;

        $Common.initCalendar();
    },

    // calendar
    initCalendar: function(){
        var $Common = this;
        var curdate = new Date();
        $('input.callCalendar').datepicker(
                $.extend(
                    {
                        dateFormat:'yy-mm-dd',
                        showOn:'both',
                        buttonImageOnly:true,
                        buttonImage:$Common.params.baseUrl+'/img/calendar.gif'
//                      minDate: new Date(curdate.getFullYear(), (curdate.getMonth()-1), 1),
//                      maxDate: new Date()
                    },
                    $.datepicker.regional['lt']
                )
            );

            $('input.callCalendarToFuture').datepicker(
                $.extend(
                    {
                        dateFormat:'yy-mm-dd',
                        showOn:'both',
                        buttonImageOnly:true,
                        buttonImage:$Common.params.baseUrl+'/img/calendar.gif'
//                      minDate: new Date(),
//                      maxDate: new Date((curdate.getFullYear()+1), curdate.getMonth(), curdate.getDate()-1)
                    },
                    $.datepicker.regional['lt']
                )
            );
    }
};
