var $j = jQuery.noConflict();

jQuery(document).ready(function(){
	jQuery(function(){
		jQuery("#wysuwane").css("left","-210px");
		
		jQuery("#wysuwane").hover(function () {
			jQuery("#wysuwane").animate({left: "0px"}, 1000 );
			jQuery(this).addClass("zamknij");
		},
		function () {
			jQuery("#wysuwane").animate({left: "-210px"}, 1000 );
			jQuery(this).removeClass("zamknij");
		}
		);
	});
	
	jQuery("a.zdjecie").fancybox();
	
	jQuery(".cal_left, .cal_right").live('click', function() {
		var object = jQuery(this).parent();
		var aid = jQuery(this).parent().attr("aid");
		var lang = jQuery(this).parent().attr("lang");
		var ids = jQuery(this).parent().attr("id");
		var date = jQuery(this).parent().find("input:first").val();
		var date_act = jQuery(this).parent().find("input:eq(1)").val();
		var act  = jQuery(this).attr('id');
		act = act.split("_");
		date = date.split("-");
		date_act = date_act.split("-");
		jQuery.ajax({
		url: "/admin/kalendarz.php?r="+date[0]+"&m="+date[1]+"&aid="+aid+"&lang="+lang+"&ids="+ids+"&act="+act[1]+"&rok_act="+date_act[0]+"&miesiac_act="+date_act[1]+"&dzien_act="+date_act[2],
		success: function(html) {
			object.html(html);
		}
		});
	});
	
	jQuery("input, textarea").focus(function(){
		if(this.value==this.defaultValue)this.value='';
	});
	
	jQuery("input, textarea").blur(function(){
		if(this.value=='')this.value=this.defaultValue;
	});
});

window.addEvent('domready', function() { myCal1 = new Calendar({ FromDate: 'd-m-Y' }, { classes: ['calendar'], direction: 1 }),myCal2 = new Calendar({ ToDate: 'd-m-Y' }, { direction: 1 }) });
