function mediumFontSize()
{
var titleOfActiveStyle = getActiveStyleSheet("fontsize");
setActiveStyleSheet("Size:10pt","fontsize");
}
function decreaseFontSize()
{
var titleOfActiveStyle = getActiveStyleSheet("fontsize");
if(titleOfActiveStyle == null) 
titleOfActiveStyle = "Size:8pt";
if(titleOfActiveStyle == "Size:14pt")
setActiveStyleSheet("Size:12pt","fontsize");
if(titleOfActiveStyle == "Size:12pt")
setActiveStyleSheet("Size:10pt","fontsize");
if(titleOfActiveStyle == "Size:10pt")
setActiveStyleSheet("Size:9pt","fontsize");
if(titleOfActiveStyle == "Size:9pt")
setActiveStyleSheet("Size:8pt","fontsize");
}
function increaseFontSize()
{
var titleOfActiveStyle = getActiveStyleSheet("fontsize");
if(titleOfActiveStyle == null) 
titleOfActiveStyle = "Size:8pt"; 
if(titleOfActiveStyle == "Size:8pt")
setActiveStyleSheet("Size:9pt","fontsize");
if(titleOfActiveStyle == "Size:9pt")
setActiveStyleSheet("Size:10pt","fontsize");
if(titleOfActiveStyle == "Size:10pt")
setActiveStyleSheet("Size:12pt","fontsize");
if(titleOfActiveStyle == "Size:12pt")
setActiveStyleSheet("Size:14pt","fontsize");
}
function fontsizechange()
{
if (fontsize.selectedIndex==0)
{
setActiveStyleSheet("Size:15pt","fontsize");
}
if (fontsize.selectedIndex==1)
{
setActiveStyleSheet("Size:16pt","fontsize");
}
if (fontsize.selectedIndex==2)
{
setActiveStyleSheet("Size:17pt","fontsize");
}
if (fontsize.selectedIndex==3)
{
setActiveStyleSheet("Size:18pt","fontsize");
}
}
function backgroundchange()
{
if (backcolor.selectedIndex==0)
{
setActiveStyleSheet("Background:White","contrast");
setActiveStyleSheet("Color: Black","color");
}
if (backcolor.selectedIndex==1)
{
setActiveStyleSheet("Background: Blue","contrast");
}
if (backcolor.selectedIndex==2)
{
setActiveStyleSheet("Background: Red","contrast");
}
if (backcolor.selectedIndex==3)
{
setActiveStyleSheet("Background: Green","contrast");
}
if (backcolor.selectedIndex==4)
{
setActiveStyleSheet("Background: Black","contrast");
setActiveStyleSheet("Color:White","color");
}
}
function fontfamilychange()
{

if (fontfamily.selectedIndex==0)
{
setActiveStyleSheet("FontFamily: Arial","family");
}
if (fontfamily.selectedIndex==1)
{
setActiveStyleSheet("FontFamily: Tahoma","family");
}
if (fontfamily.selectedIndex==2)
{
setActiveStyleSheet("FontFamily: Verdana","family");
}
if (fontfamily.selectedIndex==3)
{
setActiveStyleSheet("FontFamily: Times","family");
}
if (fontfamily.selectedIndex==4)
{
setActiveStyleSheet("FontFamily: Comic","family");
}
}
 
function fontcolorchange()
{
if (color.selectedIndex==0)
{
setActiveStyleSheet("Color:White","color");
setActiveStyleSheet("Background: Black","contrast");
}
if (color.selectedIndex==1)
{
setActiveStyleSheet("Color: Blue","color");
}
if (color.selectedIndex==2)
{
setActiveStyleSheet("Color: Red","color");
}
if (color.selectedIndex==3)
{
setActiveStyleSheet("Color: Green","color");
}
if (color.selectedIndex==4)
{
setActiveStyleSheet("Color: Black","color");
setActiveStyleSheet("Background:White","contrast");
}
}
 
function setActiveStyleSheet(title,type) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && isStyleSheetType(a.getAttribute("title"),type)) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
function isStyleSheetType(str,type) {
if (str == "") { return true; }
else if (type == "fontsize" && str.match(/\Size/)) {return true;}
else if (type == "weight" && str.match(/\Font/)) {return true;}
else if (type == "contrast" && str.match(/^Back/)) {return true;}
else if (type == "family" && str.match(/\FontFamily/)) {return true;}
else if (type == "color" && str.match(/^Color/)) {return true;}
return false;
}
function getActiveStyleSheet(type) {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && isStyleSheetType(a.getAttribute("title"),type) && !a.disabled) return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}

function nostyle(title,title1) 
  {
            var i, a, main;
             createCookie("PageStyle",0,10);
             for(i=0; (a = document.getElementsByTagName("link")[i]); i++) 
             {
               if(a.getAttribute("title") == title)
               {
		   a.disabled = true;
					
		}
               if(a.getAttribute("title") == title1)
               {
	    		a.disabled = false;
		}

             }
   }
function style(title,title1) 
  {
            var i, a, main;
            vishide();
            createCookie("PageStyle",1,10);
           
             for(i=0;(a = document.getElementsByTagName("link")[i]);i++)             
             {
		 if(a.getAttribute("title") == title)
                 {
                   a.disabled = false;
                   
                 } 
                if(a.getAttribute("title") == title1)
                {
				
		    a.disabled = true;
		}

             }
                       
        
   }


function createCookie(name,value,days) 
{
  if (days)
 {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
 {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
window.onload = function()
{
    
var title = ""
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"fontsize");
cookie = readCookie("wstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"weight");
cookie = readCookie("cstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"contrast");
cookie = readCookie("fstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"family");
cookie = readCookie("colorstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"color");

    var cookies = readCookie("PageStyle");
      if(cookies=="0")
      {
         nostyle('global','Font');
      }
      if(cookies=="1")
      {
         style('global','Font');
      }
      if(cookies==null)
      {
        style('global','Font');
      }
}

window.onunload = function(e) {
var title = getActiveStyleSheet("fontsize");
createCookie("style", title, 365);
var title = getActiveStyleSheet("weight");
createCookie("wstyle", title, 365);
var title = getActiveStyleSheet("contrast");
createCookie("cstyle", title, 365);
var title = getActiveStyleSheet("family");
createCookie("fstyle", title, 365);
var title = getActiveStyleSheet("color");
createCookie("colorstyle", title, 365);
}

var title = ""
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"fontsize");
cookie = readCookie("wstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"weight");
cookie = readCookie("cstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"contrast");
cookie = readCookie("fstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"family");
cookie = readCookie("colorstyle");
title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title,"color");

  var cookies = readCookie("PageStyle");
      if(cookies=="0")
      {
         nostyle('global','Font');
      }
      if(cookies=="1")
      {
         style('global','Font');
      }
      if(cookies==null)
      {
        style('global','Font');
      }

function vishide()
{
setActiveStyleSheet("Background:White","contrast");
setActiveStyleSheet("Color: Black","color");
setActiveStyleSheet("Size:8pt","fontsize");
setActiveStyleSheet("FontFamily: Tahoma","family");
}
