﻿/** Javascript destinado para el paginador de imagenes en el MICROSITE **/
var timerUp;
var timerDown;

function generateimage(which, imagen) {

    // Inhabilitar botones
    var imagenes = document.getElementsByName("virtualImg");

    if (imagenes.length > 0) {
        for (i = 0; i < imagenes.length; i++) {
            imagenes.item(i).setAttribute("class", "");
        }
    }

    // Colocar imagen en el panel y cambiar Css Class al boton seleccionado
    var contentobj = document.getElementById("imagenesDiv");
    imagen.setAttribute("class", "selected");

    if (contentobj != null) {
        contentobj.innerHTML = '<img src="' + which + '" width="280" height="200" alt=""/>'
    }
}

defaultStep = 25
step = defaultStep

function scrollDivDown(id) {
    clearTimeout('timerUp')
    document.getElementById(id).scrollTop += step
    timerDown = setTimeout("scrollDivDown('" + id + "')", 10)
}

function scrollDivUp(id) {
    clearTimeout('timerDown')
    document.getElementById(id).scrollTop -= step
    timerUp = setTimeout("scrollDivUp('" + id + "')", 10)
}

function resetScroll() {
    
    if (document.getElementById('productosDiv')!= null)
        document.getElementById('productosDiv').scrollTop = 0;
    if (document.getElementById('nosotrosDiv') != null)
        document.getElementById('nosotrosDiv').scrollTop = 0;
    if (document.getElementById('sucursalesDiv') != null)
        document.getElementById('sucursalesDiv').scrollTop = 0;
    if (document.getElementById('menuDiv') != null) 
        document.getElementById('menuDiv').scrollTop = 0;

    clearTimeout(timerUp)
    clearTimeout(timerDown)
}
/*
var BusinessName = 'MicroSite_PaginasAmarillas(RD)';
function exportToPdf() {
    //convertContentToPdf(BusinessName, 'content_pdf');
    convertContentToPdf(BusinessName, 'content_pdf');
}

function convertContentToPdf(p_str_BusinessName, p_str_HtmlControlID) {
    var xml = document.getElementById(p_str_HtmlControlID);
    var exportForm = document.getElementById("exportForm");
    exportForm.content.value = xml.innerHTML;    
    //exportForm.busName.value = document.getElementById('nombrePerfil').innerText + ' - ' + p_str_BusinessName;
    //exportForm.busName.value = BusinessName + ' - ' + p_str_BusinessName;
    exportForm.busName.value = BusinessName;
    exportForm.link.value = document.location.href;
    exportForm.typeFile.value = "PDF";
    exportForm.submit();
    exportForm.content.value = "";    
    //setTimeout("hideMsg()", 4000);
}*/

