$(document).ready(function(){
	jQuery.each(jQuery.browser, function(i, val) {
		if(file_exists("eam-css/eam-css-ie-9.css") ){
			if(i=="msie" && jQuery.browser.version.substr(0,3)=="9.0"){
				$('head').append('<link rel="stylesheet" href="eam-css/eam-css-ie-9.css" type="text/css" />');
			} 
		}
		if (file_exists("eam-css/eam-css-moz-6.css")){
			if($.browser.mozilla){
				$('head').append('<link rel="stylesheet" href="eam-css/eam-css-moz-6.css" type="text/css" />');
			}
		}
		if (file_exists("eam-css/eam-css-chrome.css")){
			if($.browser.opera){
				$('head').append('<link rel="stylesheet" href="eam-css/eam-css-chrome.css" type="text/css" />');
			}
		}
		if (file_exists("eam-css/eam-css-chrome.css")){
			if($.browser.safari){
				$('head').append('<link rel="stylesheet" href="eam-css/eam-css-chrome.css" type="text/css" />');
			}
		}
		if (file_exists("eam-css/eam-css-chrome.css")){
			if($.browser.chrome){
				$('head').append('<link rel="stylesheet" href="eam-css/eam-css-chrome.css" type="text/css" />');
			}
		}
	});
	
	/*IN - NOTICIAS INICIO*/
	var current=0;
	function autoAdvance()
	{
		switch (current)
		{
		case 0:
			$("#noticia1").hide();
			$("#noticia2").hide();
			$("#noticia3").hide();
			$("#noticia4").hide();
			$("#noticia0").show();
			$("#0").removeClass("hipervinculoMenuNoticiasIndex");
			$("#0").addClass("hipervinculoMenuNoticiasIndexSele");
			$("#1").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#1").addClass("hipervinculoMenuNoticiasIndex");
			$("#2").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#2").addClass("hipervinculoMenuNoticiasIndex");
			$("#3").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#3").addClass("hipervinculoMenuNoticiasIndex");
			$("#4").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#4").addClass("hipervinculoMenuNoticiasIndex");
			$('div.triangulodeSeleccion').removeClass('triangulodeSeleccion').addClass('triangulodeSeleccionNO');
			$('#s0').addClass('triangulodeSeleccion');
			break;
		case 1:
			$("#noticia0").hide();
			$("#noticia1").show();
			$("#noticia2").hide();
			$("#noticia3").hide();
			$("#noticia4").hide();
			$("#0").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#0").addClass("hipervinculoMenuNoticiasIndex");
			$("#2").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#2").addClass("hipervinculoMenuNoticiasIndex");
			$("#3").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#3").addClass("hipervinculoMenuNoticiasIndex");
			$("#4").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#4").addClass("hipervinculoMenuNoticiasIndex");
			$("#1").addClass("hipervinculoMenuNoticiasIndexSele");
			$("#1").removeClass("hipervinculoMenuNoticiasIndex");
			$('div.triangulodeSeleccion').removeClass('triangulodeSeleccion').addClass('triangulodeSeleccionNO');
			$('#s1').addClass('triangulodeSeleccion');
			break;
		case 2:
			$("#noticia0").hide();
			$("#noticia1").hide();
			$("#noticia2").show();
			$("#noticia3").hide();
			$("#noticia4").hide();
			$("#0").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#0").addClass("hipervinculoMenuNoticiasIndex");
			$("#1").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#1").addClass("hipervinculoMenuNoticiasIndex");
			$("#3").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#3").addClass("hipervinculoMenuNoticiasIndex");
			$("#4").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#4").addClass("hipervinculoMenuNoticiasIndex");
			$("#2").addClass("hipervinculoMenuNoticiasIndexSele");
			$("#2").removeClass("hipervinculoMenuNoticiasIndex");
			$('div.triangulodeSeleccion').removeClass('triangulodeSeleccion').addClass('triangulodeSeleccionNO');
			$('#s2').addClass('triangulodeSeleccion');
			break;
		case 3:
			$("#noticia0").hide();
			$("#noticia1").hide();
			$("#noticia2").hide();
			$("#noticia3").show();
			$("#noticia4").hide();
			$("#0").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#0").addClass("hipervinculoMenuNoticiasIndex");
			$("#1").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#1").addClass("hipervinculoMenuNoticiasIndex");
			$("#2").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#2").addClass("hipervinculoMenuNoticiasIndex");
			$("#4").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#4").addClass("hipervinculoMenuNoticiasIndex");
			$("#3").addClass("hipervinculoMenuNoticiasIndexSele");
			$("#3").removeClass("hipervinculoMenuNoticiasIndex");
			$('div.triangulodeSeleccion').removeClass('triangulodeSeleccion').addClass('triangulodeSeleccionNO');
			$('#s3').addClass('triangulodeSeleccion');
			break;
		case 4:
			$("#noticia0").hide();
			$("#noticia1").hide();
			$("#noticia2").hide();
			$("#noticia3").hide();
			$("#noticia4").show();
			$("#0").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#0").addClass("hipervinculoMenuNoticiasIndex");
			$("#1").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#1").addClass("hipervinculoMenuNoticiasIndex");
			$("#2").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#2").addClass("hipervinculoMenuNoticiasIndex");
			$("#3").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#3").addClass("hipervinculoMenuNoticiasIndex");
			$("#4").addClass("hipervinculoMenuNoticiasIndexSele");
			$("#4").removeClass("hipervinculoMenuNoticiasIndex");
			$('div.triangulodeSeleccion').removeClass('triangulodeSeleccion').addClass('triangulodeSeleccionNO');
			$('#s4').addClass('triangulodeSeleccion');
			break;
		case 5:
			current=0;
			$("#noticia0").show();
			$("#noticia1").hide();
			$("#noticia2").hide();
			$("#noticia3").hide();
			$("#noticia4").hide();
			$("#1").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#1").addClass("hipervinculoMenuNoticiasIndex");
			$("#2").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#2").addClass("hipervinculoMenuNoticiasIndex");
			$("#3").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#3").addClass("hipervinculoMenuNoticiasIndex");
			$("#4").removeClass("hipervinculoMenuNoticiasIndexSele");
			$("#4").addClass("hipervinculoMenuNoticiasIndex");
			$("#0").addClass("hipervinculoMenuNoticiasIndexSele");
			$("#0").removeClass("hipervinculoMenuNoticiasIndex");
			$('div.triangulodeSeleccion').removeClass('triangulodeSeleccion').addClass('triangulodeSeleccionNO');
			$('#s0').addClass('triangulodeSeleccion');
			break;
		default:
			current=0;
		}
		current++;
	}
	var changeEvery = 5;
	var itvl = setInterval(function(){autoAdvance()},changeEvery*1000);
	$('a.hipervinculoMenuNoticiasIndex').mouseover(function(e,keepScroll){
		clearInterval(itvl);
		var pos = parseInt($(this,"a").attr("id"));
		current=pos;
		autoAdvance();
	});
	$('a.hipervinculoMenuNoticiasIndexSele').mouseover(function(e,keepScroll){
		clearInterval(itvl);
		var pos = parseInt($(this,"a").attr("id"));
		current=pos;
		autoAdvance();
	});
	current=1;
	autoAdvance();
	current=0;
	autoAdvance();
	/*OUT - NOTICIAS INICIO*/
});
function file_exists (url) {
    var req = this.window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
    if (!req) {throw new Error('XMLHttpRequest not supported');}
    req.open('HEAD', url, false);
    req.send(null);
    if (req.status == 200){
        return true;
    }
    return false;
}

//Especificamos a jQuery los navegadores (Útil para diferenciar Safari de Chrome).
var userAgent = navigator.userAgent.toLowerCase();
jQuery.browser = {
	version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
	chrome: /chrome/.test( userAgent ),
	safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
	opera: /opera/.test( userAgent ),
	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};
function seleccionarImagen(imag){ 
   imag.style.opacity='1';
   imag.style.border='2px solid #333';
   //imag.width='188';
   //imag.height='188';
}
function deseleccionarImagen(imag){ 
   imag.style.opacity='.8';
   imag.style.border='2px solid #FFF';
   //imag.width='192';
   //imag.height='192';
} 
function alertSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth; myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth; myHeight = document.body.clientHeight;
	}
	if(myDiv.offsetTop<=(myHeight-160))
	{
		myWidth=myHeight-160;
		myDiv.style.top = myWidth + 'px';
	}
}

function cambiar_color_over(celda){ 
   celda.style.backgroundColor="#A2CFFD";
} 
function cambiar_color_out(celda){ 
   celda.style.backgroundColor="#eeeeee";
}
function cambiar_color_over_hist(celda){ 
   celda.style.backgroundColor="#A2CFFD";
} 
function cambiar_color_out_hist(celda){ 
   celda.style.backgroundColor="#ffffff";
}
function cambiar_color_over_dep(celda,celda2){ 
   celda.style.backgroundColor="#A2CFFD";
   celda.style.borderColor="#000000";
   celda2.style.backgroundColor="#A2CFFD";
   celda2.style.borderColor="#000000";
} 
function cambiar_color_out_dep(celda,celda2){ 
   celda.style.backgroundColor="#ffffff";
   celda.style.borderColor="#cccccc";
   celda2.style.backgroundColor="#ffffff";
   celda2.style.borderColor="#cccccc";
}
function depabrir(var1) {
div = document.getElementById('01');
div.style.display = 'none';
div = document.getElementById('02');
div.style.display = 'none';
div = document.getElementById('03');
div.style.display = 'none';
div = document.getElementById('04');
div.style.display = 'none';
div = document.getElementById('05');
div.style.display = 'none';
div = document.getElementById('06');
div.style.display = 'none';
div = document.getElementById('07');
div.style.display = 'none';
div = document.getElementById('08');
div.style.display = 'none';
div = document.getElementById('09');
div.style.display = 'none';
div = document.getElementById('010');
div.style.display = 'none';
div = document.getElementById('011');
div.style.display = 'none';
div = document.getElementById('012');
div.style.display = 'none';
div = document.getElementById('013');
div.style.display = 'none';
div = document.getElementById('014');
div.style.display = 'none';
div = document.getElementById('015');
div.style.display = 'none';
div = document.getElementById(var1);
div.style.display = '';

}
function mostrardiv() {

div = document.getElementById('divOcultar');
document.getElementById('divXCambiar2').innerHTML = "";

div.style.display = '';

}

function cerrar() {

div = document.getElementById('divOcultar');
document.getElementById('divXCambiar2').innerHTML = "&nbsp;";


div.style.display='none';
div = document.getElementById('facebook');
div.style.opacity = '.8';
div = document.getElementById('privado');
div.style.opacity = '.8';
div = document.getElementById('correo');
div.style.opacity = '.8';
div = document.getElementById('estado');
div.style.opacity = '.8';
}
function mos() {

div = document.getElementById('ocu1');
div.style.display = '';

}

function cer() {

div = document.getElementById('ocu1');
div.style.display='none';

}
function cambiar(a)
{
	mostrardiv();
	switch (a) { 
   	case 1: 
      	 document.getElementById('divXCambiar').innerHTML = "Accede a la p&aacute;gina oficial<br />de Facebook de la Escuela<br />de Aviaci&oacute;n Militar";
		 div = document.getElementById('facebook');
		 div.style.opacity = '1';
      	 break 
   	case 2: 
      	 document.getElementById('divXCambiar').innerHTML = "Accede al correo Privado";
		 div = document.getElementById('correo');
		 div.style.opacity = '1';
      	 break 
   	case 3: 
      	 document.getElementById('divXCambiar').innerHTML = "Accede al &Aacute;rea Privada";
		 div = document.getElementById('privado');
		 div.style.opacity = '1';
      	 break 
   	case 4: 
      	 document.getElementById('divXCambiar').innerHTML = "Ir al INICIO"; 
      	 break 
   	case 5: 
      	 document.getElementById('divXCambiar').innerHTML = "Encontra a la Escuela<br />en el mapa"; 
      	 break 
   	case 6:
		 document.getElementById('divXCambiar').innerHTML = "Recorre la historia<br />de la Escuela"; 
      	 break 
   	case 7: 
      	 document.getElementById('divXCambiar').innerHTML = "Conoce la Misión<br />de la Escuela"; 
      	 break  
	case 8: 
      	 document.getElementById('divXCambiar').innerHTML = "Conoce las Autoridades<br />actuales y pasadas<br />de la Escuela"; 
      	 break
	case 9: 
      	 document.getElementById('divXCambiar').innerHTML = "Carta Bienvenida"; 
      	 break
	case 10: 
      	 document.getElementById('divXCambiar').innerHTML = "Conoce las razones de<br />por que elegir nuestra Escuela"; 
      	 break
	case 11: 
      	 document.getElementById('divXCambiar').innerHTML = "Visita virtual<br />visita 360&deg;"; 
      	 break
	case 12: 
      	 document.getElementById('divXCambiar').innerHTML = "Requisitos para el ingreso<br />a la escuela a la Escuela"; 
      	 break
	case 13: 
      	 document.getElementById('divXCambiar').innerHTML = "Actividades posteriores<br />al ingreso a la Escuela"; 
      	 break
	case 14: 
      	 document.getElementById('divXCambiar').innerHTML = "Descarga los formularios<br />de ingreso"; 
      	 break
	case 15: 
      	 document.getElementById('divXCambiar').innerHTML = "Ver la documentaci&oacute;n<br />del apoyo educativo"; 
      	 break
	case 16: 
      	 document.getElementById('divXCambiar').innerHTML = "Preguntas Frecuentes"; 
      	 break
	case 17: 
      	 document.getElementById('divXCambiar').innerHTML = "Plan de Estudio<br />Academico"; 
      	 break
	case 18: 
      	 document.getElementById('divXCambiar').innerHTML = "Plan de Instrucci&oacute;n<br />Militar"; 
      	 break
	case 19: 
      	 document.getElementById('divXCambiar').innerHTML = "Volovelismo"; 
      	 break
	case 20: 
      	 document.getElementById('divXCambiar').innerHTML = "Deportes"; 
      	 break
	case 21: 
      	 document.getElementById('divXCambiar').innerHTML = "Conoce las actividades<br />del cadete en la escuela"; 
      	 break
	case 22: 
      	 document.getElementById('divXCambiar').innerHTML = "Descubr&iacute; el Escalaf&oacute;n Aire<br />y sus especialidades"; 
      	 break
	case 23: 
      	 document.getElementById('divXCambiar').innerHTML = "Descubr&iacute; el Escalaf&oacute;n General<br />y sus especialidades"; 
      	 break
	case 24: 
      	 document.getElementById('divXCambiar').innerHTML = "Descubr&iacute; el Escalaf&oacute;n T&eacute;cnico<br />y sus especialidades"; 
      	 break
	case 25: 
      	 document.getElementById('divXCambiar').innerHTML = "Proyecci&oacute;n Profesional";
      	 break
	case 26: 
      	 document.getElementById('divXCambiar').innerHTML = "Eventos Especiales"; 
      	 break
	case 27: 
      	 document.getElementById('divXCambiar').innerHTML = "Noticias"; 
      	 break
	case 28: 
      	 document.getElementById('divXCambiar').innerHTML = "Viasita alguno de nuestros<br />link de interes"; 
      	 break
	case 29: 
      	 document.getElementById('divXCambiar').innerHTML = "Multimedia<br />Imagenes"; 
      	 break
	case 30: 
      	 document.getElementById('divXCambiar').innerHTML = "Multimedia<br />Audios"; 
      	 break
	case 31: 
      	 document.getElementById('divXCambiar').innerHTML = "Multimedia<br />Videos"; 
      	 break
	case 32: 
      	 document.getElementById('divXCambiar').innerHTML = "Banda de M&uacute;sica"; 
      	 break
	case 33: 
      	 document.getElementById('divXCambiar').innerHTML = "100 A&ntilde;os Escuela"; 
      	 break
	case 34: 
      	 document.getElementById('divXCambiar').innerHTML = "30 A&ntilde;os Malvinas"; 
      	 break
	case 35: 
      	 document.getElementById('divXCambiar').innerHTML = "Ciencia y Tecnolog&iacute;a"; 
      	 break
	case 36: 
      	 document.getElementById('divXCambiar').innerHTML = "Consult&aacute; el estado de tu<br />Inscripci&oacute;n"; 
		 div = document.getElementById('estado');
		 div.style.opacity = '1';
      	 break
   	default: 
      	 cerrar(); 
	}	 
}	
// speed in milliseconds
var scrollSpeed = 70;

// set the default position
var current = 0;

// set the direction
var direction = 'h';

function bgscroll(){

	// 1 pixel row at a time
	current -= 1;

	// move the background with backgrond-position css properties
	$('body').css("backgroundPosition", (direction == 'h') ? current+"px 0" : "0 " + current+"px");

}

//Calls the scrolling function repeatedly
 setInterval("bgscroll()", scrollSpeed);
