var itemArray = new Array();
var linkArray = new Array();

function toggleItinerary(item, link) {
	var itineraryItem = document.getElementById(item);
	var itineraryLink = document.getElementById(link);
	
	for(var i=0; i<itemArray.length; i++) {
		itemArray[i].style.display = 'none';
		
	}
		
	for(var j=0; j<itemArray.length; j++) {
		linkArray[j].className = '';
	}
		
	if(itineraryItem.style.display == 'none' ) {
		itineraryItem.style.display = 'block';
		} else {
		itineraryItem.style.display = 'none';		
	}
	
	if(itineraryLink.className == '') {
		itineraryLink.className = 'current';
	} else {
		itineraryLink.className = '';
	}
	
	return false;
}



/**************** mini map **********************/


function toggleMiniMap() {
	var mapItem = document.getElementById('miniMap');
	
	if(mapItem.style.display == 'none') {
		mapItem.style.display = 'block';
	} else {
		mapItem.style.display = 'none';
	}
	
	return false;
	
}

/* *********** Text Size **************** */

var textSize = 70; // %
var cookieVal = getCookie("textSize");

var status = 0;

if (cookieVal !=  null) {
  textSize = cookieVal*1;
  status = (cookieVal == 80) ? 1 : 0;
}

function setTextSize(size) {
  size = (size > 80) ? 80 : (size < 70) ? 70 : size; 
  document.getElementsByTagName("body")[0].style.fontSize = size+'%';
  textSize = size;
  setCookie("textSize", textSize);
}



function upTextSize() {
  setTextSize(textSize+10);
  return false;
}

function downTextSize() {
  setTextSize(textSize-10);
  return false;
}



function textIncrease() {
	
	if(status == 0) {
		upTextSize();
		status = 1;
	} else if(status != 0) {
		downTextSize();
		status = 0;
	}
}


function setInitalTextSize() {
  if (document.getElementsByTagName("body").length > 0) {
    setTextSize(textSize);
    clearTimeout(setTextSizeTimer);
  } else {
    setTextSizeTimer = setTimeout('setInitalTextSize();', 1);
  }
}
//var setTextSizeTimer = setTimeout('setInitalTextSize();', 1); // Start a timeout that will check every .001 seconds to see if body has been created yet, and if so, set its text size




/** cookie handling code **/

function setCookie(name,value,days)
{
    var expires = "";
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
  document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}