
var counter=0;
var initial=true;
if(navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById)var type="OP"; 
if (document.all)var type="IE"; 
if (document.layers)var type="NN"; 
if (!document.all && document.getElementById)var type="MO"; 
function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}
function changeworks(){
    
if(!initial){
     window.setTimeout("changeworks()", 6000);
	 window.setTimeout("changeimage(1,"+counter+")", 1000);
     window.setTimeout("changeimage(2,"+counter+")", 2000);
	 window.setTimeout("changeimage(3,"+counter+")", 3000);
     window.setTimeout("changeimage(4,"+counter+")", 4000);
	 window.setTimeout("changeimage(5,"+counter+")", 5000);
}
else{ window.setTimeout("changeworks()", 2000);
     initial=false;
}
   counter++;
 if(counter==3)counter=0;
}
function initImage(id) {
  imageId = id;
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}
function changeimage(foto,counter){
     imageId = foto;
     image = document.getElementById(imageId);
     image.src=eval('img'+foto+'['+counter+'].src');
     ref = document.getElementById('ref'+imageId);
     ref.href=eval('refs'+foto+'['+counter+']');
     initImage(foto);
     }
function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  obj.style.filter = "alpha(opacity:"+opacity+")";
  obj.style.KHTMLOpacity = opacity/100;
  obj.style.MozOpacity = opacity/100;
  obj.style.opacity = opacity/100;
}	 
function actualizar(id,formulario) {
    document.forms[formulario].act.value=id;
}