
log_debug = function() {
  if(window.console && window.console.firebug) console.log.apply(this, arguments)
}

$(document).ready(function() {
   


   
   $("a[rel^='prettyOverlay'],a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal', 
			opacity: 0.55, 
			showTitle: true,
			allowresize: true, 
			counter_separator_label: '/' ,
			theme: 'light_rounded' /* light_rounded / dark_rounded / light_square / dark_square */

		});
 
   $("#eventcal_prev").click(function() {
	   //alert('prev');
	   events_cal_change('prev');
	});
   
   $("#eventcal_next").click(function() {
	   //alert('next');
	  events_cal_change('next');
	});
	
   


});


function ajax_pagi(page,div,pid)
{
	//alert(page);
	$.get("/projects/index.php", { pos: page, xdajax: 1, id: pid},
	   function(data){			
		//alert(data);
		$('#'+div).html(data);
	   });
	
	
}

function ajax_trackimage(img)
{
	//alert(img);
	//alert(page);
	var pid = $('#pid').val();
	//alert(pid);
	$.get("/projects/index.php", { xdajax: 1, id: pid, ajaxmodule: 'mediagallery', args: 'mode=trackimage&img='+img},
	   function(data){			
		//alert(data);
		//$('#'+div).html(data);
	   });
	
	
}

function events_cal_change(direction)
{
	var timestamp = $('#eventcal_month_ts').val();
	var pid = $('#pid').val();
	var replacer = $('#eventcal_replacer').val();
	$('.cal-navi .inner .loading').show();
	$('.cal-navi .inner .text').hide();
	//alert(timestamp);
	$.get("/projects/index.php", { xdajax: 1, id: pid, ajaxmodule: 'events', args: 'mode=calendar'+'&timestamp='+timestamp+'&direction='+direction},
	   function(data){			
		$('#'+replacer).html(data);
	  });
	
}
