function GetCookieVal(b){var a=document.cookie.indexOf(";",b);if(a==-1){a=document.cookie.length}return unescape(document.cookie.substring(b,a))}function GetCookie(d){var b=d+"=";var f=b.length;var a=document.cookie.length;var e=0;while(e<a){var c=e+f;if(document.cookie.substring(e,c)==b){return GetCookieVal(c)}e=document.cookie.indexOf(" ",e)+1;if(e==0){break}}return null}function SetCookie(c,e){var a=SetCookie.arguments;var h=SetCookie.arguments.length;var b=(2<h)?a[2]:null;var g=(3<h)?a[3]:null;var d=(4<h)?a[4]:null;var f=(5<h)?a[5]:false;document.cookie=c+"="+escape(e)+((b==null)?"":("; expires="+b.toGMTString()))+((g==null)?"":("; path="+g))+((d==null)?"":("; domain="+d))+((f==true)?"; secure":"")}function SetCookieOneYear(a,c){var b=new Date();b.setTime(b.getTime()+(24*60*60*1000*360));SetCookie(a,c,b,"/",null,false)}function SetCookieOneMonth(a,c){var b=new Date();b.setTime(b.getTime()+(24*60*60*1000*30));SetCookie(a,c,b,"/",null,false)};

var sKeyF="NeuhauserFontCookie";
function SetElSize(size) {
  var usedId = "";

  var commonSize = 12;
  var h1Size = 14;
  var h2Size = 14;
  var h3Size = 13;

  if(size == 's') {
    commonSize = 12;
    h1Size = 16;
    h2Size = 16;
    h3Size = 13;
  }
  if(size == 'm') {
    commonSize = 14;
    h1Size = 18;
    h2Size = 18;
    h3Size = 15;
  }
  if(size == 'l') {
    commonSize = 16;
    h1Size = 20;
    h2Size = 20;
    h3Size = 17;
  }

  var fs_container = document.getElementById('content-center');
  usedId = 'content-center';
  if(fs_container == null)
  {
      fs_container = document.getElementById('content-slider');
      usedId = 'content-slider';
  }
  
  fs_container.style.fontSize=commonSize+'px';

  var p = fs_container.getElementsByTagName('p');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=commonSize+'px';
  }

  var p = fs_container.getElementsByTagName('th');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=commonSize+'px';
  }

  var p = fs_container.getElementsByTagName('td');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=commonSize+'px';
  }

  if(usedId != 'content-slider')
  {
    var p = fs_container.getElementsByTagName('li');
    for(i=0;i<p.length;i++) {
      p[i].style.fontSize=commonSize+'px';
    }
  }

  var p = fs_container.getElementsByTagName('input');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=commonSize+'px';
  }

  var p = fs_container.getElementsByTagName('select');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=commonSize+'px';
  }

  var p = fs_container.getElementsByTagName('textarea');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=commonSize+'px';
  }

  var p = fs_container.getElementsByTagName('h1');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=h1Size+'px';
    p[i].style.lineHeight=(h1Size+2)+'px';
  }
  var p = fs_container.getElementsByTagName('h2');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=h2Size+'px';
    p[i].style.lineHeight=(h2Size+2)+'px';
  }
  var p = fs_container.getElementsByTagName('h3');
  for(i=0;i<p.length;i++) {
    p[i].style.fontSize=h3Size+'px';
    p[i].style.lineHeight=(h3Size+2)+'px';
  }
}
function SetFSize(b) {
  SetElSize(b);
  SetCookieOneYear(sKeyF,b);
}

jQuery.noConflict();
jQuery(document).ready(function() {
  var k=GetCookie(sKeyF);
  if(k!=null) SetElSize(k);
  jQuery('.csc-uploads tr').each(function() {
    jQuery(this).click(function() {window.open(jQuery(this).find('.csc-uploads-fileName a').attr('href'));});
    jQuery(this).mouseover(function() {
      jQuery(this).find('td').css('background-image', 'url(/fileadmin/template/neuhauser/i/download-act-bg-new.png)');
    });
    jQuery(this).mouseout(function() {
      jQuery(this).find('td').css('background-image', 'url(/fileadmin/template/neuhauser/i/download-no-bg-new.png)');
    });
  });
  jQuery('.csc-uploads a').click(function(event) {event.preventDefault();});
});

