//==============================================================================
// Function: DC_DrawHorizontalCell()
// Description: Creats the Horizontal Cells 
// If you change anything in this Function you will need to change DC_BottomNav()
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawHorizontalCell(iPrecent, iSiteRef, iHref, iName) {
   var sHBarCell = "<td width='"+iPrecent+"%' nowrap>" +
    "<a class='Headers' href='"+iSiteRef+iHref+"' target='_top'>"+iName+"</a></td>" +
    "<td>|</td>";
	return(sHBarCell);
}

//==============================================================================
// Function: DC_TableSection1()
// Description: Draws the Top Section of a Box
// Inputs: None
// Return: None
//==============================================================================
function DC_TableSection1() {
   var sSiteRef = "";
// var sSiteRef = "../";

   var TableSection1 = "<table width='100%' border='0' cellspacing='0' cellpadding='0'>" +
        "<tr>" +
          "<td height='27'><img border='0' src='"+sSiteRef+"images/page-design/top-lft.png' width='9' height='27'>" +
          "</td>" +
          "<td width='100%' background='"+sSiteRef+"images/page-design/top-cnt.png' class='Headers'>" +
            "<p class='Headers'>";

	document.writeln(TableSection1);
}
//==============================================================================
// Function: DC_TableSection2()
// Description: Draws the Middle Section of a Box
// Inputs: None
// Return: None
//==============================================================================
function DC_TableSection2() {
   var sSiteRef = "";
// var sSiteRef = "../";

   var TableSection2 = "</td>" +
          "<td><img border='0' src='"+sSiteRef+"images/page-design/top-rt.png' width='10' height='27'></td>" +
        "</tr>" +
        "<tr>" +
          "<td width='9' height='35' background='"+sSiteRef+"images/page-design/border-lft.png'><span style='display: none'>&nbsp;</span></td>" +
          "<td width='87%' valign='top' bgcolor='#FFFFFF' class='MainBody'>" +
                "<p class='MainBody'>";

	document.writeln(TableSection2);
}
//==============================================================================
// Function: DC_TableSection3()
// Description: Draws the Last Section of a Box
// Inputs: None
// Return: None
//==============================================================================
function DC_TableSection3() {
   var sSiteRef = "";
// var sSiteRef = "../";

   var TableSection3 = "</td>" +
          "<td width='11' background='"+sSiteRef+"images/page-design/border-rt.png'>&nbsp;</td>" +
        "</tr>" +
        "<tr>" +
          "<td height='11' valign='top'>" +
            "<img border='0' src='"+sSiteRef+"images/page-design/bottom-lft.png' width='9' height='11'></td>" +
          "<td width='100%' background='"+sSiteRef+"images/page-design/bottom-cnt.png'><span style='display: none'>&nbsp;</span></td>" +
          "<td valign='top'>" +
          "<img border='0' src='"+sSiteRef+"images/page-design/bottom-rt.png' width='10' height='11'></td>" +
        "</tr>" +
      "</table>";

	document.writeln(TableSection3);
}
//==============================================================================
// Function: DC_DrawSideL1()
// Description: Draws the First Box on the left side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideL1() {
   var DrawSideL1Header = "NAVIGATION";
   var DrawSideL1Body = "&nbsp";
   DC_TableSection1();
	document.writeln(DrawSideL1Header);
   DC_TableSection2();
	NavMenuList();
	document.writeln(DrawSideL1Body);
   DC_TableSection3();
}
//==============================================================================
// Function: DC_DrawSideL2()
// Description: Draws the Second Box on the left side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideL2() {
   //var DrawSideL2Header = "WELCOME!";
   //var DrawSideL2Body = "&nbsp;Test";
   //DC_TableSection1();
	//document.writeln(DrawSideL2Header);
   //DC_TableSection2();
	//document.writeln(DrawSideL2Body);
   //DC_TableSection3();
}
//==============================================================================
// Function: DC_DrawSideL3()
// Description: Draws the Third Box on the left side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideL3() {
   //var DrawSideL3Header = "WELCOME!";
   //var DrawSideL3Body = "&nbsp;Test";
   //DC_TableSection1();
	//document.writeln(DrawSideL3Header);
   //DC_TableSection2();
	//document.writeln(DrawSideL3Body);
   //DC_TableSection3();

}
//==============================================================================
// Function: DC_DrawSideL4()
// Description: Draws the Forth Box on the left side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideL4() {
   //var DrawSideL4Header = "WELCOME!";
   //var DrawSideL4Body = "&nbsp;Test";
   //DC_TableSection1();
	//document.writeln(DrawSideL4Header);
   //DC_TableSection2();
	//document.writeln(DrawSideL4Body);
   //DC_TableSection3();
}
//==============================================================================
// Function: DC_DrawSideR1()
// Description: Draws the First Box on the right side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideR1() {
   var DrawSideR1Header = "WELCOME!";
   var DrawSideR1Body = "<p>Welcome to Dragon*Con 2009, the largest science fiction, fantasy, pop culture convention in North America!</p> If you any questions please contact <a href=\"mailto:pr@dragoncon.org\">pr@dragoncon.org</a>.";
   DC_TableSection1();
	document.writeln(DrawSideR1Header);
   DC_TableSection2();
	document.writeln(DrawSideR1Body);
   DC_TableSection3();
}
//==============================================================================
// Function: DC_DrawSideR2()
// Description: Draws the Second Box on the right side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideR2() {
   var DrawSideR2Header = "PUBLICATION DEADLINES";
   var DrawSideR2Body = "<strong>May 22, 2009</strong><br>Progress Report Ad Deadline</br> <br><strong>July 24, 2009</strong><br>Program Book Ad Deadline";
   DC_TableSection1();
	document.writeln(DrawSideR2Header);
   DC_TableSection2();
	document.writeln(DrawSideR2Body);
   DC_TableSection3();
}
//==============================================================================
// Function: DC_DrawSideR3()
// Description: Draws the Third Box on the right side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideR3() {
   var DrawSideR3Header = "DAYS UNTIL THE CON";
   var DrawSideR3Body1 = "<div align=center><b>";
   var DrawSideR3Body2 = "</b></div>";
   DC_TableSection1();
	document.writeln(DrawSideR3Header);
   DC_TableSection2();
	document.writeln(DrawSideR3Body1);
	DC_DayCounter();
	document.writeln(DrawSideR3Body2);
   DC_TableSection3();
}
//==============================================================================
// Function: DC_DrawSideR4()
// Description: Draws the Forth Box on the right side
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawSideR4() {
   //var DrawSideR4Header = "WELCOME!";
   //var DrawSideR4Body = "&nbsp;Test";
   //DC_TableSection1();
	//document.writeln(DrawSideR4Header);
   //DC_TableSection2();
	//document.writeln(DrawSideR4Body);
   //DC_TableSection3();
}

//==============================================================================
// Function: DC_DayCounter()
// Description: Draws the Top Horizontal Bar 
// Inputs: None
// Return: None
//==============================================================================
function DC_DayCounter() {
 nextDC =new Date("September 4, 2009");
 today  =new Date();
 msPerDay=24 * 60 * 60 * 1000;
 daysaway=(nextDC.getTime()-today.getTime())/msPerDay;
 daysaway=Math.round(daysaway);
 if (daysaway>0)                document.write(" ONLY "+  daysaway +" DAYS LEFT! ");
 if (daysaway>-5 && daysaway<1) document.write(" NOW! ");
 if (daysaway<0 && daysaway<-4) document.write(" NEXT Dragon*Con: September 2009");
}


//==============================================================================
// Function: DC_BottomNav()
// Description: Draws the Top Horizontal Bar 
// If you change anything in this Function you will need to change DC_DrawHorizontalBarTop()
//  or DC_DrawHorizontalBarBottom()
// Inputs: None
// Return: None
//==============================================================================
function DC_NavLink(iSiteRef, iHref, iName) {
   var sNavLink = "<a class='Headers' href='"+iSiteRef+iHref+"' target='_top'>"+iName+"</a>";

	return(sNavLink);
}

//==============================================================================
// Function: DC_BottomNav()
// Description: Draws the Top Horizontal Bar 
// If you change anything in this Function you will need to change DC_DrawHorizontalBarTop()
//  or DC_DrawHorizontalBarBottom()
// Inputs: None
// Return: None
//==============================================================================
function DC_BottomNav() {
// var sSiteRef = "";
// var sSiteRef = "../";
//   var sBottomNav = DC_NavLink(sSiteRef, "index.php", "Home") + " - " +
//  DC_NavLink(sSiteRef, "dc_shop.htm", "Shop");
//	document.writeln(sBottomNav);
}

//==============================================================================
// Function: DC_DrawFooter()
// Description: Draws the actual footer
// Inputs: None
// Return: None
//==============================================================================
function DC_DrawFooter() {
   var sFooter = "© Copyright 2009 <a class='Darkbody' href='mailto:dragoncon@dragoncon.org'>Dragon*Con</a> " +
         "All Rights Reserved. | Dragon*Con: <font color='#b1bac0'>September 4-7, 2009.</font>";

	document.writeln(sFooter);
}

//==============================================================================
// Function: expandDiv(el)
// Description: Expands a section in the navigation menu
// Inputs: el = the section name.
// Return: None
//==============================================================================
function expandDiv(el) 
{
  //if (!ver4) return;
  document.getElementById("nav_2_open_" + el).style.display = "block";
  document.getElementById("nav_2_closed_" + el).style.display = "none";
  activeDiv = el;
}

//==============================================================================
// Function: collapseDiv(el)
// Description: Collapses a section in the navigation menu
// Inputs: el = the section name.
// Return: None
//==============================================================================
function collapseDiv(el) 
{
  //if (!ver4) return;
  document.getElementById("nav_2_open_" + el).style.display = "none";
  document.getElementById("nav_2_closed_" + el).style.display = "block";
  activeDiv = "";
}

//==============================================================================
// This Section Runs everytime a web page is accessed.
// It detects to see if the person is running a browser that can handle 
// the Expanding and collapsing Menu.
//==============================================================================
var bV=parseInt(navigator.appVersion);
NS6=document.getElementById&&!document.all;
IE4=((document.all)&&(bV>=4))?true:false;
ver4 = (NS6 || IE4) ? true : false;
function expandDiv(){return;}
function collapseDiv(){return;}

//==============================================================================
// Function: initialize()
// Description: All sections are collapsed via the Cascading Style Sheet.
//             This section will expand a section on start up.
//             Add expandDiv('sectionName'); for any section you want to 
//             start opened.
// Inputs: None
// Return: None
//==============================================================================
function initialize()
{ 
// expandDiv('test2');
}

//==============================================================================
// Function: expandDiv(el)
// Description: Expands a section in the navigation menu
// Inputs: el = the section name.
// Return: None
//==============================================================================
function expandDiv(el) 
{
  if (!ver4) return;
//exclusive thingy!
//  if (activeDiv != "") collapseDiv(activeDiv);
  document.getElementById("nav_2_open_" + el).style.display = "block";
  document.getElementById("nav_2_closed_" + el).style.display = "none";
  activeDiv = el;
}


//==============================================================================
// Function: collapseDiv(el) 
// Description: Collapses a section in the navigation menu
// Inputs: el = the section name.
// Return: None
//==============================================================================
function collapseDiv(el) 
{
  if (!ver4) return;
  document.getElementById("nav_2_open_" + el).style.display = "none";
  document.getElementById("nav_2_closed_" + el).style.display = "block";
  activeDiv = "";
}

//==============================================================================
// Function: NavMenuTop(sectionEl, sectionName, sectionURL)
// Description: Creates the Collapsed and the top part of a sub menu
// Inputs: sectionEl = The a unique name for the section to reference.  
//                It should be simple with only alpha and neumeric characters.
//         sectionName = This is the name that will show up on the menu.
//         sectionURL = This it the dinamic URL of the referenced page from 
//                the main site.  The Java code will take care of adjustment.
// Return: None
//==============================================================================
function NavMenuTop(sectionEl, sectionName, sectionURL, sectionTarget)
{
   if (sectionURL.indexOf("http") != (-1)){
      var sSiteRef = "";
   } else {
   var sSiteRef = "";
// var sSiteRef = "../";
   }
  var sNavMenuTop;

		sNavMenuTop = "<div class=\"nav_2_closed\" id=\"nav_2_closed_"+sectionEl+"\">" +
  "<table border=0 cellpadding=0 cellspacing=0 width=100%>" +
    "<tr>" +
      "<td align=left id=tab onClick=\"expandDiv('"+sectionEl+"'); return false;\">" +
         "<a href=\""+sSiteRef+sectionURL+"\" onClick=\"expandDiv('"+sectionEl+"'); return false;\">"+sectionName+"</a></td>" +
      "<td align=right id=tab onClick=\"expandDiv('"+sectionEl+"'); return false;\">" +
         "<img src=\""+sSiteRef+"images/page-design/arrow-rt.jpg\"  border=0></td>" +
    "</tr>" +
  "</table>" +
  "</div>" +
  "<div class=\"nav_2_open\" id=\"nav_2_open_"+sectionEl+"\">" +
	"<table border=0 cellpadding=0 cellspacing=0 width=100%>" +
		"<tr>" +
			"<td align=left id=tab onClick=\"collapseDiv('"+sectionEl+"'); return false;\">" +
            "<a onClick=\"collapseDiv('"+sectionEl+"'); return false;\">"+sectionName+"</a></td>" +
			"<td align=right id=tab onClick=\"collapseDiv('"+sectionEl+"'); return false;\">" +
            "<img src=\""+sSiteRef+"images/page-design/arrow-dn.jpg\"  border=0></td>" +
		"</tr>";
  
  	document.write(sNavMenuTop);
}


//==============================================================================
// Function: NavMenuSub(sectionName, sectionURL)
// Description: Creates the sub menus of a sub menu
// Inputs: sectionName = This is the name that will show up on the menu.
//         sectionURL = This it the dinamic URL of the referenced page from 
//                the main site.  The Java code will take care of adjustment.
// Return: None
//==============================================================================
function NavMenuSub(sectionName, sectionURL, sectionTarget)
{
   if (sectionURL.indexOf("http") != (-1)){
      var sSiteRef = "";
   } else {
   var sSiteRef = "";
// var sSiteRef = "../";
   }
	var sNavMenuSub;

		sNavMenuSub = "<tr>" +
		"<td align=right id=subtab colspan=2 bgcolor=\"#FFFFFF\" onMouseOver=\"style.backgroundColor='#eeeeee';\" onMouseOut=\"style.backgroundColor='#FFFFFF';\">" +
   	"<a href=\""+sSiteRef+sectionURL+"\" target=\""+sectionTarget+"\">"+sectionName+"</a></td>" +
	"</tr>";
  
  	document.write(sNavMenuSub);
}

//==============================================================================
// Function: NavMenuFinal()
// Description: Creates a blank row to close off a sub menu
// Inputs: None
// Return: None
//==============================================================================
function NavMenuFinal()
{
   var sSiteRef = "";
// var sSiteRef = "../";

	var sNavMenuFinal;

		sNavMenuFinal = "<tr>" +
			"<td bgcolor=\"FFFFFF\" colspan=2><img src=\""+sSiteRef+"images/page-design/spacer.gif\" height=2></td>" +
		"</tr>" +
  "</table>" +
  "</div>";
  
  	document.write(sNavMenuFinal);
}

//==============================================================================
// Function: NavMenuSingle("sectionName", "sectionURL")
// Description: Creates the sub menus of a sub menu
// Inputs: sectionName = This is the name that will show up on the menu.
//         sectionURL = This it the dynamic URL of the referenced page from 
//                the main site.  The Java code will take care of adjustment.
// Return: None
//==============================================================================
function NavMenuSingle(sectionName, sectionURL, sectionTarget)
{
   if (sectionURL.indexOf("http") != (-1)){
      var sSiteRef = "";
   } else {
   var sSiteRef = "";
// var sSiteRef = "../";
   }

	var sNavMenuSingle;

  sNavMenuSingle = "<div class=\"nav_2_closed\">" +
	"<table border=0 cellpadding=0 cellspacing=0 width=100%>" +
		"<tr>" +
			"<td align=left); return false;\">" +
            "<a href=\""+sSiteRef+sectionURL+"\" target=\""+sectionTarget+"\">"+sectionName+"</a></td>" +
			"<td align=right>" +
            "<img src=\""+sSiteRef+"images/page-design/spacer.gif\" height=2></td>" +
		"</tr>"+
		"<tr>" +
			"<td bgcolor=\"FFFFFF\" colspan=2>" +
            "<img src=\""+sSiteRef+"images/page-design/spacer.gif\" height=2></td>" +
		"</tr>" +
  "</table>" +
  "</div>";
  
  	document.write(sNavMenuSingle);
}

//==============================================================================
// Function: NavMenuList()
// Description: Create the expanding and colapsable menu
// Expanding Menu: NavMenuTop("sectionEl", "sectionName", "sectionURL");
//                 NavMenuSub("sectionName", "sectionURL");
//                 NavMenuFinal();
// Non-Expanding Menu: NavMenuSingle("sectionName", "sectionURL");
// Inputs: None
// Return: None
//==============================================================================
function NavMenuList()
{
   NavMenuSingle("Dragon*Con Home", "http://www.dragoncon.org/", "_top");
  document.write("<hr>");   
   NavMenuSingle("Publications Home", "index.htm", "_top");
   NavMenuSingle("Daily Dragon", "http://dailydragon.dragoncon.org", "_blank");
//   NavMenuSingle("Dragon*Con Ads", "http://publications.dragoncon.org/index.htm#Ads", "_top");
//   NavMenuSingle("Flyers", "http://publications.dragoncon.org/index.htm#Flyers", "_top");
   NavMenuSingle("Newsletter", "http://newsletter.dragoncon.org", "_blank");
   NavMenuSingle("Pocket Program & Grids", "http://publications.dragoncon.org/index.htm#Pocket", "_top");
   NavMenuSingle("Program Book", "http://publications.dragoncon.org/index.htm#ProgBook", "_top");
   NavMenuSingle("Progress Report", "http://publications.dragoncon.org/index.htm#ProgRep", "_top");
//   NavMenuSingle("Schedule Grids", "http://publications.dragoncon.org/index.htm#Grids", "_top");
   NavMenuSingle("Web Banners", "http://publications.dragoncon.org/index.htm#Banners", "_top");
   NavMenuSingle("Contact", "contact.htm", "_top");
   initialize();
}