//
//====================================================================================================
//
//					   Copyright Notice
//                                            Version 3.0
//
//                                    Copyright (c) 2004 - 2008
//                                          Linda Walters
//                                       All Rights Reserved
//
//====================================================================================================
//



//
//====================================================================================================
//
//	Call this function at the bottom of any page to display the copyright date notice,
//	name of the copyright holder, contact email, name for the email and any base copyright
//	date for multi-year copyrights in the footer frame of G3. 
//
//	For Example:
//
//	<script type="text/javascript">
//      	document.write(CopyrightNotice(2006));
//	</script>
//
//	This will display the following:
//
//			Copyright © 2006-2008
//		         All Rights Reserved
//
//	which will be centered on the page.
//	
//	The email address will be a mailto protocol hyperlink applied to the text of
//	the first argument.
//
//	If the last argument for the base copyright data is omitted the Copyright line
//	will simply be "Copyright (c) " and the current four-digit year.
//
//	The Modified: line derives its data from the lastModified property of the document.
//
//====================================================================================================


//==================================================
//		     CONSTANTS
//==================================================
var COPYRIGHT_HEADING		= "Copyright &copy; ";
var DASH			= "-";
var CRLF			= "<br />";
var MAIL_ANCHOR			= "<a href='mailto:";
var MAIL_SUBJECT		= "?subject=Website'>";
var ANCHOR_CLOSE		= "</a>"
var RIGHTS_RESERVED		= "All Rights Reserved";
var MODIFIED_LINE		= "Modified: ";
var COPYRIGHT_DIV_ELEMENT	= "copyrightDivision";
var COPYRIGHT_FOOT_ELEMENT	= "footerCopyright";


function CopyrightNotice(baseDate)
{
var result;
var dateString;
var modDate;
var yearFull;
var currentDocument;
var oCopyrightDiv;
var ownerName;
var ownerEMail;
var CurWindow;
var mainFrame;
var frameName;

	result = true;	
	CurWindow = window;

	try {
		ownerName = CurWindow.parent.gCopyrightHolder;
		ownerEMail = CurWindow.parent.gCopyrightContact;
		
		modDate = new Date(window.parent.frames["mainFrame"].document.lastModified);

		if (modDate != null) {
			yearFull = modDate.getFullYear();
			dateString = modDate.toLocaleDateString();
		
			if ((baseDate > 0) && (baseDate < yearFull)) {
				result = COPYRIGHT_HEADING + baseDate + DASH + yearFull + CRLF;
			}
			
			else {
				result = COPYRIGHT_HEADING + yearFull + CRLF;
			}
		
			result = result + MAIL_ANCHOR + ownerEMail + MAIL_SUBJECT + ownerName + ANCHOR_CLOSE + CRLF + RIGHTS_RESERVED + CRLF;
			result = result + MODIFIED_LINE + dateString + CRLF;
	
			try {
				currentDocument = window.parent.frames["mainFrame"].document;
				oCopyrightDiv = currentDocument.getElementById(COPYRIGHT_DIV_ELEMENT);
				oCopyrightDiv.innerHTML = result;
			} catch(ex) {
				result = false;
			}
		}
	} catch(ex) {
		result = false;
	}

	return(result);
} // function CopyrightNotice()


function FooterCopyrightNotice(baseDate)
{
var result;
var dateString;
var modDate;
var yearFull;
var footerDocument;
var oCopyrightDiv;
var ownerName;
var ownerEMail;
var CurWindow;
var mainFrame;
var frameName;

	result = true;	
	CurWindow = window;

	try {
		ownerName = CurWindow.parent.gCopyrightHolder;
		ownerEMail = CurWindow.parent.gCopyrightContact;
		
		modDate = new Date(window.parent.frames[MAIN_FRAME].document.lastModified);

		if (modDate != null) {
			yearFull = modDate.getFullYear();
			dateString = modDate.toLocaleDateString();
		
			if ((baseDate > 0) && (baseDate < yearFull)) {
				result = COPYRIGHT_HEADING + baseDate + DASH + yearFull + CRLF;
			}
			
			else {
				result = COPYRIGHT_HEADING + yearFull + CRLF;
			}
		
			result = result + MAIL_ANCHOR + ownerEMail + MAIL_SUBJECT + ownerName + ANCHOR_CLOSE + CRLF + RIGHTS_RESERVED + CRLF;
			result = result + MODIFIED_LINE + dateString + CRLF;
	
			try {
				footerDocument = window.parent.frames[FOOTER_FRAME].document;
				oCopyrightDiv = footerDocument.getElementById(COPYRIGHT_FOOT_ELEMENT);
				oCopyrightDiv.innerHTML = result;
			} catch(ex) {
				result = false;
			}
		}
	} catch(ex) {
		result = false;
	}

	return(result);
} // function FooterCopyrightNotice()


function backupCopyright() {
var result;
var dateString;
var modDate;
var yearFull;
var footerDocument;
var oCopyrightDiv;
var ownerName;
var ownerEMail;
var CurWindow;
var mainFrame;
var frameName;

	result = true;	
	CurWindow = window;

	try {
		footerDocument = window.document;
		oCopyrightDiv = footerDocument.getElementById(COPYRIGHT_DIV_ELEMENT);
		if (oCopyrightDiv.innerHTML == "") {
			ownerName = "Linda Gail Walters"
			ownerEMail = "linda@lindagailwalters.com"
			modDate = new Date(window.document.lastModified);

			if (modDate != null) {
				yearFull = modDate.getFullYear();
				dateString = modDate.toLocaleDateString();
			
				result = COPYRIGHT_HEADING + yearFull + CRLF;			
				result = result + MAIL_ANCHOR + ownerEMail + MAIL_SUBJECT + ownerName + ANCHOR_CLOSE + CRLF + RIGHTS_RESERVED + CRLF;
				result = result + MODIFIED_LINE + dateString + CRLF;
		
				oCopyrightDiv.innerHTML = result;
			}
		}
	} catch(ex) {
		result = false;
	}

	return(result);
}
