// ------------------------------------------------------------------------------
// AUSSI Portal Copyright (C) 2004-2010 by Frank Braun, frankbraun@optusnet.com.au
// 
// This file is part of AUSSI Portal.
// 
// AUSSI Portal is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as 
// published by the Free Software Foundation. 
// 
// AUSSI Portal is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with AUSSI Portal; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
// 
// http://www.gnu.org/licenses/gpl.txt
//
// ------------------------------------------------------------------------------

function validateCodes() 
{
	ac  = document.downloadForm.accessCode.value;
	cc  = document.downloadForm.clubCode.value;
	key = document.downloadForm.key.value;
	
	if ( ac=="" ) 
	{
		alert("Please enter the access code!");
		document.downloadForm.accessCode.focus();
		return false;
	}

	if ( cc=="" ) 
	{
		alert("Please enter a valid club code!");
		document.downloadForm.clubCode.focus();
		return false;
	}
	else if ( cc.length == 2 ) 
	{
    	switch ( cc ) 
    	{
    		case "NT":
    			break;
    		case "SA":
    			break;
    		case "WA":
    			break;
    		default:
        		alert("Please enter a valid club code!");
        		document.downloadForm.clubCode.focus();
    			return false;
        }
	}
	else if ( cc.length != 3 ) 
	{
		alert("Please enter a valid club code!");
		document.downloadForm.clubCode.focus();
		return false;
	}

    document.downloadForm.clubCode.value = cc.toUpperCase();

	if ( key=="" ) 
	{
		alert("Please enter the Image Key!");
		document.downloadForm.key.focus();
		return false;
	}


	return true;
}


