window.onload=get_cookie;

function get_cookie() {
  var search = 'getSizeFont';
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) {
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
	if(returnvalue == '=1'){
		document.getElementById("center").style.fontSize = "1em";
	}
	if(returnvalue == '=2'){
		document.getElementById("center").style.fontSize = "0.8em";
	}
	if(returnvalue == '=3'){
		document.getElementById("center").style.fontSize = "0.6em";
	}
  //return returnvalue;
}


function increaseFontSize() {
	document.getElementById("center").style.fontSize = "1em";
	document.cookie="getSizeFont=1";
}

function normalFontSize() {
	document.getElementById("center").style.fontSize = "0.8em";
	document.cookie="getSizeFont=2";
}

function decreaseFontSize() {
	document.getElementById("center").style.fontSize = "0.6em";
	document.cookie="getSizeFont=3";
}

/*
 * SlideShow object
 *
 * @param name Variable name that reference the object
 * @param img Image object
 * @param pictureList Array of pictures
 * @param delay Delay between rotations in millisecond
 */
function SlideShow(name, img, pictureList, delay) {
	this.name = name;
	this.img = img;
	this.delay = delay;
	this.imgArray = new Array();
	
	for(var i = 0; i < pictureList.length; i++) {
		var img = new Image();
		img.src = pictureList[i];
		this.imgArray[i] = img;
	}
		
	this.start = function() {
		this.rotate(0);
	}
	
	this.rotate = function(index) {
		this.img.src = this.imgArray[index].src;
		
		index++;
		if (index >= this.imgArray.length)
			index = 0;
		setTimeout(this.name + ".rotate(" + index + ")", this.delay);
	}
}

function goTo(anchor) {
	if (anchor != null && anchor != "")
		document.location = anchor;
}

function isEmail(email) {
	var re = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;

	if (!re.test(email))
		return false;

	return true;
}

function showSubMenu(li) {
	var bName = navigator.appName;
	var bVersion = parseInt(navigator.appVersion);
	if (bName != "Microsoft Internet Explorer" || bVersion > 6)
		return;
	
	var subMenu = li.getElementsByTagName("ul")[0];
	subMenu.style.display = "block";
}

function hideSubMenu(li) {
	var bName = navigator.appName;
	var bVersion = parseInt(navigator.appVersion);
	if (bName != "Microsoft Internet Explorer" || bVersion > 6)
		return;
	
	var subMenu = li.getElementsByTagName("ul")[0];
	subMenu.style.display = "none";
}