
// Opens a New window in the current space
function MM_openBrWindow( theURL, winName, features )
{ //v2.0
	window.open( theURL, winName, features) ;
}

	// Creates the basic elements for each page
	// ========================================

	// Displays the main page graphic
	function DisplayBanner()
	{
		document.getElementById('banner').innerHTML = "<img src='images/maldivesbanner.gif' width='600' height='150' alt='Maldives Scuba Diving Club' title='Maldives Scuba Diving Club' />" ;
	}

	// Display the breadcrumb trail
	function DisplayBreadCrumb( breadcrumb1, breadcrumb2, breadcrumb3, breadcrumb4, breadcrumb5 )
	{	
		// Create & initalise the breadcrumb string
		var breadcrumbString = "<ul>" ;
		
		// Check for each parameter & add it if present
		if ( breadcrumb1) 
		{
			breadcrumbString = breadcrumbString + "<li>" + breadcrumb1 + "</li>" ;
			
			if ( breadcrumb2 )
			{
				breadcrumbString = breadcrumbString + "<li>" + breadcrumb2 + "</li>" ;

				if ( breadcrumb3 )
				{
					breadcrumbString = breadcrumbString + "<li>" + breadcrumb3 + "</li>" ;

					if ( breadcrumb4 )
					{
						breadcrumbString = breadcrumbString + "<li>" + breadcrumb4 + "</li>" ;
						
						if ( breadcrumb5 )
						{
							breadcrumbString = breadcrumbString + "<li>" + breadcrumb5 + "</li>" ;
						}
					}	// end of breadcrumb4
				}		// end of breadcrumb3
			}			// end of breadcrumb2
		}				// end of breadcrumb1
		
		// Add the tail & display
		breadcrumbString = breadcrumbString + "</ul>" ;
		document.getElementById('breadCrumb').innerHTML = breadcrumbString ;
	}
	
	function DisplayContactUs()
	{
		document.getElementById('contactUs').innerHTML = "<a style='color:#F00' href='mailto:mike@thetrainingstation.org'>Contact Maldives</a>" ;
	}
	
	// Displays the main menu
	function DisplayMainMenu()
	{
		document.getElementById('mainMenu').innerHTML = "<ul class='mainMenu'>" +
														"<li><a href='index.html'>Home</a></li>" + 
														"<li><a href='club.html'>The Club</a></li>" + 
														"<li><a href='diary.php'>Diary</a></li>" + 
														"<li><a href='photos.html'>Photos</a></li>" + 
														"<li><a href='divereports.html'>Sites and Reports</a></li>" + 
														"<li><a href='training.html'>Training</a></li>" + 
														"<li><a href='equipment.html'>Equipment</a></li>" + 
														"<li><a href='fun.html'>Fun Stuff</a></li>" + 
														"<li><a href='links.html'>Links and Forms</a></li>" +
														"<li><a href='sharksurvey.php'>Shark Survey</a</li>" +
														"</ul>" ;
	}

	// Displays Page Title
	function DisplayPageTitle( pageTitle )
	{
		document.getElementById('pageTitle').innerHTML = pageTitle ;	
	}
	
	// Display Clickable Sharklab image
	function DisplaySharklab()
	{
		document.getElementById('sharkLab').innerHTML = "<a href='#' onclick='MM_openBrWindow(\"http://www.sharklab.tk\",\"Sharklab\",\"width=1200,height=750,scrollbars=1\")'><img src='images/sharklab.png' width='125' height='135' alt='Sharklab' title='Sharklab' border='None' /></a>" ;
	}
	
	function DisplaySiteMap()
	{
		document.getElementById('siteMap').innerHTML = "<a href='sitemap.html'>Site Map</a>" ;
	}
	
	function DisplayTaurus()
	{
		var onclick_String ;
	
		onclick_string = 'onclick="MM_openBrWindow(\'http://www.thetrainingstation.org/taurus.htm\',\'Taurus\',\'width=1200,height=750\')"' ;
	
		document.getElementById('taurus').innerHTML = 'Created by <a href="#" "' + onclick_string + '" >Taurus Analysis Ltd <img src="images/taurus1.gif" class="right" width="100" height="50" alt="Taurus Analysis Ltd" title="Taurus" /></a>' ;
		
	}

	function DisplayW3C()
	{
		document.getElementById('w3c').innerHTML = "<a href='http://validator.w3.org/check?uri=referer'><img src='http://www.w3.org/Icons/valid-xhtml10' alt='Valid XHTML 1.0 Transitional' class='center' height='31' width='88' title='W3C Validator' /></a>" ;
	}


	// ======================================
	// Create a Post It note object & methods
	// ======================================
	function PostIt (left, top, width )
	{
		this.left = left ;
		this.top = top ;
		this.width = width ;
		
		// Setup the style string
		this.showNote = function( border ) 
		{
			var style = "<div class='postItNote' style='left:" + this.left + "px; top:" + this.top + "px; width:" + this.width + "px;" ;
			
			// See if we need to add a border
			if ( border == "True" )
			{
				style += "border:thin solid;>'" ;
			}
			else
			{
				style += "border:none;>'" ;
			}
			
			document.write( style ) ;
		} ;
		
		// Show the Pin
		this.showPin = function( colour )
		{
			var pin_name ;
			switch ( colour )
			{
				case "White":
					pin_name = "images/pinw.gif" ;
					break ;
					
				case "Red":
					pin_name = "images/pinr.gif" ;
					break ;
					
				// Do nothing if no pin specified
				default:
					break ;
			}

			document.write( "<img src='" + pin_name +"' height='20' width='20' alt='pin' title='pin' class='left' />" ) ;
		} ;
		
		// Display the title
		this.showTitle = function( title )
		{
			document.write( "<h1>" + title + "</h1>" ) ;
		} ;
		
		// Display the post it note content
		// Parameters: 	content 		: The content of the note
		//				justification	: Centre = Centred
		//								: else Full justification
		this.showContent = function ( content, justification )
		{
			// Declare & initialise the styling
			var style = "h2" ;

			// See if the styling parameter has been passed
			if ( justification )
			{
				// Yes...see if centre is required
				if ( justification == "Centre" )
				{
					// Yes...set the style
					style = "h3" ;
				}
			}
			
			// Display the content
			document.write( "<" + style + ">" + content + "</" + style + ">" ) ;
		}
		
		// Close off the post it note
		this.closeNote = function()
		{
			document.write( "</div>" ) ;
		}
	} ;			

	// ====================================================


// Opens a file, passing iun parameters on the command line
function MM_goToURL()
{
	var i, args = MM_goToURL.arguments ;
	document.MM_returnValue = false ;
	
	for ( i = 0 ; i < ( args.length - 1 ) ; i += 2 )
		eval( args[ i ] + ".location='" + args[ i + 1 ] + "'" ) ;
}

// Verifies that the data entered is complete
function verify()
{
	var themessage = "Please complete the following : " ;
	// Assume all fields are valid
	var success = true ;
	
	if (document.entryForm.name.value == "" )
	{
		themessage = themessage + " - Name";
		success = false ;
	}
	
	if (document.entryForm.email.value == "" )
	{
		themessage = themessage + " - EMail" ;
		success = false ;
	}
	
	if (document.entryForm.divesite.value == "" )
	{
		themessage = themessage + " - Dive Site" ;
		success = false ;
	}
		
	//alert if fields are empty and cancel form submit
	if ( success == false )
	{
		alert( themessage ) ;
	}
	
	// return the state of the validation
	return success ;
}
