function setCookie(sName,sValue){
  document.cookie = sName + "=" + escape(sValue) + "; path=/";
}
function getCookie(sName){
  var cookieArray=document.cookie.split("; ");
  for(i=0;i<cookieArray.length;i++){
    var aCrumb=cookieArray[i].split("=");
    if(sName==aCrumb[0]){
      return unescape(aCrumb[1]);
    }
  }
  return null;
}
function set_font_size_css(){
  var str1 = document.getElementById('font_size_css').href;
  var str2 = "";
  switch(font_size){
    case '1': str2 = str1.replace(/size-\d/,"size-1");break;
    case '2': str2 = str1.replace(/size-\d/,"size-2");break;
    case '3': str2 = str1.replace(/size-\d/,"size-3");break;
  }
  if(str2){document.getElementById('font_size_css').href=str2;}
}
function set_color_css(){
  var str1 = document.getElementById('color_css').href;
  var str2 = "";
  switch(color_type){
    case '1': str2 = str1.replace(/color-\d/,"color-1");break;
    case '2': str2 = str1.replace(/color-\d/,"color-2");break;
    case '3': str2 = str1.replace(/color-\d/,"color-3");break;
  }
  if(str2){document.getElementById('color_css').href=str2;}
}
function change_font_size(){
  switch(font_size){
    case '1': font_size='2';break;
    case '2': font_size='3';break;
    case '3': font_size='1';break;
    default : font_size='2';break;
  }
  setCookie("font-size",font_size);
  set_font_size_css();
}
function change_color(){
  switch(color_type){
    case '1': color_type='2';break;
    case '2': color_type='3';break;
    case '3': color_type='1';break;
    default : color_type='2';break;
  }
  setCookie("color-type",color_type);
  set_color_css();
}
function print_view(){ 
  var dlm;
  var url=document.URL;
  if(url.indexOf('#') != -1){
    url = url.replace(/#.*/,'');
  }
  if(url.indexOf('?') == -1){
    var dlm = '?';
  }else{
    var dlm = '&';
  }
  window.open(url+dlm+"print=1","print","WIDTH=800,HEIGHT=400,SCROLLBARS=1,RESIZABLE=1,TOOLBAR=1,MENUBAR=1,LOCATION=0 DIRECTORIES=0,STATUS=1");
}

var font_size;
font_size  = getCookie("font-size");
set_font_size_css();

/*
var color_type;
color_type = getCookie("color-type");
set_color_css();
*/