			$(document).ready(function(){  
						
			  $("#events li:first").addClass("first");
			  //$("#events li:last").addClass("last");
			
			  function getMonth(n){
				    switch(n)
					{
					case "January":
					   return "01";
					  break;
					case "February":
					  return "02";
					  break;
					case "March":
					  return "03";
					  break;
					case "April":
					  return "04";
					  break;
					case "May":
					  return "05";
					  break;
					case "June":
					  return "06";
					  break; 
					case "July":
					  return "07";
					  break;
					case "August":
					  return "08";
					  break;
					case "September":
					  return "09";
					  break;
					case "October":
					  return "10";
					  break;
					case "November":
					  return "11";
					  break;
					default:
					  return "12";
					}
			  }
				
			  $("#tooltip").hide();
			  
              $("#events").find("li").each(function(){
                  $this = $(this);
                  var data = $this.attr("id"); 
                  var ttp = $this.find(".tooltip");
                  ttp.css({"position":"absolute", "left":"25"});
                  $this.bind("mouseenter",function(){
                      ttp.html("<img src='/_img/spinner.gif' alt='loading'/>");
                      if(ttp.length < 2){
                          ttp.load('/_ajax/events-tooltip_home.php',{'data':data},function(){
              			   	var top = 5 - ttp.outerHeight() + "px"; 
              				//var lft = pos.left + ($("#tooltip").outerWidth()/3) + "px";
              			    ttp.css({"position":"absolute", "top":top}); 
                            ttp.show();
              			});
                      }
                  });
                  $this.bind("mouseleave",function(){
                       ttp.hide();
                  }); 
                  $this.click(function(){
                    var arry = data.split("-");
                    var month = getMonth(arry[0]);
                    var day;
                    if(parseInt(arry[1]) < 10 ){
                        day = "0"+ arry[1];
                    }else{
                        day = arry[1];
                    }
                    var year = arry[2];
                    window.location = "/temple-events/"+year+"/"+month+"/"+day; 
                  });
              });

					$('.dateblock:gt(2)').remove();
			});
