var feedsExist;
function change_size(whatstyle,firsttime) {
 document.getElementById('small').disabled=true;
 document.getElementById('medium').disabled=true;
 document.getElementById('large').disabled=true;
 document.getElementById(whatstyle).disabled=false;
 eraseCookie('resize_fontsize');
 createCookie('resize_fontsize',whatstyle,'1');
 if (firsttime!='first_time') {set_size_button(whatstyle);}
}
function set_feedSize() {
 try {
  sizeToSet = document.location.href.split('?')[1];
  if (sizeToSet) {
     document.getElementById('small').disabled=true;
     document.getElementById('medium').disabled=true;
     document.getElementById('large').disabled=true;
     document.getElementById(sizeToSet).disabled=false;
  }
 } catch (e){}
}

function set_size_button(new_style) {

 document.getElementById('button_small').style.backgroundImage="url(images/schriftgroesse_1on.gif)";
 document.getElementById('button_medium').style.backgroundImage="url(images/schriftgroesse_2on.gif)";
 document.getElementById('button_large').style.backgroundImage="url(images/schriftgroesse_3on.gif)";
 document.getElementById('button_'+new_style).style.backgroundImage="url(images/blind.gif)";

}

var current_style;
function set_size_first_time() {
 if (!readCookie('resize_fontsize')) {
   document.getElementById('small').disabled=false;
   current_style='small';
 } else {
   current_style=readCookie('resize_fontsize')
   change_size(current_style,'first_time');
 }

}
if (document.getElementById('small')) {
    set_size_first_time();
}









// cookie

function Cookiemanager(name,defaultExpiration,expirationUnits,defaultDomain,defaultPath) {
 var url = window.location.href;
 var applicationName = url.substring(url.indexOf('WebObjects') + 11,url.indexOf('.woa'));
 var adaptorPrefix = url.substring(url.substring(0,url.indexOf("/WebObjects")).lastIndexOf("/"),url.indexOf("/WebObjects"));
  this.name = name;
  this.defaultExpiration = this.getExpiration(defaultExpiration,expirationUnits);
  this.defaultDomain = (defaultDomain)?defaultDomain:document.domain;
  this.defaultPath = (defaultPath)?defaultPath:adaptorPrefix+'/WebObjects/'+applicationName+'.woa';
  this.cookies = new Object();
  this.expiration = new Object();
  this.domain = new Object();
  this.path = new Object();
  window.onunload = new Function (this.name+'.setDocumentCookies();');
 this.getDocumentCookies();
 }
Cookiemanager.prototype.getExpiration = function(expiration,units) {
  expiration = (expiration)?expiration:7;
  units = (units)?units:'days';
  var date = new Date();
  switch(units) {
  case 'years':
   date.setFullYear(date.getFullYear() + expiration);
   break;
  case 'months':
   date.setMonth(date.getMonth() + expiration);
   break;
  case 'days':
   date.setTime(date.getTime()+(expiration*24*60*60*1000));
   break;
  case 'hours':
   date.setTime(date.getTime()+(expiration*60*60*1000));
   break;
  case 'minutes':
   date.setTime(date.getTime()+(expiration*60*1000));
   break;
  case 'seconds':
   date.setTime(date.getTime()+(expiration*1000));
   break;
  default:
   date.setTime(date.getTime()+expiration);
   break;
  }
 return date.toGMTString();
 }
Cookiemanager.prototype.getDocumentCookies = function() {
 var cookie,pair;
  var cookies = document.cookie.split(';');
  var len = cookies.length;
 for(var i=0;i < len;i++) {
  cookie = cookies[i];
  while (cookie.charAt(0)==' ') cookie = cookie.substring(1,cookie.length);
   pair = cookie.split('=');
   this.cookies[pair[0]] = pair[1];
  }
 }


Cookiemanager.prototype.setDocumentCookies = function() {
 var expires = '';
 var cookies = '';
 var domain = '';
 var path = '';
 for(var name in this.cookies) {
  expires = (this.expiration[name])?this.expiration[name]:this.defaultExpiration;
  path = (this.path[name])?this.path[name]:this.defaultPath;
  domain = (this.domain[name])?this.domain[name]:this.defaultDomain;
  if (name.indexOf('DB24') == '-1' && name.indexOf('ID_STR') == '-1' && name != "" && name.indexOf('undefined') == '-1') {
     cookies = name + '=' + this.cookies[name] + '; expires=' + expires + '; path=' + path + '; host=' + domain;
     document.cookie = cookies;
  }
 }
 return true;
 }

Cookiemanager.prototype.getCookie = function(cookieName) {
 var cookie = this.cookies[cookieName]
 return (cookie)?cookie:false;
 }
Cookiemanager.prototype.setCookie = function(cookieName,cookieValue,expiration,expirationUnits,domain,path) {
 this.cookies[cookieName] = cookieValue;
 if (expiration) this.expiration[cookieName] = this.getExpiration(expiration,expirationUnits);
 if (domain) this.domain[cookieName] = domain;
 if (path) this.path[cookieName] = path;
 return true;
 }
var cookieManager = new Cookiemanager('cookieManager',1,'years');

