if (document.images)
{
	pic1= new Image(986,371); 
	pic1.src="http://www.cocalero.com/narcocorridobrand/images/img_001.gif"; 
	
	pic2= new Image(986,371); 
	pic2.src="http://www.cocalero.com/narcocorridobrand/images/img_002.jpg"; 
	
	pic3= new Image(986,371); 
	pic3.src="http://www.cocalero.com/narcocorridobrand/images/img_003.gif"; 
	
	pic4= new Image(986,371); 
	pic4.src="http://www.cocalero.com/narcocorridobrand/images/img_004.jpg"; 
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}


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 fadeOut(objId,opacity) 
{
  if (document.getElementById) 
  {
    obj = document.getElementById(objId);
    if (opacity >= 0) 
    {
      setOpacity(obj, opacity);
      opacity -= 10;
      window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
    }
  }
}


function initImage(imageName) 
{
	useImageSrc = "pic" + imageName + ".src";
	useImage = "pic" + imageName;
	
	//alert(isImageOk(eval(useImage)));
	
	document.getElementById('photoholder').innerHTML = "<img src=\"" + eval(useImageSrc) + "\" alt=\"Photo\" id=\"thephoto\" />";
	imageId = "thephoto";
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId, 0);

	setTimeout('fadeOut(imageId,100)',7000);
	
	if(imageName < 4)
	{
	//alert(imageName);
		imageName = eval(imageName) + 1;
	//alert(imageName);
	}
	else
	{
		imageName = 1;
	}
	setTimeout('initImage(' + imageName + ')',9000); 
}





function isImageOk(img) {
    // During the onload event, IE correctly identifies any images
    // that weren't downloaded as not complete. Others should too.
    // Gecko-based browsers act like NS4 in that they report this
    // incorrectly: they always return true.
    if (!img.complete) {
        return false;
    }

    // However, they do have two very useful properties: naturalWidth
    // and naturalHeight. These give the true size of the image. If
    // it failed to load, either of these should be zero.
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {
        return false;
    }

    // No other way of checking: assume it's ok.
    return true;
}




