var xmlhttp ;
var ROL_Success = 1 ;
var ROL_Error = 0 ;

function f_validateEmail(p_StrValue)
{
	var objRegExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
	//check for valid email
	return objRegExp.test(p_StrValue);
}

function f_validateNotEmpty(p_StrValue)
{
	var strTemp = p_StrValue;
	strTemp = f_trimAll(strTemp);
	if ( strTemp.length > 0 )
	{
		return true;
	}
	return false;
}

function f_trimAll(p_StrValue)
{
	var objRegExp = /^(\s*)$/;

	//check for all spaces
	if(objRegExp.test(p_StrValue))
	{
		p_StrValue = p_StrValue.replace(objRegExp, '');
		if ( p_StrValue.length == 0 )
			return p_StrValue;
	}

	//check for leading & trailing spaces
	objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	if ( objRegExp.test(p_StrValue) )
	{
		//remove leading and trailing whitespace characters
		p_StrValue = p_StrValue.replace(objRegExp, '$2');
	}
	return p_StrValue;
}

function f_getConfig(configId)
{
	// set the values of global configuration variables
	ROL_ConfigId = configId ;
	ROL_ID = configArray[configId][0] ;
	ROL_LinkType = configArray[configId][1] ;
	ROL_LinkSubType = configArray[configId][2] ;
	ROL_Lang = configArray[configId][3] ;
	ROL_Script = configArray[configId][4] ;
	ROL_Charset = configArray[configId][5] ;
}

function f_sendHttpRequest(p_Url)
{
	var retValue = "" ;

	if ( window.XMLHttpRequest )
	{
		xmlhttp = new XMLHttpRequest();
	}
	else if ( window.ActiveXObject )
	{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if ( xmlhttp )
	{
		xmlhttp.open("GET",p_Url,false);
		xmlhttp.send(null);
	
		if ( xmlhttp.status == 200 )
		{
			retValue = xmlhttp.responseText ;
		}
		else
		{
			retValue = "Problem has occurred : " + xmlhttp.statusText ;
		}
		
		xmlhttp = null;
	}
	
	return retValue ;
}
