	/***************************************************************************
	*     Author         :  PHP Dev Team, iFactor Solutions, India
	*     Programmer     :  NELLS.K.S
	*     Script Name    :  /include/common.js
	*     Created On     :  2004-10-02
	*     Last Modified  :  2004-10-02
	*     Description    :  All Javascript functions were written here.
	****************************************************************************/
	
	//	Gets date from popup calendar
	function get_date(frm, elem) {
		document.forms[frm].elements[elem].value = "";
		gfPop.fStartPop(document.forms[frm].elements[elem],Date);
		return false;
	}
	
	//	Checks whether value is whitespace or nor
	function isWhiteSpace(val) {
		var len = val.length;
		var blank = true;
		
		if (len != 0)
			for (i = 0; i < len; i++)
				blank = ( (val[i] == ' ') || (val[i] == '\t') || (val[i] == '\n') || (val[i] == '\r') ) ? blank: false;
		
		return blank;
	}
	
	//	Checks for Valid e-mail
	function isEmail(addr) {
		return /^([\w\-]+(?:\.[\w\-]+)*)@([\w\-]+(?:\.[\w\-]+)*\.[\w\-]{2,4})$/.test(addr);
	}
	
	//	Sets all slaves according to master
	function setCheckBoxes(master, slave) {
		var len = slave.length;
		if (len == undefined)
			slave.checked = master.checked;
		else
			for (i = 0; i < len; i++)
				slave[i].checked = master.checked;
		
	}
	
	//	Checks whether there is any files selected to upload
	function checkFile(ref) {
		var len = ref.length;
		var files = 0;
		if (len == undefined)
			files += !isWhiteSpace(ref.value);
		else
			for (fl = 0; fl < len; fl++) {
				files += !isWhiteSpace(ref[fl].value);
			}
		
		return files > 0;
	}
	
	//	Makes a Popup
	function popup(url, wname, w, h, x, y) {
		var win = window.open(url, wname, "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbar=0, resizable=0, copyhistory=0, width=" + w + ", height=" + h + ", left=" + x + ", top=" + y + ", screenX=" + x + ", screenY=" + y);
		win.focus();
	}
	
	//	Makes a Popup with a URI
	function popupURI(url, wname, w, h, x, y, args, argv) {
		var len = args.length;
		for (i = 0; i < len; i++)
			url += "&" + args[i] + "=" + argv[i];
		var win = window.open(url, wname, "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbar=0, resizable=0, copyhistory=0, width=" + w + ", height=" + h + ", left=" + x + ", top=" + y + ", screenX=" + x + ", screenY=" + y);
		win.focus();
	}
	
