arrayMenu = new Array("noticias","promocion","resultados","formacion","convocatorias","agenda");

// Colores
var c_noticias 		= "#FE6601";
var c_promocion		= "#92CC06";
var c_resultados 	= "#0095A4";
var c_formacion		= "#37A836";
var c_convocatorias	= "#0D5CA9";
var c_agenda	 	= "#D89E01";


//--------------------- PROTOTYPE ---------------------
//This function is for switching beetwin two condtions of preloader division that you need to
//place in your page here the division name is: loading
function showLoad(show){
	if(show){
		//$('espacio').style.display="none";
		$('loading-bar').style.display="inline";
	}else{
		//$('espacio').style.display="inline";
		$('loading-bar').style.display="none";
	}
};

// Modificar estilo en las celdas de las tablas (convocatorias y resultados)
function changeColor(id,color){
	$("idTD"+id).setStyle({   backgroundColor: color }); 
};

function changeColor2(id) {
	$(id).setStyle({   backgroundColor: '#CCCCCC' }); 
}
function restoreColor2(id) {
	$(id).setStyle({   backgroundColor: '#DBDBDB' }); 
}
function changeColor_cell(id,color){
	if ($("idTD"+id).getStyle('backgroundColor')!="#648c04" && $("idTD"+id).getStyle('backgroundColor')!="#44767a") { $("idTD"+id).setStyle({   backgroundColor: color }); }
};
function restoreColor_cell(id,color){
	if ($("idTD"+id).getStyle('backgroundColor')!="#648c04" && $("idTD"+id).getStyle('backgroundColor')!="#44767a") { $("idTD"+id).setStyle({   backgroundColor: color }); }
};


function loader(url,opc,color) {
	$$(".clsMenu").each(
		function(elemento) {
			elemento.setStyle({   background: 'none', color: '#000000' }); 
		}
	);
	$("idTxt"+opc).setStyle({   backgroundColor: color, color: '#FFFFFF' }); 
	ajaxload('ajaxcontainer',url);
}

///////////// CARGAR BOLETIN //////////////////
function loader_boletin(url,opc){
	ajaxload('ajaxcontainer2',url);
}


function ajaxload(div,url){
	//call showload function to show preloader
    showLoad(true);

	new Ajax.Updater(div,url, {
		//loaded content would be updated inside this division
		update: div,
		//this should be true if you want to execute JS inside the loaded content
		evalScripts: true,
		onComplete:function(r) {
			//It sets the type property of the script tag, 
			//then puts the script body inside of the element (between the opening and closing script tags),
			//then injects into the head of the page
			var script = new Element('script')
			script.setProperty('type','text/javascript');
			script.setHTML(r);
		},
		onSuccess:function(){
			//This would disappear preloader div
			showLoad(false);
			//The ajaxlinks function is being called here,I defined this function in footer
		}
	});
}