// Thsi file is to be included in the rci.html to get access to the cookie function for textsize function


/**
function setCookie(name, value, expires, path, domain, secure) {
  * name       Name of the cookie
  * value      Value of the cookie
  * [expires]  Expiration date of the cookie (default: end of current session)
  * [path]     Path where the cookie is valid (default: path of calling document)
  * [domain]   Domain where the cookie is valid
  *              (default: domain of calling document)
  * [secure]   Boolean value indicating if the cookie transmission requires a
  *              secure transmission
}
 */
function setCookie(name, value ,reloadParam) {


    var expires = new Date();
    var expDays = 30;
    expires.setTime(expires.getTime() + (expDays * 24 * 60 * 60 * 1000));
    var path = "/";
    var domain = "";
    var secure = "";

    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
 if(reloadParam == 1)
    window.location.reload(false);
}


function getCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if(begin == -1) {
      begin = dc.indexOf(prefix);
      if (begin != 0) return null;
   }else {
      begin += 2;
   }
   var end = document.cookie.indexOf(";", begin);
   if(end == -1) {
      end = dc.length;
   }
   return unescape(dc.substring(begin + prefix.length, end));
}


//reading cookie on page load for setting page size as recorder in cookie
if(getCookie("csatext") == 'medium') {
//if medium  loads the style2.css
document.write('<link rel=stylesheet type="text/css" href="include/style2.css">'); 
}else if(getCookie("csatext") == 'large') {
//if large  loads the style3.css
document.write('<link rel=stylesheet type="text/css" href="include/style3.css">');
}else {
//if nothing  loads the style.css which is default css
document.write('<link rel=stylesheet type="text/css" href="include/style.css">');
}