$(document).ready(function() {
    $.fn.colorbox({iframe:true, width:"685", height:"550", inline:true, href:"intro.html"});

    
    
    $(".iframe3").colorbox({iframe:true, width:"700", height:"600"});
    
    $(".iframe4").colorbox({iframe:true, width:"700", height:"600"});
    
    $(".iframe2").colorbox({iframe:true, width:"400", height:"520"});
    
    $("#iframeVideo4").colorbox({iframe:true, width:"525", height:"450"});
    
    
    
    
    
    $("#progress").hide();
    

 
 $(".group2").colorbox({rel:'group2'});
  $(".group3").colorbox({rel:'group3'});
  $(".group6").colorbox({rel:'group6'});
 
 getFirmaInfo();
 
 $('#firma').click(function() {
  //alert('firma');
  getFirmaInfo();
  scroll(0,703);
 });
 $('#vision').click(function() {
  //alert('vision');
  getVisionInfo();
  scroll(0,703);
 });
 $('#grafico').click(function() {
  //alert('grafico');
  getGrafico();
  scroll(0,0);
 });
  $('#vermas3').click(function() {
  //alert('grafico');
  getGrafico();
  scroll(0,0);
 });
 $('#multimedia').click(function() {
  //alert('multimedia');
  getMultimedia();
  scroll(0,0);
 });
 $('#aplicaciones').click(function() {
  //alert('aplicaciones');
  scroll(0,0);
  getMoviles();
 });
 $('#contactenos').click(function() {
  //alert('contactenos');
  //getContacto();
 });
 $('#firma2').click(function() {
  //alert('firma2');
  getFirmaInfo();
  scroll(0,703);
 });
 $('#vision2').click(function() {
  //alert('vision2');
  getVisionInfo();
  scroll(0,703);
 });
 $('#grafico2').click(function() {
  //alert('grafico2');
  getGrafico();
  scroll(0,0);
 });
 $('#multimedia2').click(function() {
  //alert('multimedia2');
  getMultimedia();
  scroll(0,0);
 });
 $('#aplicaciones2').click(function() {
  //alert('aplicaciones2');
  getMoviles();
  scroll(0,0);
 });
 $('#vermas4').click(function() {
  //alert('aplicaciones2');
  getMoviles();
  scroll(0,0);
 });
 $('#vermas5').click(function() {
  //alert('aplicaciones2');
  getMultimedia();
  scroll(0,0);
 });
 $('#contactenos2').click(function() {
  //alert('contactenos2');
  //getContacto();
  //getFirmaInfo();
 });
 $('#boxBBC').click(function() {
  //alert('contactenos2');
  newsFeed();
  scroll(0,703);
 });
 
 //$("#carousel").css('background','');
        $("#carousel").featureCarousel({
          // include options like this:
          // (use quotes only for string values, and no trailing comma after last option)
          // option: value,
          // option: value
        });


});

$(window).load(function() {
 // executes when complete page is fully loaded, including all frames, objects and images
 //alert("window is loaded");
});

function getFirmaInfo(){
    $("#carrusel").html("");
    $('#carrusel').css('background','url(images/carrusel.png) center center no-repeat');
    //$("#columna1").hide();
    $("#progress").hide();
    var xmlhttp;    

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("columna1").innerHTML=xmlhttp.responseText;
        //$('#columna1').css('background','none');
        $("#columna1").css("background","url(images/david.png) right bottom no-repeat");
        $("#content_wrapper").css("background","url(images/cajas_juntas.png) 53px -5px no-repeat");
        $("#columna1").hide().fadeIn("slow");
        }
      }
    xmlhttp.open("GET","scripts/firma.php",true);
    xmlhttp.send();
}

function getVisionInfo(){
    $("#progress").hide();
    $("#carrusel").html("");
    $('#carrusel').css('background','url(images/carrusel.png) center center no-repeat');
    //$("#columna1").hide();
    var xmlhttp;    

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("columna1").innerHTML=xmlhttp.responseText;
        $("#columna1").css("background","url(images/vision.png) right bottom no-repeat");
        $("#content_wrapper").css("background","url(images/cajas_juntas.png) 53px -5px no-repeat");
        $("#columna1").hide().fadeIn("slow");
        }
      }
    xmlhttp.open("GET","scripts/vision.php",true);
    xmlhttp.send();
}

function getContacto(){
    $("#progress").hide();
    $("#carrusel").html("");
    $('#carrusel').css('background','url(images/carrusel.png) center center no-repeat');
    //$("#columna1").hide();
    var xmlhttp;    

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("columna1").innerHTML=xmlhttp.responseText;
        $("#columna1").hide().fadeIn("slow");
        }
      }
    xmlhttp.open("GET","scripts/contactenos.php",true);
    xmlhttp.send();
}

function newsFeed(){
    $("#progress").hide();
    $("#carrusel").html("");
    //$("#columna1").hide();
    $('#carrusel').css('background','url(images/carrusel.png) center center no-repeat');
    $('#columna1').css('background-image','none');
    document.getElementById("columna1").innerHTML="<div style='background:url(images/ajax-loader.gif) center center no-repeat;' id='holderRSS'></div>";
    //$("#columna1").hide();
    var xmlhttp;    

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("columna1").innerHTML="<div id='holderRSS'></div>";
            document.getElementById("holderRSS").innerHTML=xmlhttp.responseText;
            $("#columna1").hide().fadeIn("slow");
            ////$("#progress").hide();
        }
      }
    xmlhttp.open("GET","scripts/rss2html.php",true);
    xmlhttp.send();
}

function getGrafico(){
    $("#progress").hide();
    //$("#columna1").hide();
    $("#progress").fadeIn("slow");
//$('#carrusel').css('background','url(images/ajax-loader.gif) center center no-repeat');
    var xmlhttp;    

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("carrusel").innerHTML=xmlhttp.responseText;
        //$('#columna1').css('background','none');
        
$("#carrusel").hide().fadeIn("slow");
        $("#carousel").featureCarousel({
          // include options like this:
          // (use quotes only for string values, and no trailing comma after last option)
          // option: value,
          // option: value
        });
        $("#content_wrapper").css("background","url(images/cajas_juntas.png) 53px -5px no-repeat");
        $(".group1").colorbox({rel:'group1', width:"750", height:"700"});
        //$("#progress").hide();
        }
        
      }
    xmlhttp.open("GET","scripts/grafico.php",true);
    xmlhttp.send();
}

function getMultimedia(){
    $("#progress").hide();
    $("#progress").fadeIn("slow");
//$('#carrusel').css('background','url(images/ajax-loader.gif) center center no-repeat');
    //$("#columna1").hide();
    var xmlhttp;    

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("carrusel").innerHTML=xmlhttp.responseText;
        //$('#columna1').css('background','none');
        
$("#carrusel").hide().fadeIn("slow");
        $("#carousel").featureCarousel({
          // include options like this:
          // (use quotes only for string values, and no trailing comma after last option)
          // option: value,
          // option: value
        });
        
        $(".group5").colorbox({rel:'group5', iframe:true, width:"525", height:"450"});
        $("#iframeVideo11").colorbox({iframe:true, width:"525", height:"200"});
       //$("#progress").hide();
        }
        
      }
    xmlhttp.open("GET","scripts/multimedia.php",true);
    xmlhttp.send();
}

function getMoviles(){
    $("#progress").hide();
     $("#carrusel").html("");
     $('#carrusel').css('background','none');
    $("#progress").fadeIn("slow");
//$('#carrusel').css('background','url(images/ajax-loader.gif) center center no-repeat');
    //$("#columna1").hide();
    var xmlhttp;    

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("carrusel").innerHTML=xmlhttp.responseText;
        //$('#columna1').css('background','none');
        $("#carrusel2").hide().fadeIn("slow");
        $("#carousel2").featureCarousel({
          // include options like this:
          // (use quotes only for string values, and no trailing comma after last option)
          // option: value,
          // option: value
        });
        $(".group4").colorbox({rel:'group4', width:"750", height:"700"});
        //$("#progress").hide();
        }
        
      }
    xmlhttp.open("GET","scripts/moviles.php",true);
    xmlhttp.send();
}
