// RESIZING TEXT -------------------------------------------------------

// Set Body text size
function setSize(iSize) {
       if (!document.getElementsByTagName) return false;
       var bodyTag = document.getElementsByTagName ("body");
       for (var i=0; i < bodyTag.length; i++) {
               if (!bodyTag[i].style.fontSize) {
               if (!readCookie("resize")) {
               bodyTag[i].style.fontSize = "80%";
               }
               else {
               bodyTag[i].style.fontSize = ((parseFloat(readCookie("resize"))) + "%");
               }
               }
               else {
               if (!readCookie("resize")) {
               bodyTag[i].style.fontSize = "80%";
               }
               else {
               bodyTag[i].style.fontSize = (((parseFloat(iSize)) + (parseFloat(readCookie("resize")))) + "%");
               }
               }
               cookieValue = bodyTag[i].style.fontSize;
               writeCookie("resize", cookieValue, 10000);
       }
}


// Attaches the onclick event to the correct ids to allow resizing
function resizeT(iID, iDir) {
       if (!document.getElementById) return false;
       var incLink = document.getElementById (iID);
       if (iDir == "decrease") {
       incLink.onclick = function() {
               setSize("-10%");
               return false;
       }
       }
       if (iDir == "increase") {
       incLink.onclick = function() {
               setSize("10%");
               return false;
       }
       }
}

// Writes cookie
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.

function writeCookie(name, value, hours) {
 var expire = "";
 if(hours != null)  {
   expire = new Date((new Date()).getTime() + hours * 3600000);
   expire = "; expires=" + expire.toGMTString();
 }
 document.cookie = name + "=" + escape(value) + expire;
}


// Read Cookie
// alert( readCookie("myCookie") );
function readCookie(name){
 var cookieValue = "";
 var search = name + "=";
 if(document.cookie.length > 0)  {
   offset = document.cookie.indexOf(search);
   if (offset != -1)    {
     offset += search.length;
     end = document.cookie.indexOf(";", offset);
     if (end == -1) end = document.cookie.length;
     cookieValue = unescape(document.cookie.substring(offset, end))    }
 }
 return cookieValue;
}
