

var popMenuIsShown = false;

var xPopMenuPos = 0;

var yPopMenuPos = 0;

var xPopMenuPageMax = 0;

var yPopMenuPageMax = 0;

var popMenuRight = 0;

var popMenuBottom = 0;

var popMenuIDStr = null;





function detectPopMenuMouseOut_M(evt)

{

   var x = evt.pageX+window.pageXOffset;

   var y = evt.pageY+window.pageYOffset;

   if (x<xPopMenuPos || y<yPopMenuPos || x>popMenuRight || y>popMenuBottom) hidePopMenu();

}







function detectPopMenuMouseOut()

{

   var x = window.event.x+document.body.scrollLeft;

   var y = window.event.y+document.body.scrollTop;

   if (x<xPopMenuPos || y<yPopMenuPos || x>popMenuRight || y>popMenuBottom) hidePopMenu();

}









function showPopMenu_M(evt)

{

  if (popMenuIsShown) return;

  popMenuIsShown = true;



  xPopMenuPos = evt.pageX + window.pageXOffset - 30;

  yPopMenuPos = evt.pageY + window.pageYOffset - 20;

  xPopMenuPageMax = window.innerWidth+window.pageXOffset;

  yPopMenuPageMax = window.innerHeight+window.pageYOffset;





  if (xPopMenuPos<=1) xPopMenuPos = 2;

  if (yPopMenuPos<=1) yPopMenuPos = 2;



  var menuObj = document.getElementById(popMenuIDStr).style;

  var popWidth = "" + menuObj.width;

  var popHeight = "" + menuObj.height;

  

  popWidth = popWidth.toLowerCase();

  popHeight = popHeight.toLowerCase();



  

  if (popWidth.indexOf("px")>0)

  {

     popWidth = parseInt(popWidth.substring(0,popWidth.indexOf("px")));

  }

  

  if (popHeight.indexOf("px")>0)

  {

     popHeight = parseInt(popHeight.substring(0,popHeight.indexOf("px")));

  }

  



  popMenuRight = xPopMenuPos + popWidth;

  popMenuBottom = yPopMenuPos + popHeight;





  if (popMenuRight>xPopMenuPageMax)

  {

     xPopMenuPos = xPopMenuPos - (popMenuRight-xPopMenuPageMax+1);

     popMenuRight = xPopMenuPageMax-1;

  }



  if (popMenuBottom>yPopMenuPageMax)

  {

     yPopMenuPos = yPopMenuPos - (popMenuBottom-yPopMenuPageMax+1);

     popMenuBottom= yPopMenuPageMax-1;

  }  

  

  menuObj.left = xPopMenuPos;

  menuObj.top = yPopMenuPos;

  menuObj.visibility = "visible";



  document.onmousemove = detectPopMenuMouseOut_M;

}





function showPopMenu_MMM(idStr)

{

  document.onmousemove = showPopMenu_M;

  popMenuIDStr = idStr;

}









function showPopMenu(idStr)

{

  if (document.all) {}

  else

  {

    showPopMenu_MMM(idStr);

    return;

  }



  if (popMenuIsShown) return;

  popMenuIsShown = true;



  xPopMenuPos = window.event.x + document.body.scrollLeft - 30;

  yPopMenuPos = window.event.y + document.body.scrollTop - 20;

  xPopMenuPageMax = document.body.clientWidth+document.body.scrollLeft;

  yPopMenuPageMax = document.body.clientHeight+document.body.scrollTop;



  if (xPopMenuPos<=1) xPopMenuPos = 2;

  if (yPopMenuPos<=1) yPopMenuPos = 2;



  var menuObj = eval("document.all."+idStr+".style");

  var popWidth = "" + menuObj.width;

  var popHeight = "" + menuObj.height;

  

  popWidth = popWidth.toLowerCase();

  popHeight = popHeight.toLowerCase();



  

  if (popWidth.indexOf("px")>0)

  {

     popWidth = parseInt(popWidth.substring(0,popWidth.indexOf("px")));

  }

  

  if (popHeight .indexOf("px")>0)

  {

     popHeight = parseInt(popHeight .substring(0,popHeight.indexOf("px")));

  }

  

  popMenuRight = xPopMenuPos + popWidth;

  popMenuBottom = yPopMenuPos + popHeight;

  

  if (popMenuRight>xPopMenuPageMax)

  {

     xPopMenuPos = xPopMenuPos - (popMenuRight-xPopMenuPageMax+1);

     popMenuRight = xPopMenuPageMax-1;

  }



  if (popMenuBottom>yPopMenuPageMax)

  {

     yPopMenuPos = yPopMenuPos - (popMenuBottom-yPopMenuPageMax+1);

     popMenuBottom= yPopMenuPageMax-1;

  }  

  

  menuObj.left = xPopMenuPos;

  menuObj.top = yPopMenuPos;

  menuObj.visibility = "visible";



  document.onmousemove = detectPopMenuMouseOut;

  popMenuIDStr = idStr;

}









function hidePopMenu_M()

{

  document.onmousemove = null;

  var menuObj = document.getElementById(popMenuIDStr).style;

  menuObj.visibility = "hidden";

  popMenuIsShown = false;

}





function hidePopMenu()

{

  if (document.all) {}

  else

  {

    hidePopMenu_M();

    return;

  }



  document.onmousemove = null;

  var menuObj = eval("document.all."+popMenuIDStr +".style");

  menuObj.visibility = "hidden";

  popMenuIsShown = false;

}













function browserInfo()

{

   if (   navigator.platform.indexOf("Win")>=0 

       && navigator.appVersion.indexOf("MSIE")>=0

      ) return "WinIE";





   if (   navigator.platform.indexOf("Mac")>=0 

       && navigator.appVersion.indexOf("MSIE")>=0

      ) return "MacIE";





   return "Other";

}





function projNo(proj,pList)

{

  for (i=0;i<pList.length;i++)

  {

     if (proj==pList[i]) return (i+1);

  }

  return 0;

}







function showProjNav(proj,pList,nList)

{

  var params = "?ProjectNumS="+pList.length+"&MarkedProjectS="+projNo(proj,pList);



  for (i=0;i<pList.length;i++)

  {

     params += "&PN"+(i+1)+"="+nList[i];

  }



  var flashMovie = "ProjectNav.swf";

//  if (pList.length>20) flashMovie = "ProjectNav2.swf";





  var objString = ""

    + "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'"

    + " codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'"

    + " WIDTH=640 HEIGHT=64>"

    + "<PARAM NAME=movie VALUE='../SystemFlashs/"+flashMovie

    + params

    + "'>" 

    + "<PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>" 

    + "<EMBED src='../SystemFlashs/"+flashMovie

    + params

    + "' quality=high bgcolor=#FFFFFF"

    + " WIDTH=640 HEIGHT=64"

    + " TYPE='application/x-shockwave-flash'"

    + " PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'>"

    + "</EMBED></OBJECT>";





   document.write (objString);

}











function nextProject(proj,pList)

{

   if (pList[pList.length-1]==proj)

   {

      return pList[0];

   }



   for (i=0;i<pList.length-1;i++)

   {

      if (pList[i]!=proj) continue;

      return pList[i+1];      

   }



   return "";

}







function setCookie2(name,value)

{

  var td = new Date();

  var d = new Date();

  d.setTime(td.getTime()+1000*60*60*24*30); //One month

  document.cookie = name + "=" + escape(value) + "; expires=" + d.toGMTString();

}







function setCookie(name,value)

{

//  var td = new Date();

//  var d = new Date();

//  d.setTime(td.getTime()+1000*60*60*24*30); //One month

//  document.cookie = name + "=" + escape(value) + "; expires=" + d.toGMTString();

   document.cookie = name + "=" + escape(value);

}



function getCookie(name)

{

  search = name+"=";

  if (document.cookie.length>0)

  {

    offset = document.cookie.indexOf(search);

    if (offset == -1) return "";

    offset += search.length;

    end = document.cookie.indexOf(";",offset);

    if (end == -1) end = document.cookie.length;

    return unescape(document.cookie.substring(offset,end));

  }

  return "";

}







function sendDate(str)

{

}



function sendData(str)

{

   setCookie("GloryMath",str);

}





//ryan was here. This function seems to be forcing the user to visit the index page at least once.

function getParam()

{

   var param = 243760897615; //getCookie("GloryMath");
   if (param==null || param=="" || param=="Invalid")

   { 

      location = "../../index.html";

      return "";

   }

   else return param;

}







function showMacProject(proj)

{

   var PlayString = "true";

   var projCookie = getCookie("NowProjectID");

   if (projCookie!=null && projCookie!="" && projCookie!=proj) PlayString = "false";



   var objString = ""

      + "<OBJECT name=ProjectMovie classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' "

      + "codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' "

      + "WIDTH=640 HEIGHT=400>"

      + "<PARAM NAME=movie VALUE='../../FlashFiles/"

      + proj + ".swf?argNet=yes&arg1=nosend&arg2=project&arg3=nosend&arg4=Off/20/1/&arg5="+getParam()+"'>" 

      + "<PARAM NAME=play VALUE=" + PlayString + ">"

      + "<PARAM NAME=menu VALUE=false><PARAM NAME=quality VALUE=high><param name=wmode value=transparent> <PARAM NAME=bgcolor VALUE=#FFFFFF>"

      + "<EMBED name=ProjectMovie src='../../FlashFiles/"

      + proj + ".swf?argNet=yes&arg1=nosend&arg2=project&arg3=nosend&arg4=Off/20/1/&arg5="+getParam()+"' "

      + "quality=high play=" + PlayString

      + " menu=false wmode=transparent bgcolor=#FFFFFF WIDTH=640 HEIGHT=400 "

      + "TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED>"

      + "</OBJECT>";



   document.write (objString);

}







function writeStringMovie()

{

   var objString = ""

      + "<OBJECT name=StringMovie classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'"

      + " codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=0 HEIGHT=0>"

      + "<PARAM NAME=movie VALUE='Preview/SystemFlashs/NavSh.swf'>"

      + "<PARAM NAME=play VALUE=true><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>"

      + "<EMBED name=StringMovie src='Preview/SystemFlashs/NavSh.swf'"

      + " quality=high play=true bgcolor=#FFFFFF WIDTH=0 HEIGHT=0"

      + " TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'>"

      + "</EMBED></OBJECT>";

   document.write (objString);

}







function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}





