	function clearInuput(obj,compare) {
		if(obj.value == compare) {
			obj.value = '';
		}
	}
	
	
	function numbersonly(data){
		val = data.replace(/[^0-9.]/g,"")
		if(!val)return 0;
		else return val;
	}
	
	// use conf to auto confirm the deletion
	function filterWords(data, conf){
		val = data.replace(/[^a-zA-Z0-9.]/g,"");
		if(!val) {
			return 0;
		}else if(val != data) {
			if(conf) {
				if(confirm('We have removed all non-alphanumeric characters from your password. (ex: #$!@ and spaces are not valid)\nPress OK to submit this password\nPress CANCEL to reenter your password')) {
					return val;
				}else {
					return 0;
				}
			}else {
				return val;
			}
		}else {
			return data;
		}
	}
	
	function valideml(obj){
		if(obj != '[object]' && obj != ['object HTMLInputElement']) {
			obj = document.getElementById(obj);
		}
		if(obj.value){
	
			var email = new String(obj.value);
			var check1 = email.indexOf("@"); 	/* Check for an @ symbol*/
			var check2 = email.lastIndexOf("."); 	/* Check for a period   */
			var check3 = email.indexOf(" "); 	/* Check for spaces	*/
	
			if((check1 <= 0) || (check2 < 0)|| 		/* No @ or period */
			  (check1 > check2)||((check2-1)==check1)||	/* Make sure @ is after period, but not immediatly after*/
			  (email.substring(check1+1).indexOf("@")>-1)||	/* No spaces, no multiple @'s */
			  ((email.length-1)-check2<2) || (check3>-1)){			/* After period is 2 letters or more */
				return 0;
			}
			return 1;
		}else{return -1;}
	}
	
	
	function recheck(msg,obj,mode){

		if(obj != '[object]' && obj != '[object HTMLInputElement]') {
			obj = getEl(obj);
		}
		
		if(msg)alert(msg);
		obj.focus();
		return false;
	}
	
	
	/* send in an id of type button or href to disable submittions, 
	*
	*/
	function sendANDdisable(id,type,frm) {
		
		targ = getEl(id);
		
		switch(type) {
			case 'href': // experminetal, i cant reattch the original onclick
				var oc = targ.onClick;

				targ.onclick=function(){
					alert('Please wait while the page loads');
				}
				setTimeout("getEl('" + id + "').onclick=" + oc,2000);				
				break;
			case 'button':
				targ.disabled=true;
				targ.value='Please wait...';
				setTimeout("targ.disabled=false",2000);
				break;
		}
			
		
		if(frm) {
			getEl(frm).submit();
		}
	}
	
	
	function round2(str){
		return Math.round(str * 100) / 100;
	}
	
	function printNotice(id) {
		tempId = 'frm_' + id;
		var heading = new String(document.getElementById(tempId).innerHTML);
		var img1 = 'form_alert';
		var img2 = 'form_alert_red';
		var check1 = heading.indexOf(img1); 	/* Check for the img already printed=*/
		var check2 = heading.indexOf(img2); 	/* Check for the red img already printed=*/
		
		if(check1 <= 0 && check2 <= 0) {
			document.getElementById(tempId).innerHTML += ' <img src="images/form_alert.gif">';
		}else if(check1 > 0 && check2 <= 0) {
			heading = heading.replace(img1, img2);
			document.getElementById(tempId).innerHTML = heading;
		}
	}
	function checkLogin(frm, mode) {
		if(!frm.uname.value)		return recheck('Please enter a username.',frm.uname, 'uname');
		if(!valideml(frm.uname)) return recheck('Please enter a valid username (Email Address Format).',frm.uname, 'uname');
		if(!frm.pword.value)		return recheck('Please enter a valid password.',frm.pword, 'pword');
		frm.password.value = hex_md5(frm.pword.value);
		frm.pword.value = '';
		if(mode == 'submit') {
			return frm.submit();
		}else {
			return true;
		}
	}