
	function recheck(msg,obj,id){
		if(msg) {alert(msg);}
		if(msg && id) {printNotice(id);}
		document.getElementById(id).focus();
		//if(!document.layers)try{obj.select();}catch(e){ }
		return false;
	}
	function recheck2(msg,obj,id){
		if(msg) {alert(msg);}
		if(msg && id) {printNotice2(id);}
		document.getElementById(id).focus();
		return false;
	}
	function numbersonly(data){
		val = data.replace(/[^0-9.]/g,"")
		if(!val)return 0;
		else return val;
	}
	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 printNotice2(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 true;
		}else {
			frm.submit();
		}
	}