 /***********************************************
 * AnyLink CSS Menu script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
 * This notice MUST stay intact for legal use
 * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
 ***********************************************/

var disappeardelay=250  //menu disappear speed onMouseout (in milliseconds)
var enableanchorlink=1 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

  button21down = new Image; button21down.src = "buttonFilmsHover.bmp";
  button31down = new Image; button31down.src = "buttonGamesHover.bmp";
  button41down = new Image; button41down.src = "buttonProjectsHover.bmp";
  button21up = new Image; button21up.src = "buttonFilms.bmp";
  button31up = new Image; button31up.src = "buttonGames.bmp";
  button41up = new Image; button41up.src = "buttonProjects.bmp";
  button1up = new Image; button1up.src = "buttonHome.bmp";
  button1down = new Image; button1down.src = "buttonHomeHover.bmp";

function MouseOverRoutine(ButtonName)
{
if (ButtonName=="button1")
{document.button1.src = button1down.src;}
if (ButtonName=="button41")
{document.button41.src = button41down.src;}
}

function MouseOutRoutine(ButtonName)
{
if (ButtonName=="button1")
{document.button1.src = button1up.src;}
if (ButtonName=="button41")
{document.button41.src = button41up.src;}
}

/////No further editing needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID, ButtonName)
{

if (ButtonName=="button21")
{
document.button21.src = button21down.src;
}

if (ButtonName=="button31")
{
document.button31.src = button31down.src;
}

//if (ButtonName=="button41")
//{
//document.button41.src = button41down.src;
//}

if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()

if (ie5||ns6)
{
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)


if (hidemenu_onclick) dropmenuobj.onclick=function()
{
dropmenuobj.style.visibility='hidden'
}

dropmenuobj.onmouseover=clearhidemenu

dropmenuobj.onmouseout=ie5? function(){dynamichide(event)} : function(event){ dynamichide(event)}

showhide(dropmenuobj.style, e, "visible", "hidden")

dropmenuobj.x=getposOffset(obj, "left")

dropmenuobj.y=getposOffset(obj, "top")

dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"

dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e, ButtonName){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu()
{

//if (ButtonName=="button21")
//{
document.button21.src = button21up.src;
//}

//if (ButtonName=="button31")
//{
document.button31.src = button31up.src;
//}

//if (ButtonName=="button41")
//{
document.button41.src = button41up.src;
//}

delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

function dtgAlert()
{
alert("HI");
}

function dtgWriteMenu()
{

document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%">');
document.write('<tr>');

//document.write('<div id="menutable2">

document.write('<td rowspan="2" width="297" height="82" background="logo.bmp">&nbsp;</td>');

document.write('<td background="brick.bmp" colspan="6"><br>&nbsp;&nbsp;');
document.write('<a href="index.html"><font size="2" color="black">Home</a></font>');

if (rank1 != "0")
{
document.write(' > <a href="' + name1 + '.htm"><font size="2" color="black">' + rank1 + '</a></font>');
}

if (rank2 != "0")
{
document.write(' > <a href="' + name2 + '.htm"><font size="2" color="black">' + rank2 + '</a></font>');
}

if (rank3 != "0")
{
document.write(' > <font size="2" color="black">' + rank3 + '</font>');
}

document.write('</td>');

document.write('</tr>');

document.write('<tr>');

document.write('<td>&nbsp;</td>');
document.write('<td rowspan="2" width="100" valign="center" align="center">');
document.write('<a href="index.html" onMouseOver="MouseOverRoutine(\'button1\')" onMouseOut="MouseOutRoutine(\'button1\')"><Img Src="buttonHome.bmp" name="button1" height="40" width="90" border="0"></a><br>');
document.write('</td>');

document.write('<td rowspan="2" width="100" valign="center" align="center">');
document.write('<span class="menulink"><a href="films.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, \'filmsmenu1\', \'button21\')"><Img Src="buttonFilms.bmp" name="button21" height="40" width="90" border="0"></a><br></span>');
document.write('<span id="filmsmenu1" class="filmscss" style="width: 300px">');
document.write('<a id="high" href="trouble.htm">Born Unto Trouble</a>');
document.write('<a id="high" href="maldon.htm">The Battle of Maldon</a>');
document.write('<a id="high" href="jaywalking.htm">Jaywalking</a>');
document.write('<a id="high" href="iadiam.htm">Inventions and Discoveries in Ancient Mesopotamia</a>');
document.write('<a id="high" href="greatDeception.htm">The Great Deception</a>');
document.write('<a id="high" href="solomon.htm">The Shield Of Solomon</a>');
document.write('<a id="high" href="mambrino.htm">El Yelmo de Mambrino</a>');
document.write('<a id="high" href="ziggurats.htm">Ziggurats: the Movie</a>');
document.write('<a id="high" href="superdaddy.htm">SuperDaddy and the Pirate Hackers</a>');
document.write('</span>');
document.write('</td>');

document.write('<td rowspan="2" width="100" valign="center" align="center">');
document.write('<span class="menulink"><a href="games.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, \'filmsmenu2\', \'button31\')"><Img Src="buttonGames.bmp" name="button31" height="40" width="90" border="0"></a><br></span>');
document.write('<span id="filmsmenu2" class="filmscss" style="width: 180px">');
document.write('<a id="high" href="cascgame1.htm">La Montagne des Monstres (Cascadeur Inc.)</a>');
document.write('<a id="high" href="ispy2.htm">I Spy...&reg; with Sinister Manor&trade;</a>');
document.write('<a id="high" href="remember.htm">Remember the Image</a>');
document.write('<a id="high" href="ispy1.htm">I Spy...&reg;</a>');
document.write('</span>');
document.write('</td>');

document.write('<td rowspan="2" width="100" valign="center" align="center">');
document.write('<a href="login.htm" onMouseOver="MouseOverRoutine(\'button41\')" onMouseOut="MouseOutRoutine(\'button41\')"><Img Src="buttonProjects.bmp" name="button41" height="40" width="90" border="0"></a><br>');

//document.write('<span class="menulink"><a href="login.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, \'filmsmenu3\', \'button41\')"><Img Src="buttonProjects.bmp" name="button41" height="40" width="90" border="0"></a><br></span>');
//document.write('<span id="filmsmenu3" class="filmscss" style="width: 180px">');
//document.write('<a id="high" href="maldon.htm">The Battle of Maldon</a>');
//document.write('<a id="high" href="notredame.htm">Notre-Dame Cathedral</a>');
//document.write('</span>');

document.write('</td>');

//document.write('</div>');
//document.write('<span class="menutable">');

document.write('<td rowspan="2">');
document.write('</td>');

//document.write('</span>');

document.write('</tr>');

document.write('<tr>');

document.write('<td height="30" background="productions.bmp"></td>');

document.write('</tr>');

id_cookie = getCookie("id");

//alert(pw_cookie);

if (id_cookie != null)
{
  document.write('<tr>');
  
  document.write('<td colspan="5"><span class="subtitle">Hello, ' + id_cookie + '. </span><span class="general"><a href="index.html" alt="Forget me" onClick="removeid(\'id\')">Forget me</a></span></td>');
  
  document.write('</tr>');
}
//else if (pw_cookie != null)
//{
//  document.write('<tr>');
  
//  document.write('<td colspan="5"><span class="subtitle">Hello, DTG Guest.</span></td>');
//  document.write('<td align="right" colspan="2"><span class="general"><a href="index.html" alt="Forget me" onClick="removeid(\'id\')">Forget me</a></span></td>');
  
//  document.write('</tr>');
//}
  
document.write('</table>');

}

function dtgWriteBottom()
{
document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%">');
document.write('<tr><td align="center"><a href="index.html">Home</a> | <a href="films.htm">Films</a> | <a href="games.htm">Games</a> | <a href="login.htm">Members</a></td></tr>');
document.write('<tr><td align="center" valign="center" background="brick.bmp"><span class="smallprint"><br />DTG Productions&reg; is a wholly-owned subsidiary of DTG&reg; Corp. All rights reserved. No part of this site, whether visual, audial or other may be reproduced without prior permission. All Mr. Cascadeur&trade; logos, pictures and software are used with the express permission of <a href="http://membre.oricom.ca/cwaugh/cascadeur/" target="blank">Cascadeur, Inc.</a> <!--The LEGO&reg; logo and brick are registered trademarks of <a href="http://www.lego.com/" target="blank">The LEGO Group&reg;</a> and are used without permission. --></span></td></tr>');
document.write('</table>');
}

function removeid(NameOfCookie)
{
  var cookie_date = new Date ();  // current date & time
  cookie_date.setTime (cookie_date.getTime() - 1);
  document.cookie = NameOfCookie += "=; expires=" + cookie_date.toGMTString();
  removepw("pw");
}

function removepw(NameOfCookie)
{
  var cookie_date = new Date ();  // current date & time
  cookie_date.setTime (cookie_date.getTime() - 1);
  document.cookie = NameOfCookie += "=; expires=" + cookie_date.toGMTString();
}


function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0) 
{ 

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 

// Our cookie was set. 
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 

// Our cookie was not set. 
// The value "null" is returned from the function.

}

function setCookie(NameOfCookie, value, expiredays) 
{

// Three variables are used to set the new cookie. 
// The name of the cookie, the value to be stored,
// and finally the number of days until the cookie expires.
// The first lines in the function convert 
// the number of days to a valid date.

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

// The next line stores the cookie, simply by assigning 
// the values to the "document.cookie" object.
// Note the date is converted to Greenwich Mean time using
// the "toGMTstring()" function.

document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie) 
{

// The function simply checks to see if the cookie is set.
// If so, the expiration date is set to Jan. 1st 1970.

if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

function loadPage()
{
  //alert("HI");
//  removepw("pw");

     pw_cookie = getCookie("pw");
//alert(pw_cookie);

     if ( pw_cookie != null )
     {
         window.location.href = pw_cookie + ".htm";
     }
}

function login(thisform)
{
  with (thisform)
  {

  if (pwform.pw.value == null || pwform.pw.value == "null" || pwform.pw.value == "")
  {

     pw_cookie = getCookie("pw");


     if ( pw_cookie == null || pw_cookie == "null" )
     {
       alert("Please enter the password");
     }
     else
     {
         window.location.href = pw_cookie + ".htm";
     }
  }
  else
  {
      setCookie("pw",pwform.pw.value,365);
      setCookie("id",pwform.id.value,365);
      window.location.href = pw.value + ".htm";
  }

    return false;
  }
}

function popWindow(url, name, width, height, scrollbars, resizable)
{
  settings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + scrollbars + ",resizable=" + resizable +",width=" + width + ", height=" + height;
  popWindow1=window.open(url,name,settings);
}

