// JavaScript Document
var tipoclima=-1;
var nroImgLoaderClima=1;

function changeTitulo(imgSrc) {
	imagen = document.getElementById("producto_titulo");
	imagen.src = imgSrc;
}

function crearImagenes(imgArray, x) {
	var objArray = new Array();
	var srcName = '';
	for(var v in imgArray) {
		obj = objArray[v];
		obj = new Image();
		srcName = imgArray[v];
		obj.src = srcName;
		if(x==1) obj.onload = show_something("prod" + v); // Esto por el momento esta deshabitlitado
		//alert(v + " ---- " + imgArray[v]);
	}
}

function switchImg(assArray) {
	
	assArray.sort(function() {return 0.5 - Math.random()}) //Array elements now scrambled
	changeImg(assArray,0);
}

var t; var tt;

function changeImg(assArray, x) {
//	alert(idProdSel+"<---idProdSel----");
	if (idProdSel==0){
		if(x >= assArray.length) { x=0; }
		var tvalue = assArray[x];
		t = setTimeout("cambImg('"+tvalue+"',"+x+")",10000);
//		tt = setTimeout("cambImg2('"+tvalue+"',"+x+")",10000);
	}
}
//document.getElementById('test'), 'buttons/udm4-whitebutton88x31.gif', '2', 'Accessible Website Menu [white]')

function setBannerInfAddress(idprod){
	var element2 = document.getElementById("linkcuadritoprod_"+idprod);
	if (element2!=null){
		var element = document.getElementById("linkbannerinf");
		if(element) {
			element.href=element2.href;
		}
	}
}

function setTituloSelected(){
	cont=0;
	while (cont<imgArray.length){
		if (imgArray[cont][0]==idProdSelec){
			changeTitulo(imgArray[cont][2]);
			cont=imgArray.length+1;
		}
		cont++;
	}
}

function cambImg(tvalue,x) {
	//alert('el numero de alerts tiene q ser el mismo q array length');
	element = document.getElementById('visor_productos');
	//element.src = '_imagenes/productos/' + tvalue + '.png';
	tsrc = tvalue;
	element.src = tsrc;
	cont=0;
	while (cont<imgArray.length){
		if (imgArray[cont][1]==tvalue){
//			alert("FOUND !!!--->"+imgArray[cont][0]+"<----");
			idProdVisor=imgArray[cont][0];
			tvalue=imgArray[cont][2];
			cont=imgArray.length+1;
		}
		cont++;
	}
	setBannerInfAddress(idProdVisor);
	cambImg2(tvalue,x);
	//crossfade(element,tsrc,'1','');
	changeImg(assArray, x+1);
}

function restoreTitle(){
	nameImgTitle="";
//	alert(idProdSel+"<---idProdSel---");
	if (idProdSel!=0){
		cont=0;
		while (cont<imgArray.length){
			if (imgArray[cont][0]==idProdSel){
				nameImgTitle=imgArray[cont][1];
				cont=imgArray.length+1;
			}
			cont++;
		}
	}
//	alert(nameImgTitle+"<---nameImgTitle---");
	if (nameImgTitle!=""){
		cambImg2(nameImgTitle,0);
	}
}

function isVisibleBannerInf(){
	var elementBann = document.getElementById('banner');
	if (elementBann){
		if (elementBann.style.display!='none'){
			return true;
		}else{
			return false;
		}
	}
}

function cambImg2(tvalue,x) {
	if (isVisibleBannerInf()){
		element = document.getElementById('producto_titulo');
		//element.src = '_imagenes/productos/' + tvalue + '.png';
		tsrc = tvalue;
		if (element){
			element.src = tsrc;
		}
		//crossfade(element,tsrc,'1','');
		//changeImg(assArray, x+1);
	}
}

function stopSwapping() {
	clearTimeout(t);
	clearTimeout(tt);
}

function addEventHandler(oNode,sEvt,fFunc, bCaptures) {
	if(typeof(window.event) != "undefined")
		oNode.attachEvent("on"+sEvt, fFunc);
	else
		oNode.addEventListener(sEvt,fFunc,bCaptures);
}

function eventHandler(e) {
	var evt = e || window.event;
	// ...
}

var contador_imagen = 0;
/*
function loadImg() {
	if(contador_imagen==imgArray.length) return;
	var frame = document.getElementById('frame');
	//frame.onload = loadImg();
	frame.src = "_imagenes/productos/" + imgArray[contador_imagen][1];
	var cuadrito = document.getElementById('prod'+imgArray[contador_imagen][0]);
	//alert(cuadrito+"----lksdkl");
	cuadrito.style.display = "block";
	contador_imagen++;
}
*/

function startLoadImg(){
	if(contador_imagen==imgArray.length){
	//	return;
	}else{
		loadImg(imgArray[contador_imagen][1]);
	}
	setInterval("checkAnchor()", 300);
}

function loadProduct(idprodLP, seccion){
//	alert("--->"+idprodLP+"<---->"+seccion+"<----");
	idProdSelec=idprodLP;
	clear_colores(cuadritoArray, 'inner'+idprodLP);
//	get_ajax('asociados.php','asociados',idprodLP);
	hide_something('banner');
	show_something('asociados');
	get_ajax('productos.php','content',idprodLP,'',seccion, '', 'loading');
//	loadDatainFrame('ajax_productos.php?param='+idprodLP+parametros,1);
	enableAllBotons();
	setTituloSelected();
	scroll(0,0);
}

function loadNosotros(idNos,seccion){
	change_boton(botonNosotrosArray, idNos, 'nos');
   get_ajax('nosotros.php','content',seccion);
}

var currentAnchor = "";
//Function which chek if there are anchor changes, if there are, sends the ajax petition
function checkAnchor(){
	//Check if it has changes
	if(currentAnchor != document.location.hash){
		currentAnchor = document.location.hash;
//		alert("--->"+currentAnchor+"<--currentAnchor---");
		//if there is not anchor, the loads the default section
		if(!currentAnchor || currentAnchor==""){
			document.location=document.location;
			//query = "section=home";
		}else{
			//Creates the  string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2
			var splits = currentAnchor.substring(1).split('-');
			//Get the section
			var tipolink = splits[0];
			switch(tipolink.substring(0,1)){
				case "p": seccion="";
							 if (splits.length>1){
								 seccion=splits[1];
							 }
							 if (seccion==""){
							 	 seccion="caracteristicas";
							 }
							 loadProduct(tipolink.substring(1),seccion);
							 break;
				case "n":
							 if (splits.length>1){
								 seccion=splits[1];
							 }
							 if (seccion==""){
							 	 seccion="nuestra_mision";
							 }
							 loadNosotros(tipolink.substring(1),seccion);
							 break;
			}
		}
	}
}

function checkUseBotoneraBlanca(){
//	alert(tipoclima+"<---tipoclima------checkUseBotoneraBlanca-----");
	switch(tipoclima){
		case "diatormelect":	return true;
									break;
		case "diatormelect":	return true;
									break;
		case "nochelluvint":	return true;
									break;
		case "nochelluvint":	return true;
									break;
		case "dialluviint":	return false;
									break;
		case "nochelluvmod":	return true;
									break;
		case "dialluvmod":	return false;
									break;
		case "nocheaguanieve":	return false;
									break;
		case "tardeaguanieve":	return false;
									break;
		case "tardenieve":	return false;
									break;
		case "diaaguanieve":	return false;
									break;
		case "nochenieve":	return false;
									break;
		case "dianieve":	return false;
									break;
		case "nochenublado":	return true;
									break;
		case "dianublado":	return true;
									break;
		case "nochenubladosol":	return true;
									break;
		case "dianubladosol":	return true;
									break;
		case "nochedespejado":	return true;
									break;
		case "diadespejado":	return true;
									break;
		default:	return "sindata";
									break;
	}
}

function setBotoneraLluvia(){
	var elementDivClod = document.getElementById('divcontBotAC');
	if (elementDivClod){
		if (!userLoginUp){
			elementDivClod.innerHTML='<a id="botACActivate" href="javascript: void(0);" onFocus="this.blur();" onMouseOut="verSwap();" onMouseOver="mouseOverBotAc();" ><img src="img/areacliente-lluvia.png" name="Image1234asdfq" id="Image1234asdfq" title="Haga click aqu&iacute; para ingresar al &Aacute;rea de Clientes." /></a>';
		}else{
			elementDivClod.innerHTML='<a id="botACActivate" href="javascript: void(0);" onFocus="this.blur();" onMouseOut="verSwap();" onMouseOver="mouseOverBotAc();" ><img src="img/areacliente-lluvia-on.png" name="Image1234asdfq" id="Image1234asdfq" title="Haga click aqu&iacute; para ingresar al &Aacute;rea de Clientes." /></a>';
		}
		initSlideAC();
	}
}

function setBotoneraStd(){
	var elementDivClod = document.getElementById('divcontBotAC');
	if (elementDivClod){
		if (!userLoginUp){
			elementDivClod.innerHTML='<a id="botACActivate" href="javascript: void(0);" onFocus="this.blur();" onMouseOut="verSwap();" onMouseOver="mouseOverBotAc();" ><img src="img/areacliente.png" name="Image1234asdfq" id="Image1234asdfq" title="Haga click aqu&iacute; para ingresar al &Aacute;rea de Clientes." /></a>';
		}else{
			elementDivClod.innerHTML='<a id="botACActivate" href="javascript: void(0);" onFocus="this.blur();" onMouseOut="verSwap();" onMouseOver="mouseOverBotAc();" ><img src="img/areacliente-on.png" name="Image1234asdfq" id="Image1234asdfq" title="Haga click aqu&iacute; para ingresar al &Aacute;rea de Clientes." /></a>';
		}
		initSlideAC();
	}
}

function rotarImgLoaderClima(){
	nroImgLoaderClima++;
	if (nroImgLoaderClima>9){
		nroImgLoaderClima=1;
	}
//	alert(nroImgLoaderClima+"<---nroImgLoaderClima----");
	var elementDivClod = document.getElementById('divloadingclima');
	if (elementDivClod){
		if (elementDivClod.style.display!='none'){
			switch(nroImgLoaderClima){
				case 1:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-desp-dia.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 2:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-desp-noche.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 3:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-lluvia-dia.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 4:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-lluvia-noche.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 5:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-nieve.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 6:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-nublado-dia.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 7:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-nublado-noche.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 8:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-torm-elec-dia.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				case 9:
							var elementDivFnd = document.getElementById('imgchgcliamloader');
							if (elementDivFnd){
								elementDivFnd.src="img/clima-torm-elec-noche.png";
								rtimg=setTimeout('rotarImgLoaderClima();',100);
							}
							break;
				default:
							break;
			}
		}
	}
}

function cambiarFndClima(idioma) {
	rotarImgLoaderClima();

	var xmlaiclima=null;
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlaiclima=new XMLHttpRequest();
	}else{
		// code for IE6, IE5
		xmlaiclima=new ActiveXObject("Microsoft.XMLHTTP");
	}
/*
"diatormelect"=1
"dialluviint"=2
"dialluvmod"=3
"diaaguanieve"=4
"dianieve"=5
"dianublado"=6
"dianubladosol"=7
"diadespejado"=8
*/
	xmlaiclima.onreadystatechange=function(){
		if (xmlaiclima.readyState==4 && xmlaiclima.status==200){
//			alert("--->"+xmlaiclima.responseText+"<---");
			var elementDivClod = document.getElementById('divloadingclima');
			if (elementDivClod){
				elementDivClod.style.display='none';
			}
			switch(xmlaiclima.responseText){
				case "diatormelect":
									tipoclima="diatormelect";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-tormenta-elect.jpg')";
										elementDivFnd.style.backgroundColor ="#4d6c7f";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "dialluviint":
									tipoclima="dialluviint";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-lluvia-int.jpg')";
										elementDivFnd.style.backgroundColor ="#929191";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-100-b.png";
									}
									setBotoneraLluvia();
									break;
				case "dialluvmod":
									tipoclima="dialluvmod";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-lluvia-mod.jpg')";
										elementDivFnd.style.backgroundColor ="#9ca1a7";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-100-b.png";
									}
									setBotoneraLluvia();
									break;
				case "diaaguanieve":
									tipoclima="diaaguanieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#979ba3";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "dianieve":
									tipoclima="dianieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#979ba3";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "dianublado":
									tipoclima="dianublado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-nublado.jpg')";
										elementDivFnd.style.backgroundColor ="#848d94";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraStd();
									break;
				case "dianubladosol":
									tipoclima="dianubladosol";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-nublado-sol.jpg')";
										elementDivFnd.style.backgroundColor ="#3a87dd";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraStd();
									break;
				case "diadespejado":
									tipoclima="diadespejado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-dia-despejado.jpg')";
										elementDivFnd.style.backgroundColor ="#6aaad6";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-50-n.png";
									}
									setBotoneraStd();
									//setBotoneraLluvia();
									break;
				case "nochetormelect":
									tipoclima="nochetormelect";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-tormenta-elect.jpg')";
										elementDivFnd.style.backgroundColor ="#1b1b1b";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "nochelluvint":
									tipoclima="nochelluvint";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-lluvia-int.jpg')";
										elementDivFnd.style.backgroundColor ="#1c1c1c";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-b.png";
									}
									setBotoneraStd();
									break;
				case "nochelluvmod":
									tipoclima="nochelluvmod";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-lluvia-mod.jpg')";
										elementDivFnd.style.backgroundColor ="#0e0c0c";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-25-n.png";
									}
									setBotoneraStd();
									break;
				case "nocheaguanieve":
									tipoclima="nocheaguanieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#292929";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "nochenieve":
									tipoclima="nochenieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#292929";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "nochenublado":
									tipoclima="nochenublado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-nublado.jpg')";
										elementDivFnd.style.backgroundColor ="#0d0d0d";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "nochenubladosol":
									tipoclima="nochenubladosol";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-nublado-luna.jpg')";
										elementDivFnd.style.backgroundColor ="#0e0e0e";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-25-n.png";
									}
									setBotoneraStd();
									break;
				case "nochedespejado":
									tipoclima="nochedespejado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-noche-despejado.jpg')";
										elementDivFnd.style.backgroundColor ="#0c182e";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-100-n.png";
									}
									setBotoneraStd();
									break;
				case "tardetormelect":
									tipoclima="tardetormelect";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-tormenta-elect.jpg')";
										elementDivFnd.style.backgroundColor ="#4d6c7f";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "tardelluvint":
									tipoclima="tardelluvint";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-lluvia-int.jpg')";
										elementDivFnd.style.backgroundColor ="#929191";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "tardelluvmod":
									tipoclima="tardelluvmod";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-lluvia-mod.jpg')";
										elementDivFnd.style.backgroundColor ="#9ca1a7";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-b.png";
									}
									setBotoneraStd();
									break;
				case "tardeaguanieve":
									tipoclima="tardeaguanieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#979ba3";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "tardenieve":
									tipoclima="tardenieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#979ba3";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "tardenublado":
									tipoclima="tardenublado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-nublado.jpg')";
										elementDivFnd.style.backgroundColor ="#848d94";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "tardenubladosol":
									tipoclima="tardenubladosol";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-nublado-sol.jpg')";
										elementDivFnd.style.backgroundColor ="#42637d";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-25-n.png";
									}
									setBotoneraStd();
									break;
				case "tardedespejado":
									tipoclima="tardedespejado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-tarde-despejado.jpg')";
										elementDivFnd.style.backgroundColor ="#458acc";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "atartormelect":
									tipoclima="atartormelect";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-tormenta-elect.jpg')";
										elementDivFnd.style.backgroundColor ="#151d3b";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "atarlluvint":
									tipoclima="atarlluvint";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-lluvia-int.jpg')";
										elementDivFnd.style.backgroundColor ="#39424b";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "atarlluvmod":
									tipoclima="atarlluvmod";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-lluvia-mod.jpg')";
										elementDivFnd.style.backgroundColor ="#0a1b3d";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-b.png";
									}
									setBotoneraStd();
									break;
				case "ataraguanieve":
									tipoclima="ataraguanieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#383d3c";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "atarnieve":
									tipoclima="atarnieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#383d3c";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "atarnublado":
									tipoclima="atarnublado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-nublado.jpg')";
										elementDivFnd.style.backgroundColor ="#1a2730";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "atarnubladosol":
									tipoclima="atarnubladosol";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-nublado-sol.jpg')";
										elementDivFnd.style.backgroundColor ="#1f2025";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-25-n.png";
									}
									setBotoneraStd();
									break;
				case "atardespejado":
									tipoclima="atardespejado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-atardecer-despejado.jpg')";
										elementDivFnd.style.backgroundColor ="#232c3f";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "medtormelect":
									tipoclima="medtormelect";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-tormenta-elect.jpg')";
										elementDivFnd.style.backgroundColor ="#4d6c7f";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "medlluvint":
									tipoclima="medlluvint";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-lluvia-int.jpg')";
										elementDivFnd.style.backgroundColor ="#929191";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "medlluvmod":
									tipoclima="medlluvmod";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-lluvia-mod.jpg')";
										elementDivFnd.style.backgroundColor ="#767d84";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-b.png";
									}
									setBotoneraStd();
									break;
				case "medaguanieve":
									tipoclima="medaguanieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#979ba3";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "mednieve":
									tipoclima="mednieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#979ba3";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "mednublado":
									tipoclima="mednublado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-nublado.jpg')";
										elementDivFnd.style.backgroundColor ="#848d94";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "mednubladosol":
									tipoclima="mednubladosol";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-nublado-sol.jpg')";
										elementDivFnd.style.backgroundColor ="#3d607b";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-25-n.png";
									}
									setBotoneraStd();
									break;
				case "meddespejado":
									tipoclima="meddespejado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-mediodia-despejado.jpg')";
										elementDivFnd.style.backgroundColor ="#569bd2";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "amantormelect":
									tipoclima="amantormelect";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-tormenta-elect.jpg')";
										elementDivFnd.style.backgroundColor ="#221f0e";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "amanlluvint":
									tipoclima="amanlluvint";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-lluvia-int.jpg')";
										elementDivFnd.style.backgroundColor ="#757b7b";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "amanlluvmod":
									tipoclima="amanlluvmod";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-lluvia-mod.jpg')";
										elementDivFnd.style.backgroundColor ="#676c7d";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-b.png";
									}
									setBotoneraStd();
									break;
				case "amanaguanieve":
									tipoclima="amanaguanieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#969796";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "amannieve":
									tipoclima="amannieve";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-nevado.jpg')";
										elementDivFnd.style.backgroundColor ="#969796";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-80-b.png";
									}
									setBotoneraLluvia();
									break;
				case "amannublado":
									tipoclima="amannublado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-nublado.jpg')";
										elementDivFnd.style.backgroundColor ="#6c7474";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
				case "amannubladosol":
									tipoclima="amannubladosol";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-nublado-sol.jpg')";
										elementDivFnd.style.backgroundColor ="#4f504a";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-1-25-n.png";
									}
									setBotoneraStd();
									break;
				case "amandespejado":
									tipoclima="amandespejado";
									var elementDivFnd = document.getElementById('contGeneralBackGround');
									if (elementDivFnd){
										elementDivFnd.style.backgroundImage="url('img/et-amanec-despejado.jpg')";
										elementDivFnd.style.backgroundColor ="#597980";
									}
									var elementDivFnd = document.getElementById('logoaittop');
									if (elementDivFnd){
										elementDivFnd.src="img/"+idioma+"/lg-2-40-n.png";
									}
									setBotoneraStd();
									break;
			}
		}
	}
	var dateVar = new Date();
	strNC = dateVar.getYear().toString() + dateVar.getMonth().toString() + dateVar.getDay().toString() + dateVar.getHours().toString() + dateVar.getMinutes().toString() + dateVar.getSeconds().toString() + aleatorio(1,100).toString();
	xmlaiclima.open("GET","readweather.php?funcion=pt"+strNC,true);
	xmlaiclima.setRequestHeader("Content-type","application/x-www-form-urlencoded");
   xmlaiclima.send("");
}

function loadImg(img_file) {
	var xmlaihob=null;
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlaihob=new XMLHttpRequest();
	}else{
		// code for IE6, IE5
		xmlaihob=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlaihob.onreadystatechange=function(){
		if (xmlaihob.readyState==4 && xmlaihob.status==200){
			var cuadrito = document.getElementById('prod'+imgArray[contador_imagen][0]);
			cuadrito.style.display = "block";
			contador_imagen++;
			if(contador_imagen==imgArray.length){
				// return;
			}else{
				setTimeout('loadImg("'+imgArray[contador_imagen][1]+'");',200);
			}
		}
	}
	xmlaihob.open("GET",img_file,true);
	xmlaihob.setRequestHeader("Content-type","application/x-www-form-urlencoded");
   xmlaihob.send("");
//	if(!param2) xmlhttp.send("param=" + param);
//	else xmlhttp.send("param=" + param + "&param2=" + param2);
}

/***********************************************
* Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

/*
var mygallery2=new fadeSlideShow({
	wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
	dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of largest image
	imagearray: [
		["http://i26.tinypic.com/11l7ls0.jpg", "", "", "Nothing beats relaxing next to the pool when the weather is hot."],
		["http://i29.tinypic.com/xp3hns.jpg", "http://en.wikipedia.org/wiki/Cave", "_new", "Some day I'd like to explore these caves!"],
		["http://i30.tinypic.com/531q3n.jpg"],
		["http://i31.tinypic.com/119w28m.jpg", "", "", "What a beautiful scene with everything changing colors."] //<--no trailing comma after very last image element!
	],
	displaymode: {type:'manual', pause:2500, cycles:0, wraparound:false},
	persist: false, //remember last viewed slide and recall within same session?
	fadeduration: 500, //transition duration (milliseconds)
	descreveal: "always",
	togglerid: "fadeshow2toggler"
})

*/
