var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
	var pageTracker = _gat._getTracker("UA-304590-3");
	pageTracker._trackPageview();
} 
catch(err) {}

var closeTimer = null;
var container = null;
var menuContainer = null;
//var menu = null;

var textSize = null;
textSize = parseInt(getCookie('font_size'));
if(!textSize) textSize = 10;

function showMenu(){
  if(menuContainer != null) menuContainer.className = "menu-on";
  if(closeTimer) clearTimeout(closeTimer);
  closeTimer = null;
}
function hideMenu(){
  if(!closeTimer && menuContainer != null){
    closeTimer = setTimeout(function(){
      menuContainer.className = "menu-off";
    },500);
  }
}

function resizeText(newSize){
  if( (newSize < 0 && textSize > 6 ) || (newSize > 0 && textSize < 15) ){
    textSize += newSize;
    setSize(textSize);
  }
}
function setSize(newSize){
  if(container != null) container.style.fontSize = (newSize/10) + "em";
  setCookie('font_size',newSize);
}

function getCookie(key){
  var start = document.cookie.indexOf( key + "=" );
  var len = start + key.length + 1;
  if ( ( !start ) && ( key != document.cookie.substring( 0, key.length ) ) ){
    return null;
  }
  if ( start == -1 ) return null;
  var end = document.cookie.indexOf( ";", len );
  if ( end == -1 ) end = document.cookie.length;
  
  return unescape( document.cookie.substring( len, end ) );
}
function setFullCookie( key, value, path, expires){
  var today = new Date();
  today.setTime( today.getTime() );
  
  if(expires) expires = expires * 1000 * 60 * 60 * 24;
  var expires_date = new Date( today.getTime() + expires );
  
  document.cookie = 
    key + "=" + escape( value ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" );
}
function setCookie(key, value){
  var daysToExpire = 365;
  setFullCookie(key, value, '/', daysToExpire);
}

function showElement(element){
  element.className = "no-fade";
}
function fadeElement(element){
  element.className = "fade";
}

function reveal(){
  setTimeout('hideMenu()',1200);
}

function init(){
  try{
    resizer = document.getElementById('resizer');
    container = document.getElementById('container');
    menuContainer = document.getElementById('pageHeadLeft');
    menu = document.getElementById('menu');
  }
  catch(e){}
  //setContentWidth();
}

window.onload = init;
//window.onresize = setContentWidth;