﻿var gallery = new Array();
var p_actual = 0;
this.slideShowInterval = null;
function img_gallery_page(array_img) {
 
    gallery = array_img;

}

function mostrar_img() {

    var img = document.getElementById("img_galeria_pagina");
    var div_descricao = document.getElementById("div_descricao_min_gal");
    if (gallery.length != 0) {
        img.src = gallery[p_actual][0];
        div_descricao.innerHTML = gallery[p_actual][1];
    }
}

function next() {
    if (p_actual == gallery.length - 1) {
        p_actual = 0;
    } else {
        p_actual++;
    }
    mostrar_img();

}

function Pre() {

    if (p_actual == 0) {
        p_actual = gallery.length - 1; 
    } else { 
    p_actual--;
    }
    mostrar_img();

}


function play(obj) {
    if (!this.slideShowInterval) {
        obj.src = "/image/base/btn_pause.png";
        next();
        this.slideShowInterval = setInterval('next()', 5000);
        
    } else {
    this.slideShowInterval = window.clearInterval(this.slideShowInterval);
    obj.src = "/image/base/btn_play.png";
    }
    
}

function play_pause() {

    this.slideShowInterval = window.clearInterval(this.slideShowInterval);

}

function stop() {
    this.slideShowInterval = window.clearInterval(this.slideShowInterval);
    p_actual = 0;
    mostrar_img();
}



//function getFlashMovie(movieName) {
//    var isIE = navigator.appName.indexOf("Microsoft") != -1;
//    return (isIE) ? window[movieName] : document[movieName];
//}

//function stopbanner() {
//    alert(document.getElementById("banner_final").id);
//    getFlashMovie("banner_final").stopBanner();
//}
