// JavaScript Document
function abrirPag01(pag){
	var nombre = '';
	var caract = 'scrollbars=no, width=400, height=410, left=100, top=50';
	abrirEmerg(pag,nombre,caract);
}

function abrirPag02(pag){
	var nombre = '';
	var caract = 'scrollbars=no, width=600, height=600, left=100, top=50';
	abrirEmerg(pag,nombre,caract);
}

function abrirPag03(pag){
	var nombre = '';
	var caract = 'scrollbars=no, width=300, height=170, left=300, top=250';
	abrirEmerg(pag,nombre,caract);
}

function abrirPag04(pag){
	var nombre = '';
	var caract = 'scrollbars=no, width=300, height=300, left=300, top=250';
	abrirEmerg(pag,nombre,caract);
}

function abrirPag05(pag){
	var nombre = '';
	var caract = 'scrollbars=no, width=630, height=600, left=100, top=20';
	abrirEmerg(pag,nombre,caract);
}
function abrirPagjhc(pag){
	var nombre = '';
	var caract = 'scrollbars=no, width=800, height=600, left=100, top=20';
	abrirEmerg(pag,nombre,caract);
}

function abrirEmerg(url,nombre,caract) {
	window.open(url,nombre,caract);
}

function cambiar_estado_div(id){
	var estado = getStyle(id, 'visibility');
	if(estado=='visible'){
		setStyle(id, 'visibility', 'hidden');
		setStyle('boton_nosot_up', 'visibility', 'visible');
	} else{
		setStyle(id, 'visibility', 'visible');
		setStyle('for_01', 'visibility', 'hidden');
	}
}

//Funcion que retorna el valor del parametro del elemento seleccionado
function getStyle(elemid, prop){
	var elem = document.getElementById(elemid);
	var valor = "";
	if(elem!=null){	
		if(document.defaultView && document.defaultView.getComputedStyle){
			valor = document.defaultView.getComputedStyle(elem, '').getPropertyValue(prop);
		}
		else if(elem.currentStyle) {
			prop = prop.replace(/\-(\w)/g, function (strMatch, p1) {
				return p1.toUpperCase();
			});
			valor = elem.currentStyle[prop];
		}
	}
	return valor;
}

//Funcion que asigna el valor del parametro del elemento seleccionado
function setStyle(elemid, prop, val){
	//alert(elemid+" "+prop+" "+val);
	var elem = document.getElementById(elemid);
	prop = prop.replace(/\-(\w)/g, function (strMatch, p1) {
		return p1.toUpperCase();
	});
	if(elem!=null)
		elem.style[prop] = val;
}

//Oculta o muestra el elemento seleccionado
function ver_ocultar(id, tipo){	
	var elem=document.getElementById(id);
	if(elem!=null)
	elem.style.visibility=tipo;
}


var num = 0;

var imagenes = new Array( 'foto_ind_01.jpg', 'foto_ind_02.jpg', 'foto_ind_03.jpg', 'foto_ind_04.jpg', 'foto_ind_05.jpg', 'foto_ind_06.jpg', 'foto_ind_07.jpg');


window.onload= function(){
	iniciarBanner();
}

function continuar(){
	precarga = new classPrecarga('precarga', imagenes, 'fondo');
	precarga.funfin = 'continuar';
	precarga.time = 3000;
	precarga.iniciar();
	//Inicia la musica de fondo
	//llamarId('', 'cargando');
	
	//Inicia la precarga de Imagenes de Actuacion
	/*precarga1 = new classPrecarga('precarga1', imagenes1, 'fotogrande_act');
	precarga1.carp = 'img/actua/';
	precarga.time = 200;
	precarga1.iniciar();
	
	//Inicia la precarga de Imagenes de Modelaje
	precarga2 = new classPrecarga('precarga2', imagenes2, 'fotogrande_model');
	precarga2.carp = 'img/modelaje/';
	precarga2.iniciar();*/
	
	//Inicia los efectos de la pagina
	//cargaPags('inicio');
}

//------------------------------Banner-------------------------------------------//
// JavaScript Document

var numimg = 0;

/*-------------------------------Matrices--------------------------------------*/

//Matrices que se usan en los efectos del Banner
function crearMtsBanner(){
	
	//Matriz Imagenes Fondo
	mtImgs = new Array ('Foto_01.jpg', 'Foto_02.jpg', 'Foto_03.jpg', 'foto_04.jpg', 'foto_05.jpg', 'foto_06.jpg',
						'foto_07.jpg', 'foto_08.jpg', 'foto_09.jpg', 'foto_10.jpg', 'foto_11.jpg', 'foto_12.jpg');
	
	//Matriz Banner1
	mtebanner1 = new Array();
	mtebanner1[0] = new Array ('franja_institucional', 'top', 'px', 0, 0, (0));
	mtebanner1[1] = new Array ('franja_institucional', 'opacity', '', 100, 20, (-3));
	//crea un objeto de la clase Efecto
	efe_banner1 = new classEfectos('efe_banner1', mtebanner1);
	
	//Matriz Banner2
	mtebanner2 = new Array();
	mtebanner2[0] = new Array ('franja_institucional', 'top', 'px', 40, 40, (0));
	mtebanner2[1] = new Array ('franja_institucional', 'opacity', '', 100, 20, (-3));
	//crea un objeto de la clase Efecto
	efe_banner2 = new classEfectos('efe_banner2', mtebanner2);
	
	//Matriz Banner3
	mtebanner3 = new Array();
	mtebanner3[0] = new Array ('franja_institucional', 'top', 'px', 40, 1, (-1));
	mtebanner3[1] = new Array ('franja_institucional', 'opacity', '', 100, 100, 0);
	//crea un objeto de la clase Efecto
	efe_banner3 = new classEfectos('efe_banner3', mtebanner3);
	
	//Matriz Banner4
	mtebanner4 = new Array();
	mtebanner4[0] = new Array ('franja_institucional', 'top', 'px', 0, 39, 1);
	mtebanner4[1] = new Array ('franja_institucional', 'opacity', '', 100, 100, 0);
	//crea un objeto de la clase Efecto
	efe_banner4 = new classEfectos('efe_banner4', mtebanner4);
	
	//Matriz Banner5
	mtebanner5 = new Array();
	mtebanner5[0] = new Array ('franja_institucional', 'top', 'px', 0, 0, (0));
	mtebanner5[1] = new Array ('franja_institucional', 'opacity', '', 20, 100, 3);
	//crea un objeto de la clase Efecto
	efe_banner5 = new classEfectos('efe_banner5', mtebanner5);
	
	//Matriz Banner2
	mtebanner6 = new Array();
	mtebanner6[0] = new Array ('franja_institucional', 'top', 'px', 40, 40, (0));
	mtebanner6[1] = new Array ('franja_institucional', 'opacity', '', 20, 100, 3);
	//crea un objeto de la clase Efecto
	efe_banner6 = new classEfectos('efe_banner6', mtebanner6);
}


function iniciarBanner(){
	crearMtsBanner();
	cargarBanner();
}

function cargarBanner(){
	efecto1();	
}

function efecto1(){
	
	//Inicia las imagenes del Banner
	efe_banner3.funfin = 'efecto2';
	efe_banner3.iniEfecto();
	
}	

function efecto2(){

	cambiarImgFon();	
	
	//Inicia las imagenes del Banner
	efe_banner3.funfin = 'efecto3';
	efe_banner3.iniEfecto();
	
}

function efecto3(){

	cambiarImgFon();
	
	//Inicia las imagenes del Banner
	efe_banner3.funfin = 'efecto4';
	efe_banner3.iniEfecto();
	
}

function efecto4(){
	
	//Inicia las imagenes del Banner
	efe_banner1.funfin = 'efecto5';
	efe_banner1.iniEfecto();
	
}

function efecto5(){

	cambiarImgFon();
	
	//Inicia las imagenes del Banner
	efe_banner5.funfin = 'efecto6';
	efe_banner5.iniEfecto();
	
}

function efecto6(){

	//Inicia las imagenes del Banner
	efe_banner4.funfin = 'efecto7';
	efe_banner4.iniEfecto();
	
}

function efecto7(){
	
	cambiarImgFon();
	
	//Inicia las imagenes del Banner
	efe_banner4.funfin = 'efecto8';
	efe_banner4.iniEfecto();
	
}

function efecto8(){
	
	cambiarImgFon();
	
	//Inicia las imagenes del Banner
	efe_banner4.funfin = 'efecto9';
	efe_banner4.iniEfecto();
}

function efecto9(){
		
	//Inicia las imagenes del Banner
	efe_banner2.funfin = 'efecto10';
	efe_banner2.iniEfecto();
}

function efecto10(){
	
	cambiarImgFon();
	
	//Inicia las imagenes del Banner
	efe_banner6.funfin = 'efecto1';
	efe_banner6.iniEfecto();
}

function cambiarImgFon(){
	numimg++;
	if(numimg>(mtImgs.length-1)){
		numimg=0;
	}
	setStyle('franja_institucional', 'background-image', 'url(img/'+mtImgs[numimg]+')');
}

function abrirPagresponsable(pag){
	var nombre = '';
	var caract = 'scrollbars=no, width=400, height=410, left=100, top=50';
	abrirEmerg(pag,nombre,caract);
}