// JavaScript Document
function open_foto(foto,x,y) {
	newWindow=window.open("../../2011/shared/imageviewer.php?idf="+foto,"","resizable=1,HEIGHT="+y+",WIDTH="+x+"");
}
function ins_commento_post(idp) {
	$.ajax({
		url: '../../2011/ajax/ins_commento.php?idp='+idp,
		success: function(data) {
			$('#post_add_comments_'+idp).html(data);
			$('#post_add_comments_'+idp).fadeIn(1000);
	  	}
	});
} 
function stat_commenti_post(idp) {
	$.ajax({
		url: '../../2011/ajax/stat_commenti.php?cache='+Math.random()+'&idp='+idp,
		success: function(data) {
			$('#post_info_'+idp).html(data);
		}
	});
} 
function view_commenti_post(idp) {
	$('#post_loading_'+idp).show();
	$.ajax({
		url: '../../2011/ajax/view_commenti.php?cache='+Math.random()+'&idp='+idp,
		success: function(data) {
			$('#post_view_comments_'+idp).html(data);
			$('#post_loading_'+idp).hide();
			$('#post_view_comments_'+idp).fadeIn(1000);
		}
	});
} 
function save_commento_post(idp) {
	$.post('../../2011/ajax/save_commento.php', $(".post_"+idp).serialize(), function(data) {
		$('#post_add_comments_'+idp).hide();
		view_commenti_post(idp);
		stat_commenti_post(idp);																			  
	});
} 
function cerca() {
	document.form_cerca.submit();
}
function show_sms() {
	$("#tbl_sms").fadeIn(1000);
	$("#sms_result").html('');
}
function send_sms() {
	$.post('../../2011/ajax/invia_sms.php', $(".sms").serialize(), function(data) {
		$('#tbl_sms').hide();
		$('#sms_result').html(data);																		  
	});
} 
function new_randomimage() {
	$("#image_randomimage").hide();
	$.ajax({
		url: '../../2011/photogallery/random.php?cache='+Math.random(),
		success: function(data) {
			$('#image_randomimage').html(data);
			$("#image_randomimage").fadeIn(1000);
		}
	});
} 
function ricerca_testo(p_sezione,p_offset) {
	p_testo=$("#testo").val();	
	$("#loading_"+p_sezione).show();
	$("#results_"+p_sezione).hide();	
	$("#results_"+p_sezione).html();	
	$.post('../../2011/ricerca/query_'+p_sezione+'.php', { findme: p_testo, offset: p_offset }, function(data) {
  	    $("#loading_"+p_sezione).hide();
		$("#results_"+p_sezione).html(data);	
		$("#results_"+p_sezione).fadeIn(1000);																		  
	});
}
function ricerca_tag(p_sezione,p_offset) {
	p_idt=$("#idt").val();	
	$("#loading_"+p_sezione).show();
	$("#results_"+p_sezione).hide();	
	$("#results_"+p_sezione).html();		
	$.post('../../2011/tag/query_'+p_sezione+'.php', { idt: p_idt, offset: p_offset }, function(data) {
  	    $("#loading_"+p_sezione).hide();
		$("#results_"+p_sezione).html(data);	
		$("#results_"+p_sezione).fadeIn(1000);																		  
	});
}
