// JavaScript Document

function cNum(e) {                        

		if(e){ // if the event object is present (NN only)
			e = e // var e = event
		} else {
			e = window.event // else e = winddow.event for IE
		}

		if(e.which){ // if there is syntax support for the property 'which' (NN only)
			var keycode = e.which // e.which is stored in variable "keycode"
		} else {
			var keycode = e.keyCode // otherwise for IE, var keycode stores e.keyCode syntax
		}
		

		// keycodes
		// backspace : 8
		// tab : 9
		// del : 46
		// left arrow : 37
		// right arrow : 39
		if((keycode!=8 )&&(keycode!=9)&&(keycode!=46)&&(keycode!=39)&&(keycode!=37)){ 
		 	var strCheck = '0123456789.';
			var whichCode = (window.Event) ? e.which : e.keyCode;
			key = String.fromCharCode(whichCode);  // Get key value from key code
			if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
		}
			
}

// put this in the input box: onkeypress="return(cNum(event));"



	function confirmDelete(id, name, field){
		if(confirm("Are you sure you want to delete "+name+" ?")){
			
			
			document.getElementById(field).value=id;
			
			document.deleteForm.submit();
		}
	}
	
	
	function alertObj(obj){
		var x = obj;
		 t = "";
	
		 c = 0;
		for (a in x) {
			c = c+1;
			t += (a + ":" + x[a] + "  ,  ");
			if (c >= 5) {
				c = 0;
				alert(t);
				t = "";
			}
		}
		alert(t);
	}


	function updateField(fieldName, fieldValue){
			
			document.getElementById(fieldName).value = fieldValue;
		
	}
	
	
	function resetIt(theForm){

			for(i=0; i < theForm.length; i++){
						
				if(theForm[i].type != "hidden" && theForm[i].type != "button"){
					theForm[i].value="";
				}
			}
	}
	
	
	function countit( field ){
			var formcontent=document.getElementById(field).value;
		formcontent=formcontent.split(" ");
		
		return formcontent.length;
		
	}
	


