Fx.Font = new Class({
	initialize: function(elements, sid, gid, growsize){
		this.growsize = growsize || 2; 
		this.elements = [];
		
		var currentSize;
 		elements.each(function(el){
			currentSize = el.getStyle('font-size').toInt();
			if(Cookie.get != null && (size = Cookie.get('fontSize')) && size == 'large'){
				el.setStyle('font-size',currentSize+this.growsize+'px');
			}
			this.elements.push([el,currentSize]);									   
		},this);
		
		$(gid).onclick = function(){this.grow()}.bind(this);
		$(sid).onclick = function(){this.shrink()}.bind(this);
	},
	grow: function(){
		this.elements.each(function(el){
			if(el[0].getStyle('font-size').toInt() == el[1])
				el[0].effect('font-size',{duration:300,unit:'px'}).custom(el[1],el[1]+this.growsize);			
		},this);
		Cookie.set('fontSize','large',1);
	},
	shrink: function(){
		this.elements.each(function(el){
			if(el[0].getStyle('font-size').toInt() == el[1]+this.growsize)
				el[0].effect('font-size',{duration:300,unit:'px'}).custom(el[1]+this.growsize, el[1]);
		},this);
		Cookie.set('fontSize','small',1);		
	}						
});

window.onload = function(){
new Fx.Font($$('p,h3'),$('shrink'),$('grow'),$('growmore'));
}
	
	
	
//SUBMENU 

function extractPageName(hrefString)
{
	var arr = hrefString.split('.');
	arr = arr[arr.length-2].split('/');
	return arr[arr.length-1].toLowerCase();		
}

function setActiveMenu(arr, crtPage)
{
	for(var i=0; i < arr.length; i++)
		if(extractPageName(arr[i].href) == crtPage)
		{
			arr[i].className = "current";
			arr[i].parentNode.className = "current";
		}
}

function setPage(){
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("nav")!=null) 
		setActiveMenu(document.getElementById("nav").getElementsByTagName("a"), extractPageName(hrefString));
		
	if (document.getElementById("submenu")!=null) 
		setActiveMenu(document.getElementById("submenu").getElementsByTagName("a"), extractPageName(hrefString));
		
}


//function that gets the page id from the URL
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
  	var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}
			
//Accordion
	window.addEvent('domready', function() {

	var hashes = getURLParam("id");
	if(hashes == 1) { var elementId = 0; }
	if(hashes == 2) { var elementId = 1; }
	if(hashes == 3) { var elementId = 2; }
	
	var accordion = new Accordion('span.atStart', 'ul.atStart', {
		alwaysHide: true,
		opacity: false,
		//display: false,
		display: elementId,
		onActive: function(toggler, element){
		toggler.setStyle('color', '#cd3202');
		toggler.setStyle('display', 'block');
		toggler.setStyle('width', '140px');
		toggler.setStyle('height', '24px');
		toggler.setStyle('line-height', '24px');
		toggler.setStyle('padding-left', '5px');
		toggler.setStyle('border-bottom', 'none');
		},
 
		onBackground: function(toggler, element){
		toggler.setStyle('color', '#000');
		toggler.setStyle('display', 'block');
		toggler.setStyle('width', '140px');
		toggler.setStyle('height', '24px');
		toggler.setStyle('line-height', '24px');
		toggler.setStyle('padding-left', '5px');
		toggler.setStyle('border-bottom', '1px solid #000');
		toggler.setStyle('cursor', 'pointer');
		}
		}, $('accordion'));
 
	});