$(document).ready(function() {

	$("a#recordar_contrasenya_oculto").fancybox({
		'transitionIn'	 : 'fade',
		'transitionOut'	 : 'fade',
		'speedIn'		 : 600,
		'speedOut'		 : 200,
		'modal'			 : true,
		'titleShow'      : false,
		'showCloseButton': false,
		'padding'		 : 0,
		'margin'		 : 0,
		'overlayOpacity' : 0.9,
		ajax : {
		    type	: "POST"
		}

	});

});

function showLog(){
	$("#frminisesion").show();
	$("#txtinisesion").hide();
}

function logme(){
	var html = $.ajax({
		url: path + "/suscriptor_validate",
		data: $("#f_login").serialize(),
		async: false,
		error: function(){
		error=true;
			alert("ups!, algo no ha ido bien.")
		}
	}).responseText;
	if(html=="ko"){
		$('#error_login').show();
	}else{
		$("#clubContent").html(html);
	}
}
function logmefacebook(){
	var html = $.ajax({
		url: "https://www.facebook.com/dialog/oauth?client_id=157191827679675&redirect_uri=http%3A%2F%2Flocalhost%2Fsapos%2Fsuscriptor_validate",
		async: false,
		/*error: function(){
		error=true;
			alert("ups!, algo no ha ido bien.")
		}*/
	}).responseText;
	if(html=="ko"){
		$('#error_login').show();
	}else{
		$("#clubContent").html(html);
	}
}

function unlogme(){
	var html = $.ajax({
		url: path + "/suscriptor_invalidate",
		async: false,
		error: function(){
		error=true;
			alert("ups!, algo no ha ido bien.")
		}
	}).responseText;
	if(html=="ko"){
		alert(html);
	}else{
		if($("#f_perfil").length>0){
			location.href = path + "/";
		}else{
			$("#clubContent").html(html);
		}
	}
}
function muestraCon(){

	$("#condiciones").show("slow");

}
function closeAlta(){
	parent.jQuery.fancybox.close();
}

function recordar(){
	$("#recordar_contrasenya_oculto").trigger('click');
}
