/*
 * This file has general-purpose functions for the web site...
 *
 */

/*
 * We'll start with some defaults for color, etc... 
 */


var today = new Date()
var bgTitle = 'darkblue'
var bgBanner = 'lightblue'
var menuChoice = 'lightcyan'
var menuShadow = 'blue'
var fgTitle = 'cornsilk'
var fgBanner = 'black'
var bgMainArea = 'beige'
var menuPosition = [7,118];
var titleHeader = 'Longmont Theatre Company';

var goUpOne = '../'; var goUp = ''; for (var i=2; i<=pageLevel; i++) { goUp = goUp + goUpOne; }

var menuAreaWidth=200
var minimumMenuDepth = 375
var actualMenuDepth = minimumMenuDepth


var realBrowserWidth = 0, realBrowserHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    realBrowserWidth = window.innerWidth;
    realBrowserHeight = window.innerHeight;
  } else {
    realBrowserWidth = screen.width-50;
    realBrowserHeight = screen.height-100;
  } 



/* Generate a title. Call this from within <head> */
function generateTitle(title)
{
    var t = titleHeader;
    if (title != "" && title != t) { t = t + " - "+title; }
    document.writeln("<title>"+t+"</title>");
}

/* Start the page. Called just inside of <body>. 
*  Creates the menu, sets up the main table and logo, and page title. 
*  Use one of the endPagexxxx functions to finish afterwards
*/
function startPage(title, bannerText, bannerIcon, menuItem)
{
    makeLTCMenu("menu1", menuPosition,menuItem, pageLevel);

    var l = new Array();

    var iconCode = '';
    if (bannerIcon != '') {
        if (bannerIcon.substring(0,1) == '<') {
            iconCode = "&nbsp;&nbsp;"+bannerIcon;
        }
        else {
            iconCode = "&nbsp;&nbsp;<img src='"+bannerIcon+"' width=50 height=50 align=middle border=0>"
        }
    }

    var textCode = ""
    if (bannerText != '' && bannerText.substring(0,1) == '<') {
        textCode = bannerText /* fully manual */
    }
    else {
        textCode = "<I>"+iconCode+"&nbsp;&nbsp;&nbsp;"+bannerText+"</I>"
    }


     l.push("<TABLE BORDER=0 CELLPADDING=0 cellspacing=0 WIDTH=100%");
     l.push("    <TR><TD ID=logoarea WIDTH="+menuAreaWidth+" HEIGHT=100 BGCOLOR='white' ALIGN='CENTER' VALIGN='MIDDLE' nowrap rowspan=2>");
     l.push("        <a href='"+goUp+"index.html'><IMG SRC='"+goUp+"img/ltcLogonew.gif' WIDTH=175 HEIGHT=75 BORDER=0 ALT='LTC Logo'></a>");
     l.push("    </TD>");
     l.push("            <TD height=75 BGCOLOR='"+bgBanner+"'><font color='"+fgBanner+"'>"+textCode+"</font></TD></TR>");
     l.push("            <TR><TD HEIGHT=25 ALIGN=center BGCOLOR='"+bgTitle+"'><FONT SIZE=+2 COLOR='"+fgTitle+"'><B><I>"+title+"</i></B></FONT></TD></TR>");
     l.push("    <TR><TD ID=menuarea WIDTH="+menuAreaWidth+" HEIGHT="+actualMenuDepth+" BGCOLOR='"+bgTitle+"'></TD>");
     /* l.push("    <TR><TD ID=menuarea WIDTH="+menuAreaWidth+" HEIGHT="+actualMenuDepth+" BGCOLOR='"+bgTitle+"' background='"+goUp+"img/black_white_mask.gif'></TD>"); */
     l.push("                <TD BGCOLOR='"+bgMainArea+"' VALIGN='TOP'>");

     for (var i = 0;i<l.length;i++) { document.writeln(l[i]); }
}


function endPage(includeSponsors)
{

    var l = new Array();
     l.push("    </TD>");
     l.push("    </TR>");
     l.push(" <tr><td bgcolor='"+bgTitle+"'></td><TD BGCOLOR='"+bgBanner+"' ALIGN='center'><font color='"+bgTitle+"'>Web hosting services provided by <A HREF='http://freehostia.com'>Free Hostia</A></font>");
     l.push("<br/><small>Copyright &copy; "+today.getFullYear()+" Longmont Theater Company. All rights reserved.</small></td></tr>");
     l.push("</TABLE>");
     if (includeSponsors) {
        l.push("<TABLE WIDTH='100%' BORDER=1>");
        l.push("<TR><TD align=center>");
        l.push("<a href='sponsors/index.html'><H2>Our Sponsors</H2></a>");
        l.push("<br/>The Longmont Theater Company would like to thank the many organizations that make");
        l.push("community theatre possible.");
        l.push("Without the support of many companies, organizations and individuals Longmont");
        l.push("would not have the quality of community theatre that it does.</p>");
        l.push("</td></tr><tr><td>");
        l.push("<table border='0' width='100%' cellpadding='0' cellspacing='0'>");
        l.push("<tr>");
        l.push("<td width='33%' align='center'><a href='http://www.scfd.org/'><img border='0' src='"+goUp+"img/scfd.gif' width='95' height='95'></a></td>");
        l.push("<td width='34%' align='center'><a href='http://www.xcelenergy.com/'><img border='0' src='"+goUp+"img/xcel.jpg' width='216' height='61'></a></td>");
        l.push("</tr>");
        l.push("</table>");
        l.push("    </TD></TR>");
        l.push("</TABLE>");
     }

     /* NOT DOING THE STAT COUNTER ANY MORE
        Insert the counter code. Put it at the bottom, because it does take up a small amount of screen space...
     l.push('<!-- Start of StatCounter Code -->');
     l.push('<script type="text/javascript" language="javascript">');
     l.push('var sc_project=595913; ');
     l.push('var sc_partition=4; ');
     l.push('var sc_security="453742d7"; ');
     l.push('</script>');
     l.push('<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c5.statcounter.com/counter.php?sc_project=595913&amp;java=0&amp;security=453742d7" alt="site hit counter" border="0"></a></noscript>');
     l.push('<!-- End of StatCounter Code -->');
     */

     l.push("</BODY>");
     l.push("</HTML>");

     for (var i = 0;i<l.length;i++) { document.writeln(l[i]); }
}

function endPageWithSponsors()    {endPage(true);}
function endPageWithoutSponsors() {endPage(false);}

