/* Show / Toggle panel */
function togglePanel(panelId) {
	if($(panelId)) {
		var linkId = panelId + "_link";
		if($(panelId).visible()) {
			Effect.SlideUp($(panelId), { duration: 0.5 });
			if($(linkId).hasClassName('displayed')) {
				$(linkId).removeClassName('displayed');
			}
			//Cookie.create(panelId, 'false', 365);
			Cookie.set(panelId, 'false', 365);
		} else {
			Effect.SlideDown($(panelId), { duration: 0.5 });
			$(linkId).addClassName('displayed');
			//Cookie.create(panelId, 'true', 365);
			Cookie.set(panelId, 'true', 365);
		}
	}
}
function showPanel(panelId) {
	if($(panelId)) {
		$(panelId).show();
	}
	var linkId = panelId + "_link";
	if($(linkId)) {
		$(linkId).addClassName('displayed');
	}
}

/* Show and hide weather forecasts */
function showHideForecasts() {
	new Effect.Move('forecats-panel', { x: 0, mode: 'absolute' });
	setTimeout("new Effect.Move('forecats-panel', { x: -350, mode: 'absolute' });", 5000);
	setTimeout("new Effect.Move('forecats-panel', { x: -700, mode: 'absolute' });", 10000);
	setTimeout("new Effect.Move('forecats-panel', { x: 0, mode: 'absolute' });", 15000);
	window.setTimeout(showHideForecasts, 20000, true);
}

// Hide SuperBanner
function hideSuperBanner() { 
	//new Effect.toggle('super-banner', 'blind'); 
	document.getElementById("superbanner").style.display = 'none';
}

// Add favorie
function AddToFavorites() {  
	var title = document.title; var url = location.href;
	if (window.sidebar) // Firefox 
	window.sidebar.addPanel(title, url, '');  
	// Opera
	else if (window.opera && window.print) { 
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar'); // required to work in opera 7+  
		elem.click();
	}
	else if(document.all) // IE  
	window.external.AddFavorite(url, title);
}

// Set and get cookie
function setCookie(name, value, expire) {
  document.cookie = name + "=" + escape(value)
  + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}

function getCookie(Name){
  var search = Name + "=";
  if (document.cookie.length > 0){
    offset = document.cookie.indexOf(search);
    if (offset != -1){
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(offset, end));
    }
  }
}


// Fontsize
function largerFontSize() {
	$("articleBodyFontSizeRegular").hide();
	$("articleBodyFontSizeLarge").show();
	$("articleBody").setStyle({ fontSize: '15px' });
	$.cookie('articleBody', 'large', {expires: 45, path: '/'});
}

function smallerFontSize() {
	$("articleBodyFontSizeRegular").show();
	$("articleBodyFontSizeLarge").hide();
	$("articleBody").setStyle({ fontSize: '13px' });
	$.cookie('articleBody', null, {path: '/'});
}