// JavaScript Document

var pathname = window.location.pathname;
var fullName = window.location.href;
var pageArray = pathname.split("/");
var currentPage = pageArray[pageArray.length-1];


// If the end of the url is blank
if (currentPage == "") {
	currentPage = "default.aspx";	
}
// Remove anything after the period
var newPageArray = currentPage.split(".");
currentPage = newPageArray[0].toLowerCase();

// Get the last part if exist (home-easter to easter)
var newPageArray2 = currentPage.split("-");
var whichSite = newPageArray2[newPageArray2.length -1].toLowerCase();

// Top Links defining by direct url
var liturgyClass = fullName === "http://www.bigbookfilms.com/default.aspx" ? "topLinkCurrent" : "topLinkRollover";
var easterClass = currentPage === "home-easter" ? "topLinkCurrent" : "topLinkRollover";
var gospelClass = currentPage === "home-gospel" ? "topLinkCurrent" : "topLinkRollover";
var adventClass = currentPage === "home-advent" ? "topLinkCurrent" : "topLinkRollover";
var lectionaryClass = currentPage === "lectionary-series" ? "topLinkCurrent" : "topLinkRollover";
var aboutClass = currentPage === "about" ? "topLinkCurrent" : "topLinkRollover";
var purchaseClass = fullName === "https://www.bigbookfilms.com/secure/default.aspx" ? "topLinkCurrent" : "topLinkRollover";
var contactClass = currentPage === "contact" ? "topLinkCurrent" : "topLinkRollover";

// For urls that contain main section names (easter, gospel, advent)
// This will override the previous variables
var easterClass = whichSite === "easter" ? "topLinkCurrent" : "topLinkRollover";
var gospelClass = whichSite === "gospel" ? "topLinkCurrent" : "topLinkRollover";
var adventClass = whichSite === "advent" ? "topLinkCurrent" : "topLinkRollover";


document.write('<div id="topLinks">');
	document.write('<table class="tableTopLinks" cellpadding="0" cellspacing="0" border="0">');
		document.write('<tr>');
			document.write('<td nowrap="nowrap" align="center"><ul class="' + liturgyClass + '"><li><a href="http://www.bigbookfilms.com/default.aspx" title="The Liturgy Series">Liturgy</a></li></ul></td>');
			
			document.write('<td><img src="/images/navDivider.gif" alt="" /></td>');
			
			document.write('<td nowrap="nowrap" align="center"><ul class="' + easterClass +'"><li><a href="http://www.bigbookfilms.com/home-easter.aspx" title="The Easter Series">Easter</a></li></ul></td>');
			
			document.write('<td><img src="/images/navDivider.gif" alt="" /></td>');
			
			document.write('<td nowrap="nowrap" align="center"><ul class="' + gospelClass + '"><li><a href="http://www.bigbookfilms.com/home-gospel.aspx" title="The Gospel Series">Gospel</a></li></ul></td>');
			
			document.write('<td><img src="/images/navDivider.gif" alt="" /></td>');
			
			document.write('<td nowrap="nowrap" align="center"><ul class="' + adventClass + '"><li><a href="http://www.bigbookfilms.com/home-advent.aspx" title="The Advent Series">Advent</a></li></ul></td>');
			
			document.write('<td><img src="/images/navDivider.gif" alt="" /></td>');
			
			document.write('<td nowrap="nowrap" align="center"><ul class="' + lectionaryClass + '"><li><a href="http://www.bigbookfilms.com/lectionary-series.aspx" title="The Lectionary Series">Lectionary</a></li></ul></td>');
			
			document.write('<td><img src="/images/navDivider.gif" alt="" /></td>');
			
			document.write('<td nowrap="nowrap" align="center"><ul class="' + aboutClass + '"><li><a href="http://www.bigbookfilms.com/about.aspx" title="About">About</a></li></ul></td>');
			
			document.write('<td><img src="/images/navDivider.gif" alt="" /></td>');
			
			document.write('<td nowrap="nowrap" align="center"><ul class="' + purchaseClass +'"><li><a href="https://www.bigbookfilms.com/secure/default.aspx" title="Purchase">Purchase</a></li></ul></td>');
			
			document.write('<td><img src="/images/navDivider.gif" alt="" /></td>');
			
			document.write('<td nowrap="nowrap" align="center"><ul class="' + contactClass +'"><li><a href="http://www.bigbookfilms.com/contact.aspx" title="Contact Us">Contact</a></li></ul></td>');
		document.write('</tr>');
	document.write('</table>');
document.write('</div>');