var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();

function writeHTMLasJS(){
document.write("");
document.write("			<table class=\"buttTable\">");
document.write("			<tr><td>&nbsp;<\/td><\/tr>");
document.write("       		<tr>");
document.write("       			<td id=\"leftColumn\">");
document.write("  <dl class=\"dropdown\">");
document.write("    <dt id=\"one-ddheader\" class=\"upperdd\" onclick=\"location.href='index.html'\">HOME<\/dt>");
document.write("  <\/dl>");
document.write("  <dl class=\"dropdown\">");
document.write("    <dt id=\"two-ddheader\" class=\"upperdd\" onclick=\"location.href='Team.html'\">Team<\/dt>");
document.write("  <\/dl>");
document.write("  <dl class=\"dropdown\">");
document.write("    <dt id=\"three-ddheader\" class=\"upperdd\" onclick=\"location.href='Faq.html'\">Faqs<\/dt>");
document.write("  <\/dl>");
document.write("  <dl class=\"dropdown\">");
document.write("    <dt id=\"four-ddheader\" class=\"upperdd\" onclick=\"location.href='Terminology.html'\">Terminology<\/dt>");
document.write("  <\/dl>");
document.write("  <dl class=\"dropdown small_dropdown\">");
document.write("    <dt id=\"five-ddheader\" class=\"upperdd\" onmouseover=\"ddMenu('five',1)\" onmouseout=\"ddMenu('five',-1)\"><span>Gallery<\/span><\/dt>");
document.write("    <dd id=\"five-ddcontent\" onmouseover=\"cancelHide('five')\" onmouseout=\"ddMenu('five',-1)\">");
document.write("      <ul>");
document.write("        <li><a href=\"Gallery1.html\" class=\"underline\">Gallery 1<\/a><\/li>");
document.write("        <li><a href=\"Gallery2.html\" class=\"underline\">Gallery 2<\/a><\/li>");
document.write("        <li><a href=\"Gallery3.html\" class=\"underline\">Gallery 3<\/a><\/li>");
document.write("        <li><a href=\"Gallery4.html\" class=\"underline\">Gallery 4<\/a><\/li>");
document.write("      <\/ul>");
document.write("    <\/dd>");
document.write("  <\/dl>");
document.write("  ");
document.write("  <dl class=\"dropdown\">");
document.write("    <dt id=\"six-ddheader\" class=\"upperdd\" onclick=\"location.href='Video.html'\">Video<\/dt>");
document.write("  <\/dl>");
document.write("  <dl class=\"dropdown\">");
document.write("    <dt id=\"six-ddheader\" class=\"upperdd\" onclick=\"location.href='Investigations.html'\">Investigations<\/dt>");
document.write("  <\/dl>");
document.write("  <dl class=\"dropdown\">");
document.write("    <dt id=\"eight-ddheader\" onmouseover=\"ddMenu('eight',1)\" onmouseout=\"ddMenu('eight',-1)\">Links<\/dt>");
document.write("    <dd id=\"eight-ddcontent\" onmouseover=\"cancelHide('eight')\" onmouseout=\"ddMenu('eight',-1)\">");
document.write("      <ul>");
document.write("        <li><a href=\"http:\/\/www.angiearistone.com\" class=\"underline\">Angie Aristone<\/a><\/li>");
document.write("        <li><a href=\"http:\/\/www.diriseborough.com\" class=\"underline\">Di Riseborough<\/a><\/li>");
document.write("		<li><a href=\"http:\/\/www.paranormalresearch.ca\" class=\"underline\">P.R.I.<div style=\"display:inline; font-size:9px\"> Paranormal Research Initiative<\/div><\/a><\/li>");
document.write("		<li><a href=\"http:\/\/www.rpighosthunter.dk\" class=\"underline\">R.P.I<div style=\"display:inline; font-size:9px\"> Renegade Paranormal Investigation<\/div><\/a><\/li>");
document.write("        <li><a href=\"http:\/\/www.windermeremanor.com\">Windermere Manor<\/a><\/li>");
document.write("        <li><a href=\"http:\/\/www.elgintheatreguild.ca\">Princess Ave Playhouse<\/a><\/li>");
document.write("        <li><a href=\"http:\/\/www.atticbooks.ca\">Attic Books<\/a><\/li>");
document.write("	  <\/ul>");
document.write("    <\/dd>");
document.write("  <\/dl>");
document.write("<\/td>");
document.write(" <\/tr>      		");
document.write("<\/table>	");
document.write("");
}

var DDSPEED = 4;
var DDTIMER = 15;
var OFFSET = -2;
var ZINT = 100;


function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    c.style.display = 'block';
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.left = (h.offsetWidth + OFFSET + 25) + 'px';
     // alert(c.style.left);
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    ZINT = ZINT + 1;
    c.style.zIndex = ZINT;
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
 
  if(d == 1){
    dist = Math.round((c.maxh - currh) / DDSPEED);
  }else{
    dist = Math.round(currh / DDSPEED);
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  
  c.style.height = currh + (dist * d ) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + ((currh * 100 / c.maxh)/1.05) + ')';
  if(currh > (c.maxh - 2) && d == 1){
    clearInterval(c.timer);
  }else if(dist < 1 && d != 1){
    clearInterval(c.timer);
    c.style.display = 'none';
  }
}

