img0 = new Image();
img0.src = "productos/RODAMIENTO 01.JPG";
img1 = new Image();
img1.src = "productos/RODAMIENTO 03.JPG";
img2 = new Image();
img2.src = "productos/RODAMIENTO 07.JPG";
img3 = new Image();
img3.src = "productos/RODAMIENTO 04.GIF";
img4 = new Image();
img4.src = "productos/RODAMIENTO 05.JPG";
img5 = new Image();
img5.src = "productos/RODAMIENTO 06.JPG";
// Creamos un array con las imágenes que utilizaremos en el efecto
var imageurl1 = new Array()
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
var velTransicion1 = 2000 
var valorFade1 = 0
var i1 = 0
var mimagen ="miImagen1"
function xtabs(url,element,opcion)
{
   new Ajax.Request( url , {
   method: 'get',
   parameters: {opcion: opcion},
   onSuccess: function(transport) {
     var response = transport.responseText || "";
    document.getElementById(element).innerHTML = "";
    document.getElementById(element).innerHTML = response;
     }
   }); 
  var response = ""
  if (opcion == 4)
  {
  alert("RODAMIENTOS")
  ejecuta()
  }
}
function ejecuta()
{
 // alert("RODAMIENTOS")
  mimagen ="miImagen1"
  xpost('php/roda.php','detalle',1)
}
function xpost(url,element,opcion)
{
   new Ajax.Request( url , {
   method: 'get',
   parameters: {opcion: opcion},
   onSuccess: function(transport) {
     var response = transport.responseText || "";
    document.getElementById(element).innerHTML = response 
     }
   }); 
productos(opcion)
}
function productos(opcion)
{
var valorFade1 = 0
var i1 = 0
var timer1 = setTimeout("fadeOutImagen1()",0)
clearTimeout(timer1)
document.getElementById(mimagen).style.MozOpacity = 0
document.getElementById(mimagen).style.filter = 'alpha(Opacity=0)'
if (opcion == 1)
   {
   rodamientos()
   }
if (opcion == 2)
   {
   chumaceras()
   }
if (opcion == 3)
   {
   tools()
   }
if (opcion == 4)
   {
   retenes()
   }
if (opcion == 5)
   {
   reductores()
   }
if (opcion == 6)
   {
   bandas()
   }
if (opcion == 7)
   {
   cadenas()
   }
if (opcion == 8)
   {
   coples()
   }
if (opcion == 9)
   {
   automatizacion()
   }
if (opcion == 10)
   {
   manejo()
   }
if (opcion == 11)
   {
   gruas()
   }
if (opcion == 12)
   {
   transportadoras()
   }
if (opcion == 13)
   {
   lubricantes()
   }
}
function rodamientos()
{
img0.src = "productos/RODAMIENTO 01.JPG";
img1.src = "productos/RODAMIENTO 08.JPG";
img2.src = "productos/RODAMIENTO 07.JPG";
img3.src = "productos/RODAMIENTO 04.GIF";
img4.src = "productos/RODAMIENTO 05.JPG";
img5.src = "productos/RODAMIENTO 06.JPG";

imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src

url[0] = "http://enlace1"
fadeInImagen1()
}
function chumaceras()
{
img0.src = "productos/CHUMACERAS 01.JPG";
img1.src = "productos/CHUMACERAS 02.JPG";
img2.src = "productos/CHUMACERAS 03.JPG";
img3.src = "productos/CHUMACERAS 04.JPG";
img4.src = "productos/CHUMACERAS 05.JPG";
img5.src = "productos/CHUMACERAS 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function tools()
{
img0.src = "productos/TOOL 01.JPG";
img1.src = "productos/TOOL 02.JPG";
img2.src = "productos/TOOL 03.JPG";
img3.src = "productos/TOOL 04.JPG";
img4.src = "productos/TOOL 05.JPG";
img5.src = "productos/TOOL 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function retenes()
{
img0.src = "productos/RETENES 01.JPG";
img1.src = "productos/RETENES 02.JPG";
img2.src = "productos/RETENES 03.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = ""
imageurl1[4] = ""
imageurl1[5] = ""
}
function reductores()
{
img0.src = "productos/REDUCTOR 01.JPG";
img1.src = "productos/REDUCTOR 07.JPG";
img2.src = "productos/REDUCTOR 03.JPG";
img3.src = "productos/REDUCTOR 04.JPG";
img4.src = "productos/REDUCTOR 05.JPG";
img5.src = "productos/REDUCTOR 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function bandas()
{
img0.src = "productos/POLEAS 01.JPG";
img1.src = "productos/POLEAS 02.JPG";
img2.src = "productos/POLEAS 03.JPG";
img3.src = "productos/POLEAS 04.JPG";
img4.src = "productos/POLEAS 05.JPG";
img5.src = "productos/POLEAS 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function cadenas()
{
img0.src = "productos/CADENAS 01.JPG";
img1.src = "productos/CADENAS 03.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = ""
imageurl1[3] = ""
imageurl1[4] = ""
imageurl1[5] = ""
}
function coples()
{
img0.src = "productos/COPLES 01.JPG";
img1.src = "productos/COPLES 02.GIF";
img2.src = "productos/COPLES 03.JPG";
img3.src = "productos/COPLES 04.JPG";
img4.src = "productos/COPLES 05.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = ""
}
function automatizacion()
{
img0.src = "productos/AUTO 01.JPG";
img1.src = "productos/AUTO 02.JPG";
img2.src = "productos/AUTO 03.JPG";
img3.src = "productos/AUTO 04.JPG";
img4.src = "productos/AUTO 05.JPG";
img5.src = "productos/AUTO 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function manejo()
{
img0.src = "productos/MUEVEN 01.JPG";
img1.src = "productos/MUEVEN 02.JPG";
img2.src = "productos/MUEVEN 03.JPG";
img3.src = "productos/MUEVEN 04.JPG";
img4.src = "productos/MUEVEN 05.JPG";
img5.src = "productos/MUEVEN 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function gruas()
{
img0.src = "productos/POLI 01.JPG";
img1.src = "productos/POLI 02.JPG";
img2.src = "productos/POLI 03.JPG";
img3.src = "productos/POLI 04.JPG";
img4.src = "productos/POLI 05.JPG";
img5.src = "productos/POLI 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function transportadoras()
{
img0.src = "productos/TRANS 01.JPG";
img1.src = "productos/TRANS 02.JPG";
img2.src = "productos/TRANS 03.JPG";
img3.src = "productos/TRANS 04.JPG";
img4.src = "productos/TRANS 05.JPG";
img5.src = "productos/TRANS 06.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = img4.src
imageurl1[5] = img5.src
}
function lubricantes()
{
img0.src = "productos/LUB 01.JPG";
img1.src = "productos/LUB 02.JPG";
img2.src = "productos/LUB 03.JPG";
img3.src = "productos/LUB 04.JPG";
imageurl1[0] = img0.src
imageurl1[1] = img1.src
imageurl1[2] = img2.src
imageurl1[3] = img3.src
imageurl1[4] = ""
imageurl1[5] = ""
}
function fadeInImagen1() {
	if (valorFade1 <= 100) {
		document.getElementById(mimagen).src = imageurl1[i1]
		document.getElementById(mimagen).style.MozOpacity = valorFade1/100
		document.getElementById(mimagen).style.filter = 'alpha(Opacity='+valorFade1+')'
		valorFade1 = valorFade1 + 10
		var timer1 = setTimeout("fadeInImagen1()",60)
	}
	
	else {
		clearTimeout(timer1)
		valorFade1 = 100
		var timer1 = setTimeout("fadeOutImagen1()",velTransicion1)
	}

}

function fadeOutImagen1()
 {
  
	if (valorFade1 >= 0) 
	{
		document.getElementById(mimagen).style.MozOpacity = valorFade1/100
		document.getElementById(mimagen).style.filter = 'alpha(Opacity='+valorFade1+')'
		valorFade1 = valorFade1 - 10
		var timer1 = setTimeout("fadeOutImagen1()",60)
	}

	else 
		{
		clearTimeout(timer1)
		i1++
		if (i1 >= imageurl1.length) {
			i1 = 0
		}
	  if (imageurl1[i1] == "")
	      {
  			i1 = 0
	      }
		valorFade1 = 0
		var timer1 = setTimeout("fadeInImagen1()",500)
	}
}
function ximagen(iopcion)
{
   var url = "php/bimagen.php"
   var element = "principal"
   new Ajax.Request( url , {
   method: 'get',
   parameters: {iopcion: iopcion},
   onSuccess: function(transport) {
    var response = transport.responseText || "";
    document.getElementById(element).innerHTML = "";
    document.getElementById(element).innerHTML = response 
     }
   }); 
}

