// Scripts Quarzo Tecnologias S.L

function gmaps(NOM,DIR,CP,MU_DES,PV_DES){

    window.open("maps.php3?_NOM="+NOM+"&_DIR="+DIR+"&_CP="+CP+"&_MU_DES="+MU_DES+"&_PV_DES="+PV_DES+"&","gmaps","width=600,height=500,status=no,resizable=yes,scrollbars=yes,top=200,left=200");

}

function validarSSL(){

    window.open("https://www.thawte.com/core/process?process=public-site-seal-cert-details&public-site-seal-cert-details.referer=https://www.iae.org.es/index.php3","ssl","width=500,height=600,status=no,resizable=yes,scrollbars=yes,top=200,left=200");
}

// Array de los meses
var monthNames = new makeArray(12);
monthNames[0] = "Enero";
monthNames[1] = "Febrero";
monthNames[2] = "Marzo";
monthNames[3] = "Abril";
monthNames[4] = "Mayo";
monthNames[5] = "Junio";
monthNames[6] = "Julio";
monthNames[7] = "Agosto";
monthNames[8] = "Septiembre";
monthNames[9] = "Octubre";
monthNames[10] = "Noviembre";
monthNames[11] = "Diciembre";

// Array de los días

var dayNames = new makeArray(7);
dayNames[0] = "Domingo";
dayNames[1] = "Lunes";
dayNames[2] = "Martes";
dayNames[3] = "Mi&eacute;rcoles";
dayNames[4] = "Jueves";
dayNames[5] = "Viernes";
dayNames[6] = "S&aacute;bado";

var now = new Date();
var year = now.getYear();

if (year < 2000) year = year + 1900;

function makeArray(len)
{
for (var i = 0; i < len; i++) this[i] = null;
this.length = len;
}

function validaEmail(valor) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
return (true)
} else {
alert("Error: La dirección de email proporcionada es incorrecta.");
return (false);
}
}

function openLightbox(url,des){

	var objLink = document.createElement('a');
	objLink.setAttribute('href',url);
	objLink.setAttribute('rel','lightbox');
	objLink.setAttribute('title',des);
	Lightbox.prototype.start(objLink);
	
}
		
function ampliaFoto (IMGA,IMGD) {

	openLightbox(IMGA,IMGD);
}

function ampliaVideo(VI_URL,VI_TIT)
{
    window.open("video.php3?_VI_URL="+VI_URL+"&_VI_TIT="+VI_TIT+"&","video","width=550,height=485,status=no,resizable=yes,scrollbars=yes,top=100,left=200");
}

function muestra_oculta(id){
	if (document.getElementById){ //se obtiene el id
	var el = document.getElementById(id); //se define la variable "el" igual a nuestro div
	el.style.display = (el.style.display == 'none') ? 'block' : 'none'; //damos un atributo display:none que oculta el div
	}
	}
	window.onload = function(){/*hace que se cargue la función lo que predetermina que div estará oculto hasta llamar a la función nuevamente*/
	muestra_oculta('cabecera');/* "contenido_a_mostrar" es el nombre que le dimos al DIV */
}

function centrar() {
     eje_x=(screen.width-document.body.clientWidth) / 2;
     eje_y=(screen.height-document.body.clientHeight) / 2;
     moveTo(eje_x,eje_y);
 } 
 
function imprimir(){
    window.print();
	}
	
function recomendar(URL){
    window.open("recomendar.php3?_URL="+URL+"&","recomendar","width=600,height=480,status=no,resizable=yes,scrollbars=yes,top=200,left=200");
	}

function qCalendar(params, form, field, type) {
    window.open("../util/cal/cal.php3", "calendar", "width=190,height=180,status=yes,top=200,left=200");
    dateField = eval("document." + form + "." + field);
    dateType = type;
}

function zerofill (num,zero) {
	while (num.length < zero) {
		num = "0"+num;
	}
	return num;
}

function accionSeleccionUno(src, valCheck, idNoticia, color_anterior)
{	
	color_sustitucion = "#fedbb7";
	
	//almacenamos en count el total de filas que se han creado (hacemos un length del array de checks que se han creado)
	campo = document.form1._NUM_FILA;
	
	count = campo.length;

	////////////////////// PINTAMOS LA FILA QUE SE HA SELECCIONADO Y EL RESTO SE PONE A BLANCO ////////////////////////////////////
	//src es el objeto que se ha seleccionado, le asignam el "on" delante de identificador para que la funcion restablece() no le cambie el color cuando pierda el foco
	if(src.id.substring(0,2)!="on")
	{	//Si es la segunda vez que se pulsa la linea no se modifica el identificador
		src.id = "on"+src.id;
	}
	src.bgColor=color_sustitucion;
	src.style.cursor = "pointer";
	
	for (i=1; i<= count ; i++)
	{
		val = "f"+i;
				
		if(document.getElementById(val)!=null)
		{	//si existe el objeto es por que no está seleccinado, le quitamos el color
			fila = document.getElementById(val);
			//fila.bgColor = "";
			fila.style.cursor = "default";
		}
		else
		{	//si pasa por aqui es por que no es el objeto que estaba seleccionado anteriormente, le quitamos el "on" de delante del indentificador
			valor = "onf"+i;
			if(src.id != valor)
			{	
				fila1 = document.getElementById(valor)
				fila1.bgColor = color_anterior;
				fila1.style.cursor = "default";
				fila1.id = "f"+i;
			}
		}
 	}
	/////////////////////  FIN PINTAR FILAS ////////////////////////////////////////////////////////////////////////////////////////////

	///////  CHECKEAMOS LA FILA SELECCIONADA, EL RESTO DESCHECKEADAS //////////
	if(count == null)
	{
		//Si solo existe una noticia la checkeamos (no es un array)
		campo.checked = true;
	}
	else
	{
		for (j=0; j<count ; j++)
		{			
			if((j)==(valCheck-1)) //ponemos (valCheck-1) por que valCheck es el valor de la fila que empieza por 1, y los check son un array que empieza desde 0
			{
				//Si es el check de la fila que hemos seleccionado, lo activamos
				campo[j].checked = true;
			}
			else
			{
				//Si el check pertenece una de las filas que no hemos seleccionado lo desactivamos
				campo[j].checked = false;
			}
		}
	}
	/////// FIN CHECKEAMOS LA FILA SELECCIONADA, EL RESTO DESCHECKEADAS /////////

}


function accionSeleccionVarios(src, valCheck, id, color_anterior)
{	
color_sustitucion = "#fedbb7";
	
	//almacenamos en count el total de filas que se han creado (hacemos un length del array de checks que se han creado)

	campo = document.form1._NUM_FILA;

	count = campo.length;	
	////////////////////// PINTAMOS LA FILA QUE SE HA SELECCIONADO Y EL RESTO SE PONE A BLANCO ////////////////////////////////////
	//src es el objeto que se ha seleccionado, le asignam el "on" delante de identificador para que la funcion restablece() no le cambie el color cuando pierda el foco
	
	if(src.id.substring(0,2)!="on")
	{	//Si es la segunda vez que se pulsa la linea no se modifica el identificador
		id_fila = src.id.substring(1,src.id.length)-1;
		src.id = "on"+src.id;
	
		src.bgColor=color_sustitucion;
		campo[id_fila].checked = true;
		src.style.cursor = "pointer";
	
	} else if (src.id.substring(0,2)=="on") {
	
		id_fila = src.id.substring(3,src.id.length)-1;
	
		src.bgColor=color_anterior;
		campo[id_fila].checked = false;
		src.style.cursor = "pointer";
	
	
	}
	
	for (i=1; i<= count ; i++)
	{
		val = "f"+i;
				
		if(document.getElementById(val)!=null)
		{	//si existe el objeto es por que no está seleccinado, le quitamos el color
			fila = document.getElementById(val);
			//fila.bgColor = "";
			fila.style.cursor = "default";
		}
		else
		{	//si pasa por aqui es por que no es el objeto que estaba seleccionado anteriormente, le quitamos el "on" de delante del indentificador
			valor = "onf"+i;
			if(src.id != valor)
			{	
				fila1 = document.getElementById(valor)
				//fila1.bgColor = color_anterior;
				fila1.style.cursor = "default";
				fila1.id = "f"+i;
			}
		}
 	}
	/////////////////////  FIN PINTAR FILAS ////////////////////////////////////////////////////////////////////////////////////////////

	///////  CHECKEAMOS LA FILA SELECCIONADA, EL RESTO DESCHECKEADAS //////////
	if(count == null)
	{
		//Si solo existe una noticia la checkeamos (no es un array)
		campo.checked = true;
	}
	/////// FIN CHECKEAMOS LA FILA SELECCIONADA, EL RESTO DESCHECKEADAS /////////
}


function ilumina(src) 
{
	color_sobre = "#fedbb7";

	ident = src.id;
		
	if(ident.substring(0,2)!="on")
	{
	
		src.bgColor=color_sobre;
		src.style.cursor ="pointer";
	}
	
}
function restablece(src, color) 
{
	
	campo = document.form1._NUM_FILA;

	ident = src.id;
	if(ident.substring(0,2)!="on")
	{
	
			id_fila = src.id.substring(1,src.id.length)-1;
		
			if (campo[id_fila].checked == true){
			
			} else {
			
				src.bgColor=color;
				src.style.cursor="default";
				
				}
				
		
	}
}

function checkeaTodos (){
	
	color_sustitucion = "#fedbb7";

	campo = document.form1._NUM_FILA;	
	count = campo.length;
	
	if (document.form1.NUM_FILA.checked == false){
		valor = 0;

} else if (document.form1.NUM_FILA.checked == true){
		valor = 1;

}
					
			for (j=0; j<count ; j++){		
			// seleccionamos y ponemos el color							
			campo[j].checked = valor;
						
			}	
						
}

function decimales(Numero, Decimales) {

    pot = Math.pow(10,Decimales);
    num = Math.round(Numero * pot) / pot;
    nume = num.toString().split('.');
    entero = nume[0];
    decima = nume[1];
    if (decima != undefined) {
        fin = Decimales-decima.length; }
    else {
        decima = '';
        fin = Decimales; }
    for(i=0;i<fin;i++)
      decima+=String.fromCharCode(48); 
    num=entero+','+decima;
    return num;
}		


function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function cerrar_pagina (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=20,top=50,left=50";
window.open(pagina,"",opciones);
}

function recLogOut(text){
	confirm(text);
}

function logOut()
{
	if (confirm("¿Está seguro que quiere cerrar la sesión?"))
		return true;
	return false;
}

function logOutAut () {
var opciones="fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=390,height=30,top=0,left=0";
window.open("../logOutAut/","",opciones);
}

function set_focus(d, el)
{
	if (!el)	// if form element not set - do nothing
		return;

	if ((x = findObj(e, d)) != null) {
		if (x.focus)
			x.focus();
		if (x.select)
			x.select();
	}
}

function syn(s)
{
	if (!s || !s.options || !s.options.length) 
		return false;
	
	if (s.options[s.options.length - 1].selected)
		s.options[s.options.length - 1].selected = false;
}

function plesk_scroll(w)
{
	var nav = navigator.appName;
	var ver = parseInt(navigator.appVersion);
	if ((nav.indexOf('Netscape') != -1) && (ver == 4) && w.document.location.hash) {
		var aname = w.document.location.hash.substr(1);
		var an = w.document.anchors[aname];
		if (an)
			w.scrollTo(an.x, an.y);
	}
}

function MM_reloadPage(init)	// reloads the window if Nav4 resized
{
	if (init == true)
		with (navigator) {
			if ((appName == 'Netscape') && (parseInt(appVersion) == 4)) {
				document.MM_pgW = innerWidth;
				document.MM_pgH = innerHeight;
				onresize = MM_reloadPage;
			}
		}
	else
		if ((innerWidth != document.MM_pgW) || (innerHeight != document.MM_pgH))
			location.reload();
}

function getButtonName(name)
{
    re = /^bname_([A-Za-z0-9-]+)$/;
    return name.replace(re,"$1");
}


function isFramed()
{
	if (opt_no_frames)
		return false;
	else
		return !("undefined" == typeof top.workFrame ||
			 "undefined" == typeof top.topFrame ||
			 "undefined" == typeof top.leftFrame);
}

function topLoaded()
{
	return !("undefined" == typeof top);
}

function workFrameLoaded()
{
	if (opt_no_frames)
		return true;
	else
		return topLoaded() && !("undefined" == typeof top.workFrame ||
			"undefined" == typeof top.workFrame.document);
}

function topFrameLoaded()
{
	if (opt_no_frames)
		return false;
	else
		return topLoaded() && !("undefined" == typeof top.topFrame ||
			"undefined" == typeof top.topFrame.document);
}

function leftFrameLoaded()
{
	if (opt_no_frames)
		return false;
	else
		return topLoaded() && !("undefined" == typeof top.leftFrame ||
			"undefined" == typeof top.leftFrame.document);
}

function conhelpLoaded()
{
	if (opt_no_frames)
		return false;
	else
		return leftFrameLoaded() && !("undefined" == typeof top.leftFrame.document.forms[0] ||
		"undefined" == typeof top.leftFrame._c);
}

function contextLoaded()
{
	if (opt_no_frames)
		return false;
	else
		return topLoaded() && !("undefined" == typeof top._context);
}

function helpPrefixLoaded()
{
	if (opt_no_frames)
		return false;
	else
		return topLoaded() && !("undefined" == typeof top._help_prefix);
}

function helpPermLoaded()
{
	if (opt_no_frames)
		return false;
	else
		return topLoaded() && !("undefined" == typeof top._helpPerm);
}

function setActiveButtonByName(name)
{
	if (!conhelpLoaded())
		return false;
	
	return top.leftFrame.setActiveNode(name);
}
	
function setActiveButton(o)
{
	if (!conhelpLoaded())
		return false;
	
	return top.leftFrame.setActiveNode(o.id);
}
	
function setScrollInIE()
{
	if (!leftFrameLoaded())
		return;

	var navL = top.leftFrame.document.getElementById ('pageLayout');
	top.leftFrame.document.body.scroll = (navL.clientHeight > top.leftFrame.document.documentElement.clientHeight || navL.clientWidth > top.leftFrame.document.documentElement.clientWidth) ? 'yes' : 'no';
}

//---------------------------------- redirect

function get_workframe()
{
	try {
		if (top.workFrame.visibilityContent && !top.workFrame.removeMe)
			return top.workFrame.visibilityContent;
	} catch (e) {}
	if (top.workFrame)
		return top.workFrame;
	else
		return this;
}

function go_to(href)
{
	return go_to_workframe(href);
}

function go_to_workframe(href)
{
	return _go_to(isFramed() ? get_workframe() : this, href);
}

function refresh_leftframe()
{
	if (opt_integrated_mode)
		return go_to_leftframe("");
	else
		return go_to_leftframe("");
}

function go_to_leftframe(href)
{
	if (!leftFrameLoaded())
		return false;
	else
		return _go_to(top.leftFrame, href);
}

function refresh_topframe()
{
	return go_to_topframe("");
}

function go_to_topframe(href)
{
	if (!topFrameLoaded())
		return false;
	else
		return _go_to(top.topFrame, href);
}

function go_to_top(href)
{
	if (!topLoaded())
		return false;
	else
		return _go_to(top, href);
}

function _go_to(target, href)
{
	target.location = href;
	return false;
}

//---------------------------------- conhelp & help

function SetConHelp(conhelp_name, direct)
{
	if (!conhelpLoaded())
		return false;
	return top.leftFrame._SetConHelp(conhelp_name, direct);
}

function SetContext(context, conhelp)
{
	SetHelpModule('');

	if (opt_integrated_mode && !opt_no_frames)
		return top.SetContext(context, conhelp)

	if (!contextLoaded())
		return false;
	if (context)
		top._context = context;
	top._conhelp = conhelp;
	return SetConHelp();
}

function SetHelpModule(module)
{
	if (opt_integrated_mode && !opt_no_frames && top.SetHelpModule)
		return top.SetHelpModule(module)

	try {
		top._help_module = module;
	} catch (e) {
		return false;
	}

	return true;
}

function GetContext()
{
	if (!contextLoaded())
		return false;
	return top._context;
}

function GetConhelp()
{
	if (!contextLoaded())
		return false;
	return top._conhelp;
}

function GetHelpPrefix()
{
	if (!helpPrefixLoaded())
		return false;
	return top._help_prefix;
}

function GetHelpModule()
{
	try {
		return top._help_module;
	} catch (e) {
		return false;
	}
}

function getHelpPerm()
{
	if (!helpPermLoaded())
		return false;
	return top._helpPerm;
}

function resetHelpPerm()
{
	if (!helpPermLoaded())
		return false;
	top._helpPerm = true;
	return true;
}

function denyHelpPerm()
{
	if (!helpPermLoaded())
		return false;
	top._helpPerm = false;
	return true;
}

function mouse_move(context, direct)
{
	if (opt_no_frames || !opt_integrated_mode)
		SetConHelp(context, direct);
	else
		top.mouse_move(context);
}

function lsetup_handler(e)
{
	lsetup(this);
	return true;
}

function lsetup(target)
{
	try {
		if (!target)
			target = this;

		var o_set = target.document.getElementById('loaderContainerWH');
		var o_getH = target.document.getElementsByTagName('BODY')[0];

		o_set.style.height = o_getH.scrollHeight;
	} catch (e) {
	}
}

function lon(target)
{
	try {
		if (parent.visibilityToolbar)
			parent.visibilityToolbar.set_display("standbyDisplayNoControls");
	} catch (e) {}

	try {
		if (!target)
			target = this;
		lsetup(target);

		if (!target._lon_disabled_arr)
			target._lon_disabled_arr = new Array();
		else if (target._lon_disabled_arr.length > 0)
			return true;

		target.document.getElementById("loaderContainer").style.display = "";
		var select_arr = target.document.getElementsByTagName("select");

		for (var i = 0; i < select_arr.length; i++) {
			if (select_arr[i].disabled)
				continue;

			select_arr[i].disabled = true;
			_lon_disabled_arr.pop(select_arr[i]);
			var clone = target.document.createElement("input");
			clone.type = "hidden";
			clone.name = select_arr[i].name;
			var values = new Array();
			for (var n = 0; n < select_arr[i].length; n++) {
				if (select_arr[i][n].selected) {
					values[values.length] = select_arr[i][n].value;
				}
			}
			clone.value = values.join(",");
			select_arr[i].parentNode.insertBefore(clone, select_arr[i]);
		}
	} catch (e) {
		return false;
	}
	return true;
}

function loff(target)
{
	try {
		if (parent.visibilityToolbar) {
			parent.visibilityToolbar.set_display(visibilityCount
												 ? "standbyDisplay"
												 : "standbyDisplayNoControls");
		}
	} catch (e) {}

	try {
		if (!target)
			target = this;

		target.document.getElementById("loaderContainer").style.display = "none";

		if (target._lon_disabled_arr) {
			while(_lon_disabled_arr.legth > 0) {
				var select = _lon_disabled_arr.push();
				select.disabled = false;

				var clones_arr = target.document.getElementsByName(select.name);
				for (var n = 0; n < clones_arr.length; n++) {
					if ("hidden" == clones_arr[n].type)
						clones_arr[n].parent.removeChild(clones_arr[n]);
				}
			}
		}
	} catch (e) {
		return false;
	}
	return true;
}

function lsubmit(f)
{
	try {
		if (f.lock.value == "true")
			return false;
		f.lock.value = "true";
	} catch (e) {
	}

	lon();

	try {
		f.submit(f);
	} catch (e) {
		loff();
		return false;
	}
	return true;
}

function hasClass(element, className)
{
    var classes = element.className.split(' ');
	for (var i in classes) {
		if (classes[i] == className)
			return true;
	}
	return false;
}

function addClass(element, className)
{
	if (!hasClass(element, className))
		element.className = (element.className == '' ? className : element.className + ' ' + className);
}

function removeClass(element, className)
{
	var newValue = '';
    var classes = element.className.split(' ');
	for (var i in classes) {
		if (classes[i] != className)
			newValue += newValue.length ? ' ' + classes[i] : classes[i];
	}
	element.className = newValue;
}

MM_reloadPage(true);

function _body_onload()
{
	setScrollInIE();
	loff();
}

function _body_resize()
{
	setScrollInIE();
}

function _body_onunload()
{
	lon();
	
}


			var opt_no_frames = false;
			var opt_integrated_mode = false;


//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["container"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller


var key = new Array(); // Define key launcher pages here
key['a'] = "principal.php3";
key['b'] = "principal.php3";
key['c'] = "principal.php3";
key['d'] = "principal.php3";
key['e'] = "principal.php3";
key['f'] = "a_arbitros.php3";
key['g'] = "a_categorias.php3";
key['h'] = "principal.php3";
key['i'] = "principal.php3";
key['j'] = "principal.php3";
key['k'] = "principal.php3";
key['l'] = "principal.php3";
key['m'] = "principal.php3";
key['n'] = "principal.php3";
key['o'] = "principal.php3";
key['p'] = "principal.php3";
key['q'] = "i_informadores.php3";
key['r'] = "principal.php3";
key['s'] = "principal.php3";
key['t'] = "principal.php3";
key['u'] = "principal.php3";
key['v'] = "principal.php3";
key['w'] = "principal.php3";
key['x'] = "principal.php3";
key['y'] = "principal.php3";
key['z'] = "principal.php3";
key['1'] = "principal.php3";
key['2'] = "principal.php3";
key['3'] = "principal.php3";
key['4'] = "principal.php3";
key['5'] = "principal.php3";
key['6'] = "principal.php3";
function getKey(keyStroke) {
isNetscape=(document.layers);
eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
which = String.fromCharCode(eventChooser).toLowerCase();
for (var i in key) if (which == i) contenido.location = key[i];
}
document.onkeypress = getKey;

// JavaScript Document
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace
	(" over", "");
   }
   }
  }
 };
objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++)
{
    objects[i].outerHTML = objects[i].outerHTML;
}
}
window.onload=startList;

function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false;
	try
	{
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			// Creacion del objet AJAX para IE
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E)
		{
			if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest();
		}
	}
	return xmlhttp; 
}

// Declaro los selects que componen el documento HTML. Su atributo ID debe figurar aqui.
var listadoSelects=new Array();
listadoSelects[0]="us_paid";
listadoSelects[1]="us_pvid";
listadoSelects[2]="us_muid";

var listadoSelectsPromocion=new Array();
listadoSelectsPromocion[0]="in_paid";
listadoSelectsPromocion[1]="in_pvid";
listadoSelectsPromocion[2]="in_muid";


function buscarEnArray(array, dato)
{
	// Retorna el indice de la posicion donde se encuentra el elemento en el array o null si no se encuentra
	var x=0;
	while(array[x])
	{
		if(array[x]==dato) return x;
		x++;
	}
	return null;
}

function cargaContenido(idSelectOrigen,rellenado,pais,provincia)
{
	
	
	// Obtengo la posicion que ocupa el select que debe ser cargado en el array declarado mas arriba
	var posicionSelectDestino=buscarEnArray(listadoSelects, idSelectOrigen)+1;
	// Obtengo el select que el usuario modifico
	var selectOrigen=document.getElementById(idSelectOrigen);
	// Obtengo la opcion que el usuario selecciono
	var opcionSeleccionada=selectOrigen.options[selectOrigen.selectedIndex].value;
	// Si el usuario eligio la opcion "Elige", no voy al servidor y pongo los selects siguientes en estado "Selecciona opcion..."
	if(opcionSeleccionada==0)
	{
		var x=posicionSelectDestino, selectActual=null;
		// Busco todos los selects siguientes al que inicio el evento onChange y les cambio el estado y deshabilito
		while(listadoSelects[x])
		{
			selectActual=document.getElementById(listadoSelects[x]);
			selectActual.length=0;
			
			var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Selecciona Opci&oacute;n...";
			selectActual.appendChild(nuevaOpcion);	selectActual.disabled=true;
			x++;
		}
	}
	// Compruebo que el select modificado no sea el ultimo de la cadena
	else if(idSelectOrigen!=listadoSelects[listadoSelects.length-1])
	{
		// Obtengo el elemento del select que debo cargar
		var idSelectDestino=listadoSelects[posicionSelectDestino];
		var selectDestino=document.getElementById(idSelectDestino);
		// Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
		var ajax=nuevoAjax();
		
		
		
		if (rellenado) {

		ajax.open("GET", "proceso_combo.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada+"&pais="+pais+"&provincia="+provincia, true);
			
		} else {
		
		ajax.open("GET", "proceso_combo.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada, true);
		
		
		
		}
		ajax.onreadystatechange=function() 
		{ 
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				selectDestino.length=0;
				var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
				selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;	
			}
			if (ajax.readyState==4)
			{
				selectDestino.parentNode.innerHTML=ajax.responseText;
			} 
		}
		ajax.send(null);
	}
}

function cargaContenidoPromocion(idSelectOrigen,rellenado,pais,provincia)
{
	
	// Obtengo la posicion que ocupa el select que debe ser cargado en el array declarado mas arriba
	var posicionSelectDestino=buscarEnArray(listadoSelectsPromocion, idSelectOrigen)+1;
	// Obtengo el select que el usuario modifico
	var selectOrigen=document.getElementById(idSelectOrigen);
	// Obtengo la opcion que el usuario selecciono
	var opcionSeleccionada=selectOrigen.options[selectOrigen.selectedIndex].value;
	// Si el usuario eligio la opcion "Elige", no voy al servidor y pongo los selects siguientes en estado "Selecciona opcion..."
	if(opcionSeleccionada==0)
	{
		
		var x=posicionSelectDestino, selectActual=null;
		// Busco todos los selects siguientes al que inicio el evento onChange y les cambio el estado y deshabilito
		while(listadoSelectsPromocion[x])
		{
			selectActual=document.getElementById(listadoSelectsPromocion[x]);
			selectActual.length=0;

			var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Selecciona Opci&oacute;n...";
			selectActual.appendChild(nuevaOpcion);	selectActual.disabled=true;
			x++;
		}
	}
	// Compruebo que el select modificado no sea el ultimo de la cadena
	else if(idSelectOrigen!=listadoSelectsPromocion[listadoSelectsPromocion.length-1])
	{
		
		// Obtengo el elemento del select que debo cargar
		var idSelectDestino=listadoSelectsPromocion[posicionSelectDestino];

		var selectDestino=document.getElementById(idSelectDestino);
		// Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
		var ajax=nuevoAjax();
		
		
		
		if (rellenado) {
			
		ajax.open("GET", "proceso_combo_promocion.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada+"&pais="+pais+"&provincia="+provincia, true);
			
		} else {
		
		
		
		ajax.open("GET", "proceso_combo_promocion.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada, true);
		
		
		
		}
		ajax.onreadystatechange=function() 
		{ 
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				selectDestino.length=0;
				var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
				selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;	
			}
			if (ajax.readyState==4)
			{
				selectDestino.parentNode.innerHTML=ajax.responseText;
			} 
		}
		ajax.send(null);
	}
}

