	function OpenWindow(xPage, xOpenArgs, xOptions)
	{
		if (!xOptions){
			xOptions="height=500, width=600, toolbar=no, location=no, resizable=yes, scrollbars=yes"
		}
		x=window.open(xPage + "?ID=" + xOpenArgs,"",xOptions)
		x.screentop=100
		x.screenright=50
		//x=window.open(xPage & "?ID=" & xOpenArgs,xOpenArgs,"Height=500, Width=600, dialogTop: 200px; dialogLeft: 200px; edge: Raised; center: Yes; help: No; resizable: No; status: No;")
	}

	function GoSubmit(strProcess,strMsg, strProcessPage, strProcessType, lngUID, strJumpPage)
	{
		if (strMsg!=""){
			//Check if the message is to be an InputBox or a MsgBox
			x=strMsg.substring(0,1)
			if (x==">"){
				strMsg=strMsg.substring(1)
				var x=prompt(strMsg,1)
				if (!x){return false}
				document.Form1.UserInput.value=x
			}else{
				if (!window.confirm(strMsg)){return false}
			}
		}
		document.Form1.action=strProcessPage
		document.Form1.ProcessType.value=strProcessType
		if (lngUID!=""){document.Form1.UniqueID.value=lngUID}
		if (strJumpPage!=""){document.Form1.JumpPage.value=strJumpPage}
		document.Form1.Process.value=strProcess
		document.Form1.submit()
	}

	function ShowPasswordBox()
	{
		var pb;
		pb=document.getElementById("PasswordBox").style.display;
		alert(document.getElementById("PasswordBox").style.display);
	}

	function ShowFilter()
	{
		var fbStyle
		var fIT
		var s1
		var s2
		var ff
		var fo
		s1=document.getElementById("Search1")
		s2=document.getElementById("Search2")
		ff=document.getElementById("FilterForm")
		fo=document.getElementById("FilterOn")
		fbStyle=document.getElementById("FilterBox").style
		fIT=document.getElementById("Filter")

		if (fbStyle.display=="none"){
			fbStyle.display="block"
			fIT.innerHTML="Remove Filter"
		}else{
			fbStyle.display="none"
			fIT.innerHTML="Show Filter"
			if (fo.value=="Y"){
				s1.value=""
				s2.value=""
				fo.value=""
				ff.submit()
			}
		}
	}
	
	function FilterRecords()
	{
		var s1
		var s2
		var ff
		var fo
		s1=document.getElementById("Search1")
		s2=document.getElementById("Search2")
		ff=document.getElementById("FilterForm")
		fo=document.getElementById("FilterOn")

		if (!(s1.value=="" && s2.value=="")){
			if (s1.value==""){
				s1.value=s2.value
				s2.value=""
			}
			fo.value="Y"
			ff.submit()
		}
	}

	function Logout()
	{
		window.location.href="PageTransition.asp?Page=logout.asp"
	}
	
	function GotoPage(strPage)
	{
		window.location.href="PageTransition.asp?Page=" + strPage
	}

	String.prototype.ucFirst = function () {
		var word = this.RemoveInvalids()
		var firstLetter = word.substr(0,1).toUpperCase();
		return word.substr(0,1).toUpperCase() + word.substr(1,word.length);
	}

	String.prototype.toTitleCase = function () {
		var sentence='';
		var words = this.RemoveInvalids().split(' ');
		for (l in words){
			words[l]=words[l].substr(0,1).toUpperCase() + words[l].substr(1,words[l].length);
		}
		sentence=words.join(' ');
		return sentence;
	}

	String.prototype.RemoveInvalids = function () {
		var strText=this;
		strText=strText.replace("'","");
		strText=strText.replace("\"","");
		return strText;
	}

	String.prototype.toNumber = function () {
		var word = this.RemoveInvalids()
		var strText='';
		for (l=0; l<word.length; l++){
			if (!isNaN(parseInt(word.substring(l,l+1)))){
				strText+= word.substring(l,l+1);
			}
		}
		return strText;
	}

	function SendEmail(xTo,xFrom,xSubject,xMsg,xMsgType,JumpPage)
	{
		document.Email.To.value=xTo
		document.Email.From.value=xFrom
		document.Email.Subject.value=xSubject
		document.Email.Msg.value=xMsg
		document.Email.MsgType.value=xMsgType
		document.Email.JumpPage.value=JumpPage
		document.Email.action='SendEmail.asp'
		document.Email.submit()
	}
	
	function frontpageValidator(theForm)
	{
		var strMsg="";
		if (theForm.ContactName.value == "")
		{
			strMsg +="* Contact Name\n";
		}
		if (theForm.Address.value == "")
		{
			strMsg +="* Postal Address\n";
		}
		if (theForm.Suburb.value == "")
		{
			strMsg +="* Suburb\n";
		}	
		if (theForm.State.value == "")
		{
			strMsg +="* State\n";
		}
		if (theForm.Postcode.value == "")
		{
			strMsg +="* Postcode\n";
		}
		if (theForm.Postcode.value == ""  || !(theForm.Postcode.value.length==4))
		{			
			strMsg +="* Postcode. It must contain 4 digits.\n";
		}
		if (theForm.Phone.value == "")
		{			
			strMsg +="* Phone Number\n";
		}
		if (!theForm.Email.value == "")
		{
			x="* Email is Invalid";
			atStart=theForm.Email.value.indexOf("@");
			if (atStart>0){
				dotStart=theForm.Email.value.indexOf(".", atStart);
				if (dotStart>-1){
					if (dotStart+1<theForm.Email.value.length){
						x="";
					}
				}
			}
			if (!x==""){
				strMsg += x + "\n";
			}
		}else{
			strMsg +="* Email is missing\n";
		}
		if (theForm.SponsorType[1].checked!=true&&theForm.SponsorType[3].checked!=true){
			if (theForm.Player1_Name.value == "")
			{			
				strMsg +="* Player 1 - Name\n";
			}
			if (theForm.Player1_Size.value == "")
			{			
				strMsg +="* Player 1 - Shirt Size\n";
			}
			if (theForm.Player1_Hcap.value == "")
			{			
				strMsg +="* Player 1 - Handicap\n";
			}
		}
		if (!strMsg=="")
		{
			alert("Some fields are missing or invalid. Please complete the following details:\n\n" + strMsg);
			return (false);
		}else{
			return (true);
		}
	}

