function showPopup(iPage, iHeight, iWidth, bScroll, bModal) {
	var sNavTo;
	
	switch (iPage) {
		case 1: // Help
			sNavTo="../Pages/Help/uagbHelpHome.htm";
			break;
		case 2: // Terms and Conditions
			sNavTo="../Pages/uagbTsAndCs.htm";
			break;
		case 3:
			sNavTo="../Pages/uagbTemplate.htm";
			break;
		case 4:
			sNavTo="../Pages/uagbTemplate.htm";
			break;											
		case 5: // Rules
			sNavTo="../../General/uageLeagueRules.aspx";
			break;
		case 6:
			sNavTo="../Pages/uagbPrivacy.htm";
			break;	
		case 7: // What is Fantastar
			sNavTo="../Pages/uagbWhatIsFantastar.htm";
			break;	
		case 8: // Why Fantastar
			sNavTo="../Pages/uagbWhyFantastar.htm";
			break;	
		case 9: // Fantastar in action
			sNavTo="../Pages/uagbDemo1.htm";
			break;	
		case 10: // Press Releases
			sNavTo="../Pages/uagbPressReleases.htm";
			break;
		case 11: // Player list
			sNavTo="../../Manager/uamaPlayerLeaderboard.aspx?i32LeaderboardType=1";
			break;
		case 12: // League Prize
			sNavTo="../../General/uageLeaguePrize.aspx";
			break;	
		case 13: // Admin Help
			sNavTo="../Pages/Help/uagbClubAdmin.htm";
			break;
		case 14: // Trump print info
			sNavTo="../Pages/uagbPrintInfo.htm";
			break;
		case 15: // Manager Scoring info
			sNavTo="../Pages/Help/uagbManagerScoring.htm";
			break;			
	}

	var sDialogFeatures = "dialogHeight:" + iHeight + "px;dialogWidth:" + iWidth + "px;status:no;help:no;center:yes;resizable:yes;"
	var sURL = "../Noexpiry/GlobalInc/uagbPopupFrame.htm";
		
	if (bScroll == false) {
		var sURL = "../Noexpiry/GlobalInc/uagbPopupFrame.htm";
		sDialogFeatures += "scroll:no;";
	} else {
		var sURL = "../Noexpiry/GlobalInc/uagbPopupFrameScrollable.htm";
	}
	
	// Set the global variable
	sPopupURL = sNavTo;
	
	if (bModal) {;
		showModalDialog(sURL, window, sDialogFeatures);
	}
	else {
		showModelessDialog(sURL, window, sDialogFeatures);
	}	
}

function showCalendarPopup(sTextBoxValue,sTextBoxName,bModal) {
	var sURL;
	var sDialogFeatures
	
	sURL = "../General/uageDatePopUp.aspx?textbox=" + sTextBoxName + "&textboxvalue=" + sTextBoxValue
	//sDialogFeatures = "dialogHeight:" + 225 + "px;dialogWidth:" + 250 + "px;status:no;help:no;center:yes;resizable:yes;"
	sDialogFeatures = "width=220,height=200,left=450,top=250"
	if (bModal) {
		//showModalDialog(sURL, window, sDialogFeatures);
		window.open(sURL,'cal',sDialogFeatures);

	}
	else {
		//showModelessDialog(sURL, window, sDialogFeatures);
		window.open(sURL,'cal',sDialogFeatures);
	}	
}

function showTrumpPopup(iTrumpId,sTrumpAccessCode,bModal) {
	var sURL;
	var sDialogFeatures

	sURL = "../General/uageShowTrumpPF.aspx?i32TrumpId=" + iTrumpId + "&strTrumpAccessCode=" + sTrumpAccessCode

	//sDialogFeatures = "dialogHeight:" + 225 + "px;dialogWidth:" + 250 + "px;status:no;help:no;center:yes;resizable:yes;"
	sDialogFeatures = "width=380,height=570,left=200,top=25,toolbar=yes,menubar=yes,resizable=yes,status=yes"
	if (bModal) {
		//showModalDialog(sURL, window, sDialogFeatures);
		window.open(sURL,'trump',sDialogFeatures)

	}
	else {
		//showModelessDialog(sURL, window, sDialogFeatures);
		window.open(sURL,'trump',sDialogFeatures)
	}	
}

// Disables the submit button when clicked (if page validation succeeds)
function btnSubmit_Click(control)
{
	if (Page_ClientValidate()==true) {
		DisableControl_SetTimeout(control.id,100);
	}
}

// Helper function used by btnSubmit_Click
function DisableControl_SetTimeout(controlId,interval)
{
	setTimeout("DisableControl('" +controlId + "')",interval);
}

// Helper function used by DisableControl_SetTimeout
function DisableControl(controlId)
{
	document.getElementById(controlId).disabled =true;
}

// Called from the standard header to initialise page
function init() {
	// quit if this function has already been called
	if (arguments.callee.done) return;

	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;
		
	initialisePage();
}

//function to display or hide a given element

function showHideItems(myItem, myButton){

	//this is the ID of the hidden item
	var myItem = document.getElementById(myItem);

	//this is the ID of the plus/minus button image
	var myButton = document.getElementById(myButton);

	if (myItem.style.display != "none") {
		//items are currently displayed, so hide them

		myItem.style.display = "none";

		swapImage(myButton,"plus");
	} else {
		//items are currently hidden, so display them
		myItem.style.display = "block";

		swapImage(myButton,"minus");
	}
}

//function to swap an image based on its current state
function swapImage(myImage, state) {

	if (state == "minus") {
		myImage.src = "../NoExpiry/Images/minus.gif";
	} else {
		myImage.src = "../NoExpiry/Images/plus.gif";
	}
}
