//array de tags con el name esdeve
var oImgCal = document.getElementsByName('esdeve');

var aFondosCal = new Array();
aFondosCal[1] = "imgs/mnuESDEVE1.gif"; //sin seleccion
aFondosCal[2] = "imgs/mnuESDEVE2.gif";//seleccionado

var activoCal = 0; //indica si el boton esta activo, valores 0 y 1

function Calendarium(){

	var oCuadroTxtCal = document.getElementById("Cuadro");
	var imgActiva = oImgCal[0].src.substring((oImgCal[0].src.length - aFondosCal[2].length)).replace(/^\s*|\s*$/g,"");
//alert(una + " == " +aFondosCal[2] + " ...  " + activoCal);

	if (MnuEdFondo == aFondosEd[20]){
	//if (imgActiva == aFondosCal[2] ){
		oCuadroTxtCal.innerHTML =  
			"<div id='titulocentro'>" + 
				"<img align='left' src='imgs/titol_esdeveniments.gif' height='60'/>" + 
			"</div>" + 

			"<div id='contenidocentro'>" + 
				"<object border='0' class='oInsertado' data='calendari.php' type='text/html' width='552' height='318' align='right' valign='top'>." + 
					"<embed border='0' class='oInsertado' type='text/html' src='calendari.php' width='552' height='318' valign='top'>." + 
					"</embed> Error. Les dades insertades en aquesta p&agrave;gina no s'han pogut mostrar." + 
				"</object>" + 
			"</div>";
		activoCal = 1;


// ************ NUEVO ************
		//-------------- AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---
		//Objeto xmlhttpRequest
		var xmlhttp = false;

		var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
			for (var i= 0; i < arrSignatures.length ; i++) {
				try{
					xmlhttp = new ActiveXObject(arrSignatures[i]);
					//alert("Estas usando internet Explorer");
					break;
					//return xmlhttp;
				}
				catch (oExcepcion) {
					xmlhttp = false;
				}
			}

		if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
			xmlhttp= new XMLHttpRequest();
			//alert("No estas usando Microsoft Internet Explorer");
		}

		function hazRequest(sPage, oID)  {
			var obj = document.getElementById(oID);
			//novedad recorta lo que se muestra del div en el que se inserta el texto
			obj.style.overflow = "hidden";//"scroll";
			obj.style.overflowX = "hidden";
			
			xmlhttp.open("GET", sPage, "false");
			xmlhttp.onreadystatechange = function(){
				if (xmlhttp.readyState==4 && xmlhttp.status==200){
					obj.innerHTML = xmlhttp.responseText;
					// Aqui iria funcion centrar
					//id tag padre, tamaņo tag padre, tag, clase tag
					//centradoVertical("contenidocentro", 315, "span", "menuCR");
				}
			}
			xmlhttp.send(null);
		}
		//carga el archivo calendari.php en el elemento esdeveniments
		hazRequest("calendari.php","contenidocentro");
		//-------------- AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---AJAX ---
// ************ /NUEVO ************
			var oDivContenido = document.getElementById("contenidocentro");
			oDivContenido.style.overflow = "scroll";
			oDivContenido.style.overflowX = "hidden";
// ***********************************************
		
	}
	
	//menu prpal valores por defecto
	//oImgs[1].src = aFondos[1]; 
	activo = 0; 
	mnuPrpalFondo= aFondos[1]; 
	//menu editorial valores por defecto
	oImgsEd[0].src = aFondosEd[20]; 
	activoEd = 5;  
	MnuEdFondo= aFondosEd[20];
}

