/* Navbar title attributes */
var homeTitle         = "Eagle Claw Kung Fu Center Homepage";
var faqTitle         = "Frequently Asked Questions";
var eagleclawTitle         = "Eagle Claw Kung Fu";
var taichiTitle     = "Tai Chi Chuan";
var schoolinfoTitle        = "Biography and Lineage";
var multimediaTitle     = "Media";
var contactTitle     = "Contact Information";
var studentTitle     = "Student Area";
var linksTitle     = "Links";
var navSite = {
  "Home"         : { name : "Home", title : homeTitle, url : "index.php" },
  "Frequently Asked Questions"     : { name : "Frequently Asked Questions", title : faqTitle, url : "faq.php"},
  "Eagle Claw Kung Fu"     : { name : "Eagle Claw Kung Fu", title : eagleclawTitle, url : "eagleclaw.php"},
  "Tai Chi Chuan"    : { name : "Tai Chi Chuan", title : taichiTitle, url : "taichi.php"},
  "Biography and Lineage"        : { name : "Biography and Lineage", title : schoolinfoTitle, url : "schoolinfo.php"},
  "Media"      : { name : "Media", title : multimediaTitle, url : "multimedia.php"},
  "Contact Information"      : { name : "Contact Information", title : contactTitle, url : "contactinfo.php"},
  "Links"      : { name : "Links", title : linksTitle, url : "links.php"},
  "Student Area"      : { name : "Student Area", title : studentTitle, url : "saindex.php"}  
};


var echistoryTitle = "Find out the history of Eagle Claw Kung Fu";
var ecstancesTitle = "The Eight Basic Stances";
var ecweaponsTitle = "The Weapons training";
var ecqaTitle = "Everything you wanted to know about Eagle Claw Kung Fu";
var ecMenu = {
  "The History"         : { name : "The History", title : echistoryTitle, url : "eagleclawhistory.php" },
  "The Eight Basic Stances"     : { name : "The Eight Basic Stances", title : ecstancesTitle, url : "eagleclawstances.php"},
  "The Weapons"    : { name : "The Weapons", title : ecweaponsTitle, url : "eagleclawweapons.php"},
  "Questions and Answers"        : { name : "Questions and Answers", title : ecqaTitle, url : "eagleclawqa.php"}
};


var tcchistoryTitle = "Find out the history of Tai Chi Chuan";
var tccqaTitle = "Everything you wanted to know about Tai Chi Chuan";
var tccMenu = {
  "The History"         : { name : "The History", title : tcchistoryTitle, url : "taichihistory.php" },
  "Questions and Answers"     : { name : "Questions and Answers", title : tccqaTitle, url : "taichiqa.php"}
};


var sainfoTitle = "Review and update your contact information";
var saformsTitle = "View the forms you've completed";
var saMenu = {
  "My Information"         : { name : "My Information", title : sainfoTitle, url : "sainfo.php" },
  "My Forms"     : { name : "My Forms", title : saformsTitle, url : "saforms.php"}
};

BuildNavBar = function ( currentPage, session )	{

switch(currentPage) 
{
	
	/*
case "Eagle Claw Kung Fu":
	BuildEC( currentPage, session );
	break;
	
case "Eagle Claw Kung Fu: The History":
	currentPage = "The History"  
	BuildEC( currentPage, session );
	break;
	
case "Eagle Claw Kung Fu: The Eight Basic Stances":
	currentPage = "The Eight Basic Stances"  
	BuildEC( currentPage, session );
	break;
	
case "Eagle Claw Kung Fu: The Weapons":
	currentPage = "The Weapons"  
	BuildEC( currentPage, session );
	break;
	
case "Eagle Claw Kung Fu: Questions and Answers":
	currentPage = "Questions and Answers"  
	BuildEC( currentPage, session );
	break;
	
	

case "Tai Chi Chuan":
	BuildTCC( currentPage, session );
	break;

case "Tai Chi Chuan: The History":
	currentPage = "The History"
	BuildTCC( currentPage, session );
	break;
	
case "Tai Chi Chuan: Questions and Answers":
	currentPage = "Questions and Answers"
	BuildTCC( currentPage, session );
	break;
	
	*/

case "Student Area":
	BuildSA( currentPage, session );
	break;
	
case "Student Area: My Information":
	currentPage = "My Information"
	BuildSA( currentPage, session );
	break;

case "Student Area: My Forms":
	currentPage = "My Forms"
	BuildSA( currentPage, session );
	break;
	
default: 
	document.write('<ul>');
	for (i in navSite) {
		if ( session != true && navSite[i].title == "Student Area" ) { } 
		else {
		document.write('<li><a href="' + navSite[i].url + '" title="' + navSite[i].title + '" id="' + i  +'">' + navSite[i].name + '</a></li>');
		}
	}
 	document.write('</ul>');
	if ( currentPage != "news" || currentPage != "Sitemap" ) {
		setCurrent(currentPage);
	}
}


 }

BuildEC = function (currentPage, session) {
	
	  	document.write('<ul>');
  		document.write('<li><a href="' + navSite["Home"].url + '" title="' + navSite["Home"].title + '" id="' + navSite["Home"].name  +'">' + navSite["Home"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Frequently Asked Questions"].url + '" title="' + navSite["Frequently Asked Questions"].title + '" id="' + navSite["Frequently Asked Questions"].name  +'">' + navSite["Frequently Asked Questions"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Eagle Claw Kung Fu"].url + '" title="' + navSite["Eagle Claw Kung Fu"].title + '" id="' + navSite["Eagle Claw Kung Fu"].name  +'" class="current">' + navSite["Eagle Claw Kung Fu"].name + '</a><ul><li><a href="' + ecMenu["The History"].url + '" title="' + ecMenu["The History"].title + '" id="' + ecMenu["The History"].name + '">' + ecMenu["The History"].name + '</a></li><li><a href="' + ecMenu["The Eight Basic Stances"].url + '" title="' + ecMenu["The Eight Basic Stances"].title + '" id="' + ecMenu["The Eight Basic Stances"].name + '">' + ecMenu["The Eight Basic Stances"].name + '</a></li><li><a href="' + ecMenu["The Weapons"].url + '" title="' + ecMenu["The Weapons"].title + '" id="' + ecMenu["The Weapons"].name + '">' + ecMenu["The Weapons"].name + '</a></li><li><a href="' + ecMenu["Questions and Answers"].url + '" title="' + ecMenu["Questions and Answers"].title + '" id="' + ecMenu["Questions and Answers"].name + '">' + ecMenu["Questions and Answers"].name + '</a></li></ul></li>'); 
		document.write('<li><a href="' + navSite["Tai Chi Chuan"].url + '" title="' + navSite["Tai Chi Chuan"].title + '" id="' + navSite["Tai Chi Chuan"].name  +'">' + navSite["Tai Chi Chuan"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Biography and Lineage"].url + '" title="' + navSite["Biography and Lineage"].title + '" id="' + navSite["Biography and Lineage"].name  +'">' + navSite["Biography and Lineage"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Media"].url + '" title="' + navSite["Media"].title + '" id="' + navSite["Media"].name  +'">' + navSite["Media"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Contact Information"].url + '" title="' + navSite["Contact Information"].title + '" id="' + navSite["Contact Information"].name  +'">' + navSite["Contact Information"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Links"].url + '" title="' + navSite["Links"].title + '" id="' + navSite["Links"].name  +'">' + navSite["Links"].name + '</a></li>'); 
		if ( session == true ) {
		document.write('<li><a href="' + navSite["Student Area"].url + '" title="' + navSite["Student Area"].title + '" id="' + navSite["Student Area"].name  +'">' + navSite["Student Area"].name + '</a></li>'); }
 	 	document.write('</ul>');		
		setCurrent(currentPage);
	
}


BuildTCC = function (currentPage, session) { 


	  	document.write('<ul>');
  		document.write('<li><a href="' + navSite["Home"].url + '" title="' + navSite["Home"].title + '" id="' + navSite["Home"].name  +'">' + navSite["Home"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Frequently Asked Questions"].url + '" title="' + navSite["Frequently Asked Questions"].title + '" id="' + navSite["Frequently Asked Questions"].name  +'">' + navSite["Frequently Asked Questions"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Eagle Claw Kung Fu"].url + '" title="' + navSite["Eagle Claw Kung Fu"].title + '" id="' + navSite["Eagle Claw Kung Fu"].name  +'">' + navSite["Eagle Claw Kung Fu"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Tai Chi Chuan"].url + '" title="' + navSite["Tai Chi Chuan"].title + '" id="' + navSite["Tai Chi Chuan"].name  +'" class="current">' + navSite["Tai Chi Chuan"].name + '</a><ul><li><a href="' + tccMenu["The History"].url + '" title="' + tccMenu["The History"].title + '" id="' + tccMenu["The History"].name + '">' + tccMenu["The History"].name + '</a></li><li><a href="' + tccMenu["Questions and Answers"].url + '" title="' + tccMenu["Questions and Answers"].title + '" id="' + tccMenu["Questions and Answers"].name + '">' + tccMenu["Questions and Answers"].name + '</a></li></ul></li>'); 
		document.write('<li><a href="' + navSite["Biography and Lineage"].url + '" title="' + navSite["Biography and Lineage"].title + '" id="' + navSite["Biography and Lineage"].name  +'">' + navSite["Biography and Lineage"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Media"].url + '" title="' + navSite["Media"].title + '" id="' + navSite["Media"].name  +'">' + navSite["Media"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Contact Information"].url + '" title="' + navSite["Contact Information"].title + '" id="' + navSite["Contact Information"].name  +'">' + navSite["Contact Information"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Links"].url + '" title="' + navSite["Links"].title + '" id="' + navSite["Links"].name  +'">' + navSite["Links"].name + '</a></li>'); 
		if ( session == true ) {
		document.write('<li><a href="' + navSite["Student Area"].url + '" title="' + navSite["Student Area"].title + '" id="' + navSite["Student Area"].name  +'">' + navSite["Student Area"].name + '</a></li>'); 
		}	
 	 	document.write('</ul>');		
		setCurrent(currentPage);



}



BuildSA = function (currentPage, session) { 


	  	document.write('<ul>');
  		document.write('<li><a href="' + navSite["Home"].url + '" title="' + navSite["Home"].title + '" id="' + navSite["Home"].name  +'">' + navSite["Home"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Frequently Asked Questions"].url + '" title="' + navSite["Frequently Asked Questions"].title + '" id="' + navSite["Frequently Asked Questions"].name  +'">' + navSite["Frequently Asked Questions"].name + '</a></li>'); 
			document.write('<li><a href="' + navSite["Eagle Claw Kung Fu"].url + '" title="' + navSite["Eagle Claw Kung Fu"].title + '" id="' + navSite["Eagle Claw Kung Fu"].name  +'">' + navSite["Eagle Claw Kung Fu"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Tai Chi Chuan"].url + '" title="' + navSite["Tai Chi Chuan"].title + '" id="' + navSite["Tai Chi Chuan"].name  +'">' + navSite["Tai Chi Chuan"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Biography and Lineage"].url + '" title="' + navSite["Biography and Lineage"].title + '" id="' + navSite["Biography and Lineage"].name  +'">' + navSite["Biography and Lineage"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Media"].url + '" title="' + navSite["Media"].title + '" id="' + navSite["Media"].name  +'">' + navSite["Media"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Contact Information"].url + '" title="' + navSite["Contact Information"].title + '" id="' + navSite["Contact Information"].name  +'">' + navSite["Contact Information"].name + '</a></li>'); 
		document.write('<li><a href="' + navSite["Links"].url + '" title="' + navSite["Links"].title + '" id="' + navSite["Links"].name  +'">' + navSite["Links"].name + '</a></li>'); 
		if ( session == true ) {
		document.write('<li><a href="' + navSite["Student Area"].url + '" title="' + navSite["Student Area"].title + '" id="' + navSite["Student Area"].name  +'" class="current">' + navSite["Student Area"].name + '</a><ul><li><a href="' + saMenu["My Information"].url + '" title="' + saMenu["My Information"].title + '" id="' + saMenu["My Information"].name  +'">' + saMenu["My Information"].name + '</a></li><li><a href="' + saMenu["My Forms"].url + '" title="' + saMenu["My Forms"].title + '" id="' + saMenu["My Forms"].name  +'">' + saMenu["My Forms"].name + '</a></li></ul></li>'); 
		}	
 	 	document.write('</ul>');		
		setCurrent(currentPage);



}



								  
setCurrent = function (current) {
  var thePage = document.getElementById( current );

  /* Check if the class is already there */
  if (!thePage.className.match(new RegExp('\\bcurrent\\b'))) {
    thePage.className += ' current';
  }

  thePage.className = "current";

}


displayYear = function() {
var currentTime = new Date();
document.write(currentTime.getFullYear());
}

ClearField = function(cf) {
     if (cf.value == cf.defaultValue) {
         cf.value = "";
     }
}

externalLinks = function() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
} 


disableMe = function() {
	this.disabled = true;
}

mms_init = function() {
	
	externalLinks();
	
}