var _basename="";
var is_ie6 = (
    window.external &&
    typeof window.XMLHttpRequest == "undefined"
);

$(document).ready(function(){
  _url=document.URL;
  _basename=_url.substring(_url.lastIndexOf("/")+1,500);
  if(_url.indexOf("servicios")>-1 || _url.indexOf("equipos")>-1 || _url.indexOf("simulacion")>-1 || _url.indexOf("e-conference")>-1 || _url.indexOf("escenarios")>-1 || _url.indexOf("votacion")>-1 || _url.indexOf("edicion")>-1 || _url.indexOf("servicio")>-1 || _url.indexOf("otros")>-1 || _url.indexOf("novedades")>-1){
    $("#cabecera > #menu").css("background","url(./images/menu2.png) left top no-repeat");
    if(is_ie6){ $("#cabecera > #menu").css("background","url(./images/menu2.jpg) left top no-repeat");    }
  }else if(_url.indexOf("galeria")>-1){
    $("#cabecera > #menu").css("background","url(./images/menu3.png) left top no-repeat");
    if(is_ie6){ $("#cabecera > #menu").css("background","url(./images/menu3.jpg) left top no-repeat");   }
  }else if(_url.indexOf("contacto")>-1){
    $("#cabecera > #menu").css("background","url(./images/menu4.png) left top no-repeat");
     if(is_ie6){  $("#cabecera > #menu").css("background","url(./images/menu4.jpg) left top no-repeat");    }
  }


    var H = getWindowSize()[1] / 2 - 450/2;
    $('#aviso').css('top',H);

    $("#cab_aviso").click(function(){
   $("#aviso").css("display","none");
    $("#bg_aviso").css("display","none");
});
$('#cat_lang').click(function(){saltarIdioma("cat");});
$('#cast_lang').click(function(){saltarIdioma("");});
$('#eng_lang').click(function(){saltarIdioma("eng");});
$(document).pngFix();
});
function saltarIdioma(idioma){
  document.location.href=""+idioma+"/"+_basename;
}
//lightbox centrado
function aviso(){
    $("#aviso").css("display","block");
    $("#bg_aviso").css("display","block");
}
$(window).resize(function() {
    var H = getWindowSize()[1] / 2 - 450/2;
    $('#aviso').css('top',H);
});

function getWindowSize() {
  var myWidth = 0, myHeight = 0;

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  return new Array(myWidth,myHeight);
}

