﻿//Hide Image Rotator
//This requires the pageWidth function to be defined previously
function align_calen(basedir) {
 if (pageWidth() < 1200) {
  var calen_div=document.getElementById('calendar_event_list');
  calen_div.style.display='none';
  //calen_div.style.width='240px';
  //calen_div.style.overflow='hidden';
  var newstitle=document.getElementById('news_title');
  newstitle.style.marginLeft='220px';
  //newstitle.style.clear='both';
  //var mainnews=document.getElementById('mainnews');
  //mainnews.style.borderLeft='0';
  //mainnews.style.clear='both';
 }
 shrink_menu_text();
 setTimeout("topbar_slideshow('"+basedir+"')", 5000);
}
//shrink text on non-home-page:
function shrink_menu_text() {
 if (pageWidth() < 900) {
   var themenu = document.getElementById('menu');
   themenu.style.fontSize='xx-small';
 }
}
//Switch Important Reminders On/Off
function toggle_ann() {
var an = document.getElementById('reminder_table');
var flecha = document.getElementById('flecha');
var flecha_src = flecha.src;
if (an.style.display != "none") {
	an.style.display = "none";
	flecha_src = flecha_src.replace('up','down');
	flecha.src = flecha_src;
} else {
	an.style.display = "block";
	flecha_src = flecha_src.replace('down','up');
	flecha.src = flecha_src;

}
}                    
//animate emergency message
function toggle_emessage () {
  jQuery('#emerg_message_content').animate({height: 'toggle'});
}

//animate background of topbar
function topbar_slideshow (basedir) {
  var num=Math.floor(Math.random()*4)+1;
  //alert(basedir+'/pix/banner'+num+'.jpg');
  //jQuery('#topbar_div').animate({backgroundPosition: '5000% 100%'});
  //jQuery('#topbar_div').animate({backgroundPosition: '100% 100%'});
  jQuery('#topbar_div').css('background-image', 'url('+basedir+'/pix/banner'+num+'.jpg)');
  setTimeout("topbar_slideshow('"+basedir+"')", 15000);
}
