<!--
// *****************************************
// Copyright © Manly Sea Eagles
// Version 4
// 26/01/2009
// *****************************************

// ----------------------------------------------------------------
	function NumberSuffix(pn) {
		var n=pn.toString();
		var p = "";
		if(pn > 9) {p=n.substr(0, (n.length -1))}
		n=n.substr((n.length -1))
		if(pn>=11 && pn <=13) {
		n=n+"th";
		} else if(n==1) {
		n=n+"st";
		} else if(n==2) {
		n=n+"nd"
		} else if(n==3) {
		n=n+"rd"
		} else {
		n=n+"th"
		}
		return p+n;					
	}

// ----------------------------------------------------------------
	function PopupContent(CID) {
		var newWin = window.open("popup-content.asp?cid=" + CID ,"PopupContent" + CID,"width=900,height=800,resizable=yes,scrollbars=yes,status=no");
		newWin.focus();
	}
	
// ----------------------------------------------------------------

	function openMWTV() {
		window.open('http://www.manlyseaeagles.com.au/mwtv/mwtv.asp', 'MWTVWin', 'width=950,height=500,resizable=yes,scrollbars=no');
	}
 //------------------------------------------------------------------------------
	function STMemPopup(URL, WinNum) {
		window.open(URL, 'STMemWin'+WinNum, 'width=800,height=550,resizable=yes,scrollbars=yes');
	}
 //------------------------------------------------------------------------------
	function ShowPhotoAlbum(PhotoGalleryID, cPhotoGalleryID) {
		var PhotoGallery = window.open('photo-album-detail.asp?PhotoAlbumID=' + PhotoGalleryID + "&C=" + cPhotoGalleryID, 'PhotoGalleryWin', 'width=800,height=600,scrollbars=yes,resizable=yes')
		PhotoGallery.focus();
	}
 //------------------------------------------------------------------------------
	function JuniorLeague() {
		alert("You are being taken to the website of the MWDJRL\nThe MWDJRL website is not maintained by the Manly Sea Eagles");
		var JuniorLeagueWin = window.open('http://www.manlyseaeagles.com.au/ad.asp?t=2', 'JuniorLeagueWin' , '');
	}
 //------------------------------------------------------------------------------
	function openLiveScore() {
		newwin = window.open("livescores.asp","LiveScoresWin","width=798,height=750,resizable=yes")
	}
 //------------------------------------------------------------------------------
	function validateRadio(RadioName) {
		var voteCheck = -1;
		for (n=0; n < RadioName.length; n++) {
			if (RadioName[n].checked) {
				voteCheck = n;
				// this bit if you want to use that value
				// v = n + 1;
				// if(v == 1){document.form1.Vote1.value++}  // this is a hidden field in the form

			}
		}
		if (voteCheck == -1) {
			return false;
		}
		return true;
	}

 //------------------------------------------------------------------------------
 	function confirmPermanentLogin(ScriptName){
		if(confirm("By clicking OK you will remain logged in permanently")){
			document.location.href = "member-login-permanent-post.asp?tx=35&page=" + ScriptName;
		}
	}
// ----------------------------------------------------------------------

	function ClearDate(DateD,DateM,DateY){
		DateD.options[0].selected = true;
		DateM.options[0].selected = true;
		DateY.options[0].selected = true;
	}

  // ----------------------------------------------------------------------

	function validateEmail(email) {
		invalidChars = " /:,;"

		for (i=0; i<invalidChars.length; i++) {// does it contain any invalid characters?
			badChar = invalidChars.charAt(i)
			if (email.indexOf(badChar,0) > -1) {
				return false
			}
		}
		atPos = email.indexOf("@",1)  // there must be one "@" symbol
		if (atPos == -1) {
			return false
		}
		if (email.indexOf("@",atPos+1) != -1) {  // and only one "@" symbol
			return false
		}
		periodPos = email.indexOf(".",atPos)
		if (periodPos == -1) {  // and at least one "." after the "@"
			return false
		}
		if (periodPos+3 > email.length) {  // must be at least 2 characters after the "."
			return false
		}
		return true;
	}

 // ----------------------------------------------------------------------

	function CheckDate(DateD,DateM,DateY) { 
		var ARNormalYear = new Array(31,28,31,30,31,30,31,31,30,31,30,31)
		var ARLeapYear = new Array(31,29,31,30,31,30,31,31,30,31,30,31)
		if(DateY%4 == 0) { 
			if(DateD > ARLeapYear[DateM-1]) { return false;	} 
		} else {
			if(DateD > ARNormalYear[DateM-1]) { return false; } 
		}
		return true;
	}
 // ----------------------------------------------------------------------	
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
	
//-->	