function sistema(){

	var pos = $("index.html").getPosition();
	$("redLine").setStyle("left",pos.x);

	menu();
	asociacion();
	agenda();
	multimedia();
	changePointMenu();
}

function menu(){
	var redLine = $("redLine");
	var opcs = $("topMenu").getElements("li");
			
	opcs.addEvents({
		mouseover: function(){
			if(this.get("id") != null){
				posInicial = redLine.getPosition();
				posFinal = this.getPosition();
				
				redLineFx = new Fx.Tween("redLine",{
					property: 'left',
					duration: 200
				});
				redLineFx.start(posInicial.x,posFinal.x);
				this.setStyle("color","#DC3A3E");
			}
		},
		mouseout: function(){
			this.setStyle("color","#000");
		},
		click: function(){
			link = this.get("id");
			if(link != null) location = link;
			else location = "#";
		}
	});		
}

function asociacion(){
	new Accordion("#asociacion .tiSubmenu","#asociacion .opcs",{
		show: 5,
		opacity: false,
		alwaysHide: true,
//		fixedHeight: 100,
		onActive: function(titulo,contenido){
			titulo.setStyles({
				"font-weight": "bold",
				"color": "#DC3A3E"
			});
			opc = contenido.getElements("li");
			opc.addEvent("click",function(){
				id = this.get("id");
				if(id != null){
					location = id;
				}
			});
		},
		onBackground: function(titulo,contenido){
			titulo.setStyles({
				"font-weight": "normal",
				"color": "#000"
			});
		}
	});
}

function agenda(){
	new Accordion("#agenda .tiSubmenu","#agenda .opcs",{
		show: 5,
		opacity: false,
		alwaysHide: true,
//		fixedHeight: 50,
		onActive: function(titulo,contenido){
			titulo.setStyles({
				"font-weight": "bold",
				"color": "#DC3A3E"
			});
			opc = contenido.getElements("li");
			opc.addEvent("click",function(){
				id = this.get("id");
				if(id != null){
					location = id;
				}
			});
		},
		onBackground: function(titulo,contenido){
			titulo.setStyles({
				"font-weight": "normal",
				"color": "#000"
			});
		}
	});
}

function multimedia(){
	new Accordion("#multimedia .tiSubmenu","#multimedia .opcs",{
		show: 5,
		opacity: false,
		alwaysHide: true,
		onActive: function(titulo,contenido){
			titulo.setStyles({
				"font-weight": "bold",
				"color": "#DC3A3E"
			});
			opc = contenido.getElements("li");
			opc.addEvent("click",function(){
				id = this.get("id");
				if(id != null){
					location = id;
				}
			});
		},
		onBackground: function(titulo,contenido){
			titulo.setStyles({
				"font-weight": "normal",
				"color": "#000"
			});
		}
	});
}

function changePointMenu(){
	var titles  = $("rightMenu").getElements("div.tiSubmenu");
	
	titles.addEvents({
		mouseover: function(){
			this.getElement("img").set("src","css/img/redPoint.jpg");
		},
		mouseout: function(){
			this.getElement("img").set("src","css/img/silverPoint.jpg");
		}
	});
}


