//
//	Endesa - Gestión de contenidos
//	Funciones varias
//	(c) 2002
//	Equipo de Proyectos
//	Dpto. Diseño
//	Mundivía, S.A.
//

var strPath = "/NR/Sites/CCH/Web/imagenes/";

function rolloverOn (imagen,cual) {
	eval("document.getElementById('"+imagen+cual+"').src = '"+strPath+imagen+"_on.gif'");
}
function rolloverOff (imagen,cual) {
	eval("document.getElementById('"+imagen+cual+"').src = '"+strPath+imagen+".gif'");
}
//Funcion para ocultar el contenido inicial de la caja de USUARIO
function ocultarEtiqueta () {
	if(document.getElementById('usuario').value=="Usuario >")
		document.getElementById('usuario').value=""
}
function ponerEtiqueta () {
	if(document.getElementById('usuario').value=="")
		document.getElementById('usuario').value="Usuario >"
}
//Funcion para ocultar el contenido inicial de la caja de CLAVE
function ocultarClave () {
	document.getElementById('cClave').style.visibility = "hidden";
	document.getElementById('Password').focus();
}

function ponerClave () {
	if(document.getElementById('Password').value == "")
		document.getElementById('cClave').style.visibility = "visible";
}
var inicial = true;
function login (){
	var miform = GETform('frmlogin','divlogin');
	if (CampoNoEstaVacio(miform.Usuario)=='true' && CampoNoEstaVacio(miform.Password)=='true'){
		window.open('','EOLLOGIN','toolbar=no,location=no,directories=no,menubar=no,width=1,height=1,fullscreen=no,top=3000,left=3000'); 
		var strAction=document.frmlogin.action;
		if (strAction.substr(0,4)!='http') {
			document.frmlogin.action = 'https://' + location.hostname + strAction;
		}
		else{
			if (strAction.substr(0,6)!='https:'){
				strAction = strAction.replace('http:', 'https:'); 
				document.frmlogin.action = strAction;
			}
		}
		
		document.frmlogin.submit();		
		document.frmlogin.Usuario.value='';
		document.frmlogin.Password.value='';		
	}
	else { alert ('Introduzca usuario y clave'); }
}

// FRR 07/10/2004
function newLogin(){
	document.frmlogin.PasswordEncrip.value = hex_md5(document.frmlogin.Password.value);
	login();
}



function f_getVentana (){ return top.frames['inferior'].ventana; }
function f_getParte (){ return top.frames['inferior'].parteAnterior; }
function f_setVentana (vent){ top.frames['inferior'].ventana = vent; }
function f_setParte (part){ top.frames['inferior'].parteAnterior = part; }

