
function MM_openBrWindow(theURL,winName,features) { 
	window.open(theURL,winName,features);
 }
 
function setColor(div, index, classSelect)
{
	if(document.getElementById(div).className != classSelect)
	{
	  if(index == 1)
	  document.getElementById(div).style.border="1px solid #006699";
	  else if(index == 2)
	  document.getElementById(div).style.border="1px solid #CCCCCC";
	}
}

function muestraOculta(div1, div2){
    var o1 = document.getElementById(div1);
    var o2 = document.getElementById(div2);
    if (o1 != null && o2 != null ) {
		if (o1.style.display == 'none'){
		  o1.style.display = 'block';
		  o2.style.display = 'none';
		 } 
		 else{
		  o1.style.display = 'none';
		  o2.style.display = 'block';
		 }
    } 
}

function nextImage(){

	if (imageActual < vecImages.length - 1)
		imageActual ++;
	else 
		imageActual = 0;

	if (vecImages.length > 0){

		document.getElementById('imgPrincipal').src = vecImages[imageActual];
		cambiaNumeroImagen();
	}
	imagenPopup = imageActual + 1;
 }
 
function previousImage(){

	if (imageActual > 0)
		imageActual --;
	else 
		imageActual = vecImages.length - 1;

	if (vecImages.length > 0){
		document.getElementById('imgPrincipal').src = vecImages[imageActual];
		cambiaNumeroImagen();
	}
	imagenPopup = imageActual + 1;
}

function cambiaNumeroImagen(){
	document.getElementById('spanFotoActual').innerHTML = imageActual + 1;
}

function cambiar(i)
{	
	var oimgP = document.getElementById('imgPrincipal');
	oimgP.src = vecImages[i - 1];
	imageActual = i - 1;
	cambiaNumeroImagen();
	imagenPopup = i;
}

function handleBrokenImages(imgId){
	document.getElementById(imgId).src = noImageFound;
}
