jQuery(document).ready(
	function() {
		jQuery('#mycarousel').jcarousel
		({visible:7,scroll:6});
		var uID;
		uID = $('#uID').attr('value');
		var imagen;
		imagen = $('#imagen').attr('value');
		//cargar_comentarios( uID,imagen);
	}
);
var url = 'http://dobleflog.com/';

function cargar_img(suID,sImg)
{
	$('#imagen').attr({ value: sImg});
	cargar_imagen(suID,sImg);	  
	cargar_comentarios(suID,sImg);
}
//cargar imagenes
function cargar_imagen(suID,sImg)
{	
$("#picture").html('<img src="media/loader.gif" border="0" alt="doble" />Cargando..');
	$.get
	  (
	  url + "do/getImg.php", { uID: suID, img: sImg },
		  function(data)
		  {
			$("#picture").html(data);
			
		  }
	  );
}

//cargar comentarios
function cargar_comentarios(suID,sImg)
{
	$("#comentarios").html('<img src="http://dobleflog.com/media/loader.gif" border="0" alt="doble" />    Cargando..');
$.get
  (
 url+ "do/getComments.php", { uID: suID, img: sImg },
	  function(data)
	  {
		$("#comentarios").html(data);
	  }
  );
}  

function guardar_comentario(msg ,suID,sImg){
$.ajax({
        url:url + "do/a_comentario.php",
        async:true,
		data: 'msg='+ msg+'&uID='+suID +'&imagen='+ sImg+'&tipo=1',
        beforeSend: function(objeto){
			$("#comentarios").html('<img src="http://dobleflog.com/media/loader.gif" border="0" alt="doble" />     guardando..');
        },
        complete: function(objeto, exito){
           // "Me acabo de completar"
            if(exito=="success"){
               // alert("Comentario guardado con éxito");				
            }
        },
        contentType: "application/x-www-form-urlencoded",
        dataType: "html",
        error: function(objeto, quepaso, otroobj){            
			$("#comentarios").html("El comentario no pudo ser agregado "+ quepaso);
			cargar_comentarios(suID,sImg);
        },
        global: true,
        ifModified: false,
        processData:true,
        success: function(datos){
		//alert(datos);
			cargar_comentarios(suID,sImg);
        },
        timeout: 3000,
        type: "POST"
}); 
//$("#status").html('');
}

function sendComment(sComment,uID){
	$('#sAviso').hide();
	$('#newComments').html(sComment);
	$('#fake').css('visibility','visible');
	$('#fake').fadeIn(1000);
	$('#sAviso').addClass('aviso');
	$('#sAviso').html('Para seguir comentando debes ser usuario.<a href="http://dobleflog.com/registro.php?uID_Ref='+uID+'">Registrate GRATIS</a>');
	$('#sAviso').fadeIn(1000);
}


function borrar_comentario($nID_comentario, suID, sImg){
	val = confirm("Estas seguro que quieres borrar este comentario?");
	if(val==1){
	$.ajax({
			url: url+"do/d_comentario.php",
			async:true,
			data: 'nID_comentario='+ $nID_comentario,
			beforeSend: function(objeto){
				//$("#comentarios").html('<img src="media/loader.gif" border="0" alt="doble" />     guardando..');
			},
			complete: function(objeto, exito){
			   // "Me acabo de completar"
				if(exito=="success"){
				   // alert("Comentario guardado con éxito");				
				}
			},
			contentType: "application/x-www-form-urlencoded",
			dataType: "html",
			error: function(objeto, quepaso, otroobj){
				alert("El comentario no pudo ser borrado "+ quepaso);
			},
			global: true,
			ifModified: false,
			processData:true,
			success: function(datos){
			//alert(datos);
				cargar_comentarios(suID,sImg);
			},
			timeout: 3000,
			type: "POST"
	}); 
	}


}
/*
// Credits: Robert Penners easing equations (http://www.robertpenner.com/easing/).
jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        easing: 'BounceEaseOut',
        animation: 1000
    });
});

function mostrar_imagen(img)
{
	var pic = document.getElementById("imagen");
	pic.innerHTML ='<img src="media/fotos/n/' + img +'" alt="doble" />';
	pic.className = "centrada";
	var c=document.getElementById('c');
	c.imagen.value = img;
}
*/
