

// JavaScript Document

function GetCommentsVisibility() {
  var theCookie = ""+document.cookie;
  var cookieName = 'motorelaxcomm';
  var ind = theCookie.indexOf(cookieName);
  if (ind==-1) return '0';
  var ind1 = theCookie.indexOf(';',ind);
  if (ind1==-1) ind1=theCookie.length;
  return theCookie.substring(ind + cookieName.length + 1, ind1);
}

function SetCommentVisibility(commVisible) {
  var today = new Date();
  var expire = new Date();
  expire.setTime(today.getTime() + 3600000*24*360);
  document.cookie = 'motorelaxcomm='+(commVisible ? '1' : '0')
                  + ";expires="+expire.toGMTString();
}

function ShowHideDiv(theClass, showDiv) {
  var allPageTags = new Array();
  allPageTags=document.getElementsByTagName('div');
  for (i=0; i<allPageTags.length; i++) {
    if (allPageTags[i].className==theClass) {
      if(showDiv) {
        allPageTags[i].style.display='block';
      } else {
        allPageTags[i].style.display='none';
      }
    }
  }
}

function ToggleCommentsVisibility() {
  var b = GetCommentsVisibility() == '0';
  ShowHideDiv('commdiv', b);
  SetCommentVisibility(b);
}

function DoCommentsVisibility() {
  var b = GetCommentsVisibility() == '0';
  ShowHideDiv('commdiv', !b);
}


