$(document).ready(function() {
	$(".datepicker .clndr").toggle(
	function(){
		var x = $(this).parent().find("#slGo li").length;
		$(this).parent().find("#slGo").css("width", x*230);
		$(this).parent().find(".DataBox").show();
		$(this).addClass("BGnone");
	},
	function(){
		$(this).parent().find(".DataBox").hide();
		$(this).removeClass("BGnone");
	});

	$(".ui-datepicker-next").click(function() {
	  var lis=$(this).parent().parent().find("#slGo li").length;
	  var ede=$(this).parent().parent().find("#slGo").css("left");
    ede=parseInt(ede,10);
    if ((-1*ede/230+1)<lis){
      $(this).parent().find(".ui-datepicker-prev").css("display","block");
  		$(this).parent().parent().find("#slGo").animate({left: ede-230}, 500);
      if (lis==(-1*ede/230+2)){
        $(this).css("display","none");
      };
    };
	});

	$(".ui-datepicker-prev").click(function() {
	  var ede=$(this).parent().parent().find("#slGo").css("left");
    ede=parseInt(ede,10);
    if(ede<0){
      $(this).parent().find(".ui-datepicker-next").css("display","block");
   		$(this).parent().parent().find("#slGo").animate({left: ede+230}, 500);
      if ((ede+230)==0){
        $(this).css("display","none");
      };
    };
	});

});	


