// JavaScript Document
//window.addEventListener("load", inicializador_general, true);
window.onload=inicializador_general;
var botonBogota;
//var botonMedellin;
var botonVideo;
var videoMedellin;
var videoBogota;


function video(){
  botonVideo=document.getElementById('video_expo');
  botonVideo.onclick=videoExpo;
}
function videoExpo() { 
    window.open('pop_ups/video/video_expo.html', 'popup', 'width=440, height=370, top=10, left=100, menubar=0, scrollbars=0, location=0, toolbar=0,  resizable=0, status=0'); 
}

function videoMedellin(){
  videoMedellin=document.getElementById('video_medellin');
  videoMedellin.onclick=window_Video_Medellin;
}
function window_Video_Medellin(){
  window.open('pop_ups/video/video_expo_medellin.html', 'popup', 'width=440, height=370, top=100, left=100, menubar=0, scrollbars=0, location=0, toolbar=0,  resizable=0, status=0'); 
}

function videoBogota(){
  videoBogota=document.getElementById('video_colombia');
  videoBogota.onclick=window_Video_Bogota;
}
function window_Video_Bogota(){
  window.open('pop_ups/video/video_expo_bogota.html', 'popup', 'width=440, height=370, top=100, left=100, menubar=0, scrollbars=0, location=0, toolbar=0,  resizable=0, status=0'); 
}



function inicializador_general (){
  obtenerElementos();
  asignarFunciones();
  videoMedellin()
  videoBogota();
  if(is_Page_Class('index')){
    video();
  }
  if(is_Page_Class('expositores')){
    tab("tbl_expositores");
  }
  if(is_Page_Class('becas')){
    tab("tbl_becas");
  }
  if(is_Page_Class('programa')){
    tab("tbl_programa");
  }
  if(is_Page_Class('contactenos')){
    init_validation('miform');
  }
  tab("tbl_fecha");
  
}
function obtenerElementos(){
  botonBogota=document.getElementById('boton_bogota');
  botonMedellin=document.getElementById('boton_medellin');
}
function asignarFunciones(){
  botonBogota.onclick = popUp;
  botonMedellin.onclick = popUp;
}


function is_Page_Class(class_Name){
  if(document.getElementById('contenido').className.lastIndexOf(class_Name)>=0){
    return true;
  }else{
    return false;
  }
}

// funcion pop up fotos
function popUp(){
  folder = this.id.substr(6);
  window.open('pop_ups/2009_'+ folder +'/fotos_evento_uno.html', 'popup', 'width=432, height=390, top=100, left=100, menubar=0, scrollbars=0, location=0, toolbar=0,  resizable=0, status=0'); 
}


//functions for Tabs
function tab(el_Target){
  id_Target = document.getElementById(el_Target);
  arr_TH = id_Target.getElementsByTagName('tr')[0].getElementsByTagName('th');
  var tab_Is_Over = false;  
  if(id_Target.className.lastIndexOf('jx_tab_over') >= 0){

    tab_Is_Over = true;
  }
  //alert(arr_TH[0].tagName);
  i = 0;
  for (clave in arr_TH){
     el_th= arr_TH[i];
     if(el_th){   
        if(tab_Is_Over){
          el_th.onmouseover = show_Tab_Element;
        }else{
          el_th.onclick = show_Tab_Element;
        }
        id_Target.getElementsByTagName('tr')[1].getElementsByTagName('div')[i].style.display = 'none';             
     }
      
     i++;
  }
}

function show_Tab_Element(){
  id_tbl = this.parentNode.parentNode.parentNode.id;
  //alert(id_tbl);
  arr_TH = this.parentNode.parentNode.parentNode.getElementsByTagName('tr')[0].getElementsByTagName('th');
  
  //alert(arr_TH[0].tagName);
  i = 0;
  var current_th;
  for (clave in arr_TH){
     el_th= arr_TH[i];
     if(el_th){ 
           el_DIV = this.parentNode.parentNode.parentNode.getElementsByTagName('tr')[1].getElementsByTagName('div')[i];
          el_DIV.style.display = 'none';
       if(this == el_th){
          current_th = this;
          tab_number = i;   

        }
     }else{
      break;
     }
     
     i++;
  }
  el_DIV = this.parentNode.parentNode.parentNode.getElementsByTagName('tr')[1].getElementsByTagName('div')[tab_number];
  el_DIV.style.display = 'block';
}
