<!--
//PRELOAD IMAGES
var myimages=new Array()
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
	myimages[i]=new Image()
	myimages[i].src=preloadimages.arguments[i]
	}
}

//TEXT RESIZE
var prefsLoaded = false;
function NormalFontSize(){
	setFontSize(75);
	createCookie("fontSize", 75, 365);
};
function IncreasedFontSize(){
	setFontSize(85);
	createCookie("fontSize", 85, 365);
};
function DecreasedFontSize(){
	setFontSize(65);
	createCookie("fontSize", 65, 365);
};
function setFontSize(fontSize){
	var stObj = (document.getElementById) ? document.getElementById('content_area') : document.all('content_area');
	document.body.style.fontSize = fontSize + '%';
};


function setUserOptions(){
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);

	if(!prefsLoaded){

		cookie = readCookie("fontSize");
		currentFontSize = cookie ? cookie : defaultFontSize;
		setFontSize(currentFontSize);
		
		prefsLoaded = true;
	}

}

//STYLE SWITCHER
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  createCookie("style", title, 365);
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

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

function readCookie(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;
}

var cookie = readCookie('style');
var title = cookie ? cookie : getPreferredStyleSheet();
 if ((title == null) && (screen.width>=1280) ) {
setActiveStyleSheet('WideScreen');
 } else {
setActiveStyleSheet(title);
}
var type = 1;

function displayLink(type) {
  var agt = navigator.userAgent.toLowerCase();
  var sn_url = "http://www.eu2012.pl";
  var sn_title = "EU 2012";
  var sn_link = "<img src=\"templates/em108/images/award_star_gold_3.gif\" alt=\"Dodaj stronę główną do ulubionych\" />";
  if (type == 3)
  {
  sn_url = top.location.href;
  sn_title = top.document.title;
  sn_link = "<img src=\"templates/em108/images/award_star_add.gif\" alt=\"Dodaj tą podstronę do ulubionych\" />";
  }
  
    if ((agt.indexOf("opera") != -1))
    {
      document.write("<a href=\"" + sn_url + "\" title=\"Dodaj tą podstronę do ulubionych\" rel=\"sidebar\">" + sn_link + "</a>");
    } else {
      document.write("<a href=\"javascript:addBookmark('" + sn_title + "','" + sn_url + "');\" title=\"Dodaj tą podstronę do ulubionych\" >" + sn_link + "</a>");

    }
}

function addBookmark(title,url) {

  var msg_netscape = "NetScape message";
  var msg_opera    = "This function does not work with this version of Opera.  Please bookmark us manually.";
  var msg_other    = "Your browser does not support automatic bookmarks.  Please bookmark us manually.";
  var agt          = navigator.userAgent.toLowerCase();


  if (agt.indexOf("opera") != -1) 
  {
    if (window.opera && window.print)
    {
      return true;
    } else 
    {
      alert(msg_other);
    }
  }    
  else if (agt.indexOf("firefox") != -1) window.sidebar.addPanel(title,url,"");
  else if ((agt.indexOf("msie") != -1) && (parseInt(navigator.appVersion) >=4)) window.external.AddFavorite(url,title); 
  else if (agt.indexOf("netscape") != -1) window.sidebar.addPanel(title,url,"")         
  else if (window.sidebar && window.sidebar.addPanel) window.sidebar.addPanel(title,url,""); 
  else alert(msg_other);
  
}
//-->

