//<script language="javascript">
/*---------------------------------------------------------------------------
/ © Copyright 2000 SunGard Pentamation, Inc., All Rights Reserved.
/ This program is PROPRIETARY and CONFIDENTIAL information of SunGard
/ Pentamation, Inc., and may not be disclosed or used except as expressly
/ authorized in a license agreement controlling such use and disclosure.
/ Unauthorized use of this program will result in legal proceedings, civil
/ damages, and possible criminal prosecution.
/----------------------------------------------------------------------------
/ System Name: eSchoolPLUS
/----------------------------------------------------------------------------
/ File Name: banner.js
/----------------------------------------------------------------------------
/ File Description:
/ Helper script functions for banner.asp.
/----------------------------------------------------------------------------
/  REV #      DATE     BY        CASE #  COMMENTS
/ 1.0.000  ??/??/????  ?         -       Initial write.
/ 2.3.001  05/14/2010  ESW       1222    If the help file doesn't exist for
/                                        the page, make the help window
/                                        display the Welcome page instead of
/                                        giving a "Page not found" error in
/                                        the help window.
/ 2.3.015  11/08/2010  ESW       -       Since some customers have HAC set up
/                                        as a web site instead of a virtual
/                                        directory, stripping off text up to
/                                        the first "/" may not be the right
/                                        thing to do when determining the
/                                        help page.
/--------------------------------------------------------------------------*/

function Logout(){
	return confirm("Are you sure you wish to exit Home Access Center?");
}

function ShowHelp() {
    var strHelpPage = "";
    var strAltHelpPage = "";
	var expContent = /\Content\//i;
	var expASP = /\.asp.*/i;

	if (document.getElementById("HelpFile")) {
		if (document.getElementById("HelpFile").value) {
			strHelpPage = document.getElementById("HelpFile").value;
			// Strip any leading slashes off the help file name.
			while ((strHelpPage.substr (0, 1) == "/") && (strHelpPage != ""))
				strHelpPage = strHelpPage.substr (1);
		}
	} else {
		strHelpPage = window.location.pathname;
		//Strip out the application name
		strHelpPage = strHelpPage.substring(1, strHelpPage.length);
		strAltHelpPage = strHelpPage;
		strHelpPage = strHelpPage.substring(strHelpPage.indexOf("/") + 1,strHelpPage.length);
		
		//replace the file extension with htm
		strHelpPage = strHelpPage.replace(expASP, ".htm");
		strAltHelpPage = strAltHelpPage.replace(expASP, ".htm");
	}

	// See if the requested help page exists.  If not, redirect to Welcome.htm
	var objHTTP;
	if (window.XMLHttpRequest)  // IE 7+
	    objHTTP = new XMLHttpRequest();
	else // IE 6
	    objHTTP = new ActiveXObject("Microsoft.XMLHTTP");

	objHTTP.open("HEAD", "../Help/Content/" + strHelpPage, false);
	objHTTP.send("");
	if (objHTTP.status != 200) {
	    objHTTP.open("HEAD", "../Help/Content/" + strAltHelpPage, false);
	    objHTTP.send("");
	    if (objHTTP.status != 200) {
	        strHelpPage = "Welcome.htm";
	    } else {
	        strHelpPage = strAltHelpPage;
	    }
	}
	objHTTP.abort();
	objHTTP = null;

	FMCOpenHelp(strHelpPage, "Main", null, null);
	
	return false;
}
//</script>
