var font_size = 13;
var font_original = 13;
var min_font = 9;
var max_font = 24;

var appNs=navigator.appVersion;
var ns4=(appNs.indexOf("4.77") != -1)||(appNs.indexOf("4.8") != -1);

function artTxt(txFg){
if (!ns4&&!txFg)document.write("<style>.txt{text-align:left;margin-right:118px;}</style>");
}

function saveFontSize(){
	var expire = new Date ();
   	expire.setTime (expire.getTime() + (6000 * 24 * 3600000)); //expires in 6 days from users clock
   	expire = expire.toGMTString();
	document.cookie="font_size="+font_size+"; expires="+expire;
}
	


function loadFontSize(){

  tempArray = document.cookie.split(";");		
  for (tA = 0; tA < tempArray.length; tA++){
	if (tempArray[tA].indexOf('font_size') > -1){
 	  fontValue = tempArray[tA].split("=");
	  font_size = parseInt(fontValue[1]);
	}
  }
}


function setFontSize(){
	
  loadFontSize()
  obj = document.getElementById("articleBody");
  obj.style.fontSize = font_size+"px";
	changecss(".tblFontResize","fontSize",font_size+"px");
	changecss(".btn","fontSize",(font_size-1)+"px");
	changecss(".error","fontSize",font_size+"px");
}


function plus (){
  obj = document.getElementById("articleBody");
  font_size = obj.style.fontSize;
  font_size = parseInt(font_size);
  
  if (font_size < max_font)  font_size = font_size + 1;
  
  obj.style.fontSize = font_size+"px";
	changecss(".tblFontResize","fontSize",font_size+"px");
	changecss(".btn","fontSize",(font_size-1)+"px");
	changecss(".error","fontSize",font_size+"px");
  saveFontSize();
}



function minus (){
  obj = document.getElementById("articleBody");
  font_size = obj.style.fontSize;
  font_size = parseInt(font_size);

  if (font_size > min_font)  font_size = font_size - 1;

  obj.style.fontSize = font_size+"px";
	changecss(".tblFontResize","fontSize",font_size+"px");
	changecss(".btn","fontSize",(font_size-1)+"px");
	changecss(".error","fontSize",font_size+"px");
  saveFontSize()
}



function original (){
  obj = document.getElementById("articleBody");
  font_size = font_original;
  obj.style.fontSize = font_size+"px";
	changecss(".tblFontResize","fontSize",font_size+"px");
	changecss(".btn","fontSize",(font_size-1)+"px");
	changecss(".error","fontSize",font_size+"px");
  saveFontSize()
}


window.onload=new Function("setFontSize();");


function changecss(theClass,element,value) {
//documentation for this script at http://www.shawnolson.net/a/503/
 var cssRules;
 if (document.all) {
  cssRules = 'rules';
 }
 else if (document.getElementById) {
  cssRules = 'cssRules';
 }
 for (var S = 0; S < document.styleSheets.length; S++){
  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
    document.styleSheets[S][cssRules][R].style[element] = value;
   }
  }
 }	
}
