DIR = "CORPORACION/";

// BOTONERA LINEAS NEGOCIO
// ----------------------------------------

function ActivaBoton(pos) {
	// comprobar que el fondo no sea tab
	strURLffox = "transparent url(" + DIR + "img/skin/boton_tab.png) repeat scroll 0% 0%";
	strURLiexp = "url(" + DIR + "img/skin/boton_tab.png)";
	getBackground = document.getElementById("boton"+pos).style.background;
	
	// fondo off oculto (on visible) para POS
	if ((getBackground != strURLffox) && (getBackground != strURLiexp)) {
		document.getElementById("boton"+pos+"i").style.visibility = "hidden";
		document.getElementById("boton"+pos).style.visibility = "hidden";
		document.getElementById("boton"+pos+"d").style.visibility = "hidden";
	}
}

function DesactivaBoton(pos) {
	// fondo off visible para POS
	document.getElementById("boton"+pos+"i").style.visibility = "visible";
	document.getElementById("boton"+pos).style.visibility = "visible";
	document.getElementById("boton"+pos+"d").style.visibility = "visible";
}

function TabVisible(pos) {
	// reaturamos fondo off a todos
	for (i = 1; i <= 5; i++)
		RestauraBoton(i);
	
	// fondo off visible para POS
	DesactivaBoton(pos);
	
	// fondo off a fondo de tab para POS
	document.getElementById("boton"+pos+"i").style.background = "url(" + DIR + "img/skin/boton_tab_left.png)";
	document.getElementById("boton"+pos).style.background = "url(" + DIR + "img/skin/boton_tab.png)";
	document.getElementById("boton"+pos+"d").style.background = "url(" + DIR + "img/skin/boton_tab_right.png)";
	
	// color tab de las letras para POS
	document.getElementById("Linea"+pos).style.color = "#525252";
}

function RestauraBoton(pos) {
	// reestablecer fondo de off para POS
	document.getElementById("boton"+pos+"i").style.background = "url(" + DIR + "img/skin/boton_off.png)";
	document.getElementById("boton"+pos).style.background = "url(" + DIR + "img/skin/boton_off.png)";
	if (pos == 5)
		document.getElementById("boton"+pos+"d").style.background = "url(" + DIR + "img/skin/boton_off_end.png)";
	else
		document.getElementById("boton"+pos+"d").style.background = "url(" + DIR + "img/skin/boton_off_right.png)";
	
	// color off de las letras para POS
	document.getElementById("Linea"+pos).style.color = "#EFEFEF";
}


// CONTENIDO
// ----------------------------------------

function CambiaColor(elem, col) {
	document.getElementById(elem).style.color = col;
}

function CambiaDeco(elem, deco) {
	document.getElementById(elem).style.textDecoration = deco;
}

// SUBMENUS
// ----------------------------------------

function CambiaFlecha(elem, onoff) {
	document.getElementById('flecha' + elem).src = DIR + 'img/skin/submenu_flecha_' + onoff + '.png';
}

function FijaActivo(elem) {
	// cambiar color, flecha ON y desactivar mouseout
	CambiaColor(elem, '#FD7609'); 
	CambiaFlecha(elem, 'on'); 
	document.getElementById(elem).onmouseout = "";
}

function Enlace(url) {
	// linkar
	if (url.length)
		window.location.href = url;
}

//
// CONTACTO
// ----------------------------------------

function compruebaFormContacto() {

	var f = document.forms.contactar
	var errores = "";
	
	if (f.check.checked == true) {
	
		if (f.nombre.value == "") {
			errores += "- Nombre\n"
		}
		
		if (f.telefono.value == "") {
			errores += "- Teléfono\n"
		}
		
		if (f.email.value == "") {
			errores += "- eMail\n"
		}
		
		if (f.asunto.value == "") {
			errores += "- Asunto\n"
		}
		
		if (errores != "") {
			alert("Debe completar los campos de:\n\n"+errores);
			return false;
		} else {
			f.submit();
		}
	}
	else {
		alert("Debe aceptar las condiciones.");
	}
	

}


//
// SALA PRENSA
// ----------------------------------------

function mostrarimagen(img) {
	
	if (img != '')
		document.getElementById("cargaimagen").innerHTML = "<img src='COMUN/multimedia/" + img + "' width='300' height='200'>";
}


function mostrarvideoflv(vid) {

	if (vid != '')
		document.getElementById("cargavideo").innerHTML = "<embed src='COMUN/swf/mediaplayer.swf' width='300' height='200' allowscriptaccess='always' allowfullscreen='true' flashvars='height=200&width=300&file=../multimedia/" + vid + "&screencolor=0x000000'/></embed>";
}

function popupvideoflv(vid) {

	if (vid != '')
		window.open('COMUN/includes/cargavideo.asp?vid=' + vid, "VIDEO", "width=320, height=220");
}

function compruebaPrensaContacto() {

	var f = document.forms.contactar
	var errores = "";
	
	if (f.nombre.value == "") {
		errores += "- Nombre y apellidos\n"
	}
	
	if (f.correo.value == "") {
		errores += "- Correo electrónico\n"
	}
	
	if (f.medio.value == "") {
		errores += "- Medio\n"
	}
	
	if (f.cargo.value == "") {
		errores += "- Cargo\n"
	}
	
	if (f.texto.value == "") {
		errores += "- Texto\n"
	}
	
	if (errores != "") {
		alert("Debe completar el/los campo/s de:\n\n"+errores);
		return false;
	} else {
		f.accion.value = "enviarFormPrensa";
		return true;
	}
}

function AccesoEnter(obj, e) {
	var tecla;

	if (window.event){
		tecla = window.event.keyCode;
	}else if (e){
		tecla = e.which;
	}else{
		return;
	}

	if (tecla == 13) {
		obj.submit();
	}
}



//
// SALA PRENSA
// ----------------------------------------

function BuscarEnter(obj, e) {
	var tecla;

	if (window.event){
		tecla = window.event.keyCode;
	}else if (e){
		tecla = e.which;
	}else{
		return;
	}

	if (tecla == 13) {
		obj.action = '?not=0&bot=0&pg=buscar&busca=' + obj.inBuscar.value;
		obj.submit();
	}
}

