// JavaScript Document
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
//convergencia_val=getCheckedValue(document.preferenciasform.convergencia);

//Funcion para nueva ventana personalizada sin barra estado, navegacion, no redimensionable
function ventanaSecundaria(URL,ancho)
{		
   window.open(URL,null,"width="+ancho+",scrollbars=YES,resizable=NO,status=NO,toolbar=NO");
}

//Borra el contenido de formularios que ya tenian contenido inicialmente ("edicion")

function borrar(formulario)
{
campos = document.forms[formulario].elements;

	for (i=0; i<document.forms[formulario].elements.length; i++) 
	{
		objeto = document.forms[formulario].elements[i] ;
		
		if(objeto.value != undefined)
		{	
			if(objeto.tagName == 'select')
				objeto.selectedIndex = 0;
			else if(objeto.type == 'checkbox')
					objeto.checked = "false";
					else
						objeto.value='';
			
		}
	}
}

//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 comprobarEmail(formulario)
{
	if(formulario.email.value!=formulario.confirmacion.value)
	{
	alert("Los campos de e-mail no coinciden");
	formulario.email.focus();
	formulario.email.select();
	return false;
	}
	else
	{
		if(formulario.clave.value!=formulario.claveconfirm.value)
		{
		alert("Los campos de clave no coinciden");
		formulario.clave.focus();
		formulario.clave.select();
		return false;
		}
		else{
		return true; 
		}
	}
}
