$(
   function() { 
      
      /* modified code from w3schools */
      var getCookie = function getCookie(c_name){
         var i,x,y,ARRcookies=document.cookie.split(";");
         for (i=0;i<ARRcookies.length;i++) {
            x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
            y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
            x=x.replace(/^\s+|\s+$/g,"");
            if (x==c_name) {
               return unescape(y);
            }
         }      
      };
      var setCookie = function (c_name,value,exdays, path){
         if (path === undefined) path = "/";
         var exdate=new Date();
         exdate.setDate(exdate.getDate() + exdays);
         var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
         var cookie=c_name + "=" + c_value + ";path=" + path + ";";
         document.cookie= cookie;
         /* 
          * document.cookie = can only set one value at a time even though
          * the expression document.cookie evaluates to ";" separeted list of all cookies.
          * Who comes up with this stuff?  -SR
          */
      };
      
      var $el = $(document.createElement("span"));
      var classname = "textsize-changer-large-text";
      $(".content-right-box").each(function() { $(this).append($el); } );
      $el.load("/textresize/textresize.html", null, function() {
         $el.find(".minus-icon").click(function() { $("body").removeClass(classname); setCookie(classname, "", 5000);});
         $el.find(".plus-icon").click(function() { $("body").addClass(classname); setCookie(classname, "true", 5000); });
         if (getCookie(classname) === "true") {
            $el.find(".plus-icon").click();          
         }
      });     
      
   }                  
);

