// cssName ed onmouseclick defined only x index.html during onload event

function setActiveCSS()
{
  var linkT, rel, title, cssLinkTitle;
  if(arguments.length == 1 && (typeof arguments[0] == "string"))
    cssLinkTitle = arguments[0]; // called from init code
  else if(this.cssName != null)
    cssLinkTitle = this.cssName;  // called from event tag code only index.HTML
  else
	return false;

  for(var i=0; (linkT = document.getElementsByTagName("link")[i]); i++) {
    rel = linkT.getAttribute("rel");
	title = linkT.getAttribute("title");
    if(rel == null || rel == "" || rel.indexOf("style") == -1 || title == null || title == "")
	  continue;
	linkT.disabled = true;
    if(title != cssLinkTitle)
	  continue;
	linkT.disabled = false;
    createCookie("mainStyle",cssLinkTitle,365);
  }
}

function disableCSS()
{
  var i,linkT;
  for(i=0; (linkT = document.getElementsByTagName("link")[i]); i++)
    if(linkT.getAttribute("rel") && linkT.getAttribute("rel").indexOf("style") != -1)
      linkT.disabled = true;
  createCookie("mainStyle","noStyle",365);	
}

function getCurrCSS()
{
  var mainStyle;
  if((mainStyle = readCookie('mainStyle')) == false)
    return "DefaultSkin";
  return mainStyle;
}

function initCSS()
{
  var mainStyle = readCookie('mainStyle');
  if(mainStyle == false || mainStyle == null || mainStyle == "")
    setActiveCSS("DefaultSkin");
  else if(mainStyle == "noStyle")
    disableCSS();
  else
    setActiveCSS(mainStyle);
}
