﻿	/**
	* Cross-Browser compatible way to retrieve an HTML element by id.
	* 
	* Get rid of all those doucment.getlElementById statments with this function
	* and without putting redundant if statment all through your code.
	*  How to use:
	*	1. Call this method/function, replacing p_idString with an HTML elements id.
	*	2. Checks to make sure the string is not null and that the element exist
	*		ex: getObject("debugWindow");
	* 	3. Also works to test for objects, just pass the object,  if NOT will return false, otherwise the object itself is returned.
	* @param string p_idString id of an html element
	* @return DOM object
	*
	* @author Khalifah Shabazz
	**/
	function GetObject(p_idString)
	{
		var htmlObj = null;
		
		if (p_idString == null) return false;
		// else if an object is passed, then use that, 
		if (typeof p_element == "object") return p_idString;
		// else
		if (document.getElementById)
			htmlObj = document.getElementById(p_idString);
		else if (document.all)
			htmlObj = document.all[p_idString];
		else if (document.layers)
			htmlObj = document.layers[p_idString];

		if (htmlObj) return htmlObj;
		
		return false;
	}
	
	
	function isValidEmail(_email)
	{
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	
		if (filter.test(_email)) { return true; } else { return false; }
	}


	function jsWindow(URL, xWidth, yHeight)
	{
		day = new Date();
		id = day.getTime();
		
		window.open(URL, id, "width=" + xWidth + ", height=" + yHeight + ", resizable=false, scrollbars=yes, toolbar=no, location=false, status=no, menubar=no");
	}
