//font control

var min=7;
var max=17;
function increaseFontSize() {
   var children = document.getElementById('content').getElementsByTagName('*');
   for(var i=0;i<children.length;i++){
      if(children[i].style.fontSize) {
         var s = parseInt(children[i].style.fontSize.replace("px",""));  
      } else {
         var s = 11;
      }
      if(s!=max) {
         s += 2;
      }
      children[i].style.fontSize = s+"px"
   }
}

function decreaseFontSize() {
   var p = document.getElementById('content');
      if(p.style.fontSize) {
         var s = parseInt(p.style.fontSize.replace("px",""));
      } else {
         var s = 11;
      }
      if(s!=min) {
         s -= 2;
      }
      p.style.fontSize = s+"px"
}

var countchange = 0;
function incdecsize(val) {

 if ( (countchange <= -4 && val < 0) ||
 (countchange >= 4 && val > 0) )
 return false;

 countchange += val;

 var container = $$('#content');
 resizeText(container, val);
}

function resizeText(element, moveSize)
{
 element = $$(element);
 elementList = element.getChildren();
 if ( elementList.length > 0 )
 {
 elementList.each(function(item)
 {
 item.each(function(el)
 {
 size = el.getStyle('fontSize').toInt();

 el.setStyle('fontSize', eval(size + moveSize) +'px');

 resizeText(el, moveSize);
 });
 });
 }
} 


//set the left banner
function setLeftBanner(){
var leftmargin=getWindowWidth();
leftmargin=(leftmargin-999)/2;
if(leftmargin<0) leftmargin=0;
//document.getElementById('main_div').style.marginLeft=leftmargin+'px';
document.getElementById('left_banner').style.width=leftmargin+'px';
}

//set the right banner
function setRightBanner(){
var rightmargin=getWindowWidth();

rightmargin=(rightmargin-999)/2;
if(rightmargin<0) rightmargin=0;
//document.getElementById('main_div').style.marginRight=rightmargin+'px';
document.getElementById('right_banner').style.width=rightmargin+'px';
document.getElementById('right_banner').style.left=rightmargin+999+'px';
}

//set banners
function setBanners(){
document.body.style.display='block';
setLeftBanner();
setRightBanner();
}



//get the window width
function getWindowWidth(){
 var viewportwidth;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = document.documentElement.clientWidth;
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth;
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
 }
 return viewportwidth;
}
