buttonDestBig(); // ojo si funciones.js vuelve al header!

function getByClass(nodeParent,tag,nameClass){
	nodeTags=nodeParent.getElementsByTagName(tag);
	j=0;
	classElements=new Array();
	
	for(i=0;i<nodeTags.length;i++){
		if(nodeTags[i].className==nameClass){
			classElements[j]=nodeTags[i];
			j++;
		}
	}
	return classElements;
}

function styleLabels(listArray){
	for(i=0;i<listArray.length;i++){
		listArray[i].style.left='-'+i*8+'px';
		listArray[i].style.zIndex=noliAux.length-i;
	}
}

function newAjax(){
	var req = false;
    try{
    	req=new XMLHttpRequest();
   	}catch (trymicrosoft) {
		try{
    		req=new ActiveXObject("Msxml2.XMLHTTP");
   		}catch (othermicrosoft) {
   			try{
    			req=new ActiveXObject("Microsoft.XMLHTTP");
   			}catch (failed) {
    			req=false;
  		 	} 
   		}
 	}
	return req;
}

function selectBanner3(){
	bannerContainer=docId('random_blo');
	banners=getByClass(bannerContainer,'div', 'bloque_der');
	
	var bannersIdNum=new Array();
	var bannersWeight=new Array();
	
	for(i=0;i<banners.length;i++){
		bannersIdNum.push(i);
		bannersWeight.push(1); //mismo peso
	}
		
	bannerPosSel=randomize(bannersWeight);
	bannerSel=bannersIdNum[bannerPosSel];
	
	for(i=0;i<banners.length;i++){
		if(bannersIdNum[i]!=bannerSel){
			banners[i].style.display='none';
		}
	}
}

pestanasStart=function(){

	if(docId('ltxt')){linP=docId('ltxt').innerHTML;}
	if(docId('wtxt')){winP=docId('wtxt').innerHTML;}

	var arrayContents=new Array();
	var arrayPestanas=new Array();
	var arrayContPestanas=new Array();
	var arrayLabels=new Array();
			
	if(docId('lprice')){
			changeWinLinLabel('lin');
	}
	

	arrayLabels=getByClass(document,'div','labels');	

	for(m=0;m<arrayLabels.length;m++){
		noliAux=arrayLabels[m].getElementsByTagName('li');
		showLabelLayer(noliAux[0].id.substring(0,noliAux[0].id.length-1),true); //la primera por defecto
				
		for (i=0;i<noliAux.length;i++){ /*escondo-muestro capas principales segun el ancla del enlace */
			
			arrayContents[i]=docId(noliAux[i].id.substring(0,noliAux[i].id.length-1));
			
			if(!docId('inicio')) leftLabel=8;
			else leftLabel=-1; //index
			
			noliAux[i].style.left=-1*i*leftLabel+'px';
			noliAux[i].style.zIndex=noliAux.length-i;
			
			noliAux[i].onclick=function(){
				labelLayer=this.id.substring(0,this.id.length-1);
				showLabelLayer(labelLayer,true);
				
				if(labelLayer=='info_linux'){
					changeWinLinLabel('lin');
					ancCompTable.href=urlCompTable+'?dc='+dc;
				}else if(labelLayer=='info_windows'){
					changeWinLinLabel('win');
					ancCompTable.href=urlCompTable+'?so=w&dc='+dc;
				}
				
				return false;
			}
		}
		
		if(Request.QueryString("p") != 'undefined' && noliAux[0].id=='c1l'){ //caso especial variable ?p=xxx
			pest=Request.QueryString("p");
			showLabelLayer('c'+pest,true);
		}

		//index
		if(docId('inicio')){
			var linksCar=new Array();
			for(i=0;i<arrayContents.length;i++){
				carLinks=arrayContents[i].getElementsByTagName('a');
				linksCar=carLinks[carLinks.length-1];
			}
			
			for(i=0;i<arrayContents.length;i++){
				arrayContents[i].style.cursor='pointer';
				arrayContents[i].onclick=function(){
					carLinks=this.getElementsByTagName('a');
					linkCar=carLinks[carLinks.length-1];
					location.href=linkCar;
				}
			}
		}
	
		arrayContPestanas[m]=arrayPestanas;
	}
	
	if(docId('compTable')){
		urlCompTable=docId('compTable').getElementsByTagName('a')[0].href;
		ancCompTable=docId('compTable').getElementsByTagName('a')[0];
	}
	
	dc='';	
	//alert(document.getElementsByTagName('body')[0].id);
	if(docId('host_web_domredir')) dc=0;
	if(docId('host_web_per')) dc=1;
	if(docId('host_web_prof')) dc=2;
	if(docId('host_web_emp')) dc=3;
	if(docId('host_web_master')) dc=4;
	if(docId('host_web_master_plus')) dc=5;
	if(docId('host_web_isp')) dc=6;
	
	if(docId('host_corr_domcorreo')) dc=0;
	if(docId('host_corr_exchange')) dc=1;
	if(docId('host_corr_priv')) dc=2;
	
	//pestana win preseleccionada a partir de Plan Master
		if(docId('host_web_prof')  || docId('host_web_emp')|| docId('host_web_master')){ 
			changeWinLinLabel('win');
			showLabelLayer('info_windows',true);
			
			//cambio el enlace de tarifas a windows
			ancCompTable.href=urlCompTable+'?so=w&dc='+dc;
		}else{
			if(docId('compTable')){ //entra siempre donde se usean pestañas si no
				ancCompTable.href=urlCompTable+'?dc='+dc;
			}
		}

		var arrayDevuelta=new Array();
		arrayDevuelta[0]=arrayContents;
		arrayDevuelta[1]=arrayContPestanas;
		return arrayDevuelta; 
}

function cardStart(){
	var arrayDivs = document.getElementsByTagName("div");
	for (i=0; i!=arrayDivs.length;i++) {
    	if(arrayDivs[i].className=="oferta_desarrollo" || arrayDivs[i].className=="categoria_desarrollo") {
       	 arrayDivs[i].style.display='none';
		 aAuxText=document.createTextNode('Cerrar');
		 aAux=document.createElement('a');
		 aAux.appendChild(aAuxText);
		 pAux=document.createElement('p');
		 pAux.className='close';
		 aAux.href='#';
		 aAux.setAttribute('aID', arrayDivs[i].id);
		 aAux.onclick=function(){
		 	showHideCard(this.getAttribute('aID'));
		 	return false;
		 }
		 pAux.appendChild(aAux);
		 arrayDivs[i].appendChild(pAux);
    	}
	}
	
	/* Rotacion de imagenes en SoporteTotal
	if(docId('acerca_att')){
		//array img, text, persona, cargo
		attCliente=new Array(
			 new Array('agata.jpg',
					   'En nuestro Servicio de Atenci&oacute;n al Cliente recibimos m&aacute;s de 2.700 consultas diarias',
					   'Àgata Domènec',
					   'Responsable Información Comercial'
			),
			 new Array('rafael.jpg',
					   'El 27% de nuestra plantilla se dedica en exclusiva a la atenci&oacute;n al cliente',
					   'Rafael Citoler',
					   'Vicepresidente Ejecutivo'
			)
		);
		
		var people=new Array(0,1);
		var peopleWeights=new Array(50,50);
		
		personPosSel=randomize(peopleWeights);
		person=people[personPosSel];
		
		docId('ab_img').src='/img/'+attCliente[person][0];
		docId('ab_img').alt=attCliente[person][2]+' - '+attCliente[person][3];
		docId('ab_text').innerHTML=attCliente[person][1];
		docId('ab_perso').innerHTML=attCliente[person][2];
		docId('ab_cargo').innerHTML=attCliente[person][3];
		
	}*/
}

function randomize(weights){ //se le pasa un array de pesos (5,1,3) y devuelve una posicion aleatoria teniendo en cuenta las probabilidades
	totalWeight=0;
			
	for(i=0;i<weights.length;i++){
		totalWeight+=weights[i];
	}
			
	var weightsOneBase=new Array();
	weightsOneBase[0]=0;
	auxWeight=0;
			
	for(i=0;i<weights.length;i++){
		auxWeight=auxWeight+(weights[i]/totalWeight);
		weightsOneBase[i+1]=auxWeight;
	}
	posSelected=0;
	randomNum=Math.random();
	for(i=0;i<weights.length;i++){
		if(weightsOneBase[i]<randomNum&&randomNum<weightsOneBase[i+1]){
			posSelected=i;
		}
	}
	return posSelected;
}

function showHideCard(id){
	el=docId(id);
	liEl=docId('li_empleo_'+id);
	if(el.style.display=='none'){
		el.style.display='';
		liEl.className='li_empleo_seleccionado';
	}else{
		el.style.display='none';
		liEl.className='';
	}
}
function showLabelLayer(lContentName, manageLayer){

	liName=lContentName+'l';
	lContentID=lContentName.substring(0,lContentName.length-1);

	nodeLi=docId(liName);
	nodeUl=nodeLi.parentNode;
	nodeLis=nodeUl.getElementsByTagName('li');
	labelLayers=new Array();
	
	
	//seleccion de etiqueta
	for(i=0;i<nodeLis.length;i++){
		if(nodeLis[i].id!=liName){ nodeLis[i].className='';
		}else{nodeLis[i].className='select';}
	}

	//seleccion de capa asociada
	if(manageLayer){
		for(i=0;i<nodeLis.length;i++){
			labelLayers[i]=docId(nodeLis[i].id.substring(0,nodeLis[i].id.length-1));
				if(labelLayers[i].id!=lContentName){ labelLayers[i].className='novisible';
				}else{labelLayers[i].className='labc';}
		}
	}
}

function changeWinLinLabel(so){
	if(so=='lin'){
		if(docId('wprice')){ //evita error en solo Linux
			winPrice=docId('wprice').innerHTML;
			docId("wtxt").innerHTML=winPrice;
		}
		docId('ltxt').innerHTML=linP;
	}else{ //so=='win'
		linuxPrice=docId('lprice').innerHTML;
		docId("ltxt").innerHTML=linuxPrice;
		docId('wtxt').innerHTML=winP;
	}
}

productStart=function(){
	recoje=pestanasStart();
	arrayCaracteristicas=recoje[0];
	arrayPestanas=recoje[1];

	for (i=0; i<arrayCaracteristicas.length; i++){  /* esconde y muestras las caracteristicas internas*/
		arrayH1=arrayCaracteristicas[i].getElementsByTagName('h1');
		for(j=0;j<arrayH1.length;j++){
			if(arrayH1[j].className=='nosc') arrayH1[j].className='novisible'; /*escondo h1 que solo deben verse sin js o en hoja de estilos de impresion*/
		}
			
		noliAux=arrayCaracteristicas[i].getElementsByTagName('li');
		escondeMuestra(noliAux);
	}
}
	
function showWinLinCar(so){
	if(so=='win'){
		showHideNodeElements(nodeWinSpan,'');
		showHideNodeElements(nodeWinTr,'');
		showHideNodeElements(nodeLinSpan,'none');
		showHideNodeElements(nodeLinTr,'none');
	}else{ //win
		showHideNodeElements(nodeWinSpan,'none');
		showHideNodeElements(nodeWinTr,'none');
		showHideNodeElements(nodeLinSpan,'');
		showHideNodeElements(nodeLinTr,'');
	}
}

function showHideNodeElements(node,sh){
	//isLinux=isLinux();	
	//problema: abre filas win o lin que quizás deberían estar cerradas si su bloque está en modo resumen
	
	for(i=0;i<node.length;i++){
		node[i].style.display=sh;
	}	
}


tarifasStart=function(){
	trAlwVis=6;
	
	nodoListaTarifas=docId('lista_tarifas');

	//proceso de desplegar capitas
	noliAux=nodoListaTarifas.getElementsByTagName('li');
	escondeMuestra(noliAux);
	
	//procesos propios de la tabla
	
	nodeTables=nodoListaTarifas.getElementsByTagName('table');
	
	noJs=getByClass(nodoListaTarifas,'span','njs');
	for(i=0;i<noJs.length;i++){
		noJs[i].style.display='none';
	}
	
	explainSpan=getByClass(nodoListaTarifas,'span','explain');
	
	for(i=0;i<explainSpan.length;i++){
		explainSpan[i].style.display='none';
	}
	
	//inicializacion de nodos de win y linux
	nodeWinSpan=getByClass(nodoListaTarifas,'span','swin');
	nodeWinTr=getByClass(nodoListaTarifas,'tr','swin');
	nodeLinSpan=getByClass(nodoListaTarifas,'span','slin');
	nodeLinTr=getByClass(nodoListaTarifas,'tr','slin');

	showWinLinCar('lin');

	//proceso de columna destacada
	arrayTds=new Array();

	
	for(i=0;i<nodeTables.length;i++){
		
		existShowHideLink=false;
		
		nodeTheadTrThs=nodeTables[i].getElementsByTagName('thead')[0].getElementsByTagName('tr')[0].getElementsByTagName('th');
		nodeTfootTrThs=nodeTables[i].getElementsByTagName('tfoot')[0].getElementsByTagName('tr')[1].getElementsByTagName('th');
		
		column=0;
		
		for(j=0;j<nodeTheadTrThs.length;j++){
			if(nodeTheadTrThs[j].className!='empty'){
				nodeTheadTrThs[j].setAttribute('tTab',i);
				nodeTheadTrThs[j].setAttribute('tTh',column);
				nodeTfootTrThs[j].setAttribute('tTab',i);
				nodeTfootTrThs[j].setAttribute('tTh',column);

				nodeTheadTrThs[j].onclick=function(){
					resColumn(this.getAttribute('tTab'),this.getAttribute('tTh'));	
				}
				nodeTfootTrThs[j].onclick=function(){
					resColumn(this.getAttribute('tTab'),this.getAttribute('tTh'));	
				}
				column++;
			}
		}
		
		nodeTr=nodeTables[i].getElementsByTagName('tr');
		arrayTds[i]=new Array();

		block=0;
		subBlock=0;
		explain=0;
		
		firstTit=true;
		
		for(j=0;j<nodeTr.length;j++){
		
			subBlock++;
			nodeTd=nodeTr[j].getElementsByTagName('td');
			arrayTds[i][j]=new Array();
			
			nodeTr[j].setAttribute('block',block);
			if(nodeTr[j].className!='tit'||nodeTr[j].className!='con'){
				nodeTr[j].setAttribute('subblock',subBlock);
			}else{
				nodeTr[j].setAttribute('subblock',subBlock+1);
			}
			
			if(nodeTr[j].className=='explain'){explain++;}
				
			if(nodeTr[j].className=='tit' || nodeTr[j].className=='con' || nodeTr[j].className=='last'){
				block++;

				subBlockAnt=subBlock;
				subBlock=0;
				
				if(!firstTit){
					//creacion de tr>td>a Ver mas...
					actualNode=nodeTr[j];
					trNode=document.createElement('tr');
					trNode.className='viewall';
					trNode.setAttribute('block',block-1);
					trNode.setAttribute('subblock',subBlockAnt);
					
					tdNode=document.createElement('td');
					tdNode.colSpan=nodeTr[j].getElementsByTagName('th')[0].colSpan;
					aNode=document.createElement('a');
					aNode.href='#';
					aNode.setAttribute('block',block-1);
					aNode.setAttribute('sTab',i);
					
					aNode.onclick=function(){
						thisBlock=this.getAttribute('block'); //extraigo datos del enlace
						thisTableNum=this.getAttribute('sTab');
						thisTable=nodeTables[thisTableNum]; //averiguo en que tabla estoy
						
						showChar(thisTable,thisBlock);
						
						return false;
					}//fin acciones onclick del nuevo enlace de Ver mas...
					
					
					if(subBlockAnt-explain>(trAlwVis+1)){
						// tNode=document.createTextNode("Ver más"); /*asi falla ie6 por constante de cadena en dterminadas páginas (ayuda)¿?*/
						// aNode.appendChild(tNode);
						
						aNode.innerHTML='Ver más';
						
						tdNode.appendChild(aNode);
						trNode.appendChild(tdNode);
			
						actualNode.parentNode.insertBefore(trNode,actualNode);
						j++; //por que hay un nuevo tr
						existShowHideLink=true; 
					}
				}
				firstTit=false;
			}
			
			
			if(subBlock>trAlwVis &&nodeTr[j]!='viewall'&& nodeTr[j]!='explain'){
				nodeTr[j].style.display='none'
			}
			
			for(k=0;k<nodeTd.length;k++){ //recorro tds, introduzco el onclick de destacar columna
				
				nodeTd[k].setAttribute('sTab',i);
				nodeTd[k].setAttribute('sTd',k);
				
				arrayTds[i][j][k]=nodeTd[k];
				
				if(nodeTd[k].colSpan==1){ //evito destacar en cerrar explain
					nodeTd[k].onclick=function(){
						resColumn(this.getAttribute('sTab'),this.getAttribute('sTd'));
					}
				}
			}
		}
	
		if(existShowHideLink){
			showHideAllParagraph=document.createElement('p');
			showHideAllParagraph.className='showHideAllLink';
			showHideAllAnchor=document.createElement('a');
			showHideAllAnchor.href='#';
			showHideAllAnchor.onclick=function(){showHideAll(this); return false;}
			showHideAllText=document.createTextNode('Desplegar características');
			
			showHideAllAnchor.appendChild(showHideAllText);
			showHideAllParagraph.appendChild(showHideAllAnchor);
		
			nodeTables[i].parentNode.insertBefore(showHideAllParagraph,nodeTables[i]);
		}
	}
	
	arrayLabels=getByClass(document,'div','labels');

	for(m=0;m<arrayLabels.length;m++){
		noliAux=arrayLabels[m].getElementsByTagName('li');
		showLabelLayer(noliAux[0].id.substring(0,noliAux[0].id.length-1),false); //la primera por defecto	
		styleLabels(noliAux);
		
		for (i=0;i<noliAux.length;i++){ /*escondo-muestro capas principales segun el ancla del enlace */
			
			//arrayContents[i]=docId(noliAux[i].id.substring(0,noliAux[i].id.length-1));
			
			noliAux[i].onclick=function(){
				labelLayer=this.id.substring(0,this.id.length-1);
				showLabelLayer(labelLayer, false);
				
				if(labelLayer=='info_linux'){
					showWinLinCar('lin');
				}
				else if(labelLayer=='info_windows'){
					showWinLinCar('win');
				}
				
				return false;
			}
		}
	}

	explainTr=getByClass(nodoListaTarifas,'tr','explain');

	for(i=0;i<explainTr.length;i++){
		explainTr[i].style.display='none';
	}
	
	
	dc=Request.QueryString('dc');
	
	if(isNumber(dc)){
		resColumn(0,dc);
	}
	
	so=Request.QueryString('so');
	if(so=='w'){
		docId('info_linuxl').className='';
		docId('info_windowsl').className='select';
		showWinLinCar('win');
	}
}

function resColumn(tTab,tTd){
	arrayTr=arrayTds[tTab];
	for(l=0;l<arrayTr.length;l++){
		if(arrayTr[l]){	
			for(m=0;m<arrayTr[l].length;m++){
				if(arrayTr[l][m]!=null){
					if(m!=tTd){
						arrayTr[l][m].className='';
					}else{
						if(arrayTr[l][m].colSpan==1){
							arrayTr[l][m].className='sel';
						}
					}
				}
			}
		}
	}
}

function showChar(table, block){ 
	tableTrs=table.getElementsByTagName('tr');
						
	isLinux=isLinuxF();
							
	for(i=0;i<tableTrs.length;i++){
		if(tableTrs[i].className!='explain'){
			if(tableTrs[i].getAttribute('block')==block){
				if((isLinux&&tableTrs[i].className!='swin')||(!isLinux&&tableTrs[i].className!='slin')){
					tableTrs[i].style.display='';
				}
				
				//enlace
				if(tableTrs[i].className=='viewall'){  //localizo el enlace de Ver mas... y le cambio el texto
					nodeA=tableTrs[i].getElementsByTagName('a')[0];						
					nodeA.removeChild(nodeA.childNodes[0]);
					
					txtResumen=document.createTextNode('Ocultar');  
					nodeA.appendChild(txtResumen);
					nodeA.onclick=function(){
						hideChar(table,block);
						return false;
					}
				}
			}
		}
	}
}

function hideChar(table, block){
	
	tableTrs=table.getElementsByTagName('tr');
	
	for(i=0;i<tableTrs.length;i++){
								
		if(tableTrs[i].getAttribute('block')==block){
			subBlock=tableTrs[i].getAttribute('subBlock')
										
			if(subBlock>trAlwVis&&tableTrs[i].className!='viewall'&&tableTrs[i].className!='tit'&&tableTrs[i].className!='con'){
				tableTrs[i].style.display='none';
			}
			
			if(tableTrs[i].className=='explain'){ tableTrs[i].style.display='none';}
			if(tableTrs[i].className=='srow'){ tableTrs[i].className='nsrow';}
			
			if(tableTrs[i].className=='viewall'){  //localizo el enlace de Ver mas... y le cambio el texto
				nodeA=tableTrs[i].getElementsByTagName('a')[0];						
				nodeA.removeChild(nodeA.childNodes[0]);
				//txtResumen=document.createTextNode('Ver mas');    /*asi falla ie6 por constante de cadena en dterminadas páginas (ayuda)¿?*/
				//nodeA.appendChild(txtResumen);
				
				nodeA.innerHTML='Ver más';
				nodeA.onclick=function(){
					showChar(table,block);
					return false;
				}
			}
		}
	}
}

function showHideAll(ancShowHide){
	//Desplegar caracteristicas //Plegar caracteristicas
	table=ancShowHide.parentNode.parentNode.parentNode; // a > td > tr > table

	viewAllTr=getByClass(table,'tr','viewall');
	
	if(ancShowHide.innerHTML=='Desplegar características'){
		for(v=0;v<viewAllTr.length;v++){
			block=viewAllTr[v].getAttribute('block');
			showChar(table,block);
		}
		
		ancShowHide.innerHTML='Plegar características';
	}else{
		for(v=0;v<viewAllTr.length;v++){
			block=viewAllTr[v].getAttribute('block');
			hideChar(table,block);
		}
		ancShowHide.innerHTML='Desplegar características';
	}	
}	
	
function isLinuxF(){
	isLinuxV=true;
	if(docId('info_windowsl')){
		if(docId('info_windowsl').className=='select'){isLinuxV=false;}	
	}
	return isLinuxV;
}


function showDetail(node){
	trNode=docId(node).parentNode.parentNode;
	explainTd=node+'_e';
	if(trNode.className=='nsrow'){
		trNode.className='srow';
		docId(explainTd).style.display='';
	}else{
		trNode.className='nsrow';
		docId(explainTd).style.display='none';
	}
	return false;
}

function showLayer(sId) {
	if(docId(sId).style.display == 'none') {
		docId(sId).style.display='block';
	} else {
	docId(sId).style.display='none';
	}
}


escondeMuestra= function(nodoLiAux){ /* despliega y contra una capa cuando clickas en un h3 */
	for (j=0; j<noliAux.length; j++) { //agrupa en un array a los li
		node = noliAux[j];
		for(k=0; k<node.childNodes.length; k++){ 
			hijo=node.childNodes[k];
			if (hijo.nodeName=="DIV") { /*esconde al iniciar los divs hijos de los li*/
				hijo.className='novisible';
			}
			if (hijo.nodeName=="H3") { /*manita en h3, no en css, xq no debe aparecer si js desactivado*/
				hijo.style.cursor='pointer';
				hijo.onclick=function(){
					nodoLi=this.parentNode;
					var capaDiv;
					for(l=0; l<nodoLi.childNodes.length; l++){ 
						hijo=nodoLi.childNodes[l];
						if (hijo.nodeName=="DIV") {
							capaDiv=hijo;
						}
					}
					if(nodoLi.className==''){
						nodoLi.className='select';
						capaDiv.className='visible';
					}else{
						nodoLi.className='';
						capaDiv.className='novisible';
					}
				}
			}
		}
	}		
}

function showLayer(sId) {
	if(docId(sId).style.display == 'none') {
		docId(sId).style.display='block';
	} else {
	docId(sId).style.display='none';
	}
}



glosaStart = function() { //hace falta
		
	var arrayLetras= new Array();
	arrayLetras[0]='a';
	arrayLetras[1]='d';
	arrayLetras[2]='g';
	arrayLetras[3]='j';
	arrayLetras[4]='m';
	arrayLetras[5]='p';
	arrayLetras[6]='s';
	arrayLetras[7]='w';
	
	/*esconde todas las capas menos la primera*/
	for(i=1;i<arrayLetras.length;i++){
		docId(arrayLetras[i]).className="novisible";
	}

	nodoTerminos=docId('lista_enlaces');

	noliAux=nodoTerminos.getElementsByTagName('li');
	noliAux[0].className='selected';
			
	var longNodo=noliAux.length;
			
	for (jj=0;jj<longNodo;jj++){ //jj en vez de j porque IE se lia con las letras del array y da error. 
		nodeLi= noliAux[jj];
		nodeLi.onclick=function(){
			for(k=0; k<this.childNodes.length; k++){ 
				childNod=this.childNodes[k];
				if(childNod.nodeName=='A'){
					anchorT=childNod.hash.substring(1,childNod.hash.length);
		
					for(l=0;l<arrayLetras.length;l++){
						capaAux2=docId(arrayLetras[l]);
						if(arrayLetras[l]!=anchorT){
							capaAux2.className="novisible";
						}else{
							capaAux2.className="visible";
						}
					}
				}
						
				for(mm=0;mm<noliAux.length;mm++){
					if(arrayLetras[mm]!=anchorT){
						noliAux[mm].className="";
					}else{
						noliAux[mm].className="selected";
					}
				}
			} return false;
		}
	}
}


/*Traslado de un dominio desde la página de tipos de dominio*/
function moveDomain() {
	var oDomain = docId("input_domain");
	var msgError = 	docId("domain_error");
	var re_domain = new RegExp("^(http://)?(www\.)?([^_\-][a-z_0-9\-\á\é\í\ó\ú\ü\ñ\ç]+)(\.[a-z]{2,4})?(\.[a-z]{2,5})$","i");	// .museum es de 5
	
	//Oculto las capas de errores y resultados de anteriores busquedas
	msgError.innerHTML ='';
	docId("show_traslado2").style.display="none";
	oDomain.style.background="#FFFFFF";

	if ( oDomain.value == null || oDomain.value == '' ) {
		msgError.innerHTML = 'Introduzca un dominio<br />';
		oDomain.style.border="1px solid #F8F9FA";
		oDomain.style.background="#FFD7D7";
	} else if (! oDomain.value.match(re_domain)) {
		msgError.innerHTML = 'Dominio incorrecto. Introduzca un dominio válido<br />';
		oDomain.style.border="1px solid #F8F9FA";
		oDomain.style.background="#FFD7D7";
	}
	// Todo Ok: cambiamos las "vistas" y asignamos el valor de dominio al formulario fhosting
	else{
		// Es un dominio 'válido', comprobamos ahora que sea uno de los admitidos por el buscador:
		// .com .org .net .info .biz .ws .eu .es .com.es .nom.es .org.es .cat
		var re_match =  re_domain.exec(oDomain.value);
		var extension = '';
		re_match[4] == "" || re_match[4] == null || re_match[4] == "undefined"? extension = re_match[5]: extension = re_match[4]+re_match[5];

		// Estas extensiones las admite el buscador...
		if(extension.match(/^(\.com|\.org|\.net|\.info|\.biz|\.ws|\.eu|\.es|\.com\.es|\.nom\.es|\.org\.es|\.mobi|\.cat|\.be)$/)) {
			docId("hExtension").value=extension;
			docId("hDominio").value=re_match[3];

			docId("fSearcher").submit();
		}
		// Extensiones territoriales que son válidas. Sólo controlamos la última extensión, así que si hay un .kaka.am también la admitimos
		else if(re_match[5].match(/^(\.name|\.pro|\.coop|\.museum|\.aero|\.edu|\.ac|\.ad|\.ae|\.af|\.ag|\.ai|\.al|\.am|\.an|\.ao|\.aq|\.ar|\.as|\.at|\.au|\.aw|\.az|\.ba|\.bb|\.bd|\.be|\.bf|\.bg|\.bh|\.bi|\.bj|\.bm|\.bn|\.bo|\.br|\.bs|\.bt|\.bv|\.bw|\.by|\.bz|\.ca|\.cc|\.cd|\.cf|\.cg|\.ch|\.ci|\.ck|\.cl|\.cm|\.cn|\.co|\.cr|\.cu|\.cv|\.cx|\.cy|\.cz|\.de|\.dj|\.dk|\.dm|\.do|\.dz|\.ec|\.ee|\.eg|\.eh|\.er|\.et|\.fi|\.fj|\.fk|\.fm|\.fo|\.fr|\.ga|\.gd|\.ge|\.gf|\.gg|\.gh|\.gi|\.gl|\.gm|\.gn|\.gp|\.gq|\.gr|\.gs|\.gt|\.gu|\.gw|\.gy|\.hk|\.hm|\.hn|\.hr|\.ht|\.hu|\.id|\.ie|\.il|\.im|\.in|\.io|\.iq|\.ir|\.is|\.it|\.je|\.jm|\.jo|\.jp|\.ke|\.kg|\.kh|\.ki|\.km|\.kn|\.kp|\.kr|\.kw|\.ky|\.kz|\.la|\.lb|\.lc|\.li|\.lk|\.lr|\.ls|\.lt|\.lu|\.lv|\.ly|\.ma|\.mc|\.md|\.mg|\.mh|\.mk|\.ml|\.mm|\.mn|\.mo|\.mp|\.mq|\.mr|\.ms|\.mt|\.mu|\.mv|\.mw|\.mx|\.my|\.mz|\.na|\.nc|\.ne|\.nf|\.ng|\.ni|\.nl|\.no|\.np|\.nr|\.nu|\.nz|\.om|\.pa|\.pe|\.pf|\.pg|\.ph|\.pk|\.pl|\.pm|\.pn|\.pr|\.pt|\.pw|\.py|\.qa|\.re|\.ro|\.ru|\.rw|\.sa|\.sb|\.sc|\.sd|\.se|\.sg|\.sh|\.si|\.sj|\.sk|\.sl|\.sm|\.sn|\.so|\.sr|\.st|\.sv|\.sy|\.sz|\.tc|\.td|\.tf|\.tg|\.th|\.tj|\.tk|\.tm|\.tn|\.to|\.tp|\.tr|\.tt|\.tv|\.tw|\.tz|\.ua|\.ug|\.uk|\.um|\.us|\.uy|\.uz|\.va|\.vc|\.ve|\.vg|\.vi|\.vn|\.vu|\.wf|\.ye|\.yt|\.yu|\.za|\.zm|\.zr|\.zw)$/)) {
			//docId("show_traslado1").style.display="none";
			docId("show_traslado2").style.display="block";
			docId("domain2").value=oDomain.value;
			docId("dominio2").innerHTML=oDomain.value;
		}
		else {
			msgError.innerHTML = 'Extensi&oacute;n no v&aacute;lida.<br />';
			oDomain.style.border="1px solid #F8F9FA";
			oDomain.style.background="#FFD7D7";
		}
	}

	// Simpre return 'false', porque no hacemos nunca el submit... solo es una trampa para recoger los valores
	return false;
}
/*Traslado de un dominio desde la página de traslado*/
function moveDomainTraslado() {
	var oDomain = docId("input_domain");
	var msgError = 	docId("domain_error");
	var re_domain = new RegExp("^(http://)?(www\.)?([^_\-][a-z_0-9\-\á\é\í\ó\ú\ü\ñ\ç]+)(\.[a-z]{2,4})?(\.[a-z]{2,5})$","i");	// .museum es de 5

	if ( oDomain.value == null || oDomain.value == '' ) {
		msgError.innerHTML = 'Introduzca un dominio<br />';
		oDomain.style.border="1px solid #F8F9FA";
		oDomain.style.background="#FFD7D7";
	} else if (! oDomain.value.match(re_domain)) {
		msgError.innerHTML = 'Dominio incorrecto. Introduzca un dominio válido<br />';
		oDomain.style.border="1px solid #F8F9FA";
		oDomain.style.background="#FFD7D7";
	}
	// Todo Ok: cambiamos las "vistas" y asignamos el valor de dominio al formulario fhosting
	else {
		// Es un dominio 'válido', comprobamos ahora que sea uno de los admitidos por el buscador:
		// .com .org .net .info .biz .ws .eu .es .com.es .nom.es .org.es cat
		var re_match =  re_domain.exec(oDomain.value);
		var extension = '';
		re_match[4] == "" || re_match[4] == null || re_match[4] == "undefined"? extension = re_match[5]: extension = re_match[4]+re_match[5];

		// Estas extensiones las admite el buscador...
		if(extension.match(/^(\.com|\.org|\.mobi|\.net|\.info|\.biz|\.ws|\.eu|\.es|\.com\.es|\.nom\.es|\.org\.es|\.cat|\.be|\.tv|\.cc|\.tel)$/)) {
			docId("hExtension").value=extension;
			docId("hDominio").value=re_match[3];

			docId("fSearcher").submit();
		}
		// Extensiones territoriales que son válidas. Sólo controlamos la última extensión, así que si hay un .kaka.am también la admitimos
		else if(re_match[5].match(/^(\.name|\.pro|\.coop|\.museum|\.aero|\.edu|\.ac|\.ad|\.ae|\.af|\.ag|\.ai|\.al|\.am|\.an|\.ao|\.aq|\.ar|\.as|\.at|\.au|\.aw|\.az|\.ba|\.bb|\.bd|\.be|\.bf|\.bg|\.bh|\.bi|\.bj|\.bm|\.bn|\.bo|\.br|\.bs|\.bt|\.bv|\.bw|\.by|\.bz|\.ca|\.cd|\.cf|\.cg|\.ch|\.ci|\.ck|\.cl|\.cm|\.cn|\.co|\.cr|\.cu|\.cv|\.cx|\.cy|\.cz|\.de|\.dj|\.dk|\.dm|\.do|\.dz|\.ec|\.ee|\.eg|\.eh|\.er|\.et|\.fi|\.fj|\.fk|\.fm|\.fo|\.fr|\.ga|\.gd|\.ge|\.gf|\.gg|\.gh|\.gi|\.gl|\.gm|\.gn|\.gp|\.gq|\.gr|\.gs|\.gt|\.gu|\.gw|\.gy|\.hk|\.hm|\.hn|\.hr|\.ht|\.hu|\.id|\.ie|\.il|\.im|\.in|\.io|\.iq|\.ir|\.is|\.it|\.je|\.jm|\.jo|\.jp|\.ke|\.kg|\.kh|\.ki|\.km|\.kn|\.kp|\.kr|\.kw|\.ky|\.kz|\.la|\.lb|\.lc|\.li|\.lk|\.lr|\.ls|\.lt|\.lu|\.lv|\.ly|\.ma|\.mc|\.md|\.mg|\.mh|\.mk|\.ml|\.mm|\.mn|\.mo|\.mp|\.mq|\.mr|\.ms|\.mt|\.mu|\.mv|\.mw|\.mx|\.my|\.mz|\.na|\.nc|\.ne|\.nf|\.ng|\.ni|\.nl|\.no|\.np|\.nr|\.nu|\.nz|\.om|\.pa|\.pe|\.pf|\.pg|\.ph|\.pk|\.pl|\.pm|\.pn|\.pr|\.pt|\.pw|\.py|\.qa|\.re|\.ro|\.ru|\.rw|\.sa|\.sb|\.sc|\.sd|\.se|\.sg|\.sh|\.si|\.sj|\.sk|\.sl|\.sm|\.sn|\.so|\.sr|\.st|\.sv|\.sy|\.sz|\.tc|\.td|\.tf|\.tg|\.th|\.tj|\.tk|\.tm|\.tn|\.to|\.tp|\.tr|\.tt|\.tw|\.tz|\.ua|\.ug|\.uk|\.um|\.us|\.uy|\.uz|\.va|\.vc|\.ve|\.vg|\.vi|\.vn|\.vu|\.wf|\.ye|\.yt|\.yu|\.za|\.zm|\.zr|\.zw)$/)) {
			docId("show_traslado1").style.display="none";
			docId("show_traslado2").style.display="block";
			docId("domain2").value=oDomain.value;
			docId("dominio2").innerHTML=oDomain.value;
		}
		else {
			msgError.innerHTML = 'Extensi&oacute;n no v&aacute;lida.<br />';
			oDomain.style.border="1px solid #F8F9FA";
			oDomain.style.background="#FFD7D7";
		}
	}

	// Siempre return 'false', porque no hacemos nunca el submit... solo es una trampa para recoger los valores
	return false;
}


//Función para poner estilo a las imágenes (google, sala de prensa)
imgStyle=function(){
	arrayDivs=document.getElementsByTagName('div');
	for(i=0;i<arrayDivs.length;i++){
		if(arrayDivs[i].className=='imgborder'){
			divEvento=arrayDivs[i];
			arrayImgs=divEvento.getElementsByTagName('img');
			imgEvento=arrayImgs[0]; /*presuponemos que hay varias imagenes dentro de evento y coge la 1. Si se da el caso de que no hay imagenes se puede poner un if de comprobacion previa*/
			widthImg=imgEvento.width;
			divEvento.style.width=(widthImg)+'px';
		}
	}
}

// Abre y cierra proteccion de datos
function protPol(){
	if(docId('politica_uso_text')){
		dataLayer=docId('politica_uso_text');
		if(dataLayer.className=='novisible') dataLayer.className='';
		else dataLayer.className='novisible';
	}
	return false;
}

 function docId(id){
  	return document.getElementById(id);
 }
		

//se salta el frame de arsys.cat
cambiaEnlacesCatStart= function(){
	nodoRegCat=docId('reg_cat');
	nodoEnlaces=nodoRegCat.getElementsByTagName('A');
	for(i=0;i<nodoEnlaces.length;i++){
		hrefEnlace=nodoEnlaces[i].href;
		longEnlace=hrefEnlace.length;
		extension=hrefEnlace.substring(longEnlace-3,longEnlace);
		if(extension=='pdf'){
			nodoEnlaces[i].target='_blank';
		}else{
			nodoEnlaces[i].target='_parent';
		}
	}
}  

//antiguo validaciones.js
var nav4 = window.Event ? true : false;

// Permite introducir sólo números en un input.
// Uso: onKeyPress="return acceptNum(event)"
function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
}

//Retorna el valor del la opcion seleccionada en el radiogroup que recibe
function getRadioButtonValue(ctrl)
{
    for(i=0;i<ctrl.length;i++)
        if(ctrl[i].checked) return ctrl[i].value;
}

//presupuestador de housing
 conFireware=new Array();
 sinFireware=new Array();
 conFireware[0]='Transferencia 100 GB/mes (30&euro;/mes)';
 conFireware[1]='Transferencia 500 GB/mes (90&euro;/mes)';
 conFireware[2]='Caudal 1Mbps (acum) (30&euro;/mes/Mbps)';
 sinFireware[0]='Transferencia 100 GB/mes (25&euro;/mes)';
 sinFireware[1]='Transferencia 500 GB/mes (75&euro;/mes)';
 sinFireware[2]='Caudal 1Mbps (acum) (25&euro;/mes/Mbps)';
 
 function changeForCon(){ //tratar de usar changeSelect de Dedicadios?
  firewall=docId('firewall').checked;
  
  
  nodeSelect=docId('conectividad');
  nodeOptions=nodeSelect.getElementsByTagName('option');
  
  optionSelect=nodeSelect.selectedIndex;
  
  if(firewall){arrayAsociado=conFireware}
  else{arrayAsociado=sinFireware}
  
  for(i=0;i<=nodeOptions.length;i++){ 
   i=0;
   if(nodeOptions[i]){
    nodeSelect.removeChild(nodeOptions[i]);
   }
  } 
  
  for(i=0;i<3;i++){
   newOption=document.createElement('option');
   newOption.setAttribute('value', i);
   newOption.innerHTML=arrayAsociado[i]; //posibilidad de no uso de innerHTML?
   nodeSelect.appendChild(newOption);
  }
  
  nodeSelect.selectedIndex=optionSelect;
 }
 
function writerHosting() {
    selecCon=docId('conectividad').selectedIndex;
 
    
    firewallSel=docId('firewall').checked;
    
    if(firewallSel){
    txtCon=conFireware[selecCon];
	txtFW='con servicio de Firewall (30 euros/mes).';
    }else{
	txtCon=sinFireware[selecCon];
    txtFW='sin servicio de Firewall.';
    }
	txtCon=txtCon.replace(new RegExp('€','g'),' euros');
    txtFW=txtFW.replace(new RegExp('€','g'),' euros');
	
     document.form1.msg.value = "Deseo información sobre la contratación del servicio de Housing con las siguientes características: \n\n Alojamiento: " + document.form1.alojamiento.value + "\n\n Fórmula de conectividad: " + txtCon +' '+txtFW;
}

/* ************************************************************* */
function addEvent(obj, evType, fn){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
  } else if (obj.attachEvent){
  	var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
  	return false;
  }
}
/* *****************************************************************
	videoViewer

	Para navegadores != de IE usamos el fichero videoplayer.asp para
	ver el vídeo en pop-up
*/
function videoPopUp() {
	// Solo para navegadores != de IE usamos el target="_blank" en los enlaces a ASX
	if(navigator.appName != 'Microsoft Internet Explorer' && navigator.appName != 'Opera') {
		var sVideoPlayer = "/apps/videoplayer.asp";
		var aA = document.getElementsByTagName('a');
		for (var i=0; i<aA.length; ++i) {
			if (aA[i].href.indexOf('.wmv') != -1) {
				aA[i].onclick = function(){
					void(window.open(sVideoPlayer+ "?v="+this.href, 'video','toolbar=0, location=0, directories=0, resizable=1, scrollbars=0, height=280, width=320,'));
					return false;
				}
			}
		}
	}
}

// Añadimos el evento de inicialización
addEvent(window, "load", videoPopUp);
addEvent(window, "load", initPromo);

function buttonDestBig(){
	buttonDest=$('.but_dest_big');
	spanAux=$('<span />');
	buttonDest.prepend(spanAux);
}

/* *****************************************************************
	popUp

	Abrir en nueva ventana de forma accesible.
	La llamada sería:
		<a href="../js/enlacePopUp.htm" target="popup-window" onclick="popUp(this,'height=200,width=400')">Lala</a>
*/
function popUp(oLink, sPropiedades){
	if(oLink.target==null || oLink.target==undefined || oLink.target=="") {
		oLink.target="_blank";
	}
	window.open(oLink.href,oLink.target,sPropiedades);
	return false;
}

function isNumber(num){
	num=parseInt(num);
	if(isNaN(num)){
		return false;
	}else{
		return true;
	}
}

addEvent(window, "load", checkCarrito);

function checkCarrito(){
	if(docId('num_prod_cart')){
		if(num_products>0){
			docId('text_cart').innerHTML='Carrito';
			docId('link_cart').href='https://shop.arsys.es/shopping-cart.php';
			docId('link_cart').title='Carrito';
			docId('num_prod_cart').innerHTML="("+num_products+")";
		}
	}
}

txtBannerVpsMaquina='<h1>Servidores Virtuales</h1><p>Flexibilidad, rendimiento y control. Administre su <strong>Servidor Virtual (VPS)</strong> desde sólo 29 €/mes.</p><p><a title="Servidor Virtual (VPS)" href="http://www.arsys.es/apps/afiliados/go1.asp?IDM=2&IDC=190&BANM=705&redir=http://www.arsys.es/servidores-virtuales/index.htm">Servidores Virtuales (VPS)</a></p>'
txtBannerVpsHumano='<h1>Yo tengo el control</h1><p>Yo instalo, yo ejecuto, yo decido.<br />Una solución <strong>flexible y eficiente</strong>, capaz de crecer con mi proyecto.</p><p><a title="Servidor Privado Virtual" href="http://www.arsys.es/apps/afiliados/go1.asp?IDM=2&IDC=190&BANM=706&redir=http://www.arsys.es/servidores-virtuales/index.htm">Servidores Virtuales (VPS) desde <strong>29 €/mes</strong></a></p>';

bannerVpsMaquina=new bannerIndex(txtBannerVpsMaquina,'http://www.arsys.es/apps/afiliados/go1.asp?IDM=2&IDC=190&BANM=705&redir=http://www.arsys.es/servidores-virtuales/index.htm ','dest-vps-home.jpg','Servidor Privado Virtual (VPS) . Un hosting flexible y eficiente.' ,4);
bannerVpsHumano=new bannerIndex(txtBannerVpsHumano,'http://www.arsys.es/apps/afiliados/go1.asp?IDM=2&IDC=190&BANM=706&redir=http://www.arsys.es/servidores-virtuales/index.htm ','servidores-virtuales-h.jpg','Servidor Privado Virtual (VPS) . Un alojamiento web flexible y eficiente.', 1);

bannersRot=new Array(bannerVpsMaquina, bannerVpsHumano);


function bannerIndex(txt,url,img,imgAlt,weight){ //objeto banner
    this.txt=txt;
    this.url=url;
    this.img=img;
    this.imgAlt=imgAlt;
    this.weight=weight;
}

function selectBannerPromo(){
    
    weights=new Array();
 
    for(i=0;i<bannersRot.length;i++){
        weights.push(bannersRot[i].weight);
    }
	
    numBanner=randomize(weights);
    
    docId('img_promo').innerHTML=''; /*borro*/
    imgBan=document.createElement('img');
    imgBan.src='/img/'+bannersRot[numBanner].img;
    imgBan.alt=bannersRot[numBanner].imgAlt;
    docId('img_promo').appendChild(imgBan);
    docId('texto_promo').innerHTML=bannersRot[numBanner].txt;
    docId('promo_index').setAttribute('numBanner',numBanner);
    docId('promo_index').onclick=function(){
        window.location=bannersRot[this.getAttribute('numBanner')].url;
    }
    
    docId('img_promo').style.display='block';
    docId('texto_promo').style.display='block';
}

/*Funcion para cambiar destacado en las index de seccion*/
var ElemMenuSelected=1;
var ElemMenuSelectedAnt=1;
function changePromo(elemMenu, promo){

if(ElemMenuSelectedAnt!=promo){

	docId("promo_menu_li_"+ElemMenuSelected).className="";
	ElemMenuSelected=promo;
	elemMenu.parentNode.className='selected';
	
	
	$('#promo_index_seccion_'+ElemMenuSelected).css('display', 'block');
	
	$('#promo_index_seccion_'+ElemMenuSelected).css('z-index', 2);
	$('#promo_index_seccion_'+ElemMenuSelectedAnt).css('z-index', 1);
	
	$('#promo_index_seccion_'+ElemMenuSelected).animate({ opacity: 1}, 1000);
	$('#promo_index_seccion_'+ElemMenuSelectedAnt).animate({ opacity: 0}, 1000);

	
	ElemMenuSelectedAnt=ElemMenuSelected;
	//$('h1').animate({ opacity: 0.4}, 4000 ).animate({ opacity: 1}, 4000 );

}

}
function initPromo(){
	$('#promo_index_seccion_2').animate({ opacity: 0}, 0);
	$('#promo_index_seccion_3').animate({ opacity: 0}, 0);
	$('#promo_index_seccion_4').animate({ opacity: 0}, 0);
	
}

/*
function extLinks() {
  var aA = document.getElementsByTagName('a');
  for (var i=0;i<aA.length;++i) {
	// Enlaces externos != de mails
	// ** Falta por considerar el caso de <a name="xxx"></a> sin href
    if (
		((aA[i].className != 'externo') && (aA[i].getAttribute('href') != '') && (aA[i].href.indexOf(document.location.host) === -1) && (aA[i].href.indexOf('mailto') === -1))
		&&
		(aA[i].hasChildNodes() && aA[i].firstChild.nodeName == '#text')
		)
		{
      aA[i].className += 'ext';
      aA[i].target = '_blank';
    }
  }  
}

addEvent(window, "load", extLinks);
*/