/**
 * @author s.jaeger
 */
$().ready(function(){
    var options = {  
         height: 300,  
         width: '228',  
         navHeight: 15,  
         labelHeight: 25,  
         firstDayOfWeek: 1,  
         navLinks: {  
             p:'&laquo;',  
             n:'&raquo;',  
             t:'Heute'  
         }, 
		 locale: {
				days: ["SO", "MO", "DI", "MI", "DO", "FR", "SA", "SO"],
				daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
				daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
				months: ["Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
				monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
				weekMin: 'wk'
			} 
     };  
	// AJAX function that sends the values of the inputs to the functions.php that will save the data in to the database
	
$.ajax
	(
		{
			//url:'http://drk-regio-aachen.de/typo3conf/ext/sja_events/php/functions.php',
			url:'/typo3conf/ext/sja_events/php/functions.php',

			data:"type=get_events&pid_data="+$("#pidEvents").val()+"&pid_detail="+$("#pidDetail").val(),
			dataType: 'json',
			success: function (data, status)
			{
			   var my_events = new Array;
			   $(data).each(function(i,item) {  
			        my_events[i] = {  
			           "EventID": item.EventID,  
			           "Date": item.Date,
					   "Title": item.Title,
					   "Class": "birthday",
					   "URL": item.URL, 
			         }; 
					 
			    });
				$.jMonthCalendar.Initialize(options,my_events); 
				
				//Manipulate Calendar
				$(".DateBox").each(function(i)
     			{
					//Tag bestimmgen
					var tag=$("#"+this.id+" > .DateLabel A").text();
					var link=$("#"+this.id+" > .Event").html();
					
					if (link!=null)
					{
						$("#"+this.id).html(link);
						$("#"+this.id).addClass("Event");
					}
					else
					{
						$("#"+this.id).html(tag);
					}
     			});
			},
			error: function (data, status, e){}
		}
	)
	
	
	 
});


