function posiciona_2(){
	 posiciona();
}
function posiciona(){
	/*var left = $('posicion').offsetLeft + 'px';
	var top = $('posicion').offsetTop + 'px';
	lefty = '';
	elem = document.getElementsByClassName('main_banner');
	if (elem.length == 0) 	elem = document.getElementsByClassName('in_banner');

	for ( i = 0; i < elem.length; i++ ){
		elem[i].style.left = left;
		elem[i].style.top = top;
	}
	var url = new String(window.location);
	urlArray = url.split('/');
	if ($(urlArray[4])){
		Effect.Appear($(urlArray[4]), {duration: 0.4});
	}else	Effect.Appear($('dominios'), {duration: 0.4});*/


}


function removeSlashes(text){

	var text = new String(text);
	if (text.substr(0,1) == '/'){
		text = text.substr(1)
	}
	if (text.substr(text.length - 1 , 1) == '/'){
		text = text.substr(0,text.length-1)
	}
	return text;
}

function setStyleMenu(){
	var url = new String(window.location);
	var urlArray = url.split('/');

	url = '';
	for ( i = 3; i < urlArray.length; i++ ){
		url = url + '/'+ urlArray[i];
	}
	/* Destacamos el <li> padre y lo destacamos */
	elem = document.getElementsByClassName('menuNav');
	for ( i = 0; i < elem.length; i++ ){
		if (removeSlashes(elem[i].pathname) == removeSlashes(url) ) {
			var ancestor = elem[i].ancestors();
			ancestor[0].addClassName('selected');
		}
	}
	if (!ancestor) return null;
	/* Plegamos todos los <ul> del menu menos el que contiene al menu seleccionado */
	elemUL = document.getElementsByClassName('level3');
	for ( i = 0; i < elemUL.length; i++ ){
		if (elemUL[i].id != ancestor[1].id ) {
			$(elemUL[i]).previousSiblings()[0].addClassName('level2-plus');
			Effect.BlindUp(elemUL[i], {duration: 0.2});
		}
	}
	/*Destacamos la opción del menú superior */
	nodesA = $('div_nav').descendants();

	for ( i = 0; i < nodesA.length; i++ ){
		var urlA = new String(removeSlashes(nodesA[i].pathname));
		urlA_Array = urlA.split('/');

		if (urlA_Array[1] == urlArray[4]){
			nodesA[i-1].addClassName('selected');
			i = 1 + nodesA.length;
		}

	}


}
function showTip(tip){
		elements = $('controls').getElementsByClassName('tooltip');
		elements.invoke('hide');
		$('text' + tip).show();
}
function hideTip(){
		elements = $('controls').getElementsByClassName('tooltip');
		elements.invoke('hide');
}

function plegaMenu(capa){
	if($(capa).visible() == true){
		$(capa).previousSiblings()[0].addClassName('level2-plus');
		if (capa != 'aloj') Effect.BlindUp($(capa), {duration: 0.2});
	}else{
		elem = document.getElementsByClassName('level3');
		for ( i = 0; i < elem.length; i++ ){
			if(elem[i].visible()){
				$(elem[i]).previousSiblings()[0].addClassName('level2-plus');
				Effect.BlindUp(elem[i], {duration: 0.2});
				iAux = i;
				i = elem.lenght + 1;
			}
		}
		if ($(capa).previousSiblings()[0].hasClassName('level2-plus')) $(capa).previousSiblings()[0].removeClassName('level2-plus');
		Effect.BlindDown($(capa), {duration: 0.4, queue: 'end'});

	}
}


function muestraCapa(capa){
	clearTimeout( banner_timeout );
	
	if ($(capa)){
		if ($(capa).visible())return false;
		elem = document.getElementsByClassName('main_banner');

		if (elem.length == 0) 	elem = document.getElementsByClassName('in_banner');

		for ( i = 0; i < elem.length; i++ ){
			if(elem[i].visible()){
				Effect.Fade(elem[i], {duration: 0.2});
				iAux = i;
				//			i = elem.lenght + 1;
			}
		}
		Effect.Appear($(capa), {duration: 0.4, queue: 'end'});
	}
}

function muestraCapaOriginal(){
	banner_timeout = window.setTimeout( 'muestraCapa( initial_banner )' , 2000 );
}

function preloadImages(){
	pic1= new Image(100,25); 
	pic1.src="<?php echo $config['site_url'] ?>images/fondo-banner-correo.jpg";
	pic1.src="<?php echo $config['site_url'] ?>images/banner-streaming.jpg";
	pic1.src="<?php echo $config['site_url'] ?>images/fondo-banner-servidores.jpg";
	pic1.src="<?php echo $config['site_url'] ?>images/fondo-banner-desarrollo.jpg";
	pic1.src="<?php echo $config['site_url'] ?>images/fondo-banner-servicios.jpg";
}
