//Funciones javascript

//Funcion para recordar password cuenta usuario



function recordar()

{

	if(megavalidacion('cuentaform'))

	{

	respuesta = document.getElementById('motor');

	envia('recordar.php','email='+document.getElementById("email").value);

	}

}

function login()

{

	if((document.logform.username.value!="")&&(document.logform.password.value!=""))

	{

	document.forms['logform'].submit();

	}

	else

	{

		alert('Hay datos incorrectos y/o campos obligatorios sin rellenar');

	}

}

//Funciones que devuelven dimensiones y scroll del area de contenido del navegador

function f_clientWidth() {

	return f_filterResults (

		window.innerWidth ? window.innerWidth : 0,

		document.documentElement ? document.documentElement.clientWidth : 0,

		document.body ? document.body.clientWidth : 0

	);

}

function f_clientHeight() {

	return f_filterResults (

		window.innerHeight ? window.innerHeight : 0,

		document.documentElement ? document.documentElement.clientHeight : 0,

		document.body ? document.body.clientHeight : 0

	);

}

function f_scrollTop() {

	return f_filterResults (

		window.pageYOffset ? window.pageYOffset : 0,

		document.documentElement ? document.documentElement.scrollTop : 0,

		document.body ? document.body.scrollTop : 0

	);

}

function f_scrollLeft() {

    return f_filterResults (

        window.pageXOffset ? window.pageXOffset : 0,

        document.documentElement ? document.documentElement.scrollLeft : 0,

        document.body ? document.body.scrollLeft : 0

    );

}



function f_filterResults(n_win, n_docel, n_body) {

	var n_result = n_win ? n_win : 0;

	if (n_docel && (!n_result || (n_result > n_docel)))

		n_result = n_docel;

	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;

}

function comentar()

{

	if(megavalidacion('comentarfrm'))

	{

		document.getElementById('formulario').style.display='none';

		respuesta = document.getElementById('respuestacomentarios');

		envia('comentarios.php',

		'usuario='+document.getElementById('usuario').value+

		'&foto='+document.getElementById('fotoid').value+

		'&comentario='+document.getElementById('comentario').value);	

	}

}

function votar2(foto)

{

	respuesta = document.getElementById('respuestavotos');

	envia('votospruebas.php','foto='+foto);

}

function votar(foto)

{

	respuesta = document.getElementById('respuestavotos');

	envia('votos.php','foto='+foto);

}



function enviar_amigo()

{

	if(megavalidacion('recomendarfrm'))

		{	

			document.getElementById('recomendar').style.display='none';

			respuesta = document.getElementById('semaforo');

			envia('enviar_amigo.php',

			'nombre='+document.getElementById('recomendarfrm').nombre.value+

			'&mensaje='+document.getElementById('recomendarfrm').mensaje.value+

			'&foto='+document.getElementById('recomendarfrm').fotoid.value+

			'&email='+document.getElementById('recomendarfrm').email.value);

		}

}

function siguientes_ranking(inicio,puesto,puestoinicial)
{
	respuesta = document.getElementById('siguientespuestos');
	envia('ranking.php','inicio='+inicio+'&puesto='+puesto+'&puestoinicial='+puestoinicial);
}

function anteriores_ranking(inicio,puesto)
{
	respuesta = document.getElementById('siguientespuestos');
	envia('ranking.php','inicio='+inicio+'&puesto='+puesto);
}


function blanco(){

  this.className="ok";

}

