﻿// Archivo JScript

var slideCache = new Array();
var pause = false;
function RunSlideShow(pictureName,imageFiles,displaySecs)
{

    var imageSeparator = imageFiles.indexOf(";");
    var nextImage = imageFiles.substring(0,imageSeparator);
    if (document.all)
    {
        document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
        document.getElementById(pictureName).filters.blendTrans.Apply();
    }

    document.getElementById(pictureName).src = nextImage;
    if (document.all)
    {
        document.getElementById(pictureName).filters.blendTrans.Play();
    }
    var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)+ ';' + nextImage;
    setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",displaySecs*1000);
    // Cache the next image to improve performance.
    imageSeparator = futureImages.indexOf(";");
    nextImage = futureImages.substring(0,imageSeparator);
    if (slideCache[nextImage] == null) {
        slideCache[nextImage] = new Image;
        slideCache[nextImage].src = nextImage;
    }
}

//var imgCache = new Array();
function MostrarImagenesStop(pictureName,imageFiles,displaySecs)
{
    var imageSeparator = imageFiles.indexOf(";");
    
    if (imageSeparator < 0){
        imageSeparator = imageFiles.length;
    }
    var nextImage = imageFiles.substring(0,imageSeparator);
    
    if (document.all)
    {
        document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
        document.getElementById(pictureName).filters.blendTrans.Apply();
    }

    document.getElementById(pictureName).src = nextImage;
    if (document.all)
    {
        document.getElementById(pictureName).filters.blendTrans.Play();
    }
    var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length);
    if (futureImages.length > 0){ 
        setTimeout("MostrarImagenesStop('"+pictureName+"','"+futureImages+"',"+displaySecs+")",displaySecs*1000);
    }
    // Cache the next image to improve performance.
    /*imageSeparator = futureImages.indexOf(";");
    nextImage = futureImages.substring(0,imageSeparator);
    if (slideCache[nextImage] == null) {
        slideCache[nextImage] = new Image;
        slideCache[nextImage].src = nextImage;
    }*/
    
}

function esconde(objFlash, objTabla) {
    document.getElementById(objFlash).style.visibility="hidden";
    if (navigator.appName == "Netscape")
    {   
        document.getElementById(objTabla).style.MozOpacity= "1";
    }else{
        document.getElementById(objTabla).style.filter="";
    }
}
        
function entrar(obj) {
    if (navigator.appName == "Netscape")
    { 
        document.getElementById(obj).style.MozOpacity= "0.4";
    }else{
        document.getElementById(obj).style.filter="alpha(opacity=40)";
    }
    
}

function salir(obj) {
    if (navigator.appName == "Netscape")
    { 
        document.getElementById(obj).style.MozOpacity= "1";
    }else{
        document.getElementById(obj).style.filter="";
    }
}

function zoom(nameFoto)
        {
            var img = new Image();
 	        img.src = document.getElementById(nameFoto).src;
	        win=window.open('','','width='+img.width+',height='+img.height+',scrollbars=no,resizable=1,toolbar=0');
	        win.document.write ('<html>\n');
	        win.document.write (' <body style="margin:0px;">\n');
	        win.document.write ('  <img src="' + document.getElementById(nameFoto).src + '" height='+img.height+' width='+img.width+'>\n');
	        win.document.write (' </body>\n');
	        win.document.write ('</html>\n');
        }

function CargarTipoPromo(Id)
 {
    var EstPro = document.getElementById("ctl00_cphDetalle_cboEstadoPromocion").options[document.getElementById("ctl00_cphDetalle_cboEstadoPromocion").selectedIndex].value;
    var Loc = document.getElementById("ctl00_cphDetalle_cboLocalizacion").options[document.getElementById("ctl00_cphDetalle_cboLocalizacion").selectedIndex].value;
    window.location="TipoPromocion.aspx?Id="+Id+"&EstPro="+EstPro+"&Loc="+Loc;
 }
 
 function CargarTipoNoti(Id)
 {
    window.location="TipoNoticia.aspx?Id="+Id;
 }

function CargarPromoId(Id)
 {
    window.open('PromocionId.aspx?Id='+Id,'_blank','width=790,height=555,scrollbars,resizable=none');
 }

function CargarNotiId(Id)
 {
    window.open('NoticiaId.aspx?Id='+Id,'_blank','width=790,height=555,scrollbars,resizable=none');
 }
