	function show_msg(num){
		switch (num) {
			case 1: msg = 'Login Error - Please Retry'; break;
			case 2: msg = 'Please enter a Username and a Password'; break;
			case 3: msg = 'LOGIN SUCCESSUL'; break;
			default: msg = 'error'; break;
		}
		
		alert(msg);
	};
	
	function confirm_cancel(path){
		var confirming = confirm("Are you sure you wish to cancel?");
		if(confirming==true){
			window.location = path;	
		}
	
	};
	
	function confirm_delete(record,path){
		var confirming = confirm("Are you sure you wish to delete the following record:\n\n     "+record+"\n   ");
		if(confirming==true){
			window.location = path;
		}
	};
	
	function confirm_multi_delete(){
		var confirming = confirm("Are you sure you wish to delete these items?");	
		if(confirming==true){
			return true;
		} else return false;
	};
	
	function confirm_changes(){
		var confirming = confirm("Are you sure you wish to make these changes?");	
		if(confirming==true){
			return true;
		} else return false;
	};

	function validate_form(form_name){
		
		switch(form_name){
			case "fixtures": 
				if(document.form1.fixOpposition.value==""){ alert("No [Opposition] entered"); return false; }
				if(document.form1.fixTeam.selectedIndex == 0){ alert("[Team] not selected"); return false; }
				if(document.form1.fixD.selectedIndex == 0){ alert("[Day] not selected"); return false; }
				if(document.form1.fixM.selectedIndex == 0){ alert("[Month] not selected"); return false; }
				if(document.form1.fixY.selectedIndex == 0){ alert("[Year] not selected"); return false; }
				if(document.form1.fixH.selectedIndex == 0){ alert("[Hour] not selected"); return false; }
				if(document.form1.fixI.selectedIndex == 0){ alert("[Minutes] not selected"); return false; }
				if(document.form1.fixCompetition.selectedIndex == 0){ alert("[Competition] not selected"); return false; }
				if(document.form1.fixVenue.selectedIndex == 0){ alert("[Venue] not selected"); return false; }
			break;
			case "news":
				if(document.form1.newsHeadline.value==""){ alert("No [Headline] entered"); return false; }
			break;
			case "images":
				if((document.form1.newImgCat.value=="")&&(document.form1.imgCategory.selectedIndex==0)){ alert("No [Category] declared"); return false; }
			break;
			case "pages":
				if(document.form1.newsHeadline.value==""){ alert("No [Page Title] entered"); return false; }
			break;
			case "change_password":
				if(document.form1.currentpassword.value==""){ alert("No [Current Password] entered"); return false; }
				if(document.form1.newpassword.value==""){ alert("No [New Password] entered"); return false; }
				if(document.form1.confirmpassword.value==""){ alert("No [Confirm Password] entered"); return false; }
				if(document.form1.newpassword.value!=document.form1.confirmpassword.value){ alert("[New Password] & [Confirm Password] do not not match"); return false; }
			break;	
			default: alert("NO/INCORRECT FORM SPECIFIED"); return false; break;
		}
		return true;
	};
	
	function checkAll(){
		var checks = document.getElementsByName('delItem[]');
		var boxLength = checks.length;
		
		if(document.getElementById('checkCheck').checked==false){
			newstatus = false;
		} else {
			newstatus = true;
		}
		
		for ( i=0; i < boxLength; i++ ) {
        	checks[i].checked = newstatus;
		}
      };
	  
	  function updateChecked(){
	  var checks = document.getElementsByName("delItem[]");
		var boxLength = checks.length;
		var totalChecked = 0;
		for(i=0; i < boxLength; i++){
			if(checks[i].checked==true){
				totalChecked++;
			}
		} 
		
		if(totalChecked>0){
			document.getElementById('deleteSelected').disabled=false;
			document.getElementById('deleteSelected').value= "Delete "+totalChecked+" Items";
		} else {
			document.getElementById('deleteSelected').disabled=true;
			document.getElementById('deleteSelected').value= "Delete Selected";
		}
	  };
	  
	function toggleLayer(layerName){
		if(document.getElementById(layerName).style.visibility=="hidden"){
			document.getElementById(layerName).style.visibility="visible";
			document.getElementById(layerName).style.display="block";
			document.getElementById(layerName+'Icon').src="media/icon-collapse.gif";
		} else if(document.getElementById(layerName).style.visibility=="visible"){
			document.getElementById(layerName).style.visibility="hidden";
			document.getElementById(layerName).style.display="none";
			document.getElementById(layerName+'Icon').src="media/icon-expand.gif";
		}
	};
	
	function limitText(limitField, limitCount, limitNum) {
		if (limitField.value.length > limitNum) {
			limitField.value = limitField.value.substring(0, limitNum);
		} else {
			limitCount.value = limitNum - limitField.value.length;
		}
	};
	
	function load_window(url){
		window.open(url,'','height=350,width=280,top=250,left=250');	
	}