﻿// JScript File

function showMenu(itemId)
{
var item=document.getElementById(itemId);
item.style.display='block';
}

function hideMenu(itemId)
{
var item=document.getElementById(itemId);
item.style.display='none';
}

function mkLink(name,domain,type)
{
    var str="mai";
    str+="lt";
    str+="o:"+name+"@";
    str+=domain;
    var ext;
    switch(type)
    {
      case 'o':
      ext=".org";
      break;
      case 'c':
      ext=".com";
      break;
      case 'n':
      ext=".net";
      break;
      case 'g':
      ext=".gov"
      break;
      case 'i':
      ext=".info";
      break;
    }
    str+=ext;
    window.location=str;
}

function loadDialog(pathVal)
{
  if(document.cookie=='')
  {
  var diaText="<table style=\"width: 225px; position: absolute; left: 115px; top: 110px; border: solid 2px #FFBB66; background-color: white; z-index:4;\" cellpadding=\"0\" cellspacing=\"0\">";
  diaText+="<tr><td style=\"text-align: right; background-color:#FFBB66; padding: 4px 4px 4px 4px\">";
  diaText+="<p style=\"font-size:60%; font-weight:bold; color:white; cursor:pointer;\" onclick=\"closeDialog();\">CLOSE</p></td></tr>";
  diaText+="<tr style=\"padding: 4px 4px 4px 4px; background-color: #f5f5dc;\"><td>";
  diaText+="<p>To view menus on The Parsonage website, hover your cursor over any <img src=\""+pathVal+"images/arrow.gif\" /> image.</p>";
  diaText+="<p><input id=\"chk1\" type=\"checkbox\" />&#160;Don't show this message again.</p></td></tr></table>";
  var diaDiv=document.getElementById('menuDialog');
  diaDiv.innerHTML=diaText;  
  }
  //else
  //{
    //alert('no dialog');
  //}
}

function closeDialog()
{
  var diaDiv=document.getElementById('menuDialog');
  var diaChk=document.getElementById('chk1');
  var newDate=new Date();
  var days=365;
  if(diaChk.checked)
  {
    newDate.setTime(newDate.getTime()+(days*24*60*60*1000));
    document.cookie='parsHide=true; expires='+newDate+' UTC; path=/';
  }
  else
  {
    newDate.setTime(newDate.getTime()+(-1*24*60*60*1000));
    document.cookie='parsHide=true; expires='+newDate+' UTC; path=/';
  }
  diaDiv.innerHTML='';
}

function clearCookie()
{
  var newDate=new Date();
  var days=365;
  newDate.setTime(newDate.getTime()+(-1*24*60*60*1000));
  document.cookie='parsHide=true; expires='+newDate+' UTC; path=/';
  alert(document.cookie);
}
    