
<!--
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;
			MM_preloadImages(a[i+2]);
			x.src = a[i+2];
		}
	}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function updatefield(srcnm, targetnm) {
	var	src = MM_findObj(srcnm);
	var	target = MM_findObj(targetnm);
	
	target.selectedIndex = src.selectedIndex;
}

function startTime()
{
var today=new Date()
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
document.getElementById('txt').innerHTML=h+":"+m+":"+s
t=setTimeout('startTime()',500)
}

function checkTime(i)
{
if (i<10) 
  {i="0" + i}
  return i
}

function submitForm(formname) {
	var the_form = MM_findObj(formname);
	the_form.submit();	
}
function submitDetailsForm(formname) {
	var the_form = MM_findObj(formname);
	var fee = MM_findObj("fee");
	var radio_choice = false;
	if (fee.checked)
	    radio_choice = true;
	for (counter = 0; counter < fee.length; counter++)
    {
        // If a radio button has been selected it will return true
        // (If not it will return false)
        if (fee[counter].checked)
            radio_choice = true; 
    }
    if (radio_choice == true)
        the_form.submit();	
    else
        alert ("Please choose appropriate payment.");
}
function getName()
{
eventname = MM_findObj("name");
return eventname.value;    
}

function resetForm(formname) {
	var the_form = MM_findObj(formname);
	the_form.reset();	
}

function hideSelects() {
    MM_showHideLayers('hide1','','hide','hide2','','hide','hide3','','hide')  
}
function showSelects() {
    MM_showHideLayers('hide1','','show','hide2','','show','hide3','','show');  
}


function updateClubForm(URL) {
	
	var state = MM_findObj('state');
	var category = MM_findObj('category');
	URL = URL + '&state=' + state.value + '&category=' + category.value;
	location.href = URL;
}

var stage = 1;
function verifyuser(formname) {
	var email = MM_findObj("email");
	var emailalt = MM_findObj("emailalt");
	var password = MM_findObj("password");
	var suburb = MM_findObj("suburb");
	var password1 = MM_findObj("password1");
	var state = MM_findObj("state");
	var dob = MM_findObj("dob");
	var output = "";
	if ((email.value == emailalt.value) && (state.selected != 0) && (suburb.value.length > 0 ) && (password.value.length >= 6) && (password.value == password1.value) && (password.value != "") && isDate(dob.value)) 
	{
		if (stage == 2) submitForm(formname);
		if (stage == 1) 
		{
			output = "Your details look in order. Please take a moment to review your details and then submit.";
			stage++;
		}
	}
	if (email.value != emailalt.value)
	{
		output = "Your email address entries do not match.\n";
		stage = 1;
	}
	if (!isDate(dob.value))
	{
		output += "Your date of birth is not a valid date.\n";
		stage = 1;
	}
	
	if (password.value != password1.value)
	{
		output += "Your password entries do not match.\n";
		stage = 1;
	}
	
	if (state.selected == 0)
	{
		output += "You must choose a state.\n";
		stage = 1;
	}
	
	if (suburb.value == "")
	{
		output += "Your suburb must not be empty.\n";
		stage = 1;
	}
	if (password.value == "")
	{
		output += "Your password must not be empty.\n";
		stage = 1;
	}
	if (password.value.length < 6)
	{
		output += "Your password must be at least 6 characters.\n";
		stage = 1;
	}
	
	if (stage == 1) output += "Please take a moment to review your detail and then resubmit.";
	if (output > "") alert (output);
	
}

function checkfilename()
{
var file = MM_findObj("excel_file");
file_array = file.value.split(".");
ext = file_array[file_array.length-1];
return ext;
}

function verifyedituser(formname) {
	var email = MM_findObj("email");
	var emailalt = MM_findObj("emailalt");
	var password = MM_findObj("password");
	var password1 = MM_findObj("password1");
	var dob = MM_findObj("dob");
	var output = "";
	if ((email.value == emailalt.value) && (password.value.length >= 6 || password.value.length == 0) && (password.value == password1.value) && isDate(dob.value)) 
	{
		if (stage == 2) submitForm(formname);
		if (stage == 1) 
		{
			output = "Your details look in order. Please take a moment to review your details and then submit.";
			stage++;
		}
	}
	if (email.value != emailalt.value)
	{
		output = "Your email address entries do not match.\n";
		stage = 1;
	}
	if (!isDate(dob.value))
	{
		output += "Your date of birth is not a valid date.\n";
		stage = 1;
	}
	
	if (password.value != password1.value)
	{
		output += "Your password entries do not match.\n";
		stage = 1;
	}
	if ((password.value.length < 6) && (password.value.length > 0))
	{
		output += "Your password must be at least 6 characters.\n";
		stage = 1;
	}
	
	if (stage == 1) output += "Please take a moment to review your detail and then resubmit.";
	if (output > "") alert (output);
	
}

function emailCheck (field) {

    return field.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);    
}


function verifyofflineuser(formname) {
	var email = MM_findObj("email");
	var dob = MM_findObj("dob");
	var firstname = MM_findObj("firstname");
	var lastname = MM_findObj("lastname");
	var fee = MM_findObj("fee");
	var output = "";
	found = 0;
		
	for (i=0;i<fee.length;i++)
	{
		if (fee[i].checked) {
			found = 1;	}
			
	}
	if (firstname.value != "" && lastname.value != "" && found == 1 && email.value != "" && isDate(dob.value)) 
	{
		if (stage == 2) submitForm(formname);
		if (stage == 1) 
		{
			output = "Your details look in order. Please take a moment to review your details and then submit.";
			stage++;
		}
	}
	if (firstname.value == "")
	{
		output += "You must enter a first name.\n";
		stage = 1;
	}
	if (lastname.value == "")
	{
		output += "You must enter a surname.\n";
		stage = 1;
	}
	if (email.value == "")
	{
		output += "You must enter an email address.\n";
		stage = 1;
	}
	if (!isDate(dob.value))
	{
		output += "Your date of birth is not a valid date.\n";
		stage = 1;
	}

	if (found == 0) {
		output += "You must choose a payment option.\n";
		stage = 1;
	}
	
	
	
	if (stage == 1) output += "Please take a moment to review your detail and then resubmit.";
	if (output > "") alert (output);
	
}

function verifyentity(formname) {
	var evname = MM_findObj("name");
	var category = MM_findObj("category");
	var state = MM_findObj("state");
	var suburb = MM_findObj("suburb");
	var allowonline = MM_findObj("allowonline");
	var output = "";
/*	if ((evname.value != "") && category.selectedIndex >= 1 && state.selectedIndex > 0 && (allowonline[0] || allowonline[1])) 
	{
		if (stage == 2) submitForm(formname);
		if (stage == 1) 
		{
			output = "Your details look in order. Please take a moment to review your details and then submit.";
			stage++;
		}
	} */
	if (evname.value == "")
	{
		output = "You must enter a name.\n";
		stage = 1;
	}
	
	if (category.selectedIndex < 1)
	{
		output += "You must select a category.\n";
		stage = 1;
	}
	if (suburb.value == "")
	{
		output += "You must enter a suburb.\n";
		stage = 1;
	}
	if (state.selectedIndex < 1)
	{
		output += "You must select a state.\n";
		stage = 1;
	}
	
	if (!allowonline[0].checked && !allowonline[1].checked)
	{
		output += "You must choose whether to accept online registrations or not.\n";
		stage = 1;
	}
	
	if (stage == 1) output; //+= "Please take a moment to review your detail and then resubmit.";
	if (output > "") 
	{
		alert (output);
		return 0;
	}
	else
	{
		return 1;
	}
	
	
	
}


function verifyTC () {
	online = MM_findObj("allowonline");
	if (verifyentity('registration'))
	{
		if (online[1].checked) {
			submitForm('registration');
		}
		else {
		    window.open('agreement.php','', 'width=780,height=380,scrollbars=yes,status=yes');
		}
	}	
}

function verifyCont () {
	online = MM_findObj("terms");
	eventid = MM_findObj("eventid");
	fee = MM_findObj("fee");
	feeSelected = 0;
    for (i=0;i<fee.length;i++) {
        if (fee[i].checked) {
            feeSelected = 1;
            }
        }
    if (feeSelected) {
    	if (online.value == 0) {
    		submitDetailsForm('register');
    	}
    	else {
    	    window.open('conditions.php?eventid='+eventid.value,'', 'width=780,height=380,scrollbars=yes,status=yes,resizable=yes');
    	}
	}
	else {
	    alert("You must select a fee option to register for this event.");    
	}
	
}

function verifyentity2(formname) {
	var bsb = MM_findObj("bsb");
	var accountnum = MM_findObj("accno");
	var accountname = MM_findObj("accname");
	var feechoice = MM_findObj("payment");
	var output = "";
	if (bsb.value != "" && accountnum.value != "" && accountname.value != "" && (feechoice[0].checked || feechoice[1].checked || feechoice[2].checked)) 
	{
		if (stage == 2) submitForm(formname);
		if (stage == 1) 
		{
			output = "Your details look in order. Please take a moment to review your details and then submit.";
			stage++;
		}
	} 
	if (bsb.value == "")
	{
		output += "You must enter a BSB number.\n";
		stage = 1;
	}
	if (accountnum.value == "")
	{
		output += "You must enter an account number.\n";
		stage = 1;
	}
	if (accountname.value == "")
	{
		output += "You must enter an account name.\n";
		stage = 1;
	}
	
	if (!feechoice[0].checked && !feechoice[1].checked && !feechoice[2].checked)
	{
		output += "You must choose a method for collecting sportsone fees.\n";
		stage = 1;
	}
	
	if (stage == 1) output += "Please take a moment to review your detail and then resubmit.";
	if (output > "") alert (output);
		
	
	
}


function verifyentityreview(formname) {
	var evname = MM_findObj("name");
	var category = MM_findObj("category");
	var state = MM_findObj("state");
	var suburb = MM_findObj("suburb");
	var bsb = MM_findObj("bsb");
	var accountnum = MM_findObj("accno");
	var accountname = MM_findObj("accname");
	var feechoice = MM_findObj("payment");
	var output = "";
    if (bsb == null) {
    	if (evname.value != "" && category.selectedIndex >= 1 && state.selectedIndex > 0 ) 
    	{
    		if (stage == 2) submitForm(formname);
    		if (stage == 1) 
    		{
    			output = "Your details look in order. Please take a moment to review your details and then submit.";
    			stage++;
    		}
    	} 
    }
    else {
       if (evname.value != "" && category.selectedIndex >= 1 && state.selectedIndex > 0 && bsb.value != "" && accountnum.value != "" && accountname.value != "" && (feechoice[0].checked || feechoice[1].checked || feechoice[2].checked)) 
    	{
    		if (stage == 2) submitForm(formname);
    		if (stage == 1) 
    		{
    			output = "Your details look in order. Please take a moment to review your details and then submit.";
    			stage++;
    		}
    	}  
    }
    
	if (evname.value == "")
	{
		output = "You must enter a name.\n";
		stage = 1;
	}
	
	if (category.selectedIndex < 1)
	{
		output += "You must select a category.\n";
		stage = 1;
	}
	if (suburb.value == "")
	{
		output = "You must enter a suburb.\n";
		stage = 1;
	}
	if (state.selectedIndex < 1)
	{
		output += "You must select a state.\n";
		stage = 1;
	}
	
	if (bsb != null) {
    	if (bsb.value == "")
    	{
    		output += "You must enter a BSB number.\n";
    		stage = 1;
    	}
    	if (accountnum.value == "")
    	{
    		output += "You must enter an account number.\n";
    		stage = 1;
    	}
    	if (accountname.value == "")
    	{
    		output += "You must enter an account name.\n";
    		stage = 1;
    	}
    	
    	if (!feechoice[0].checked && !feechoice[1].checked && !feechoice[2].checked)
    	{
    		output += "You must choose a method for collecting sportsone fees.\n";
    		stage = 1;
    	}
    }
    
	
	if (stage == 1) output += "Please take a moment to review your detail and then resubmit.";
	if (output > "") alert (output);
		
	
	
}



function verifyagreement() 
{
    age = MM_findObj("ageselect");
    agree = MM_findObj("agreeselect");

    if (age.checked == true && agree.checked == true)
    {
        window.opener.submitForm('registration');
        window.close();
    }
 
}

function verifyconditions() 
{
    agree = MM_findObj("agreeselect");

    if (agree.checked == true)
    {
        window.opener.submitForm('register');
        window.close();
    }
 
}

var buttonhit;
buttonhit = 0;
function hitonce(){

  var item;
  var comment;
  var blob = "The following errors were encounted:\n\n";
  var pass = true;
  var cardname = MM_findObj("card_name");
  var cardnum = MM_findObj("cardnum");
  var card_type = MM_findObj("card_type");
  var cardcvn = MM_findObj("card_cvn");
  var ccform = MM_findObj("cc");
  cnum = cardnum.value;
  if(!buttonhit)
  {
  	if(cardname.value.length == 0)
  	{
		blob = blob + "Credit Card Name field MUST be entered.\n";
		pass = false;
	}
	  
	if (card_type.value != "Bankcard") {
	 
		if(cardcvn.value.length == 0){
		blob = blob + "Card Validation Number (CVN) field MUST be entered.\n";
		pass = false;
		}
		checkcard = CheckCardNumber(ccform);
		if (checkcard.length>0) 
		{
			pass = false;
		  	blob = blob + checkcard;
		}  	  
	  	if (!pass){
	  		alert(blob);
			return(0);
		}
	}

	buttonhit = 1;
	exit = false;
	ccform.submit();

  }
}


// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 4500;
// Duration of crossfade (seconds)
var crossFadeDuration = 5;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/slide/frontpage1.jpg'
Pic[1] = 'images/slide/frontpage2.jpg'
Pic[2] = 'images/slide/frontpage3.jpg'
Pic[3] = 'images/slide/frontpage4.jpg'
Pic[4] = 'images/slide/frontpage5.jpg'
Pic[5] = 'images/slide/frontpage6.jpg'

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;



var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed);
}

function submitActivitySearch(formname)
{
    field1 = MM_findObj('category');
    field2 = MM_findObj('state');
    if ((field1.selectedIndex != 0) && (field2.selectedIndex != 0))
        submitForm(formname);
    else
        alert("Please select from each of the search criteria.");
}
function submitClubSearch(formname)
{
    field1 = MM_findObj('category');
    field2 = MM_findObj('state');
    field3 = MM_findObj('suburb');
    if ((field1.selectedIndex != 0) && (field2.selectedIndex != 0))
        submitForm(formname);
    else
        alert("Please select from each of the search criteria.");
}
function submitEventSearch(formname)
{
    field1 = MM_findObj('category');
    field2 = MM_findObj('state');
    field3 = MM_findObj('month');
    if ((field1.selectedIndex != 0) && (field2.selectedIndex != 0) && (field3.selectedIndex != 0))
        submitForm(formname);
    else
        alert("Please select from each of the search criteria.");
}

 -->