/**
 * libarary that contains the news load based on the sarissa library for xml rendering on client side
 * @Author: Nandagopal R
*/
/***********************************************************************************
	JavaScript function that will trim the leading and trailing spaces
	in the string given to it
***********************************************************************************/
function trim(strValueToTrim){
	// variable that will return the trimmed value
	var strTrimmedValue = strValueToTrim;
	// check whether there are leading blank spaces and remove them
	while (strTrimmedValue.charAt(0)==' '){
		strTrimmedValue = strTrimmedValue.substring(1, strTrimmedValue.length);
	}
	// check whether there are trailing blank spaces and remove them
	while (strTrimmedValue.charAt(strTrimmedValue.length - 1) == ' '){
		strTrimmedValue = strTrimmedValue.substring(0, (strTrimmedValue.length - 1));
	}
	return strTrimmedValue;
}

/***********************************************************************************
	JavaScript function that will return the value of the quertystring variable
	given to it
***********************************************************************************/
function getQueryVariable(sQSVariable){
	// get the entire querystring
	var sQuery = window.location.search.substring(1);
	// get each variable into array
	var arrQS = sQuery.split("&");
	// loop through the querystring variables
	for (var ixTemp = 0; ixTemp < arrQS.length; ixTemp++){
		// split the querystring variable and its value
		var arrQSPair = arrQS[ixTemp].split("=");
		// check whether the current variable is equal to the variable supplied
		if (arrQSPair[0] == sQSVariable){
			// return the value of the querystring
			return arrQSPair[1];
		}
	}
	// return false
	return false;
}

/***********************************************************************************
	JavaScript function that will get the value of a form element
***********************************************************************************/
function getFormElementValue(sFormName, sElementName){
	// return the form element value
	return trim(eval('document.forms["' + sFormName + '"].' + sElementName).value);
}

/***********************************************************************************
	JavaScript function that will set the value of a form element
***********************************************************************************/
function setFormElementValue(sFormName, sElementName, sElementValue){
	// return the form element value
	eval('document.forms["' + sFormName + '"].' + sElementName).value = sElementValue;
	// return
	return true;
}
//EOF
