/* Desc: This javascript file will have global functions to help our website */

/*
	Date:   2009 01 16
	Desc:   This function will Trim the string
	Param:  _strVal - the value to format
	Pre:    Parameter(s) must be a valid string
	Return: The string passed in will be returned with no extra blank spaces on the left and right
*/	
function Trim( _strVal ) {
	return _strVal.replace( /^\s+|\s+$/g, "" );
}	// Trim

/*
	Date:   2009 01 16
	Desc:   This function will check if the field is empty
	Param:  _strVal - the value to check
	Pre:    Parameter(s) must be a valid string	
	Return: true - strnig is empty, false - otherwise
*/
function CheckEmpty( _strVal )
{
	return ( Trim( _strVal ).length == 0 ) ? true : false;
}	// CheckEmpty

/*
 	Date:   2009 01 16
    Desc:   Checks for valid Emails
    Param:  _strVal - value to check
    Pre:    Parameter(s) must be valid strings
    Return: true - valid email, false - otherwise
*/
function ValidateEmail( _strVal )
{
    var m_regExp = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
    
    return TestRegExp( _strVal, m_regExp );
} // ValidateEmail

/*
    Date:   2009 01 16
    Desc:   Tests the string using a reg exp
    Param:  _strVal - value to check
            _regExp - regular expression
    Pre:    Parameter(s) must be valid strings
    Return: true - string passed regular expression, false - otherwise
*/
function TestRegExp( _strVal, _regExp )
{
    return _regExp.test( _strVal );
} // TestRegExp

/*
    Date:   2009 01 16
    Desc:   Returns the browser
    Param:  N/A
    Return: browser name
*/
function detectBrowser()
{
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	
	return browser;
}


/*
	Date: 2009 02 01
	Desc: This object will store the section information
	Param: 	_strName - name of the section
			_strContent - content of the section
*/
function objSection( _strName, _strContent )
{
	this.sectionName = _strName;
	this.sectionContent = _strContent;
} // objSection
