
/*	
	======================================================================

	javascript/misc.php

	======================================================================
	Copyright 2008 S.A.G.E. Designs NWpe
	======================================================================
*/


	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  IgnoreKeys
	//
	/////////////////////////////////////////////////////////
	
		function IgnoreKeys (event, restrictions) {
		
			var charCode = event.charCode ? 
			               event.charCode :
			              (event.which    ? 
			               event.which    : 
			               event.keyCode) ;
								 
			// allow tab key
			
			if (charCode == 9) {
				
				return true;
			}
			
			// return false if return/enter key
			
			if (charCode == 13 || charCode == 3 || charCode == 0) {
				
				return false;
			}
			
			// handle digits restriction
			
			if (restrictions == 'digits') {

				if (charCode < 48 || charCode > 57) {
				
					alert ("Please enter digits only in this field");
				
					return false;
				}
			}
			
			// handle phone number restriction
			
			if (restrictions == 'phoneNumber') {

				if ((charCode != 45) && (charCode < 48 || charCode > 57)) {
				
					alert ("Please enter digits or a hyphen (-) only in this field");
				
					return false;
				}
			}

			return true;
		}


		

	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  HideDiv
	//
	/////////////////////////////////////////////////////////
	
		function HideDiv (id) {
		
			if (document.getElementById) { // DOM3 = IE5, NS6
		
				document.getElementById(id).style.display = 'none';
			}
		
			else {
		
				if (document.layers) { // Netscape 4
				
					document.id.display = 'none';
				}
				
				else { // IE 4
				
					document.all.id.style.display = 'none';
				}
			}
			
			return true;
		}


	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  ShowDiv
	//
	/////////////////////////////////////////////////////////
	
		function ShowDiv (id) {

			if (document.getElementById) { // DOM3 = IE5, NS6
		
				document.getElementById(id).style.display = 'block';
			}
		
			else {
		
				if (document.layers) { // Netscape 4
		
					document.id.display = 'block';
				}
		
				else { // IE 4
		
					document.all.id.style.display = 'block';
				}
			}
			
			return true;
		}
		