


function loadCalendar(year, month) {

	// get the calendar
	$.get("index.php?lang="+lang+"&ajax=true&calendar=true&caldate="+year+"-"+month, {}, function(data){
		// update calendar_container div
		$("#calendar_container").html(data);
		// update month and year spans
		$("#month_name").html( month_names[eval(now_month)] );
		$("#year_number").html( now_year );
	});


}


//


$(document).ready(function() {



	//
	// flash player
	// 


	// single video
	if (typeof single_video_url != 'undefined') {
	
		var singlevid = new SWFObject("player.swf","ply","450","400","9");
		singlevid.addParam("allowfullscreen","true");
		singlevid.addParam("allownetworking","all");
		singlevid.addParam("allowscriptaccess","always");
		singlevid.addParam("flashvars","file="+single_video_url+"&autostart=false&volume=100&image="+single_video_thumb);
		singlevid.write("single_video_container");
	
	}



  //
	// load initial calendar
	//
	
	//loadCalendar(now_year, now_month);
	
	
	
	//
	// next and prev months
	//
	
	$("#prevMonth").click(function(){
	
		// get new/previous month and year
		if( eval(now_month) == 1 ) {
			now_month = 12;
			now_year = ""+ ( eval(now_year)-1 );
		} else {
			now_month = eval(now_month) - 1;
		}
		
		// nullify new month
		if( now_month < 10 ) {
			now_month = "0"+now_month;
		} else {
			now_month = ""+now_month;
		}
		
		
		// load new calendar
		loadCalendar(now_year, now_month);
		
		return false;
	
	});
	
	//
	//
	//
	
	$("#nextMonth").click(function(){
	
		// get new/next month and year
		if( eval(now_month) == 12 ) {
			now_month = 1;
			now_year = ""+ ( eval(now_year)+1 );
		} else {
			now_month = eval(now_month) + 1;
		}
		
		// nullify new month
		if( now_month < 10 ) {
			now_month = "0"+now_month;
		} else {
			now_month = ""+now_month;
		}
		
		
		
		// load new calendar
		loadCalendar(now_year, now_month);
		
		
		return false;
	
	});
	
	
	
	//
	// add subscription
	//
	
	$("#subscribe_email").focus(function(){
	  // clean field on focus
    $(this).attr("value", "");
  });
	
	
	$("#subscribeform").submit(function(){
  
    var email = $("#subscribe_email").attr("value");
    var subsform = this;
    
  	$.get("index.php?lang="+lang+"&ajax=true&addsubscription=true&subsc_email="+email, {}, function(data){
  		
  		$(subsform).hide();
  		$(".thankyou").fadeIn();
  		
  	});
  
    return false;
  
  });


	if(typeof galleryPage != 'undefined') {
	
			$('.gallery a').lightBox({
				txtImage: "",
				txtOf: " / "
	   }); 
	   
	}
	
	
	



});
