var DataChanged = 0;




// *********************************
// *********************************
// *********************************
// MENU SELECTIONS
// *********************************
// *********************************
// *********************************


// *********************************
// *********************************
// HOME PAGE
// *********************************
// *********************************

function SelectHomePage()
{
	strURL="ProcessMenuSelection.asp?pc=1"
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// NEWS PAGES
// *********************************
// *********************************

function SelectNewsPage()
{
	strURL="ProcessMenuSelection.asp?pc=2&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectNewsLettersPage()
{
	strURL="ProcessMenuSelection.asp?pc=2&spc=2"
	window.location.replace(strURL);
	return true;
}

function SelectPressReleasesPage()
{
	strURL="ProcessMenuSelection.asp?pc=2&spc=3"
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// WHO WE ARE PAGES
// *********************************
// *********************************

function SelectWhoWeArePage()
{
	strURL="ProcessMenuSelection.asp?pc=3&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectDirectorsPage()
{
	strURL="ProcessMenuSelection.asp?pc=3&spc=2"
	window.location.replace(strURL);
	return true;
}

function SelectCommitteesPage()
{
	strURL="ProcessMenuSelection.asp?pc=3&spc=3"
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// SLO-PITCH PAGES
// *********************************
// *********************************

function SelectSloPitchPage()
{
	strURL="ProcessMenuSelection.asp?pc=4&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectSloPitchLeaguesPage()
{
	strURL="ProcessMenuSelection.asp?pc=4&spc=2"
	window.location.replace(strURL);
	return true;
}

function SelectSloPitchTournamentsPage()
{
	strURL="ProcessMenuSelection.asp?pc=4&spc=3"
	window.location.replace(strURL);
	return true;
}

function SelectSloPitchChampionshipsPage()
{
	strURL="ProcessMenuSelection.asp?pc=4&spc=4"
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// FAST PITCH PAGES
// *********************************
// *********************************

function SelectFastPitchPage()
{
	strURL="ProcessMenuSelection.asp?pc=5"
	window.location.replace(strURL);
	return true;
}

function SelectFastPitchLeaguesPage()
{
	strURL="ProcessMenuSelection.asp?pc=5&spc=2"
	window.location.replace(strURL);
	return true;
}

function SelectFastPitchTournamentsPage()
{
	strURL="ProcessMenuSelection.asp?pc=5&spc=3"
	window.location.replace(strURL);
	return true;
}

function SelectFastPitchChampionshipsPage()
{
	strURL="ProcessMenuSelection.asp?pc=5&spc=4"
	window.location.replace(strURL);
	return true;
}



// *********************************
// *********************************
// UMPIRE PAGES
// *********************************
// *********************************

function SelectUmpirePage()
{
	strURL="ProcessMenuSelection.asp?pc=6&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectUmpireClinicsPage()
{
	strURL="ProcessMenuSelection.asp?pc=6&spc=3"
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// PROGRAM PAGES
// *********************************
// *********************************

function SelectLearnToPlayPage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectInsurancePage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=2"
	window.location.replace(strURL);
	return true;
}

function SelectCodesOfConductPage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=3"
	window.location.replace(strURL);
	return true;
}

function SelectCoachesStandardsPage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=3&mode=1"
	window.location.replace(strURL);
	return true;
}

function SelectPlayersStandardsPage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=3&mode=2"
	window.location.replace(strURL);
	return true;
}

function SelectOfficialsStandardsPage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=3&mode=3"
	window.location.replace(strURL);
	return true;
}

function SelectFansStandardsPage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=3&mode=4"
	window.location.replace(strURL);
	return true;
}


function SelectLibraryPage()
{
	strURL="ProcessMenuSelection.asp?pc=8&spc=6"
	window.location.replace(strURL);
	return true;
}





// *********************************
// *********************************
// FACILITIES PAGES
// *********************************
// *********************************


function SelectFacilitiesPage()
{
	strURL="ProcessMenuSelection.asp?pc=10&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectDiamondsPage()
{
	strURL="ProcessMenuSelection.asp?pc=10&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectRecCentresPage()
{
	strURL="ProcessMenuSelection.asp?pc=10&spc=2"
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// HONOUR ROLE PAGES
// *********************************
// *********************************


function SelectHonourRolePage()
{
	strURL="ProcessMenuSelection.asp?pc=11&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectAnnualAwardsPage()
{
	strURL="ProcessMenuSelection.asp?pc=11&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectTourTheHallPage()
{
	strURL="ProcessMenuSelection.asp?pc=11&spc=2"
	window.location.replace(strURL);
	return true;
}

function SelectAboutTheHallPage()
{
	strURL="ProcessMenuSelection.asp?pc=11&spc=3"
	window.location.replace(strURL);
	return true;
}







// *********************************
// *********************************
// HONOUR ROLE PAGES
// *********************************
// *********************************


function SelectLinksPage()
{
	strURL="ProcessMenuSelection.asp?pc=12"
	window.location.replace(strURL);
	return true;
}

function SelectSponsorsPage()
{
	strURL="ProcessMenuSelection.asp?pc=12&spc=1"
	window.location.replace(strURL);
	return true;
}

function SelectGoverningBodiesPage()
{
	strURL="ProcessMenuSelection.asp?pc=12&spc=2"
	window.location.replace(strURL);
	return true;
}

function SelectOtherSitesPage()
{
	strURL="ProcessMenuSelection.asp?pc=12&spc=3"
	window.location.replace(strURL);
	return true;
}

function SelectLeagueSitesPage()
{
	strURL="ProcessMenuSelection.asp?pc=12&spc=4"
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// CONTACT US PAGE
// *********************************
// *********************************


function SelectContactUsPage()
{
	strURL="ProcessMenuSelection.asp?pc=13"
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// SITE MAP
// *********************************
// *********************************


function SelectSiteMapPage()
{
	strURL="ProcessMenuSelection.asp?pc=14"
	window.location.replace(strURL);
	return true;
}


// **********************************
// **********************************
// Set Checkmark for Bulk EMail Group
// **********************************
// **********************************

function SetCheckMark(x)
{
q = "Group"+x;
y = document.getElementById(q);
y.src="/Graphics/OK.gif";
return true;
}



// *********************************
// *********************************
// SelectHOFYear
//
// Selects an HOF year for display
// *********************************
// *********************************

function SelectHOFYear()
{
ActionString="ProcessHOFQuery.asp";
document.HOFQuery.action=ActionString;
document.HOFQuery.submit();
}





// ***********************************************************************
// ***********************************************************************
// ***********************************************************************
// ADMINISTRATIVE FUNCTIONS
// ***********************************************************************
// ***********************************************************************
// ***********************************************************************



// *****************************************
// *****************************************
// *****************************************
// Login functions
// *****************************************
// *****************************************
// *****************************************



// ************************************
// ************************************
// ValidateLogin
// Member login on-screen validation
// ************************************
// ************************************

function ValidateLogin()
{
	x = document.Login.fusername.value;
	if (x.length <= 0) { 
		alert('You must enter a user name and password before logging in.')
		return false; 
	}
	
	x = document.Login.fpassword.value;
	if (x.length <= 0) { 
		alert('You must enter a user name and password before logging in.')
		return false; 
	}

	return true;
}


// *********************************
// *********************************
// SubmitLogin
// Confirm successful login
// *********************************
// *********************************

function SubmitLogin()
{
ActionString="AdminProcessLogin.asp";
document.Login.action=ActionString;
document.Login.submit();
}




// *****************************************
// *****************************************
// *****************************************
// ADMIN MENU OPTIONS
// *****************************************
// *****************************************
// *****************************************




// *********************************
// *********************************
// News Articles
// *********************************
// *********************************

function SelectAdminNewsArticles()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=1";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Slo-Pitch Articles
// *********************************
// *********************************

function SelectAdminSloPitchArticles()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=2";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Fast Pitch Articles
// *********************************
// *********************************

function SelectAdminFastPitchArticles()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=3";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Blue Crew Articles
// *********************************
// *********************************

function SelectAdminBlueArticles()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// LTP Articles
// *********************************
// *********************************

function SelectAdminLTPArticles()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=5";
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// Leagues
// *********************************
// *********************************

function SelectLeagues()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=1";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Teams
// *********************************
// *********************************

function SelectTeams()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=2";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// MSA Groups
// *********************************
// *********************************

function SelectMSAGroups()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=3";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Rolodex
// *********************************
// *********************************

function SelectRolodex()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Recreational Organizations
// *********************************
// *********************************

function SelectRecOrganizations()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=5";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Schools
// *********************************
// *********************************

function SelectSchools()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=6";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Media
// *********************************
// *********************************

function SelectMedia()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=7";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// MSA Events
// *********************************
// *********************************

function SelectMSAEvents()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=3&spc=1";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// Tournaments
// *********************************
// *********************************

function SelectTournaments()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=3&spc=2";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// Chmapionships
// *********************************
// *********************************

function SelectChampionships()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=3&spc=3";
	window.location.replace(strURL);
	return true;
}





// *********************************
// *********************************
// Newsletters
// *********************************
// *********************************

function SelectNewsletters()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=1";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// Press Releases
// *********************************
// *********************************

function SelectPressReleases()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=2";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// Awards
// *********************************
// *********************************

function SelectAwards()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=3";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// Hall of Fame Inductees
// *********************************
// *********************************

function SelectHOF()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=5";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// Player Clinics
// *********************************
// *********************************

function SelectPlayerClinics()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=2";
	window.location.replace(strURL);
	return true;
}



// *********************************
// *********************************
// MSA Coaching Clinics
// *********************************
// *********************************

function SelectMSAClinics()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=3";
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// General Reports
// *********************************
// *********************************

function SelectGeneralReports()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=6&spc=1";
	window.location.replace(strURL);
	return true;
}











// *****************************************
// *****************************************
// *****************************************
// HOME PAGE CONTENT MANAGEMENT
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// AdminSaveNewsArticle
//
// Saves a new or updated news 
//	article
// *********************************
// *********************************

function AdminSaveNewsArticle()
{
ActionString="/Admin/AdminProcessNewsPageUpdate.asp";
document.ArticleForm.action=ActionString;
document.ArticleForm.submit();
}


// *********************************
// *********************************
// AdminQuitNewsArticle()
//
// Quit News Article Save
// *********************************
// *********************************

function AdminQuitNewsArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=1";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// PreviewArticle
//
// Preview a News Article
// *********************************
// *********************************

function PreviewArticle(x)
{
	strURL="/Admin/PreviewArticle.asp?ArticleID="+x;
	window.open(strURL);
	return true;
}



// *********************************
// *********************************
// NewsArticleListScope
//
// Select the type of articles to
//	be displayed
// *********************************
// *********************************

function NewsArticleListScope()
{
ActionString="/Admin/AdminNewsArticleListScope.asp";
document.NewsList.action=ActionString;
document.NewsList.submit();
}


// *********************************
// *********************************
// AddNewsArticle
//
// Add a news article
// *********************************
// *********************************

function AddNewsArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=1&Mode=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// EditNewsArticle
//
// Edit a news article
// *********************************
// *********************************

function EditNewsArticle(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=1&Mode=5&IntKey="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// DeleteNewsArticle
//
// Delete a news article
// *********************************
// *********************************

function DeleteNewsArticle(x)
{
	strURL="/Admin/AdminDeleteNewsArticle.asp?IntKey="+x;
	window.location.replace(strURL);
	return true;
}




// *****************************************
// *****************************************
// *****************************************
// SLOPITCH PAGE CONTENT MANAGEMENT
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// AdminSaveSloPitchArticle
//
// Saves a new or updated SloPitch 
//	article
// *********************************
// *********************************

function AdminSaveSloPitchArticle()
{
ActionString="/Admin/AdminProcessSloPitchPageUpdate.asp";
document.ArticleForm.action=ActionString;
document.ArticleForm.submit();
}


// *********************************
// *********************************
// AdminQuitSloPitchArticle()
//
// Quit SloPitch Article Save
// *********************************
// *********************************

function AdminQuitSloPitchArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=2";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// PreviewSloPitchArticle
//
// Preview a SloPitch Article
// *********************************
// *********************************

function PreviewSloPitchArticle(x)
{
	strURL="/PreviewSloPitchArticle.asp?ArticleID="+x;
	window.open(strURL);
	return true;
}



// *********************************
// *********************************
// AddSloPitchArticle
//
// Add a SloPitch article
// *********************************
// *********************************

function AddSloPitchArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=2&Mode=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// EditSloPitchArticle
//
// Edit a SloPitch article
// *********************************
// *********************************

function EditSloPitchArticle(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=2&Mode=5&IntKey="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// DeleteSloPitchArticle
//
// Delete a Slo Pitch article
// *********************************
// *********************************

function DeleteSloPitchArticle(x)
{
	strURL="/Admin/AdminDeleteSloPitchArticle.asp?IntKey="+x;
	window.location.replace(strURL);
	return true;
}










// *****************************************
// *****************************************
// *****************************************
// FASTPITCH PAGE CONTENT MANAGEMENT
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// AdminSaveFastPitchArticle
//
// Saves a new or updated FastPitch 
//	article
// *********************************
// *********************************

function AdminSaveFastPitchArticle()
{
ActionString="/Admin/AdminProcessFastPitchPageUpdate.asp";
document.ArticleForm.action=ActionString;
document.ArticleForm.submit();
}


// *********************************
// *********************************
// AdminQuitFastPitchArticle()
//
// Quit FastPitch Article Save
// *********************************
// *********************************

function AdminQuitFastPitchArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=3";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// PreviewFastPitchArticle
//
// Preview a FastPitch Article
// *********************************
// *********************************

function PreviewFastPitchArticle(x)
{
	strURL="/PreviewFastPitchArticle.asp?ArticleID="+x;
	window.open(strURL);
	return true;
}



// *********************************
// *********************************
// AddFastPitchArticle
//
// Add a FastPitch article
// *********************************
// *********************************

function AddFastPitchArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=3&Mode=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// EditFastPitchArticle
//
// Edit a FastPitch article
// *********************************
// *********************************

function EditFastPitchArticle(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=3&Mode=5&IntKey="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// DeleteFastPitchArticle
//
// Delete a FastPitch article
// *********************************
// *********************************

function DeleteFastPitchArticle(x)
{
	strURL="/Admin/AdminDeleteFastPitchArticle.asp?IntKey="+x;
	window.location.replace(strURL);
	return true;
}















// *****************************************
// *****************************************
// *****************************************
// UMPIRE PAGE CONTENT MANAGEMENT
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// AdminSaveUmpireArticle
//
// Saves a new or updated Umpire 
//	article
// *********************************
// *********************************

function AdminSaveUmpireArticle()
{
ActionString="/Admin/AdminProcessUmpirePageUpdate.asp";
document.ArticleForm.action=ActionString;
document.ArticleForm.submit();
}


// *********************************
// *********************************
// AdminQuitUmpireArticle()
//
// Quit Umpire Article Save
// *********************************
// *********************************

function AdminQuitUmpireArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// PreviewUmpireArticle
//
// Preview an Umpire Article
// *********************************
// *********************************

function PreviewUmpireArticle(x)
{
	strURL="/PreviewUmpireArticle.asp?ArticleID="+x;
	window.open(strURL);
	return true;
}



// *********************************
// *********************************
// AddUmpireArticle
//
// Add an Umpire article
// *********************************
// *********************************

function AddUmpireArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=4&Mode=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// EditUmpireArticle
//
// Edit an Umpire article
// *********************************
// *********************************

function EditUmpireArticle(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=4&Mode=5&IntKey="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// DeleteUmpireArticle
//
// Delete an Umpire article
// *********************************
// *********************************

function DeleteUmpireArticle(x)
{
	strURL="/Admin/AdminDeleteUmpireArticle.asp?IntKey="+x;
	window.location.replace(strURL);
	return true;
}











// *****************************************
// *****************************************
// *****************************************
// LTP PAGE CONTENT MANAGEMENT
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// AdminSaveLTPArticle
//
// Saves a new or updated LTP 
//	article
// *********************************
// *********************************

function AdminSaveLTPArticle()
{
ActionString="/Admin/AdminProcessLearnToPlayPageUpdate.asp";
document.ArticleForm.action=ActionString;
document.ArticleForm.submit();
}


// *********************************
// *********************************
// AdminQuitLTPArticle()
//
// Quit LTP Article Save
// *********************************
// *********************************

function AdminQuitLTPArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=5";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// PreviewLTPArticle
//
// Preview an LTP Article
// *********************************
// *********************************

function PreviewLTPArticle(x)
{
	strURL="/PreviewLTPArticle.asp?ArticleID="+x;
	window.open(strURL);
	return true;
}



// *********************************
// *********************************
// AddLTPArticle
//
// Add an LTP article
// *********************************
// *********************************

function AddLTPArticle()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=5&Mode=4";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// EditLTPArticle
//
// Edit an LTP article
// *********************************
// *********************************

function EditLTPArticle(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=1&spc=5&Mode=5&IntKey="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// DeleteLTPArticle
//
// Delete an LTP article
// *********************************
// *********************************

function DeleteLTPArticle(x)
{
	strURL="/Admin/AdminDeleteLTPArticle.asp?IntKey="+x;
	window.location.replace(strURL);
	return true;
}



















// *****************************************
// *****************************************
// *****************************************
// TEAM OPTIONS
// *****************************************
// *****************************************
// *****************************************




// *********************************
// *********************************
// SubmitTeamQuery
//
// Process a team query
// *********************************
// *********************************

function SubmitTeamQuery()
{
ActionString="/Admin/AdminProcessTeamQuery.asp";
document.TeamQuery.action=ActionString;
document.TeamQuery.submit();
}


// *********************************
// *********************************
// ClearTeamCriteria
//
// Clear team query criteria
// *********************************
// *********************************

function ClearTeamCriteria()
{
	document.TeamQuery.Season.value = "0";
	document.TeamQuery.Division.value = "";
	document.TeamQuery.Region.value = "";
	document.TeamQuery.Gender.value = "";
	document.TeamQuery.Category.value = "0";
	document.TeamQuery.Classification.value = "";
	document.TeamQuery.TeamName.value = "";
	document.TeamQuery.LeagueID.value = "0";

return true
}

// *********************************
// *********************************
// EditTeam
//
// Edit a team record
// *********************************
// *********************************

function EditTeam(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=2&Mode=5&intKey="+x;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeleteTeam
//
// Delete a team record
// *********************************
// *********************************

function DeleteTeam(x)
{
	strURL="/Admin/AdminProcessTeamUpdate.asp?Mode=6&intKey="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// AddTeam
//
// Access the New Team screen
// *********************************
// *********************************

function AddTeam()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=2&Mode=4";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// SaveNewTeam
//
// Saves a new team
// *********************************
// *********************************

function SaveNewTeam()
{
ActionString="/Admin/AdminProcessTeamUpdate.asp?Mode=4";
document.TeamForm.action=ActionString;
document.TeamForm.submit();
}


// *********************************
// *********************************
// QuitTeamDetails
//
// Return to the Teams list screen
// *********************************
// *********************************

function QuitTeamDetails()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=2&Mode=1";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// SaveTeamChanges
//
// Saves changes to a team
// *********************************
// *********************************

function SaveTeamChanges()
{
ActionString="/Admin/AdminProcessTeamUpdate.asp?Mode=5";
document.TeamForm.action=ActionString;
document.TeamForm.submit();
}


// *********************************
// *********************************
// SearchForTeamMembers
//
// Call Rolodex Query to add a 
//	team member
// *********************************
// *********************************

function SearchForTeamMembers(x)
{
ActionString="/Admin/AdminProcessRolodexQuery.asp?TeamID="+x;
document.TeamForm.action=ActionString;
document.TeamForm.submit();
}

// *********************************
// *********************************
// DeleteTeamMember
//
// Removes a coach or player from
//	a team
// *********************************
// *********************************

function DeleteTeamMember(x,y,z)
{
	strURL="/Admin/AdminTeamClearMember.asp?TeamID="+x+"&PersonID="+y+"&TeamRole="+z;
	window.location.replace(strURL);
	return true;
}







// *****************************************
// *****************************************
// *****************************************
// MSA GROUP OPTIONS
// *****************************************
// *****************************************
// *****************************************


// ***********************************
// ***********************************
// SubmitCommitteeQuery
//
// Select a year for MSA Group display
// ***********************************
// ***********************************

function SubmitCommitteeQuery()
{
ActionString="/Admin/AdminProcessCommitteeQuery.asp";
document.Committees.action=ActionString;
document.Committees.submit();
return true;
}

// *********************************
// *********************************
// CreateNewYearCommittees
//
// Creates upcoming year MSA Groups
// *********************************
// *********************************

function CreateNewYearCommittees()
{
ActionString="/Admin/CreateNewCommitteeYear.asp";
document.Committees.action=ActionString;
document.Committees.submit();
}









// *****************************************
// *****************************************
// *****************************************
// ROLODEX OPTIONS
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// SubmitRolodex
//
// Submit a rolodex record for
//	processing
// *********************************
// *********************************


function SubmitRolodex(x)
{
ActionString="AdminProcessRolodexUpdate.asp?Mode="+x;
document.PersonForm.action=ActionString;
document.PersonForm.submit();
}


// *********************************
// *********************************
// SubmitRolodexQuery
//
// Process a rolodex query
// *********************************
// *********************************

function SubmitRolodexQuery()
{
ActionString="/Admin/AdminProcessRolodexQuery.asp";
document.RolodexQuery.action=ActionString;
document.RolodexQuery.submit();
}


// *********************************
// *********************************
// SubmitRolodexSubQuery
//
// Stash the results of a rolodex 
//	subquery
// *********************************
// *********************************

function SubmitRolodexSubQuery(x)
{
ActionString="/Admin/AdminProcessRolodexSubQuery.asp?strKey="+x;
document.RolodexQuery.action=ActionString;
document.RolodexQuery.submit();
}

// *********************************
// *********************************
// RolodexAddScreen
//
// Access the rolodex entry screen
// *********************************
// *********************************

function RolodexAddScreen()
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=4";
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// RolodexAddScreenReturn
//
// Access the rolodex entry screen
//	with a return value
// *********************************
// *********************************

function RolodexAddScreenReturn(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=4&"+x;
window.location.replace(strURL);
return true;
}



// *********************************
// *********************************
// RolodexNewSearch
//
// Start a new rolodex query
// *********************************
// *********************************

function RolodexNewSearch()
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4";
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// RolodexNewSearchWithReturn
//
// Start a new rolodex query
// *********************************
// *********************************

function RolodexNewSearchWithReturn(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&"+x;
window.location.replace(strURL);
return true;
}



// *********************************
// *********************************
// ReturnRolodexToLeague
//
// Return a rolodex query to the 
//	league screen
// *********************************
// *********************************

function ReturnRolodexToLeague(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=1&mode=5&intKey="+x;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// ReturnRolodexToTournament
//
// Return a rolodex query to the 
//	tournament screen
// *********************************
// *********************************

function ReturnRolodexToTournament(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=3&spc=2&mode=5&intKey="+x;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// ReturnRolodexToChampionship
//
// Return a rolodex query to the 
//	championship screen
// *********************************
// *********************************

function ReturnRolodexToChampionship(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=3&spc=3&mode=5&intKey="+x;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// ReturnRolodexToMSAEvent
//
// Return a rolodex query to the 
//	MSA Event screen
// *********************************
// *********************************

function ReturnRolodexToMSAEvent(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=3&spc=1&mode=5&intKey="+x;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// ReturnRolodexToMSAGroup
//
// Return a rolodex query to the 
//	MSA Group screen
// *********************************
// *********************************

function ReturnRolodexToMSAGroup(x,y)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=3&mode=5&intKey="+x+"&intkey2="+y;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// ReturnRolodexToUmpireClinic
//
// Return a rolodex query to the 
//	Umpire Clinic screen
// *********************************
// *********************************

function ReturnRolodexToUmpireClinic(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=1&mode=5&intKey="+x;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// ReturnRolodexToCoachesClinic
//
// Return a rolodex query to the 
//	Coaches Clinic screen
// *********************************
// *********************************

function ReturnRolodexToCoachesClinic(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=3&mode=5&intKey="+x;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// ReturnRolodexToPlayerClinic
//
// Return a rolodex query to the 
//	Player Clinic screen
// *********************************
// *********************************

function ReturnRolodexToPlayerClinic(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=2&mode=5&intKey="+x;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// SelectRolodexRecord
//
// Selects a rolodex record
// *********************************
// *********************************

function SelectRolodexRecord(x)
{
strURL="/Admin/AdminProcessRolodexSelection.asp?PersonID="+x;
window.location.replace(strURL);
return true;
}



// *********************************
// *********************************
// EditRolodexRecordReturn
//
// Edit a rolodex record with 
//	returnto set
// *********************************
// *********************************

function EditRolodexRecordReturn(x,y)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=5&IntKey="+x+"&"+y;
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// EditRolodexRecord
//
// Edit a rolodex record (no return)
// *********************************
// *********************************

function EditRolodexRecord(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=5&IntKey="+x;
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// DeleteRolodexRecord
//
// Delete a rolodex record
// *********************************
// *********************************

function DeleteRolodexRecord(x)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=6&IntKey="+x;
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// ValidateRolodexForm
//
// On-screen validation for a
// 	rolodex record
// *********************************
// *********************************

function ValidateRolodexForm()
{
	x = document.PersonForm.LastName.value;
	if (x.length == 0) 
	{ 
		alert('You must enter a name');
		return false; 
	}
	
	return true;
}
 

// *********************************
// *********************************
// RolodexReturnToListWithReturn
//
// Return to the rolodex list screen
//	(with return value)
// *********************************
// *********************************

function RolodexReturnToListWithReturn(x)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=3"+x;
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// RolodexReturnToListWithReturn
//
// Return to the rolodex list screen
//	(with return value)
// *********************************
// *********************************

function RolodexReturnToList()
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=3";
window.location.replace(strURL);
return true;
}



// *********************************
// *********************************
// SetDisplayPhone
//
// Sets the DIsplayPhone value to
//	home phone
// *********************************
// *********************************

function SetDisplayPhone()
{
x = String(document.PersonForm.DisplayPhone.value);
if (x.length == 0)
{
	document.PersonForm.DisplayPhone.value = document.PersonForm.HomePhone.value
	return true;
}
}


// *********************************
// *********************************
// RolodexTab
//
// Select a specified tab on the
//	Rolodex Detail screen
// *********************************
// *********************************

function RolodexTab(x,y,z)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=5&intKey="+x+"&intkey2="+y+"&strKey="+z;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// SelectRolodexSeason
//
// Select the season for rolodex
//	details
// *********************************
// *********************************

function SelectRolodexSeason()
{
ActionString="/Admin/AdminLoadNewRolodexYear.asp";
document.PersonForm.action=ActionString;
document.PersonForm.submit();
}


// *********************************
// *********************************
// DeleteTeamAffiliation
//
// Deletes a person from a team
// *********************************
// *********************************

function DeleteTeamAffiliation(x,y,z)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=66&IntKey="+x+"&TeamID="+y+"&Role="+z;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// DeleteLeagueAffiliation
//
// Deletes a person from a league
// *********************************
// *********************************

function DeleteLeagueAffiliation(x,y)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=16&IntKey="+x+"&League="+y;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// DeleteMSARoleAffiliation
//
// Deletes a person from an MSA Role
// *********************************
// *********************************

function DeleteMSARoleAffiliation(x,y,z,q)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=76&IntKey="+x+"&GroupID="+y+"&Season="+z+"&Sequence="+q;
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// SaveCoachCertification
//
// Save changes to a coach 
//	certification
// *********************************
// *********************************

function SaveCoachCertification(x,y)
{
ActionString="/Admin/AdminProcessRolodexUpdate.asp?Mode=55&intKey="+x+"&CourseLevel="+y;
document.PersonForm.action=ActionString;
document.PersonForm.submit();
}


// *********************************
// *********************************
// AddCoachCertification
//
// Add a new coach certification
// *********************************
// *********************************

function AddCoachCertification(x)
{
ActionString="/Admin/AdminProcessRolodexUpdate.asp?Mode=54&intKey="+x;
document.PersonForm.action=ActionString;
document.PersonForm.submit();
}



// *********************************
// *********************************
// ValidateCoachCertification
//
// Performs on-screen validation for
//	a coaching certification
// *********************************
// *********************************

function ValidateCoachCertification()
{
	x = document.PersonForm.SelectedCoachLevel;
	if (x.value == '0') 
	{ 
		alert('You must select a level');
		return false; 
	}
	
	return true;
}
 

// *********************************
// *********************************
// EditCoachCertification
//
// Edit a coaching certification
// *********************************
// *********************************

function EditCoachCertification(x,y)
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=4&Mode=55&IntKey="+x+"&intkey2="+y+"&strkey=Coaching";
window.location.replace(strURL);
return true;
}

// *********************************
// *********************************
// DeleteCoachCertification
//
// Delete a coaching certification
// *********************************
// *********************************

function DeleteCoachCertification(x,y)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=56&IntKey="+x+"&CourseLevel="+y;
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// DeleteTournamentContact
//
// Delete a tournament contact
// *********************************
// *********************************

function DeleteTournamentContact(x,y)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=26&IntKey="+x+"&TournamentID="+y;
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// DeleteChampionshipContact
//
// Delete a championship contact
// *********************************
// *********************************

function DeleteChampionshipContact(x,y,z)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=36&IntKey="+x+"&TournamentID="+y+"&ContactNum="+z;
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// ValidateAdHocGroupMember
//
// Performs on-screen validation for
//	a new ad hoc group member
// *********************************
// *********************************

function ValidateAdHocGroupMember()
{
	x = document.PersonForm.SelectedAdHocGroup;
	if (x.value == '0') 
	{ 
		alert('You must select a group');
		return false; 
	}
	
	return true;
}
 

// *********************************
// *********************************
// AddAdHocGroupMember
//
// Add a new ad hoc group member
// *********************************
// *********************************

function AddAdHocGroupMember(x,y)
{
ActionString="/Admin/AdminProcessRolodexUpdate.asp?Mode=4"+x+"&intKey="+y;
document.PersonForm.action=ActionString;
document.PersonForm.submit();
}



// *********************************
// *********************************
// DeleteAdHocGroupMember
//
// Delete an ad hoc group member
// *********************************
// *********************************

function DeleteAdHocGroupMember(x,y)
{
strURL="/Admin/AdminProcessRolodexUpdate.asp?Mode=46&IntKey="+x+"&GroupID="+y;
window.location.replace(strURL);
return true;
}




// *****************************************
// *****************************************
// *****************************************
// REC DISTRICT OPTIONS
// *****************************************
// *****************************************
// *****************************************






// *********************************
// *********************************
// SubmitRecDistrictQuery
//
// Process a rec district query
// *********************************
// *********************************

function SubmitRecDistrictQuery()
{
ActionString="/Admin/AdminProcessRecDistrictQuery.asp";
document.RecDistrictQuery.action=ActionString;
document.RecDistrictQuery.submit();
}



// *********************************
// *********************************
// ClearRecDistrictCriteria
//
// Clears all RecDistrict query 
//	criteria
// *********************************
// *********************************

function ClearRecDistrictCriteria()
{
	document.RecDistrictQuery.Region.value = "";
	document.RecDistrictQuery.OrgType.value = "";
	document.RecDistrictQuery.Email.value = "-1";
	document.RecDistrictQuery.Address.value = "";
	document.RecDistrictQuery.Name.value = "";
	document.RecDistrictQuery.City.value = "";
	document.RecDistrictQuery.Province.value = "";
	document.RecDistrictQuery.LeagueID.value = "0";

return true
}

// *********************************
// *********************************
// SubmitRecDistrict
//
// Submit a Rec District record for
//	processing
// *********************************
// *********************************


function SubmitRecDistrict(x)
{
ActionString="AdminProcessRecDistrictUpdate.asp?Mode="+x;
document.RecDistrictForm.action=ActionString;
document.RecDistrictForm.submit();
}

// *********************************
// *********************************
// DeleteRecDistrictContact
//
// Removes a contact from a rec
//	district
// *********************************
// *********************************

function DeleteRecDistrictContact(x,y)
{
	strURL="/Admin/AdminDeleteRecDistrictContact.asp?DistrictID="+x+"&SequenceNum="+y;
	window.location.replace(strURL);
	return true;
}












// *****************************************
// *****************************************
// *****************************************
// SCHOOL OPTIONS
// *****************************************
// *****************************************
// *****************************************






// *********************************
// *********************************
// SubmitSchoolQuery
//
// Process a school query
// *********************************
// *********************************

function SubmitSchoolQuery()
{
ActionString="/Admin/AdminProcessSchoolQuery.asp";
document.SchoolQuery.action=ActionString;
document.SchoolQuery.submit();
}



// *********************************
// *********************************
// ClearSchoolCriteria
//
// Clears all school querty criteria
// *********************************
// *********************************

function ClearSchoolCriteria()
{
	document.SchoolQuery.DivisionID.value = "0";
	document.SchoolQuery.Address.value = "";
	document.SchoolQuery.SchoolName.value = "";
	document.SchoolQuery.City.value = "";
	document.SchoolQuery.Province.value = "";
	document.SchoolQuery.Elementary.value = "-1";
	document.SchoolQuery.JR.value = "-1";
	document.SchoolQuery.HS.value = "-1";
	document.SchoolQuery.G12.value = "-1";

return true
}


// *********************************
// *********************************
// SubmitSchool
//
// Submit a school record for
//	processing
// *********************************
// *********************************


function SubmitSchool(x)
{
ActionString="AdminProcessSchoolUpdate.asp?Mode="+x;
document.SchoolForm.action=ActionString;
document.SchoolForm.submit();
}





// *****************************************
// *****************************************
// *****************************************
// TOURNAMENT OPTIONS
// *****************************************
// *****************************************
// *****************************************


// *********************************
// *********************************
// SubmitTournamentQuery
//
// Process a Tournament query
// *********************************
// *********************************

function SubmitTournamentQuery()
{
ActionString="/Admin/AdminProcessTournamentQuery.asp";
document.TournamentQuery.action=ActionString;
document.TournamentQuery.submit();
}



// *********************************
// *********************************
// ClearTournamentCriteria
//
// Clears all Tournament query 
//	criteria
// *********************************
// *********************************

function ClearTournamentCriteria()
{

	document.TournamentQuery.Season.value = "0";
	document.TournamentQueryGeocode.value = "0";
	document.TournamentQuery.Division.value = "0";
	document.TournamentQuery.Gender.value = "0";
	document.TournamentQuerystartdate.value = "";
	document.TournamentQuery.enddate.value = "";
return true
}


// *********************************
// *********************************
// SubmitTournament
//
// Submit a Tournament for
//	processing
// *********************************
// *********************************


function SubmitTournament(x)
{
ActionString="AdminProcessTournamentUpdate.asp?Mode="+x;
document.TournamentForm.action=ActionString;
document.TournamentForm.submit();
}


// *********************************
// *********************************
// SubmitTournamentContact
//
// Submit a Tournament contact for
//	processing
// *********************************
// *********************************

function SubmitTournamentContact(ActionString)
{
document.TournamentForm.action=ActionString;
document.TournamentForm.submit();
return true;
}

















// *****************************************
// *****************************************
// *****************************************
// CHAMPIONSHIP OPTIONS
// *****************************************
// *****************************************
// *****************************************


// *********************************
// *********************************
// SubmitChampionshipQuery
//
// Process a championship query
// *********************************
// *********************************

function SubmitChampionshipQuery()
{
ActionString="/Admin/AdminProcessChampionshipQuery.asp";
document.ChampionshipQuery.action=ActionString;
document.ChampionshipQuery.submit();
}



// *********************************
// *********************************
// ClearChampionshipCriteria
//
// Clears all Championship query 
//	criteria
// *********************************
// *********************************

function ClearChampionshipCriteria()
{
	document.ChampionshipQuery.Season.value = "0";
	document.ChampionshipQuery.ChampLevel.value = "0";
	document.ChampionshipQuery.Division.value = "";
	document.ChampionshipQuery.Gender.value = "";
	document.ChampionshipQuery.AgeCode.value = "0";
	document.ChampionshipQuery.Category.value = "";
	document.ChampionshipQuery.startdate.value = "";
	document.ChampionshipQuery.enddate.value = "";

return true
}


// *********************************
// *********************************
// SubmitChampionship
//
// Submit a championship for
//	processing
// *********************************
// *********************************


function SubmitChampionship(x)
{
ActionString="AdminProcessChampionshipUpdate.asp?Mode="+x;
document.ChampionshipForm.action=ActionString;
document.ChampionshipForm.submit();
}


function SubmitChampionshipContact(ActionString)
{
document.ChampionshipForm.action=ActionString;
document.ChampionshipForm.submit();
return true;
}












// *****************************************
// *****************************************
// *****************************************
// NEWSLETTER OPTIONS
// *****************************************
// *****************************************
// *****************************************




// *********************************
// *********************************
// SubmitNewsLetter
//
// Submit a NewsLetter for
//	processing
// *********************************
// *********************************


function SubmitNewsLetter(x)
{
ActionString="AdminProcessNewsLetterUpdate.asp?Mode="+x;
document.NewsLetterForm.action=ActionString;
document.NewsLetterForm.submit();
}



// *********************************
// *********************************
// EditNewsLetter
//
// Add a NewsLetter
// *********************************
// *********************************

function EditNewsLetter(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=1&Mode=5&intkey="+x;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeleteNewsLetter
//
// Delete a NewsLetter
// *********************************
// *********************************

function DeleteNewsLetter(x)
{
	strURL="/Admin/AdminProcessNewsLetterUpdate.asp?Mode=6&intkey="+x;
	window.location.replace(strURL);
	return true;
}




// *****************************************
// *****************************************
// *****************************************
// PRESS RELEASE OPTIONS
// *****************************************
// *****************************************
// *****************************************




// *********************************
// *********************************
// SubmitPressRelease
//
// Submit a press release for
//	processing
// *********************************
// *********************************


function SubmitPressRelease(x)
{
ActionString="AdminProcessPressReleaseUpdate.asp?Mode="+x;
document.PressReleaseForm.action=ActionString;
document.PressReleaseForm.submit();
}



// *********************************
// *********************************
// EditPressRelease
//
// Add a Press Release
// *********************************
// *********************************

function EditPressRelease(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=2&Mode=5&intkey="+x;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeletePressRelease
//
// Delete a Press Release
// *********************************
// *********************************

function DeletePressRelease(x)
{
	strURL="/Admin/AdminProcessPressReleaseUpdate.asp?Mode=6&intkey="+x;
	window.location.replace(strURL);
	return true;
}





// *****************************************
// *****************************************
// *****************************************
// AWARD OPTIONS
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// AddAward
//
// Add an award
// *********************************
// *********************************

function AddAward(y)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=3&Mode=4&intkey2="+y;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// AwardListScope
//
// Select the type of awards to
//	be displayed
// *********************************
// *********************************

function AwardListScope()
{
ActionString="/Admin/AdminAwardListScope.asp";
document.AwardsList.action=ActionString;
document.AwardsList.submit();
}


// *********************************
// *********************************
// EditAward
//
// Add an award
// *********************************
// *********************************

function EditAward(x,y)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=4&spc=3&Mode=5&strkey="+x+"&intkey2="+y;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeleteAward
//
// Delete an award
// *********************************
// *********************************

function DeleteAward(x)
{
	strURL="/Admin/AdminProcessAwardPageUpdate.asp?Mode=6&Abbreviation="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// SubmitAward
//
// Submit an award record for
//	processing
// *********************************
// *********************************


function SubmitAward(x)
{
ActionString="AdminProcessAwardPageUpdate.asp?Mode="+x;
document.ArticleForm.action=ActionString;
document.ArticleForm.submit();
}

// *********************************
// *********************************
// AdminQuitAward()
//
// Quit Award Save
// *********************************
// *********************************

function AdminQuitAward()
{
	strURL="/Admin/AdminQuitAwardPage.asp";
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// AddAwardRecipient
//
// Submit an award recipient for
//	processing
// *********************************
// *********************************


function AddAwardRecipient()
{
ActionString="AdminProcessAwardPageUpdate.asp?Mode=14";
document.ArticleForm.action=ActionString;
document.ArticleForm.submit();
}


// *********************************
// *********************************
// DeleteAwardRecipient
//
// Deletes an award recipient
// *********************************
// *********************************

function DeleteAwardRecipient(x,y,z)
{
	strURL="/Admin/AdminDeleteAwardRecipient.asp?Award="+x+"&AwardYear="+y+"&RecipientName="+z;
	window.location.replace(strURL);
	return true;
}


// *****************************************
// *****************************************
// *****************************************
// HALL OF FAME OPTIONS
// *****************************************
// *****************************************
// *****************************************


// *********************************
// *********************************
// SubmitHOFQuery
//
// Process a Hall of Fame query
// *********************************
// *********************************

function SubmitHOFQuery()
{
ActionString="/Admin/AdminProcessHOFQuery.asp";
document.HOFQuery.action=ActionString;
document.HOFQuery.submit();
}



// *********************************
// *********************************
// ClearHOFCriteria
//
// Clears all Hall of Fame query 
//	criteria
// *********************************
// *********************************

function ClearHOFCriteria()
{

	document.HOFQuery.LastName.value = "";
	document.HOFQuery.Category.value = "";
	document.HOFQuery.YearInducted.value = "0";

return true
}



// *********************************
// *********************************
// SubmitHOF
//
// Submit an HOF record for
//	processing
// *********************************
// *********************************


function SubmitHOF(x)
{
ActionString="/Admin/AdminProcessHOFUpdate.asp?Mode="+x;
document.HOFForm.action=ActionString;
document.HOFForm.submit();
}


























// *****************************************
// *****************************************
// *****************************************
// MEDIA OPTIONS
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// SubmitMediaQuery
//
// Process a media query
// *********************************
// *********************************

function SubmitMediaQuery()
{
ActionString="/Admin/AdminProcessMediaQuery.asp";
document.MediaQuery.action=ActionString;
document.MediaQuery.submit();
}


// *********************************
// *********************************
// ClearMediaCriteria
//
// Clears all media query criteria
// *********************************
// *********************************

function ClearMediaCriteria()
{
	document.MediaQuery.Region.value = "";
	document.MediaQuery.MediaType.value = "";
	document.MediaQuery.Email.value = "-1";
	document.MediaQuery.Name.value = "";
	document.MediaQuery.City.value = "";
	document.MediaQuery.Province.value = "";

return true
}


// *********************************
// *********************************
// EditMedia
//
// Edit a media contact record
// *********************************
// *********************************

function EditMedia(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=2&spc=7&Mode=5&intKey="+x;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeleteMedia
//
// Delete a Media contact record
// *********************************
// *********************************

function DeleteMedia(x)
{
	strURL="/Admin/AdminProcessMediaUpdate.asp?Mode=6&intKey="+x;
	window.location.replace(strURL);
	return true;
}


// *********************************
// *********************************
// SubmitMedia
//
// Submit a media record for
//	processing
// *********************************
// *********************************


function SubmitMedia(x)
{
ActionString="AdminProcessMediaUpdate.asp?Mode="+x;
document.MediaForm.action=ActionString;
document.MediaForm.submit();
}
















// *****************************************
// *****************************************
// *****************************************
// PLAYER CLINIC OPTIONS
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// SubmitPlayerClinicQuery
//
// Process a Player clinic query
// *********************************
// *********************************

function SubmitPlayerClinicQuery()
{
ActionString="/Admin/AdminProcessPlayerClinicQuery.asp";
document.PlayerClinicQuery.action=ActionString;
document.PlayerClinicQuery.submit();
}


// *********************************
// *********************************
// ClearPlayerClinicCriteria
//
// Clear Player Clinic query criteria
// *********************************
// *********************************

function ClearPlayerClinicCriteria()
{
	document.PlayerClinicQuery.ClinicYear.value = "0";
	document.PlayerClinicQuery.ClinicCode.value = "";
	document.PlayerClinicQuery.Description.value = "";
	document.PlayerClinicQuery.startdate.value = "";
	document.PlayerClinicQuery.enddate.value = "";
	document.PlayerClinicQuery.Region.value = "";

return true
}


// **********************************
// **********************************
// PlayerCLinicAddScreen
//
// Access the Player clinic entry screen
// **********************************
// **********************************

function PlayerClinicAddScreen()
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=2&Mode=4";
window.location.replace(strURL);
return true;
}


// **********************************
// **********************************
// PlayerClinicNewSearch
//
// Enter a new Player clinic search
// **********************************
// **********************************

function PlayerClinicNewSearch()
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=2&Mode=0";
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// EditPlayerClinic
//
// Edit an MSA Clinic record
// *********************************
// *********************************

function EditPlayerClinic(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=2&Mode=5&intKey="+x;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeletePlayerClinic
//
// Delete a Player Clinic record
// *********************************
// *********************************

function DeletePlayerClinic(x)
{
	strURL="/Admin/AdminDeletePlayerClinic.asp?ClinicID="+x;
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// SaveNewPlayerClinic
//
// Saves a new Player Clinic
// *********************************
// *********************************

function SaveNewPlayerClinic()
{
ActionString="/Admin/AdminProcessPlayerClinicUpdate.asp?Mode=4";
document.PlayerClinicForm.action=ActionString;
document.PlayerClinicForm.submit();
}


// *********************************
// *********************************
// QuitPlayerClinicDetails
//
// Return to the Player Clinics list screen
// *********************************
// *********************************

function QuitPlayerClinicDetails()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=2&Mode=1";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// SavePlayerlinicChanges
//
// Saves changes to a Player Clinic
// *********************************
// *********************************

function SavePlayerClinicChanges()
{
ActionString="/Admin/AdminProcessPlayerClinicUpdate.asp?Mode=5";
document.PlayerClinicForm.action=ActionString;
document.PlayerClinicForm.submit();
}


// *********************************
// *********************************
// SearchForPlayerClinicMembers
//
// Call Rolodex Query to add a 
//	Player Clinic participamt
// *********************************
// *********************************

function SearchForPlayerClinicMembers(x)
{
ActionString="/Admin/AdminProcessRolodexQuery.asp?PlayerClinicID="+x;
document.PlayerClinicForm.action=ActionString;
document.PlayerClinicForm.submit();
}


// *********************************
// *********************************
// EditPlayerClinicClinician
//
// Edit a Player Clinic clinician
// *********************************
// *********************************

function EditPlayerClinicClinician(x,y)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=2&mode=35&intkey="+x+"&intkey2="+y;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeletePlayerClinicMember
//
// Removes a clinician or participant
//  	from a player Clinic
// *********************************
// *********************************

function DeletePlayerClinicMember(x,y,z)
{
	strURL="/Admin/AdminPlayerClinicClearMember.asp?ClinicID="+x+"&PersonID="+y+"&Role="+z;
	window.location.replace(strURL);
	return true;
}



// *********************************
// *********************************
// SavePlayerClinicClinician
//
// Saves changes to a Player Clinic
//	clinician record
// *********************************
// *********************************

function SavePlayerClinicClinician()
{
ActionString="/Admin/AdminProcessPlayerClinicianUpdate.asp";
document.PlayerClinicForm.action=ActionString;
document.PlayerClinicForm.submit();
}











// *****************************************
// *****************************************
// *****************************************
// MSA (Coaching) CLINIC OPTIONS
// *****************************************
// *****************************************
// *****************************************



// *********************************
// *********************************
// SubmitMSAClinicQuery
//
// Process an MSA clinic query
// *********************************
// *********************************

function SubmitMSAClinicQuery()
{
ActionString="/Admin/AdminProcessMSAClinicQuery.asp";
document.MSAClinicQuery.action=ActionString;
document.MSAClinicQuery.submit();
}


// *********************************
// *********************************
// ClearMSAClinicCriteria
//
// Clear MSA Clinic query criteria
// *********************************
// *********************************

function ClearMSAClinicCriteria()
{
	document.MSAClinicQuery.CalendarYear.value = "";
	document.MSAClinicQuery.NCCPLevel.value = "0";
	document.MSAClinicQuery.Description.value = "";
	document.MSAClinicQuery.startdate.value = "";
	document.MSAClinicQuery.enddate.value = "";
	document.MSAClinicQuery.Region.value = "";

return true
}


// **********************************
// **********************************
// MSACLinicAddScreen
//
// Access the MSA clinic entry screen
// **********************************
// **********************************

function MSAClinicAddScreen()
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=3&Mode=4";
window.location.replace(strURL);
return true;
}


// **********************************
// **********************************
// MSAClinicNewSearch
//
// Enter a new MSA clinic search
// **********************************
// **********************************

function MSAClinicNewSearch()
{
strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=3&Mode=0";
window.location.replace(strURL);
return true;
}


// *********************************
// *********************************
// EditMSAClinic
//
// Edit an MSA Clinic record
// *********************************
// *********************************

function EditMSAClinic(x)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=3&Mode=5&intKey="+x;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeleteMSAClinic
//
// Delete an MSA Clinic record
// *********************************
// *********************************

function DeleteMSAClinic(x)
{
	strURL="/Admin/AdminDeleteMSAClinic.asp?ClinicID="+x;
	window.location.replace(strURL);
	return true;
}




// *********************************
// *********************************
// SaveNewMSAClinic
//
// Saves a new MSAClinic
// *********************************
// *********************************

function SaveNewMSAClinic()
{
ActionString="/Admin/AdminProcessMSAClinicUpdate.asp?Mode=4";
document.MSAClinicForm.action=ActionString;
document.MSAClinicForm.submit();
}


// *********************************
// *********************************
// QuitMSAClinicDetails
//
// Return to the MSA Clinics list screen
// *********************************
// *********************************

function QuitMSAClinicDetails()
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=3&Mode=1";
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// SaveMSAClinicChanges
//
// Saves changes to an MSA Clinic
// *********************************
// *********************************

function SaveMSAClinicChanges()
{
ActionString="/Admin/AdminProcessMSAClinicUpdate.asp?Mode=5";
document.MSAClinicForm.action=ActionString;
document.MSAClinicForm.submit();
}


// *********************************
// *********************************
// SearchForMSAClinicMembers
//
// Call Rolodex Query to add an 
//	MSA Clinic participamt
// *********************************
// *********************************

function SearchForMSAClinicMembers(x)
{
ActionString="/Admin/AdminProcessRolodexQuery.asp?MSAClinicID="+x;
document.MSAClinicForm.action=ActionString;
document.MSAClinicForm.submit();
}


// *********************************
// *********************************
// EditMSAClinicClinician
//
// Removes a coach or player from
//	a team
// *********************************
// *********************************

function EditMSAClinicClinician(x,y)
{
	strURL="/Admin/AdminProcessMenuSelection.asp?pc=5&spc=3&mode=35&intkey="+x+"&intkey2="+y;
	window.location.replace(strURL);
	return true;
}

// *********************************
// *********************************
// DeleteMSAClinicMember
//
// Removes a clinician or participant
//  	from an MS Clinic
// *********************************
// *********************************

function DeleteMSAClinicMember(x,y,z)
{
	strURL="/Admin/AdminMSAClinicClearMember.asp?ClinicID="+x+"&PersonID="+y+"&Role="+z;
	window.location.replace(strURL);
	return true;
}



// *********************************
// *********************************
// SaveMSAClinicClinician
//
// Saves changes to an MSA Clinic
//	clinician record
// *********************************
// *********************************

function SaveMSAClinicClinician()
{
ActionString="/Admin/AdminProcessMSAClinicianUpdate.asp";
document.MSAClinicForm.action=ActionString;
document.MSAClinicForm.submit();
}







function AfterLastName(FrmName)
{
x = FrmName.LastName.value;

if (x.length == 0) { return true; }

x = FrmName.Abbreviation.value;
if (x.length > 0) { return true; }

x = FrmName.LastName.value.substr(0,1);
FrmName.Abbreviation.value = String(FrmName.FirstName.value.concat(' ',x));
return true;

}


function SubmitDiamond(ActionString)
{
document.DiamondForm.action=ActionString;
document.DiamondForm.submit();
}


function SubmitDiamondQuery()
{
document.Maps.action="ProcessDiamondQuery.asp";
document.Maps.submit();
}




function SubmitLeague(ActionString)
{
document.LeagueForm.action=ActionString;
document.LeagueForm.submit();
}


function SubmitSPTournamentSearch()
{
document.Tournaments.action="ProcessSPTournamentQuery.asp";
document.Tournaments.submit();
}

function SubmitFPTournamentSearch()
{
document.Tournaments.action="ProcessFPTournamentQuery.asp";
document.Tournaments.submit();
}


function SubmitSPChampionshipSearch()
{
document.Championships.action="ProcessSPChampionshipQuery.asp";
document.Championships.submit();
}

function SubmitFPChampionshipSearch()
{
document.Championships.action="ProcessFPChampionshipQuery.asp";
document.Championships.submit();
}




function SubmitTeam(ActionString)
{
document.TeamForm.action=ActionString;
document.TeamForm.submit();
}

function SubmitMSAEvent(ActionString)
{
document.MSAEventForm.action=ActionString;
document.MSAEventForm.submit();
}


function SubmitDisplayTournamentQuery()
{
document.Tournaments.submit();
return true;
}

function SubmitDisplayChampionshipQuery()
{
document.Championships.submit();
return true;
}

function SubmitCommittee(ActionString)
{
document.GroupForm.action=ActionString;
document.GroupForm.submit();
return true;
}

function SubmitUmpireClinic(ActionString)
{
document.UmpireClinicForm.action=ActionString;
document.UmpireClinicForm.submit();
}

function SubmitPlayerClinic(ActionString)
{
document.PlayerClinicForm.action=ActionString;
document.PlayerClinicForm.submit();
}

function SubmitMSAClinic(ActionString)
{
document.MSAClinicForm.action=ActionString;
document.MSAClinicForm.submit();
}



function SubmitAwardQuery()
{
document.AwardQuery.action="ProcessAwardQuery.asp";
document.AwardQuery.submit();
return true;
}


function SubmitLibraryQuery()
{
document.LibraryQuery.action="ProcessLibraryQuery.asp";
document.LibraryQuery.submit();
return true;
}

function NewLibrarySearch()
{
strURL="ProcessMenuSelection.asp?pc=8&spc=6&mode=0"
window.location.replace(strURL);
return true;
}


function SubmitCoachingClinicQuery()
{
document.ClinicQuery.submit();
return true;
}

function SubmitWebStatQuery()
{
document.StatsQuery.submit();
return true;
}




// *********************************
// CheckNewPassword
// CHANGED PASSWORD VALIDATION
// *********************************
function CheckNewPassword(FrmName)
{
	x = FrmName.fpassword.value;
	if (x.length <= 0) { 
		alert('You must enter your existing password.')
		return false; 
	}
	
	x = FrmName.password1.value;
	if (x.length <= 0) { 
		alert('You must enter a value for the new password.')
		return false; 
	}
	
	y = FrmName.password2.value;
	if (y.length <= 0) { 
		alert('You must re-enter the value for the new password.')
		return false; 
	}

	if (x != y) {
		alert('The new passwords must match.')
		return false; 
	}

	return true;
}


// *********************************
// ClearELCriteria
// CLEAR EVENT LOCATOR CRITERIA
// *********************************
function ClearELCriteria(FrmName)
{
	FrmName.FirstDate.value = "";
	FrmName.LastDate.value = "";
	FrmName.Team.value = "0";
	FrmName.EventType.value = "0";
	FrmName.Diamond.value = "0";

return true
}


function ClearRolodexCriteria(FrmName)
{
	FrmName.FirstName.value = "";
	FrmName.LastName.value = "";
	FrmName.Address.value = "";
	FrmName.City.value = "";
	FrmName.Province.value = "";
	FrmName.Country.value = "";
	FrmName.Gender.value = "";
	FrmName.Email.value = "-1";
	FrmName.startbirthdate.value = "";
	FrmName.endbirthdate.value = "";
	FrmName.EmailAddress.value = "";

return true
}

function ClearMSAEventCriteria(FrmName)
{
	FrmName.Category.value = "";
	FrmName.startdate.value = "";
	FrmName.enddate.value = "";
return true
}




function ClearDiamondCriteria(FrmName)
{
	FrmName.Region.value = "";
	FrmName.HasMap.value = "-1";
	FrmName.Listed.value = "-1";
	FrmName.Name.value = "";
	FrmName.NonDiamond.value = "-1";
	FrmName.LeagueID.value = "0";

return true
}



function ClearLibraryCriteria(FrmName)
{
	FrmName.LID.value = "";
	FrmName.Title.value = "";
	FrmName.Category.value = "0";
	FrmName.Topic.value = "0";
	FrmName.Description.value = "";
	FrmName.Author.value = "";
	FrmName.MediaFormat.value = "";
	FrmName.Level.value = "0";

return true
}


function ClearLeagueCriteria(FrmName)
{
	FrmName.Division.value = "";
	FrmName.Gender.value = "";
	FrmName.Inactove.value = "-1";

return true
}


function ClearUmpireClinicCriteria(FrmName)
{
	FrmName.ClinicYear.value = "0";
	FrmName.ClinicCode.value = "";
	FrmName.Description.value = "";
	FrmName.startdate.value = "";
	FrmName.enddate.value = "";
	FrmName.Region.value = "";
return true
}






// *********************************
// LoadAddress
// LOAD NEW URL
// *********************************
function LoadAddress(strURL)
{
	window.location.replace(strURL);
	return true;
}
 
 
function MandatoryField(FldName)
{
x = FldName.value
if (x.length == 0)
{
	alert('You must enter a value for this field');
	FldName.select();
	FldName.focus();
	return false;
}

return true;

}



function OpenNewAddress(strURL,FrmName)
{
	z = FrmName.UserTitle.value;
	window.open(strURL+"&UserTitle="+z, '', 'toolbar=false, location=false, status=false, menubar=1, scrollbars=1, resizable=1');
	return true;
}
 

function LaunchReport(strURL)
{
	z = ReportForm.ReportYear.value;
	window.open(strURL+"?prompt0="+z, '', 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes');
}
 



// *********************************
// PrintPage
// WINDOWS PRINTER INTERFACE
// *********************************

function printpage()
{
	window.print()
}

function QuickLetterSearch(FrmName)
{

	x = String(FrmName.LastName.value);
	if (x.length == 0)
	{
		return false;
	}
	FrmName.submit();
}

function QuickLetterSelectionSearch(FrmName)
{

	x = String(FrmName.LastName.value);
	if (x.length == 0)
	{
		return false;
	}
	return true;
}


function CalcUmpClinician(FrmName)
{
if (isNaN(FrmName.Hours.value)) { v1 = 0; FrmName.Hours.value = '0 '; } else { v1 = Number(FrmName.Hours.value); }
if (isNaN(FrmName.Rate.value)) { v2 = 0; FrmName.Rate.value = '0 '; } else { v2 = Number(FrmName.Rate.value); }
v3 = v1*v2;
FrmName.Hours.value = v1.toFixed(2);
FrmName.Rate.value = v2.toFixed(2);
FrmName.Fee.value = v3.toFixed(2);

if (isNaN(FrmName.Accommodations.value)) { v4 = 0; FrmName.Accommodations.value = '0 '; } else { v4 = Number(FrmName.Accommodations.value); }
if (isNaN(FrmName.AccommodationsGST.value)) { v5 = 0; FrmName.AccommodationsGST.value = '0 '; } else { v5 = Number(FrmName.AccommodationsGST.value); }
v6 = v4+v5;
FrmName.Accommodations.value = v4.toFixed(2);
FrmName.AccommodationsGST.value = v5.toFixed(2);
FrmName.AccommodationsTotal.value = v6.toFixed(2);

if (isNaN(FrmName.Meals.value)) { v7 = 0; FrmName.Meals.value = '0 '; } else { v7 = Number(FrmName.Meals.value); }
if (isNaN(FrmName.MealsGST.value)) { v8 = 0; FrmName.MealsGST.value = '0 '; } else { v8 = Number(FrmName.MealsGST.value); }
v9 = v7+v8;
FrmName.Meals.value = v7.toFixed(2);
FrmName.MealsGST.value = v8.toFixed(2);
FrmName.MealsTotal.value = v9.toFixed(2);

if (isNaN(FrmName.Kms.value)) { v10 = 0; FrmName.Kms.value = '0 '; } else { v10 = Number(FrmName.Kms.value); }
if (isNaN(FrmName.KmsRate.value)) { v11 = 0; FrmName.KmsRate.value = '0 '; } else { v11 = Number(FrmName.KmsRate.value); }
v12 = v10*v11;
FrmName.Kms.value = v10.toFixed(2);
FrmName.KmsRate.value = v11.toFixed(2);
FrmName.KmsTotal.value = v12.toFixed(2);

v13 = v3+v4+v7+v12;
FrmName.NetTotal.value = v13.toFixed(2);

v14 = v5+v8;
FrmName.GSTTotal.value = v14.toFixed(2);

v15 = v3+v6+v9+v12;
FrmName.Total.value = v15.toFixed(2);

return true;

}

function CalcPlayerClinician(FrmName)
{
if (isNaN(FrmName.Hours.value)) { v1 = 0; FrmName.Hours.value = '0 '; } else { v1 = Number(FrmName.Hours.value); }
if (isNaN(FrmName.Rate.value)) { v2 = 0; FrmName.Rate.value = '0 '; } else { v2 = Number(FrmName.Rate.value); }
v3 = v1*v2;
FrmName.Hours.value = v1.toFixed(2);
FrmName.Rate.value = v2.toFixed(2);
FrmName.Fee.value = v3.toFixed(2);

if (isNaN(FrmName.Accommodations.value)) { v4 = 0; FrmName.Accommodations.value = '0 '; } else { v4 = Number(FrmName.Accommodations.value); }
if (isNaN(FrmName.AccommodationsGST.value)) { v5 = 0; FrmName.AccommodationsGST.value = '0 '; } else { v5 = Number(FrmName.AccommodationsGST.value); }
v6 = v4+v5;
FrmName.Accommodations.value = v4.toFixed(2);
FrmName.AccommodationsGST.value = v5.toFixed(2);
FrmName.AccommodationsTotal.value = v6.toFixed(2);

if (isNaN(FrmName.Meals.value)) { v7 = 0; FrmName.Meals.value = '0 '; } else { v7 = Number(FrmName.Meals.value); }
if (isNaN(FrmName.MealsGST.value)) { v8 = 0; FrmName.MealsGST.value = '0 '; } else { v8 = Number(FrmName.MealsGST.value); }
v9 = v7+v8;
FrmName.Meals.value = v7.toFixed(2);
FrmName.MealsGST.value = v8.toFixed(2);
FrmName.MealsTotal.value = v9.toFixed(2);

if (isNaN(FrmName.Kms.value)) { v10 = 0; FrmName.Kms.value = '0 '; } else { v10 = Number(FrmName.Kms.value); }
if (isNaN(FrmName.KmsRate.value)) { v11 = 0; FrmName.KmsRate.value = '0 '; } else { v11 = Number(FrmName.KmsRate.value); }
v12 = v10*v11;
FrmName.Kms.value = v10.toFixed(2);
FrmName.KmsRate.value = v11.toFixed(2);
FrmName.KmsTotal.value = v12.toFixed(2);

v13 = v3+v4+v7+v12;
FrmName.NetTotal.value = v13.toFixed(2);

v14 = v5+v8;
FrmName.GSTTotal.value = v14.toFixed(2);

v15 = v3+v6+v9+v12;
FrmName.Total.value = v15.toFixed(2);

return true;

}


function CalcMSAClinician(FrmName)
{
if (isNaN(FrmName.Hours.value)) { v1 = 0; FrmName.Hours.value = '0 '; } else { v1 = Number(FrmName.Hours.value); }
if (isNaN(FrmName.Rate.value)) { v2 = 0; FrmName.Rate.value = '0 '; } else { v2 = Number(FrmName.Rate.value); }
v3 = v1*v2;
FrmName.Hours.value = v1.toFixed(2);
FrmName.Rate.value = v2.toFixed(2);
FrmName.Fee.value = v3.toFixed(2);

if (isNaN(FrmName.Accommodations.value)) { v4 = 0; FrmName.Accommodations.value = '0 '; } else { v4 = Number(FrmName.Accommodations.value); }
if (isNaN(FrmName.AccommodationsGST.value)) { v5 = 0; FrmName.AccommodationsGST.value = '0 '; } else { v5 = Number(FrmName.AccommodationsGST.value); }
v6 = v4+v5;
FrmName.Accommodations.value = v4.toFixed(2);
FrmName.AccommodationsGST.value = v5.toFixed(2);
FrmName.AccommodationsTotal.value = v6.toFixed(2);

if (isNaN(FrmName.Meals.value)) { v7 = 0; FrmName.Meals.value = '0 '; } else { v7 = Number(FrmName.Meals.value); }
if (isNaN(FrmName.MealsGST.value)) { v8 = 0; FrmName.MealsGST.value = '0 '; } else { v8 = Number(FrmName.MealsGST.value); }
v9 = v7+v8;
FrmName.Meals.value = v7.toFixed(2);
FrmName.MealsGST.value = v8.toFixed(2);
FrmName.MealsTotal.value = v9.toFixed(2);

if (isNaN(FrmName.Kms.value)) { v10 = 0; FrmName.Kms.value = '0 '; } else { v10 = Number(FrmName.Kms.value); }
if (isNaN(FrmName.KmsRate.value)) { v11 = 0; FrmName.KmsRate.value = '0 '; } else { v11 = Number(FrmName.KmsRate.value); }
v12 = v10*v11;
FrmName.Kms.value = v10.toFixed(2);
FrmName.KmsRate.value = v11.toFixed(2);
FrmName.KmsTotal.value = v12.toFixed(2);

v13 = v3+v4+v7+v12;
FrmName.NetTotal.value = v13.toFixed(2);

v14 = v5+v8;
FrmName.GSTTotal.value = v14.toFixed(2);

v15 = v3+v6+v9+v12;
FrmName.Total.value = v15.toFixed(2);

return true;

}



function SetDataChanged()
{
	DataChanged = 1;
	return true;
}

function SetLetterSearch(FrmName,Letter)
{
	FrmName.LastName.value = Letter;
	FrmName.submit();
}


function ShowMessage(messtext)
{
	alert(messtext);
	return true;
}



function SubmitLibrary(ActionString)
{
document.LibraryForm.action=ActionString;
document.LibraryForm.submit();
}







// *********************************
// VALIDATEDATE
// DATE FIELD VALIDATION
// *********************************

function ValidateDate(FldName)
{
x = FldName.value
if (x.length == 0)
{
	return true;
}


if (x.length != 10)
{
	alert('Invalid date');
	FldName.select();
	FldName.focus();
	return false;
}

yr = x.substring(0,4)	
if (!(yr >= '1000' && yr <= '9999'))
{
	alert('Invalid date');
	FldName.select();
	FldName.focus();
	return false;
}

mo = x.substring(5,7)	
if (!(mo >= '01' && mo <= '12'))
{
	alert('Invalid date');
	FldName.select();
	FldName.focus();
	return false;
}

da = x.substring(8,10)	
if (!(da >= '01' && da <= '31'))
{
	alert('Invalid date');
	FldName.select();
	FldName.focus();
	return false;
}

if ((mo == '04' || mo == '06' || mo == '09' || mo == '11') && (da > '30'))
{
	alert('Invalid date');
	FldName.select();
	FldName.focus();
	return false;
}

if (mo == '02')
{
	if (   ((Number(yr)%4) == 0 && (da > '29')) || ( (Number(yr)%4) > 0 && (da > '28') )   )
	{
		alert('Invalid date');
		FldName.select();
		FldName.focus();
		return false;
	}
}


return true

}


function ValidateLeagueContact(FrmName)
{
	x = FrmName.SelectedLeague;
	if (x.value == '0') 
	{ 
		alert('You must select a league');
		return false; 
	}
	
	x = FrmName.ContactTitle.value;
	if (x.length == 0) 
	{
		if (!confirm('No role has been defined for the contact. Press OK to continue or Cancel to return to the current screen')) { return false; }
	 }

	return true;
}
 

// *********************************
// ValidateForm
// EVENT LOCATOR CRITERIA VALIDATION
// *********************************
function ValidateELForm(FrmName)
{
	x = FrmName.FirstDate.value;
	if (x.length > 0) { return true; }
	
	x = FrmName.LastDate.value;
	if (x.length > 0) { return true; }

	x = FrmName.Team;
	if (x.value != '0') { return true; }

	x = FrmName.EventType;
	if (x.value != '0') { return true; }

	x = FrmName.Diamond;
	if (x.value != '0') { return true; }

	alert('You must define at least one criteria for the search')

	return false;
}
 

function ValidateGameForm(FrmName)
{
	x = FrmName.EventDate.value;
	if (x.length == 0) { alert('You must enter a date for the game'); return false; }


return true; 
}
 
function ValidateTournamentForm(FrmName)
{
	x = FrmName.TournamentName.value;
	if (x.length == 0) { alert('You must enter a name for the tournament'); return false; }

	x = FrmName.StartDate.value;
	if (x.length == 0) { alert('You must enter a start date for the tournament'); return false; }


return true; 
}
 


// +------------------------------------------------------------+
// |                   Popup Calendar(Window)                   |
// +------------------------------------------------------------+
// | Last Modified:                  22-Dec-2005                |
// | Web Site:                       http://www.yxscripts.com   |
// | EMail:                          m_yangxin@hotmail.com      |
// +------------------------------------------------------------+
// |       Copyright 2002  Xin Yang   All Rights Reserved.      |
// |           This version featured on Dynamic Drive           |
// |               (http://www.dynamicdrive.com)                |
// +------------------------------------------------------------+

// default settings
var fontFace="verdana";
var fontSize=9;

var titleWidth=90;
var titleMode=1;
var dayWidth=12;
var dayDigits=1;

var titleColor="#0000FF";
var daysColor="#cccccc";
var bodyColor="#ffffff";
var dayColor="#ffffff";
var currentDayColor="#333333";
var footColor="#0000FF";
var borderColor="#333333";

var titleFontColor = "#FFFFFF";
var daysFontColor = "#333333";
var dayFontColor = "#333333";
var currentDayFontColor = "#ffffff";
var footFontColor = "#FFFFFF";

var calFormat = "yyyy-mm-dd";

var weekDay = 0;
// ------

// codes
var calWidth=200, calHeight=200, calOffsetX=-200, calOffsetY=16;
var calWin=null;
var winX=0, winY=0;
var cal="cal";
var cals=new Array();
var currentCal=null;

var yxMonths=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var yxDays=new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
var yxLinks=new Array("Close");

var nav=navigator.userAgent.toLowerCase();;
var isOpera=(nav.indexOf("opera")!=-1)?true:false;
var isOpera5=(nav.indexOf("opera 5")!=-1 || nav.indexOf("opera/5")!=-1)?true:false;
var isOpera6=(isOpera && parseInt(navigator.appVersion)>=6)?true:false;
var isN6=(nav.indexOf("gecko")!=-1);
var isN4=(document.layers)?true:false;
var isMac=(nav.indexOf("mac")!=-1);
var isIE=(document.all && !isOpera && (!isMac || navigator.appVersion.indexOf("MSIE 4")==-1))?true:false;

if (isN4) {
  fontSize+=2;
}

var span2="</span>";

function span1(tag) {
  return "<span class='"+tag+"'>";
}
function spanx(tag, color) {
  return "."+tag+" { font-family:"+fontFace+"; font-size:"+fontSize+"px; color:"+color+"; }\n";
}

function a1(tag) {
  return "<a class='"+tag+"' href=";
}

function ax(tag, color) {
  return "."+tag+" { text-decoration:none; color:"+color+"; }\n";
}

function calOBJ(name, title, field, form) {
  this.name = name;
  this.title = title;
  this.field = field;
  this.formName = form;
  this.form = null
}

function setFont(font, size) {
  if (font != "") {
    fontFace=font;
  }
  if (size > 0) {
    fontSize=size;

    if (isN4) {
      fontSize+=2;
    }
  }
}

function setWidth(tWidth, tMode, dWidth, dDigits) {
  if (tWidth > 0) {
    titleWidth=tWidth;
  }
  if (tMode == 1 || tMode == 2) {
    titleMode=tMode;
  }
  if (dWidth > 0) {
    dayWidth=dWidth;
  }
  if (dDigits > 0) {
    dayDigits=dDigits;
  }
}

function setColor(tColor, dsColor, bColor, dColor, cdColor, fColor, bdColor) {
  if (tColor != "") {
    titleColor=tColor;
  }
  if (dsColor != "") {
    daysColor=dsColor;
  }
  if (bColor != "") {
    bodyColor=bColor;
  }
  if (dColor != "") {
    dayColor=dColor;
  }
  if (cdColor != "") {
    currentDayColor=cdColor;
  }
  if (fColor != "") {
    footColor=fColor;
  }
  if (bdColor != "") {
    borderColor=bdColor;
  }
}

function setFontColor(tColorFont, dsColorFont, dColorFont, cdColorFont, fColorFont) {
  if (tColorFont != "") {
    titleFontColor=tColorFont;
  }
  if (dsColorFont != "") {
    daysFontColor=dsColorFont;
  }
  if (dColorFont != "") {
    dayFontColor=dColorFont;
  }
  if (cdColorFont != "") {
    currentDayFontColor=cdColorFont;
  }
  if (fColorFont != "") {
    footFontColor=fColorFont;
  }
}

function setFormat(format) {
  calFormat = format;
}

function setSize(width, height, ox, oy) {
  if (width > 0) {
    calWidth=width;
  }
  if (height > 0) {
    calHeight=height;
  }

  calOffsetX=ox;
  calOffsetY=oy;
}

function setWeekDay(wDay) {
  if (wDay == 0 || wDay == 1) {
    weekDay = wDay;
  }
}

function setMonthNames(janName, febName, marName, aprName, mayName, junName, julName, augName, sepName, octName, novName, decName) {
  if (janName != "") {
    yxMonths[0] = janName;
  }
  if (febName != "") {
    yxMonths[1] = febName;
  }
  if (marName != "") {
    yxMonths[2] = marName;
  }
  if (aprName != "") {
    yxMonths[3] = aprName;
  }
  if (mayName != "") {
    yxMonths[4] = mayName;
  }
  if (junName != "") {
    yxMonths[5] = junName;
  }
  if (julName != "") {
    yxMonths[6] = julName;
  }
  if (augName != "") {
    yxMonths[7] = augName;
  }
  if (sepName != "") {
    yxMonths[8] = sepName;
  }
  if (octName != "") {
    yxMonths[9] = octName;
  }
  if (novName != "") {
    yxMonths[10] = novName;
  }
  if (decName != "") {
    yxMonths[11] = decName;
  }
}

function setDayNames(sunName, monName, tueName, wedName, thuName, friName, satName) {
  if (sunName != "") {
    yxDays[0] = sunName;
    yxDays[7] = sunName;
  }
  if (monName != "") {
    yxDays[1] = monName;
  }
  if (tueName != "") {
    yxDays[2] = tueName;
  }
  if (wedName != "") {
    yxDays[3] = wedName;
  }
  if (thuName != "") {
    yxDays[4] = thuName;
  }
  if (friName != "") {
    yxDays[5] = friName;
  }
  if (satName != "") {
    yxDays[6] = satName;
  }
}

function setLinkNames(closeLink) {
  if (closeLink != "") {
    yxLinks[0] = closeLink;
  }
}

function addCalendar(name, title, field, form) {
  cals[cals.length] = new calOBJ(name, title, field, form);
}

function findCalendar(name) {
  for (var i = 0; i < cals.length; i++) {
    if (cals[i].name == name) {
      if (cals[i].form == null) {
        if (cals[i].formName == "") {
          if (document.forms[0]) {
            cals[i].form = document.forms[0];
          }
        }
        else if (document.forms[cals[i].formName]) {
          cals[i].form = document.forms[cals[i].formName];
        }
      }

      return cals[i];
    }
  }

  return null;
}

function getDayName(y,m,d) {
  var wd=new Date(y,m,d);
  return yxDays[wd.getDay()].substring(0,3);
}

function getMonthFromName(m3) {
  for (var i = 0; i < yxMonths.length; i++) {
    if (yxMonths[i].toLowerCase().substring(0,3) == m3.toLowerCase()) {
      return i;
    }
  }

  return 0;
}

function getFormat() {
  var calF = calFormat;

  calF = calF.replace(/\\/g, '\\\\');
  calF = calF.replace(/\//g, '\\\/');
  calF = calF.replace(/\[/g, '\\\[');
  calF = calF.replace(/\]/g, '\\\]');
  calF = calF.replace(/\(/g, '\\\(');
  calF = calF.replace(/\)/g, '\\\)');
  calF = calF.replace(/\{/g, '\\\{');
  calF = calF.replace(/\}/g, '\\\}');
  calF = calF.replace(/\</g, '\\\<');
  calF = calF.replace(/\>/g, '\\\>');
  calF = calF.replace(/\|/g, '\\\|');
  calF = calF.replace(/\*/g, '\\\*');
  calF = calF.replace(/\?/g, '\\\?');
  calF = calF.replace(/\+/g, '\\\+');
  calF = calF.replace(/\^/g, '\\\^');
  calF = calF.replace(/\$/g, '\\\$');

  calF = calF.replace(/dd/i, '\\d\\d');
  calF = calF.replace(/mm/i, '\\d\\d');
  calF = calF.replace(/yyyy/i, '\\d\\d\\d\\d');
  calF = calF.replace(/day/i, '\\w\\w\\w');
  calF = calF.replace(/mon/i, '\\w\\w\\w');

  return new RegExp(calF);
}

function getDateNumbers(date) {
  var y, m, d;

  var yIdx = calFormat.search(/yyyy/i);
  var mIdx = calFormat.search(/mm/i);
  var m3Idx = calFormat.search(/mon/i);
  var dIdx = calFormat.search(/dd/i);

  y=date.substring(yIdx,yIdx+4)-0;
  if (mIdx != -1) {
    m=date.substring(mIdx,mIdx+2)-1;
  }
  else {
    var m = getMonthFromName(date.substring(m3Idx,m3Idx+3));
  }
  d=date.substring(dIdx,dIdx+2)-0;

  return new Array(y,m,d);
}

function hideCal() {
  calWin.close();
  calWin = null;
  window.status = "";
}

function getLeftIE(x,m) {
  var dx=0;
  if (x.tagName=="TD"){
    dx=x.offsetLeft;
  }
  else if (x.tagName=="TABLE") {
    dx=x.offsetLeft;
    if (m) { dx+=(x.cellPadding!=""?parseInt(x.cellPadding):2); m=false; }
  }
  return dx+(x.parentElement.tagName=="BODY"?0:getLeftIE(x.parentElement,m));
}
function getTopIE(x,m) {
  var dy=0;
  if (x.tagName=="TR"){
    dy=x.offsetTop;
  }
  else if (x.tagName=="TABLE") {
    dy=x.offsetTop;
    if (m) { dy+=(x.cellPadding!=""?parseInt(x.cellPadding):2); m=false; }
  }
  return dy+(x.parentElement.tagName=="BODY"?0:getTopIE(x.parentElement,m));
}

function getLeftN4(l) { return l.pageX; }
function getTopN4(l) { return l.pageY; }

function getLeftN6(l) { return l.offsetLeft; }
function getTopN6(l) { return l.offsetTop; }

function lastDay(d) {
  var yy=d.getFullYear(), mm=d.getMonth();
  for (var i=31; i>=28; i--) {
    var nd=new Date(yy,mm,i);
    if (mm == nd.getMonth()) {
      return i;
    }
  }
}

function firstDay(d) {
  var yy=d.getFullYear(), mm=d.getMonth();
  var fd=new Date(yy,mm,1);
  return fd.getDay();
}

function dayDisplay(i) {
  if (dayDigits == 0) {
    return yxDays[i];
  }
  else {
    return yxDays[i].substring(0,dayDigits);
  }
}

function calTitle(d) {
  var yy=d.getFullYear(), mm=yxMonths[d.getMonth()];
  var s;

  if (titleMode == 2) {
    s="<tr align='center' bgcolor='"+titleColor+"'><td colspan='7'>\n<table cellpadding='0' cellspacing='0' border='0'><tr align='center' valign='middle'><td align='right'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(-10)'>&nbsp;&#171;</a>&nbsp;"+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(-1)'>&#139;&nbsp;</a></b>"+span2+"</td><td width='"+titleWidth+"'><b>"+span1("title")+yy+span2+"</b></td><td align='left'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(1)'>&nbsp;&#155;</a>&nbsp;"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(10)'>&#187;&nbsp;</a></b>"+span2+"</td></tr><tr align='center' valign='middle'><td align='right'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.prepMonth) window.opener.prepMonth("+d.getMonth()+")'>&nbsp;&#139;&nbsp;</a></b>"+span2+"</td><td width='"+titleWidth+"'><b>"+span1("title")+mm+span2+"</b></td><td align='left'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.nextMonth) window.opener.nextMonth("+d.getMonth()+")'>&nbsp;&#155;&nbsp;</a></b>"+span2+"</td></tr></table>\n</td></tr><tr align='center' bgcolor='"+daysColor+"'>";
  }
  else {
    s="<tr align='center' bgcolor='"+titleColor+"'><td colspan='7'>\n<table cellpadding='0' cellspacing='0' border='0'><tr align='center' valign='middle'><td>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(-1)'>&nbsp;&#171;</a>&nbsp;"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.prepMonth) window.opener.prepMonth("+d.getMonth()+")'>&#139;&nbsp;</a></b>"+span2+"</td><td width='"+titleWidth+"'><nobr><b>"+span1("title")+mm+" "+yy+span2+"</b></nobr></td><td>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.nextMonth) window.opener.nextMonth("+d.getMonth()+")'>&nbsp;&#155;</a>&nbsp;"+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(1)'>&#187;&nbsp;</a></b>"+span2+"</td></tr></table>\n</td></tr><tr align='center' bgcolor='"+daysColor+"'>";
  }

  for (var i=weekDay; i<weekDay+7; i++) {
    s+="<td width='"+dayWidth+"'>"+span1("days")+dayDisplay(i)+span2+"</td>";
  }

  s+="</tr>";

  return s;
}

function calHeader() {
  return "<head>\n<title>"+currentCal.title+"</title>\n<style type='text/css'>\n"+spanx("title",titleFontColor)+spanx("days",daysFontColor)+spanx("foot",footColor)+spanx("day",dayFontColor)+spanx("currentDay",currentDayFontColor)+ax("titlea",titleFontColor)+ax("daya",dayFontColor)+ax("currenta",currentDayFontColor)+ax("foota",footFontColor)+"</style>\n</head>\n<body>\n<table align='center' border='0' bgcolor='"+borderColor+"' cellspacing='0' cellpadding='1'><tr><td>\n<table cellspacing='1' cellpadding='3' border='0'>";
}

function calFooter() {
  return "<tr bgcolor='"+footColor+"'><td colspan='7' align='center'>"+span1("foot")+"<b>"+a1("foota")+"'javascript:if (window.opener && !window.opener.closed && window.opener.hideCal) window.opener.hideCal()'>"+yxLinks[0]+"</a></b>"+span2+"</td></tr></table>\n</td></tr></table>\n</body>";
}

function calBody(d,day) {
  var s="", dayCount=1, fd=firstDay(d), ld=lastDay(d);

  if (weekDay > 0 && fd == 0) {
    fd = 7;
  }

  for (var i=0; i<6; i++) {
    s+="<tr align='center' bgcolor='"+bodyColor+"'>";
    for (var j=weekDay; j<weekDay+7; j++) {
      if (i*7+j<fd || dayCount>ld) {
        s+="<td>"+span1("day")+"&nbsp;"+span2+"</td>";
      }
      else {
        var bgColor=dayColor;
        var fgTag="day";
        var fgTagA="daya";
        if (dayCount==day) { 
          bgColor=currentDayColor; 
          fgTag="currentDay";
          fgTagA="currenta";
        }
        
        s+="<td bgcolor='"+bgColor+"'>"+span1(fgTag)+a1(fgTagA)+"'javascript: if (window.opener && !window.opener.closed && window.opener.pickDate) window.opener.pickDate("+dayCount+")'>"+(dayCount++)+"</a>"+span2+"</td>";
      }
    }
    s+="</tr>";
  }

  return s;
}

function moveYear(dy) {
  cY+=dy;
  var nd=new Date(cY,cM,1);
  changeCal(nd);
}

function prepMonth(m) {
  cM=m-1;
  if (cM<0) { cM=11; cY--; }
  var nd=new Date(cY,cM,1);
  changeCal(nd);
}

function nextMonth(m) {
  cM=m+1;
  if (cM>11) { cM=0; cY++;}
  var nd=new Date(cY,cM,1);
  changeCal(nd);
}

function changeCal(d) {
  var dd = 0;

  if (currentCal != null) {
    var calRE = getFormat();

    if (currentCal.form[currentCal.field].value!="" && calRE.test(currentCal.form[currentCal.field].value)) {
      var cd = getDateNumbers(currentCal.form[currentCal.field].value);
      if (cd[0] == d.getFullYear() && cd[1] == d.getMonth()) {
        dd=cd[2];
      }
    }
    else {
      var cd = new Date();
      if (cd.getFullYear() == d.getFullYear() && cd.getMonth() == d.getMonth()) {
        dd=cd.getDate();
      }
    }
  }

  var calendar=calHeader()+calTitle(d)+calBody(d,dd)+calFooter();

  calWin.document.open();
  calWin.document.write(calendar);
  calWin.document.close();
}

function markClick(e) {
  if (isIE || isOpera6) {
    winX=event.screenX;
    winY=event.screenY;
  }
  else if (isN4 || isN6) {
    winX=e.screenX;
    winY=e.screenY;

    document.routeEvent(e);
  }

  if (isN4 || isN6) { 
    document.routeEvent(e); 
  } 
  else { 
    event.cancelBubble=false; 
  } 

  return true;
}

function showCal(name) {
  var lastCal=currentCal;
  var d=new Date(), hasCal=false;

  currentCal = findCalendar(name);

  if (currentCal != null && currentCal.form != null && currentCal.form[currentCal.field]) {
    var calRE = getFormat();

    if (currentCal.form[currentCal.field].value!="" && calRE.test(currentCal.form[currentCal.field].value)) {
      var cd = getDateNumbers(currentCal.form[currentCal.field].value);
      d=new Date(cd[0],cd[1],cd[2]);

      cY=cd[0];
      cM=cd[1];
      dd=cd[2];
    }
    else {
      cY=d.getFullYear();
      cM=d.getMonth();
      dd=d.getDate();
    }

    var calendar=calHeader()+calTitle(d)+calBody(d,dd)+calFooter();

    if (calWin != null && typeof(calWin.closed)!="undefined" && !calWin.closed) {
      hasCal=true;
      calWin.moveTo(winX+calOffsetX,winY+calOffsetY);
    }

    if (!hasCal) {
      if (isIE || isOpera6) {
        calWin=window.open("Calendar","cal","toolbar=0,width="+calWidth+",height="+calHeight+",left="+(winX+calOffsetX)+",top="+(winY+calOffsetY));
      }
      else {
        calWin=window.open("Calendar","cal","toolbar=0,width="+calWidth+",height="+calHeight+",screenx="+(winX+calOffsetX)+",screeny="+(winY+calOffsetY));
      }
    }

    calWin.document.open();
    calWin.document.write(calendar);
    calWin.document.close();

    calWin.focus();
  }
  else {
    if (currentCal == null) {
      window.status = "Calendar ["+name+"] not found.";
    }
    else if (!currentCal.form) {
      window.status = "Form ["+currentCal.formName+"] not found.";
    }
    else if (!currentCal.form[currentCal.field]) {
      window.status = "Form Field ["+currentCal.formName+"."+currentCal.field+"] not found.";
    }

    if (lastCal != null) {
      currentCal = lastCal;
    }
  }
}

function get2Digits(n) {
  return ((n<10)?"0":"")+n;
}

function clearDate() {
  currentCal.form[currentCal.field].value="";
  hideCal();
}

function pickDate(d) {
  hideCal();
  window.focus();

  var date=calFormat;
  date = date.replace(/yyyy/i, cY);
  date = date.replace(/mm/i, get2Digits(cM+1));
  date = date.replace(/MON/, yxMonths[cM].substring(0,3).toUpperCase());
  date = date.replace(/Mon/i, yxMonths[cM].substring(0,3));
  date = date.replace(/dd/i, get2Digits(d));
  date = date.replace(/DAY/, getDayName(cY,cM,d).toUpperCase());
  date = date.replace(/day/i, getDayName(cY,cM,d));

  currentCal.form[currentCal.field].value=date;
  // IE5/Mac needs focus to show the value, weird.
  currentCal.form[currentCal.field].focus();
}
// ------

// user functions
function checkDate(name) {
  var thisCal = findCalendar(name);

  if (thisCal != null && thisCal.form != null && thisCal.form[thisCal.field]) {
    var calRE = getFormat();

    if (calRE.test(thisCal.form[thisCal.field].value)) {
      return 0;
    }
    else {
      return 1;
    }
  }
  else {
    return 2;
  }
}

function getCurrentDate() {
  var date=calFormat, d = new Date();
  date = date.replace(/yyyy/i, d.getFullYear());
  date = date.replace(/mm/i, get2Digits(d.getMonth()+1));
  date = date.replace(/dd/i, get2Digits(d.getDate()));

  return date;
}

function compareDates(date1, date2) {
  var calRE = getFormat();
  var d1, d2;

  if (calRE.test(date1)) {
    d1 = getNumbers(date1);
  }
  else {
    d1 = getNumbers(getCurrentDate());
  }

  if (calRE.test(date2)) {
    d2 = getNumbers(date2);
  }
  else {
    d2 = getNumbers(getCurrentDate());
  }

  var dStr1 = d1[0] + "" + d1[1] + "" + d1[2];
  var dStr2 = d2[0] + "" + d2[1] + "" + d2[2];

  if (dStr1 == dStr2) {
    return 0;
  }
  else if (dStr1 > dStr2) {
    return 1;
  }
  else {
    return -1;
  }
}

function getNumbers(date) {
  var calRE = getFormat();
  var y, m, d;

  if (calRE.test(date)) {
    var yIdx = calFormat.search(/yyyy/i);
    var mIdx = calFormat.search(/mm/i);
    var m3Idx = calFormat.search(/mon/i);
    var dIdx = calFormat.search(/dd/i);

    y=date.substring(yIdx,yIdx+4);
    if (mIdx != -1) {
      m=date.substring(mIdx,mIdx+2);
    }
    else {
      var mm=getMonthFromName(date.substring(m3Idx,m3Idx+3))+1;
      m=(mm<10)?("0"+mm):(""+mm);
    }
    d=date.substring(dIdx,dIdx+2);

    return new Array(y,m,d);
  }
  else {
    return new Array("", "", "");
  }
}
// ------

if (isN4 || isN6) {
  document.captureEvents(Event.CLICK);
}
document.onclick=markClick;



