//();// JavaScript Document

//Abrir ventana para funciones
function Lanzar(tmp) {
day = new Date();
id = day.getTime();
URL=tmp
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=0,location=1,statusbar=1,menubar=1,resizable=0');");
}
/*sistema de entrada en parte privada*/
function Comprobar()
{
username=document.miform.txtusername.value;
password=document.miform.txtpassword.value;
location.href="./comprobar.asp?t="+ username + "&q=" + password;
}

//Cargar el link de otro menu
function Pagina (idioma,mimenu)
{
window.location.href= "../" + idioma + "/" + mimenu + ".htm"
}

//Cambiar de color el link de un <P>

function CambiarColorIn (clase)
{
var miP = document.getElementById(clase)
miP.style.color = "#ABADAB";
}

function CambiarColorOut (clase)
{
var miP = document.getElementById(clase)
miP.style.color = "#FFFFFF";
}

//Barra de estado con texto
//variable con la posicion en el texto. poner siempre a 0
var pos = 0
//creo una funcion para cambiar el texto de la barra de estado
function textoEstado(idioma){
	//variable con el texto a mostrar
	 var texto
	 var textoidioma
	if (idioma==1)
	 {texto= "Bienvenidos a la página web de Muebles Marqués.  Puede visitarnos en avda Lepanto 40 Benitachell (Alicante)"
	  textoidioma = "textoEstado(1)"
	 }
	else if (idioma ==2)
		 {texto = "Benvinguts a la plana web de Mobles Marqués.  Pot visitar-nos també a la avinguda Lepanto 40 Benitatxell (Alacant)"
	  textoidioma = "textoEstado(2)"	
	  	 }
		else if (idioma == 3)
			 {texto = "Welcome to Muebles Marqués web.  You can visit our showroom in 40 Lepanto Avenue, Benitachell (Alicante)"
			  textoidioma = "textoEstado(3)"
			 }
	//incremento la posicion en 1 y extraigo el texto a mostrar en este momento.
   pos = pos + 1
   textoActual = texto.substring(0,pos)
   //pongo el texto que quiero mostrar en la barra de estado del navegador
   window.status = textoActual
   //Llamamos otra vez a esta funcion para que continue    mostrando texto
   if (pos == texto.length){
      //si hemos llegado al final, vuelvo al principio y hago un retardo superior
      pos = 0
//      setTimeout("textoEstado(idioma)",1500)
      setTimeout(textoidioma,1500)
	  } else{
      //si no hemos llegado al final, sigo con la funcion con un retardo minimo.
//      setTimeout("textoEstado(idioma)",100)
	      setTimeout(textoidioma,100)
   }
}



//Seleccion de idiomas

function Idioma(pagina)
{
with (document.form1){
if (menu1.value=='1') 
	window.location.href="../es/"+pagina+".htm"
else if (menu1.value=='2')
	window.location.href = "../va/"+pagina+".htm"
	else if (menu1.value=='3')
		window.location.href= "../en/"+pagina+".htm"
}
}


// Scroll de imagenes, este diseñado para imagen siguiente

var cont =2
var ampliada

function nextImage(miArray,totalImage)
{
//alert(cont);
cont++
if (cont==totalImage+1)
	{
	document.images["Pos-2"].src= miArray[cont-1]
	document.images["Pos-1"].src= miArray[0]
	document.images["Pos"].src =  miArray[1]
	document.images["Pos+1"].src= miArray[2]
	document.images["Pos+2"].src= miArray[3]
	cont=1
	ampliada = cont
	}
if (cont==totalImage)
	{
	document.images["Pos-2"].src= miArray[cont-2]
	document.images["Pos-1"].src= miArray[cont-1]
	document.images["Pos"].src =  miArray[0]
	document.images["Pos+1"].src= miArray[1]
	document.images["Pos+2"].src= miArray[2]
	cont=0
	ampliada = cont
	}
else if (cont==totalImage-1)
		{
		document.images["Pos-2"].src= miArray[cont-2]
		document.images["Pos-1"].src= miArray[cont-1]
		document.images["Pos"].src =  miArray[cont]
		document.images["Pos+1"].src= miArray[0]
		document.images["Pos+2"].src= miArray[1]
		ampliada = cont
		}
	 else if (cont == totalImage-2)
	 		{
			document.images["Pos-2"].src= miArray[cont-2]
			document.images["Pos-1"].src= miArray[cont-1]
			document.images["Pos"].src =  miArray[cont]
			document.images["Pos+1"].src= miArray[cont+1]
			document.images["Pos+2"].src= miArray[0]
			ampliada = cont
			}
		 else if (cont ==1)
		 		{
				document.images["Pos-2"].src= miArray[totalImage-1]
				document.images["Pos-1"].src= miArray[cont-1]
				document.images["Pos"].src =  miArray[cont]
				document.images["Pos+1"].src= miArray[cont+1]
				document.images["Pos+2"].src= miArray[cont+2]
				ampliada = cont
				}
			  else
			  	{
				document.images["Pos-2"].src= miArray[cont-2]
				document.images["Pos-1"].src= miArray[cont-1]
				document.images["Pos"].src =  miArray[cont]
				document.images["Pos+1"].src= miArray[cont+1]
				document.images["Pos+2"].src= miArray[cont+2]
				ampliada = cont
				}
document.images["ampliada"].src = miCat[ampliada]
//alert(cont);
//return cont
}

function previousImage(miArray,totalImage)
{
cont--
if (cont==totalImage-2)
	{
	document.images["Pos-2"].src= miArray[cont-2]
	document.images["Pos-1"].src= miArray[cont-1]
	document.images["Pos"].src =  miArray[cont]
	document.images["Pos+1"].src= miArray[cont+1]
	document.images["Pos+2"].src= miArray[0]
	ampliada = cont
	}
else if (cont==totalImage-1)
		{
		document.images["Pos-2"].src= miArray[cont-2]
		document.images["Pos-1"].src= miArray[cont-1]
		document.images["Pos"].src =  miArray[cont]
		document.images["Pos+1"].src= miArray[0]
		document.images["Pos+2"].src= miArray[1]
		ampliada=cont
		}
	 else if (cont == 0)
	 		{
			document.images["Pos-2"].src= miArray[totalImage-2]
			document.images["Pos-1"].src= miArray[totalImage-1]
			document.images["Pos"].src =  miArray[cont]
			document.images["Pos+1"].src= miArray[cont+1]
			document.images["Pos+2"].src= miArray[cont+2]
			ampliada = cont
			cont=totalImage
			}
		 else if (cont ==1)
		 		{
				document.images["Pos-2"].src= miArray[totalImage-1]
				document.images["Pos-1"].src= miArray[cont-1]
				document.images["Pos"].src =  miArray[cont]
				document.images["Pos+1"].src= miArray[cont+1]
				document.images["Pos+2"].src= miArray[cont+2]
				ampliada=cont
				}
			  else
			  	{
				document.images["Pos-2"].src= miArray[cont-2]
				document.images["Pos-1"].src= miArray[cont-1]
				document.images["Pos"].src =  miArray[cont]
				document.images["Pos+1"].src= miArray[cont+1]
				document.images["Pos+2"].src= miArray[cont+2]
				ampliada = cont
				}
//alert(ampliada);
document.images["ampliada"].src = miCat[ampliada]
//return cont
//alert(cont);
}

//Detector de navegador y resolución
function Optimizacion()
{
var windows = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var internetExplorer  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var netscape = (navigator.appName.indexOf('Netscape') != -1) ? true : false;
//primero miramos el navegador de internet, si es internet Explorer
if (internetExplorer)
{	//Luego miramos la resolucion y como la adaptamos
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
/*		
	if (screen.width==1280) 
		{
		document.styleSheets[0].href= "../css/estilo1280.css";
		}
	else if (screen.width == 1024) 
		{
		document.styleSheets[0].href= "../css/estilo1024.css";
		}
		 else
		 document.styleSheets[0].href= "../css/estilo800.css";
*/
	if (screen.width==1280) 
		{
		document.styleSheets[0].disabled = false
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
		}
	else if (screen.width == 1024) 
		{
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = false
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
		}
		 else
		{
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = false
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
		}

}

else{
	if (screen.width==1280) 
		{
		document.styleSheets[0].disabled =false
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
		}
	else if (screen.width == 1024) 
		{
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = false
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
		}
		 else
		{
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = false
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
		}

}
//alert(document.styleSheets[4].disabled);
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0);
 }
 
 //Detector de navegador y resolución
function OptimizacionInicio()
{
var windows = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var internetExplorer  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var netscape = (navigator.appName.indexOf('Netscape') != -1) ? true : false;
//primero miramos el navegador de internet, si es internet Explorer

if (internetExplorer)
{	//Luego miramos la resolucion y como la adaptamos
	if (screen.width==1280) 
		document.styleSheets[0].href= "./js/estilo1280.css";
	else if (screen.width == 1024) 
		document.styleSheets[0].href= "./js/estilo1024.css";
		 else
			 document.styleSheets[0].href= "./js/estilo800.css";
}

else{
//El resto de navegadores
	if (screen.width==1280) 
		{
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = false
		}
	else if (screen.width == 1024) 
		{
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = true
		document.styleSheets[4].disabled = false
		document.styleSheets[5].disabled = true
		}
		 else
		{
		document.styleSheets[0].disabled = true
		document.styleSheets[1].disabled = true
		document.styleSheets[2].disabled = true
		document.styleSheets[3].disabled = false
		document.styleSheets[4].disabled = true
		document.styleSheets[5].disabled = true
		}

}
window.resizeTo(screen.availWidth,screen.availHeight);
alert(document.styleSheets[0].disabled);
 }