function GetImagePath(){
	var imagepath = "/includes/images/";
	return imagepath;
}
function changeTNAValue(obj, value, newpos, knobId){
	var v1 = obj.getValue(1);
	var v2 = obj.getValue(2);
	var result = v1 + '~' + v2;

	var TNAhidden = getElementById(TNAValue);
	if (TNAhidden != null)
		TNAhidden.value = result;
	GetSearchSum();
}

function changeRatioValue(obj, value, newpos, knobId){
	var v = obj.getValue(1);
	result = (v - 1) * 0.5;

	var Ratiohidden = getElementById(RatioValue);
	if (Ratiohidden != null)
		Ratiohidden.value = result;
	GetSearchSum();
}

function init(){
	TotalNetAssetsSlider = new Bs_Slider();
	TotalNetAssetsSlider.width         = 336;
	TotalNetAssetsSlider.height        = 22;
	TotalNetAssetsSlider.imgDir = GetImagePath();
	TotalNetAssetsSlider.setBackgroundImage('sliderbk.gif', 'no-repeat');
	TotalNetAssetsSlider.minVal        = 1;
	TotalNetAssetsSlider.maxVal        = 6;
	TotalNetAssetsSlider.valueInterval = 1;
	TotalNetAssetsSlider.valueDefault  = TotalNetAssetsSliderDefaultValue1;
	TotalNetAssetsSlider.setSliderIcon('slider.gif', 13, 18);

	TotalNetAssetsSlider.useSecondKnob        = true;
	TotalNetAssetsSlider.preventValueCrossing = true;
	TotalNetAssetsSlider.wheelAmount        = 0; //disable mouse wheeling cause we have 2 knobs.
	TotalNetAssetsSlider.minVal2        = 1;
	TotalNetAssetsSlider.maxVal2        = 6;
	TotalNetAssetsSlider.valueInterval2 = 1;
	TotalNetAssetsSlider.valueDefault2  = TotalNetAssetsSliderDefaultValue2;
	TotalNetAssetsSlider.setSliderIcon2('slider.gif', 13, 18);

	TotalNetAssetsSlider.colorbar = new Object({ type:'between', cssClass:'selected', offsetLeft:6, height:10, offsetTop:1 });
	TotalNetAssetsSlider.drawInto('TotalNetAssetsSliderDiv');
	TotalNetAssetsSlider.attachOnChange(changeTNAValue);

	
	ExpenseRatioSlider = new Bs_Slider();
	ExpenseRatioSlider.width         = 336;
	ExpenseRatioSlider.height        = 22;
	ExpenseRatioSlider.imgDir   = GetImagePath();
	ExpenseRatioSlider.setBackgroundImage('sliderbk.gif', 'no-repeat');
	ExpenseRatioSlider.minVal        = 1;
	ExpenseRatioSlider.maxVal        = 6;
	ExpenseRatioSlider.valueInterval = 1;
	ExpenseRatioSlider.valueDefault  = ExpenseRatioSliderDefaultValue;
	ExpenseRatioSlider.setSliderIcon('slider.gif', 13, 18);

	ExpenseRatioSlider.colorbar = new Object({ cssClass:'selected',widthDifference:-0, offsetLeft:6, height:10, offsetTop:1 });

	ExpenseRatioSlider.drawInto('ExpenseRatioDiv');
	ExpenseRatioSlider.attachOnChange(changeRatioValue);
}

function fundcompareOpenGlossary(url, windowname){
	if (GlossaryPopup.toLowerCase() == "true"){
		openHelpFullScreen(url, windowname);
	}else{
		window.location.href = url
	}
}

function moveToTop(){
	this.location='#TheTopOfThePage';
	return true;
}

function toolsTitleBarChangeCurrency(opt){
	var ele = getElementById(hdnSelectedCurrency);
	if (ele != null) ele.value = opt.value;
	__doPostBack('ToolsTitleBarChangeCurrency', '');
	return false;
}

function toolsTitleBarChangeLanguage(opt){
	__doPostBack('ToolsTitleBarChangeLanguage', '');
	return false;
}
var oHttpReq;

function UpdateListSelection(id){
	var e = getElementById(id);
	if (e.value == 1){
		e.value = 0;
		removeClass(e.parentNode, "selected");
	}else{
		e.value = 1;
		applyClass(e.parentNode, "selected");
	}
	GetSearchSum();
}

function GetSearchSum(){
	try{
		if (ShowTotalResults == "true" || ShowTotalResults == "top" || ShowTotalResults == "bottom"){
			var sUniverse = GetElementValue(ddlUniverse);

			if (sUniverse == "")
				sUniverse = DefaultUniverse;

			// If no universe is selected, set to 0
			if (sUniverse == ""){
				setSearchSumValue("0");
				return;
			}

			var sExchange = GetElementValue(ddlExchange);
			var sCategoryID = GetElementValue(ddlCategory);
			var sCustomCategoryID = GetElementValue(ddlCustomCategory);
			var sCustomCategory2ID = GetElementValue(ddlCustomCategory2);
			var sCustomCategory3ID = GetElementValue(ddlCustomCategory3);
			var sAICSectorID = GetElementValue(ddlAICSector);
			var sDomicile = GetElementValue(ddlDomicile);
			var sBaseCurrencyID = GetElementValue(ddlBaseCurrency);
			var sCustomRisk = GetElementValue(ddlCustomRisk);
			var sIMASectorID = GetElementValue(ddlIMASector);
			var sAMFCategoryID = GetElementValue(ddlAMFCategory);
			var sPEAStatus = GetCheckBoxValue(chkPEAStatus,  "true", "false");
			var sASGSectorID = GetElementValue(ddlASGSector);
			var sCompanyID = GetElementValue(ddlCompany);
			var sInsuranceWrapper = GetElementValue(ddlInsuranceWrapper);
			var sUnderlyingCompanyID = GetElementValue(ddlFundManagementCompany);
			var sPurchase = GetElementValue(ddlMinPurchase);
			var sInitialSalesCharge = GetElementValue(ddlInitialSalesCharge);
			var sRatio = GetElementValue(RatioValue) != "2.5" ? GetElementValue(RatioValue) : "";
			var sSearchText = GetElementValue(txtSearch);
			var sSharpeRatio = GetElementValue(ddlSharpeRatio);
			var sSectorFilter = GetElementValue(ddlLargestSector);
			var sRegionalFilter = GetElementValue(ddlLargestRegion);
			var sSectorPercentage = GetElementValue(ddlSectorPercentage);
			var sSectorPercentageFilter = GetElementValue(ddlSectorPercentageFilter);
			var sRegionalPercentage = GetElementValue(ddlRegionalPercentage);
			var sRegionalPercentageFilter = GetElementValue(ddlRegionalPercentageFilter);
			var sBroadCategory = GetElementValue(ddlBroadCategoryType);
			var sCPFScheme = GetElementValue(ddlCPFScheme);
			var sIncorAcc = GetIncAcc();
			var sInvestorType = GetInvestorType();
			var sFundOfFunds = GetFundOfFunds();
			var sEquityStyle = GetEquityStyle();
			var sFixedStyle = GetFixedStyle();
			var sTNA = GetTNA();
			var sRating = GetRating();
			var sQualRating = GetQualRating();
			var sCatRankM3 = GetElementValue(ddlCatRankM3);
			var sCatRankM6 = GetElementValue(ddlCatRankM6);
			var sCatRankM0 = GetElementValue(ddlCatRankM0);
			var sCatRankM12 = GetElementValue(ddlCatRankM12);
			var sCatRankM36 = GetElementValue(ddlCatRankM36);
			var sSPRating = GetElementValue(ddlSPRating);
			var sSPRatingCheckBoxes = GetSPRatingCheckBoxes();
			var sRisk = GetRisk();
			var sInversisRisk = GetInversisRisk();
			var sStdDeviation = GetStdDeviation();
			var sReturn = GetReturn();
			var sCategoryReturn = GetCategoryReturn();
			var sReturnsOperatorStates = GetReturnsOperatorStates();
			var sUseAnnualizedReturns = GetCheckBoxValue(chkToggleAnnualizedReturns,  "", "false");
			var sR2TimePeriods = GetR2TimePeriods();
			var sCategoryR2TimePeriods = GetCategoryR2TimePeriods();
			var sSharpeRatioTimePeriods = GetSharpeRatioTimePeriods();
			var sCategorySharpeRatioTimePeriods = GetCategorySharpeRatioTimePeriods();
			var sBetaTimePeriods = GetBetaTimePeriods();
			var sCategoryBetaTimePeriods = GetCategoryBetaTimePeriods();
			var sAlphaTimePeriods = GetAlphaTimePeriods();
			var sCategoryAlphaTimePeriods = GetCategoryAlphaTimePeriods();
			var sInformationRatioTimePeriods = GetInformationRatioTimePeriods();
			var sCategoryInformationRatioTimePeriods = GetCategoryInformationRatioTimePeriods();
			var sTrackingErrorTimePeriods = GetTrackingErrorTimePeriods();
			var sCategoryTrackingErrorTimePeriods = GetCategoryTrackingErrorTimePeriods();
			var sSpecialCriteria = GetElementValue(ddlSpecialCriteria);
			var sClientFunds = GetElementValue(ddlClientFunds);
			var sMinimumAge = GetElementValue(ddlMinimumAge);
			var sQuartileTimePeriod = GetQuartileTimePeriods();
			var sQuartiles = GetQuartiles();
			var sFundClosed = GetCheckBoxValue(chkFundClosed, "true", "");
			var sTransferTaxExempt = GetCheckBoxValue(chkTransferTaxExempt, "true", "");
			var sCustomIsFavourite = GetCheckBoxValue(chkCustomIsFavourite, "true", "");
			var sManagementFee = GetElementValue(ddlManagementFee);
			var sCustomBuyFee = GetElementValue(ddlCustomBuyFee);
			var sDepositoryFee = GetElementValue(ddlDepositoryFee);
			var sSubscriptionFee = GetElementValue(ddlSubscriptionFee);
			var sRedemptionFee = GetElementValue(ddlRedemptionFee);
			var sABISector = GetElementValue(ddlABISector);
			var sGIFSector = GetElementValue(ddlGIFSector);
			var sISA = GetCheckBoxValue(chkISAOption, "1", "0");
			var sPensionFund = GetPensionFund();
			var sFilterList = FundGroupFilterList;

			var sAIMCCode = GetElementValue(ddlAIMCClassification);
			var sSECCode = GetElementValue(ddlSECSpecialCharacteristic);

			var sbUrl = "";
			sbUrl += "../util/fundlistgettotalresult.aspx?ModuleId=" + ModuleId;
			sbUrl += AppendUrl(sCategoryID, "Category");
			sbUrl += AppendUrl(sCustomCategoryID, "CustomCategoryId");
			sbUrl += AppendUrl(sCustomCategory2ID, "CustomCategoryId2");
			sbUrl += AppendUrl(sCustomCategory3ID, "CustomCategoryId3");
			sbUrl += AppendUrl(sAICSectorID, "AICSector");
			sbUrl += AppendUrl(sUniverse, "Universe");
			sbUrl += AppendUrl(sExchange, "ExchangeId");
			sbUrl += AppendUrl(sCustomRisk, "CustomRisk");
			sbUrl += AppendUrl(sSectorFilter, "SectorFilter");
			sbUrl += AppendUrl(sRegionalFilter, "RegionalFilter");
			sbUrl += AppendUrl(sSectorPercentage, "SectorPercentage");
			sbUrl += AppendUrl(sSectorPercentageFilter, "SectorPercentageFilter");
			sbUrl += AppendUrl(sRegionalPercentage, "RegionalPercentage");
			sbUrl += AppendUrl(sRegionalPercentageFilter, "RegionalPercentageFilter");
			sbUrl += AppendUrl(sDomicile, "Domicile");
			sbUrl += AppendUrl(sBaseCurrencyID, "BaseCurrencyId");
			sbUrl += AppendUrl(sPurchase, "Purchase");
			sbUrl += AppendUrl(sInitialSalesCharge, "InitialSalesCharge");
			sbUrl += AppendUrl(sRatio, "Ratio");
			sbUrl += AppendUrl(sRating, "Rating");
			sbUrl += AppendUrl(sQualRating, "QualitativeRating");
			sbUrl += AppendUrl(sCatRankM3, "CatRankM3");
			sbUrl += AppendUrl(sCatRankM6, "CatRankM6");
			sbUrl += AppendUrl(sCatRankM0, "CatRankM0");
			sbUrl += AppendUrl(sCatRankM12, "CatRankM12");
			sbUrl += AppendUrl(sCatRankM36, "CatRankM36");
			sbUrl += AppendUrl(sSPRating, "SPRating");
			sbUrl += AppendUrl(sSPRatingCheckBoxes, "SPRatingCheckBoxes");
			sbUrl += AppendUrl(sTNA, "TNA");
			sbUrl += AppendUrl(sEquityStyle, "EquityStyle");
			sbUrl += AppendUrl(sFixedStyle, "FixedStyle");
			sbUrl += AppendUrl(sReturn, "Return");
			sbUrl += AppendUrl(sCategoryReturn, "CategoryReturn");
			sbUrl += AppendUrl(sReturnsOperatorStates, "ReturnsOperatorStates");
			sbUrl += AppendUrl(sR2TimePeriods, "R2TimePeriods");
			sbUrl += AppendUrl(sCategoryR2TimePeriods, "CategoryR2TimePeriods");
			sbUrl += AppendUrl(sSharpeRatioTimePeriods, "SharpeRatioTimePeriods");
			sbUrl += AppendUrl(sCategorySharpeRatioTimePeriods, "CategorySharpeRatioTimePeriods");
			sbUrl += AppendUrl(sBetaTimePeriods, "BetaTimePeriods");
			sbUrl += AppendUrl(sCategoryBetaTimePeriods, "CategoryBetaTimePeriods");
			sbUrl += AppendUrl(sAlphaTimePeriods, "AlphaTimePeriods");
			sbUrl += AppendUrl(sCategoryAlphaTimePeriods, "CategoryAlphaTimePeriods");
			sbUrl += AppendUrl(sTrackingErrorTimePeriods, "TrackingErrorTimePeriods");
			sbUrl += AppendUrl(sCategoryTrackingErrorTimePeriods, "CategoryTrackingErrorTimePeriods");
			sbUrl += AppendUrl(sInformationRatioTimePeriods, "InformationRatioTimePeriods");
			sbUrl += AppendUrl(sCategoryInformationRatioTimePeriods, "CategoryInformationRatioTimePeriods");
			sbUrl += AppendUrl(sRisk, "Risk");
			sbUrl += AppendUrl(sInversisRisk, "InversisRisk");
			sbUrl += AppendUrl(sStdDeviation, "StdDeviation");
			sbUrl += AppendUrl(sUseAnnualizedReturns, "UseAnnualizedReturns");

			sbUrl += AppendUrl(sClientFunds, "ClientFunds");
			sbUrl += AppendUrl(sMinimumAge, "MinimumAge");
			sbUrl += AppendUrl(sQuartileTimePeriod, "QuartileTimePeriods");
			sbUrl += AppendUrl(sQuartiles, "Quartiles");

			sbUrl += AppendUrl(sFundClosed, "FundClosed");
			sbUrl += AppendUrl(sTransferTaxExempt, "TransferTaxExempt");
			sbUrl += AppendUrl(sCustomIsFavourite, "CustomIsFavourite");
			//sbUrl += AppendUrl(sManagementFee, "ManagementFee");
			//sbUrl += AppendUrl(sDepositoryFee, "DepositoryFee");
			//sbUrl += AppendUrl(sSubscriptionFee, "SubscriptionFee");
			//sbUrl += AppendUrl(sRedemptionFee, "RedemptionFee");

			sbUrl += AppendUrl(sCompanyID, "Company");
			sbUrl += AppendUrl(sInsuranceWrapper, "Wrapper");
			sbUrl += AppendUrl(sUnderlyingCompanyID, "UnderlyingCompany");
			sbUrl += AppendUrl(sFilterList, "FilterList");
			sbUrl += AppendUrl(sPensionFund, "LnPType");
			sbUrl += AppendUrl(sSearchText, "SearchText");
			sbUrl += AppendUrl(sSharpeRatio, "SharpeRatio");
			sbUrl += AppendUrl(sISA, "ISA");
			sbUrl += AppendUrl(sBroadCategory, "CategoryType");
			sbUrl += AppendUrl(sCPFScheme, "CPFScheme");

			sbUrl += GetGreaterOrLessThanFromDropdownValue(getElementById(ddlManagementFee), "ManagementFeeMin", "ManagementFeeMax");
			sbUrl += GetGreaterOrLessThanFromDropdownValue(getElementById(ddlCustomBuyFee), "CustomBuyFeeMin", "CustomBuyFeeMax");
			sbUrl += GetGreaterOrLessThanFromDropdownValue(getElementById(ddlCustomMinimumPurchaseAmount), "CustomMinimumPurchaseAmountMin", "CustomMinimumPurchaseAmountMax");
			sbUrl += GetGreaterOrLessThanFromDropdownValue(getElementById(ddlSubscriptionFee), "SubscriptionFeeMin", "SubscriptionFeeMax");
			sbUrl += GetGreaterOrLessThanFromDropdownValue(getElementById(ddlDepositoryFee), "DepositoryFeeMin", "DepositoryFeeMax");
			sbUrl += GetGreaterOrLessThanFromDropdownValue(getElementById(ddlRedemptionFee), "RedemptionFeeMin", "RedemptionFeeMax");

			if (IsLifeAndPensionUniverse == "True"){
				sbUrl += AppendUrl(sABISector, "ABISector");
			}else{
				sbUrl += AppendUrl(sIncorAcc, "IncorAcc");
				sbUrl += AppendUrl(sIMASectorID, "IMASector");
				sbUrl += AppendUrl(sASGSectorID, "ASGSector");
				sbUrl += AppendUrl(sSpecialCriteria, "SpecialCriteria");
			}
			sbUrl += AppendUrl(sAMFCategoryID, "AMFCategory");
			sbUrl += AppendUrl(sPEAStatus, "PEAStatus");
			sbUrl += AppendUrl(sGIFSector, "GIFSector");
			sbUrl += AppendUrl(getElementById(hdnSelectedCurrency).value, "CurrencyId");
			sbUrl += AppendUrl(sInvestorType, "InvestorType");
			sbUrl += AppendUrl(sFundOfFunds, "FundOfFunds");

			sbUrl += AppendUrl(sAIMCCode, "AIMCCode");
			sbUrl += AppendUrl(sSECCode, "SECCODE");

			setSearchSumValue('loading...');

			if (oHttpReq != null) oHttpReq.abort();
			oHttpReq = GetXmlHttpObject();
			oHttpReq.open("GET", sbUrl, true);
			oHttpReq.onreadystatechange = changeSearchSumValue;
			oHttpReq.send(null);
		}
	}
	catch(ex){
	}
}

function changeSearchSumValue(){
	if (oHttpReq.readyState == 4){
		if (oHttpReq.status == 200){
			var searchSum = oHttpReq.responseText;

			setSearchSumValue(searchSum);

			oHttpReq = null;

			var oBtnSBottom = getElementById(btnSearchBottom);
			var oBtnSTop = getElementById(btnSearchTop);
			if (searchSum == 0){
				if (oBtnSBottom) oBtnSBottom.disabled = true;
				if (oBtnSTop) oBtnSTop.disabled = true;
			}else{
				if (oBtnSBottom) oBtnSBottom.disabled = false;
				if (oBtnSTop) oBtnSTop.disabled = false;
			}
		}
	}
}

function setSearchSumValue(value){
	var searchResultBoxes = getElementsByClassName(document, 'span', 'search-results-value');
	for (i=0; i<searchResultBoxes.length; i++){
		searchResultBoxes[i].innerHTML = value;
	}
}

function CheckCatReturnValue(value, optionsClientId){
	if (value != null){
		if (getElementById(optionsClientId).checked == true){
			if (isNaN(value) == false) GetSearchSum();
		}
	}
}

function GetElementValue(id){
	var value = null;
	var ele = getElementById(id);
	if (ele == null) return "";
	try{
		value = ele.value;
	}
	catch (e){
		value = "";
	}
	return value;
}

function GetCheckBoxValue(id, valTrue, valFalse){
	var ele = getElementById(id);
	if (ele == null) return valFalse;
	return ele.checked ? valTrue : valFalse;
}

function GetDOMDocument(xml){
    var xmlDoc = null;
	try{
		// Internet Explorer
		xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
		xmlDoc.loadXML(xml);
	}
	catch (e){
		// Firefox, Opera 8.0+, Safari
		//xmlDoc = document.implementation.createDocument( ' ', 'doc', null);
		xmlDoc = (new DOMParser()).parseFromString(xml, "text/xml");
	}
	return xmlDoc;
}

function GetXmlHttpObject(){
	var xmlHttp = null;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch (e){
		// Internet Explorer
		try{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function AppendUrl(value, paraName){
	var sbUrl = "";
	if (value != null && value != "") sbUrl = "&" + paraName + "=" + UrlEncode(value);
	return sbUrl;
}

function UrlEncode(s){
	return encodeURIComponent(s);
}

var SEPERATER = "|";
var DROPDOWN_VALUE_SEPERATER = "&";
var TRUE = "1";
var FALSE = "0";
var NULL = "NULL";
var GREATER_THAN = "GT";
var LESS_THAN = "LT";

function GetIncAcc(){
	var sb = "";
	try {
	    sb += (getElementById(rdDistributionStatusAll).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(rdDistributionStatusInc).checked ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(rdDistributionStatusAcc).checked ? TRUE : FALSE;
	}
	catch(ex){
	}
	return CheckDefaultValue(sb, 2);
}

function GetInvestorType() {
	var sb = "";
	try {
		sb += (getElementById(rdAllFunds).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(rdInstitutional).checked ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(rdNonInstitutional).checked ? TRUE : FALSE;
	}
	catch(ex) {
	}
	return CheckDefaultValue(sb, 2);
}

function GetFundOfFunds() {
	var sb = "";
	try {
		sb += (getElementById(rdFundOfFundsAll).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(rdFundOfFundsYes).checked ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(rdFundOfFundsNo).checked ? TRUE : FALSE;
	}
	catch(ex) {
	}
	return CheckDefaultValue(sb, 2);
}

function CheckDefaultValue(value, number){
	return CheckDefaultValue3(value, number, FALSE);
}

//Helper function - returns "" if passed string matches default value
function CheckDefaultValue3(value, number, flagFalse){
	var defaultValue = "";

	for (i=0; i<number; ++i){
		if (i == 0) defaultValue += flagFalse;
		else defaultValue += SEPERATER + flagFalse;
	}
	if (value == defaultValue) return "";
	else return value;
}

function GetPensionFund(){
	if (IsItalianPensionFunds == "true"){
		var sb = "";
		try{
			sb += (getElementById(chkTipologyOpen).checked ? TRUE : FALSE) + SEPERATER;
			sb += (getElementById(chkTipologyClose).checked ? TRUE : FALSE);
		}
		catch(ex){
		}
		return CheckDefaultValue(sb, 3);
	}
	return "";
}

function GetRisk(){
	var sb = "";
	try{
		sb += (getElementById(chkRisk1).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkRisk2).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkRisk3).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkRisk4).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkRisk5).value == "1" ? TRUE : FALSE;
	}
	catch(ex){
	}
	return CheckDefaultValue(sb, 5);
}

function GetInversisRisk(){
	var sb = "";
	try{
		sb += (getElementById(chkInversisRisk1).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkInversisRisk2).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkInversisRisk3).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkInversisRisk4).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkInversisRisk5).value == "1" ? TRUE : FALSE;
	}
	catch(ex){
	}
	return CheckDefaultValue(sb, 5);
}

function GetQuartileTimePeriods(){
	var sb = "";
	try{
		var items = getElementById('chkQuartilePeriods').getElementsByTagName('input');
		sb += (items[3].checked == true ? TRUE : FALSE) + SEPERATER;
		sb += (items[0].checked == true ? TRUE : FALSE) + SEPERATER;
		sb += (items[1].checked == true ? TRUE : FALSE) + SEPERATER;
		sb += (items[2].checked == true ? TRUE : FALSE) + SEPERATER;
		sb += (items[4].checked == true ? TRUE : FALSE) + SEPERATER;
		sb += (items[5].checked == true ? TRUE : FALSE) + SEPERATER;
		sb += (items[6].checked == true ? TRUE : FALSE) + SEPERATER;
		sb += items[7].checked == true ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 8);
}

function GetQuartiles(){
	var sb = "";
	try{
		sb += (getElementById(chkQuartile1).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkQuartile2).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkQuartile3).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkQuartile4).value == "1" ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 4);
}

function GetStdDeviation(){
	var sb = "";
	try{
		sb += (getElementById(chkThreeYStdDeviationLow).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkThreeYStdDeviationModerate).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkThreeYStdDeviationHigh).value == "1" ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 3);
}

function GetEquityStyle(){
	var sb = "";
	try	{
		sb += (getElementById(chkEquitySB1).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkEquitySB2).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkEquitySB3).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkEquitySB4).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkEquitySB5).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkEquitySB6).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkEquitySB7).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkEquitySB8).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkEquitySB9).value == "1" ? TRUE : FALSE;
	}
	catch(ex){
	}
	return CheckDefaultValue(sb, 9);
}

function GetFixedStyle(){
	var sb = "";
	try	{
		sb += (getElementById(chkFixedSB1).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkFixedSB2).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkFixedSB3).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkFixedSB4).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkFixedSB5).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkFixedSB6).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkFixedSB7).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkFixedSB8).value == "1" ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkFixedSB9).value == "1" ? TRUE : FALSE;
	}
	catch(ex){
	}
	return CheckDefaultValue(sb, 9);
}

function GetRating(){
	var sb = "";
	try	{
		sb += (getElementById(chkStar1).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkStar2).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkStar3).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkStar4).checked ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkStar5).checked ? TRUE : FALSE;
	}
	catch(ex)	{
	}
	return CheckDefaultValue(sb, 5);
}

function GetQualRating(){
	var sb = "";
	try	{
		sb += (getElementById(chkQR1).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkQR2).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkQR3).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkQR4).checked ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkQR5).checked ? TRUE : FALSE;
	}
	catch(ex)	{
	}
	return CheckDefaultValue(sb, 5);
}

function GetSPRatingCheckBoxes(){
	var sb = "";
	try	{
		sb += (getElementById(chkAAA).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkAA).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkA).checked ? TRUE : FALSE) + SEPERATER;
		sb += (getElementById(chkNR).checked ? TRUE : FALSE) + SEPERATER;
		sb += getElementById(chkUR).checked ? TRUE : FALSE;
	}
	catch(ex)	{
	}
	return CheckDefaultValue(sb, 5);
}

// Must return ALL parts ALWAYS in this order: YTD|1M|3M|6M|1Y|3Y|5Y|10Y
function GetCategoryReturn(){
	var sb = "";
	var total = 8;
	try
	{
		sb = GetCategoryReturnHelper(ddlReturnYTD, sb, SEPERATER);
		sb = GetCategoryReturnHelper(ddlReturnMonth1, sb, SEPERATER);
		sb = GetCategoryReturnHelper(ddlReturnMonth3, sb, SEPERATER);
		sb = GetCategoryReturnHelper(ddlReturnMonth6, sb, SEPERATER);
		sb = GetCategoryReturnHelper(ddlReturnYear1, sb, SEPERATER);
		sb = GetCategoryReturnHelper(ddlReturnYear3, sb, SEPERATER);
		sb = GetCategoryReturnHelper(ddlReturnYear5, sb, SEPERATER);
		sb = GetCategoryReturnHelper(ddlReturnYear10, sb, "");
	}
	catch(ex){
	}
	return CheckDefaultValue(sb, total);
}

function GetCategoryReturnHelper(id, sb, delim){
	var ele = getElementById(id);
	if (ele == null) sb += FALSE + delim;
	else sb += ((ele.selectedIndex == 1) ? TRUE : FALSE) + delim;
	return sb;
}

function GetCategoryR2TimePeriods(){
	var sb = "";

	try{
			sb += ((getElementById(ddlR21Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
			sb += ((getElementById(ddlR23Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlR25Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
			sb += (getElementById(ddlR210Year).selectedIndex == 1) ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 4);
}

function GetCategoryR2TimePeriods_withOperator(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so it is excluded from the string used to check for the default value

	try{
		sb += ((getElementById(ddlR21YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlR21Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlR23YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlR23Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlR25YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlR25Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlR210YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlR210Year).selectedIndex == 1) ? TRUE : FALSE;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue(sb_check, 4)){
		return "";
	}else{
		return sb;
	}
}

function GetCategorySharpeRatioTimePeriods(){
	var sb = "";

	try{
		sb += ((getElementById(ddlSharpe1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlSharpe3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlSharpe5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += (getElementById(ddlSharpe10Year).selectedIndex == 1) ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 4);
}


function GetCategorySharpeRatioTimePeriods_withOperator(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so it is excluded from the string used to check for the default value

	try{
		sb += ((getElementById(ddlSharpe1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlSharpe1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlSharpe3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlSharpe3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlSharpe5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlSharpe5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlSharpe10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlSharpe10Year).selectedIndex == 1) ? TRUE : FALSE;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue(sb_check, 4)){
		return "";
	}else{
		return sb;
	}
}

function GetCategoryBetaTimePeriods(){
	var sb = "";

	try{
		sb += ((getElementById(ddlBeta1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlBeta3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlBeta5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += (getElementById(ddlBeta10Year).selectedIndex == 1) ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 4);
}

function GetCategoryBetaTimePeriods_withOperator(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so it is excluded from the string used to check for the default value

	try{
		sb += ((getElementById(ddlBeta1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlBeta1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlBeta3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlBeta3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlBeta5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlBeta5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlBeta10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlBeta10Year).selectedIndex == 1) ? TRUE : FALSE;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue(sb_check, 4)){
		return "";
	}else{
		return sb;
	}
}

function GetCategoryAlphaTimePeriods(){
	var sb = "";
	try{
		sb += ((getElementById(ddlAlpha1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlAlpha3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlAlpha5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += (getElementById(ddlAlpha10Year).selectedIndex == 1) ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 4);
}

function GetCategoryAlphaTimePeriods_withOperator(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so it is excluded from the string used to check for the default value

	try{
		sb += ((getElementById(ddlAlpha1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlAlpha1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlAlpha3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlAlpha3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlAlpha5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlAlpha5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlAlpha10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlAlpha10Year).selectedIndex == 1) ? TRUE : FALSE;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue(sb_check, 4)){
		return "";
	}else{
		return sb;
	}
}


function GetCategoryInformationRatioTimePeriods(){
	var sb = "";

	try{
		sb += ((getElementById(ddlInformationRatio1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlInformationRatio3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlInformationRatio5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += (getElementById(ddlInformationRatio10Year).selectedIndex == 1) ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 4);
}


function GetCategoryInformationRatioTimePeriods_withOperator(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so it is excluded from the string used to check for the default value

	try{
		sb += ((getElementById(ddlInformationRatio1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlInformationRatio1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlInformationRatio3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlInformationRatio3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlInformationRatio5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlInformationRatio5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlInformationRatio10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlInformationRatio10Year).selectedIndex == 1) ? TRUE : FALSE;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue(sb_check, 4)){
		return "";
	}else{
		return sb;
	}
}


function GetCategoryTrackingErrorTimePeriods(){
	var sb = "";

	try{
		sb += ((getElementById(ddlTrackingError1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlTrackingError3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += ((getElementById(ddlTrackingError5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += (getElementById(ddlTrackingError10Year).selectedIndex == 1) ? TRUE : FALSE;
	}
	catch(ex){
	}

	return CheckDefaultValue(sb, 4);
}


function GetCategoryTrackingErrorTimePeriods_withOperator(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so it is excluded from the string used to check for the default value

	try{
		sb += ((getElementById(ddlTrackingError1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlTrackingError1Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlTrackingError3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlTrackingError3Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlTrackingError5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlTrackingError5Year).selectedIndex == 1) ? TRUE : FALSE) + SEPERATER;;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlTrackingError10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlTrackingError10Year).selectedIndex == 1) ? TRUE : FALSE;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue(sb_check, 4)){
		return "";
	}else{
		return sb;
	}
}

function GetReturn(){
	var sb = "";
	var total = 8;
	try{
		sb = GetReturnHelper(ddlReturnYTD, txtReturnYTD, sb, SEPERATER);
		sb = GetReturnHelper(ddlReturnMonth1, txtReturnMonth1, sb, SEPERATER);
		sb = GetReturnHelper(ddlReturnMonth3, txtReturnMonth3, sb, SEPERATER);
		sb = GetReturnHelper(ddlReturnMonth6, txtReturnMonth6, sb, SEPERATER);
		sb = GetReturnHelper(ddlReturnYear1, txtReturnYear1, sb, SEPERATER);
		sb = GetReturnHelper(ddlReturnYear3, txtReturnYear3, sb, SEPERATER);
		sb = GetReturnHelper(ddlReturnYear5, txtReturnYear5, sb, SEPERATER);
		sb = GetReturnHelper(ddlReturnYear10, txtReturnYear10, sb, "");
	}
	catch(ex){
	}
	return CheckDefaultValue3(sb, total, NULL);
}

function GetReturnHelper(ddlID, txtID, sb, delim){
	var ddl = getElementById(ddlID);
	var txt = getElementById(txtID);
	if (ddl == null || txt == null)
		sb += NULL + delim;
	else
		sb += ((ddl.selectedIndex == 2 && txt.value.trim().length > 0) ? GetInvariantFormattedNumber(txt.value.trim()) : NULL) + delim;
	return sb;
}

function GetReturnsOperatorStates(){
	var sb = "";
	try{
		sb += (getElementById(ddlReturnYTDComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb += (getElementById(ddlReturnMonth1ComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb += (getElementById(ddlReturnMonth3ComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb += (getElementById(ddlReturnMonth6ComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb += (getElementById(ddlReturnYear1ComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb += (getElementById(ddlReturnYear3ComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb += (getElementById(ddlReturnYear5ComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb += getElementById(ddlReturnYear10ComparisonOperator).selectedIndex == 0 ? GREATER_THAN : LESS_THAN;
	}
	catch(ex){
	}
	return sb;
}

function showComparisonObjects(boolShowComparisonObjects){
	if (boolShowComparisonObjects == true){
		removeClass(getElementById(ddlReturnYear1), 'hidden');
		removeClass(getElementById(ddlReturnYear3), 'hidden');
		removeClass(getElementById(ddlReturnYear5), 'hidden');
		removeClass(getElementById(ddlReturnYear10), 'hidden');
	}else{
		applyClass(getElementById(ddlReturnYear1), 'hidden');
		getElementById(ddlReturnYear1).selectedIndex = 2;
		ChangeStatusDropDownList(ddlReturnYear1,txtReturnYear1, ddlReturnYear1ComparisonOperator, false);
		applyClass(getElementById(ddlReturnYear3), 'hidden');
		getElementById(ddlReturnYear3).selectedIndex = 2;
		ChangeStatusDropDownList(ddlReturnYear3,txtReturnYear3, ddlReturnYear3ComparisonOperator, false);
		applyClass(getElementById(ddlReturnYear5), 'hidden');
		getElementById(ddlReturnYear5).selectedIndex = 2;
		ChangeStatusDropDownList(ddlReturnYear5,txtReturnYear5, ddlReturnYear5ComparisonOperator, false);
		applyClass(getElementById(ddlReturnYear10), 'hidden');
		getElementById(ddlReturnYear10).selectedIndex = 2;
		ChangeStatusDropDownList(ddlReturnYear10,txtReturnYear10, ddlReturnYear10ComparisonOperator, false);
	}

	GetSearchSum();
	return;
}

function GetR2TimePeriods(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so are excluded from the string used to check if default value

	try{
		sb += ((getElementById(ddlR21YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlR21Year).selectedIndex == 2 && getElementById(txtR21Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtR21Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlR23YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlR23Year).selectedIndex == 2 && getElementById(txtR23Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtR23Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlR25YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlR25Year).selectedIndex == 2 && getElementById(txtR25Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtR25Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlR210YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlR210Year).selectedIndex == 2 && getElementById(txtR210Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtR210Year).value.trim()) : NULL;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue3(sb_check, 4, NULL)){
		return "";
	}else{
		return sb;
	}
}

function GetSharpeRatioTimePeriods(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so are excluded from the string used to check if default value

	try{
		sb += ((getElementById(ddlSharpe1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlSharpe1Year).selectedIndex == 2 && getElementById(txtSharpe1Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtSharpe1Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlSharpe3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlSharpe3Year).selectedIndex == 2 && getElementById(txtSharpe3Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtSharpe3Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlSharpe5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlSharpe5Year).selectedIndex == 2 && getElementById(txtSharpe5Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtSharpe5Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlSharpe10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlSharpe10Year).selectedIndex == 2 && getElementById(txtSharpe10Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtSharpe10Year).value.trim()) : NULL;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue3(sb_check, 4, NULL)){
		return "";
	}else{
		return sb;
	}
}

function GetBetaTimePeriods(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so are excluded from the string used to check if default value

	try{
		sb += ((getElementById(ddlBeta1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlBeta1Year).selectedIndex == 2 && getElementById(txtBeta1Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtBeta1Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlBeta3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlBeta3Year).selectedIndex == 2 && getElementById(txtBeta3Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtBeta3Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlBeta5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlBeta5Year).selectedIndex == 2 && getElementById(txtBeta5Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtBeta5Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlBeta10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlBeta10Year).selectedIndex == 2 && getElementById(txtBeta10Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtBeta10Year).value.trim()) : NULL;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue3(sb_check, 4, NULL)){
		return "";
	}else{
		return sb;
	}
}

function GetAlphaTimePeriods(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so are excluded from the string used to check if default value

	try{
		sb += ((getElementById(ddlAlpha1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlAlpha1Year).selectedIndex == 2 && getElementById(txtAlpha1Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtAlpha1Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlAlpha3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlAlpha3Year).selectedIndex == 2 && getElementById(txtAlpha3Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtAlpha3Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlAlpha5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlAlpha5Year).selectedIndex == 2 && getElementById(txtAlpha5Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtAlpha5Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlAlpha10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlAlpha10Year).selectedIndex == 2 && getElementById(txtAlpha10Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtAlpha10Year).value.trim()) : NULL;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue3(sb_check, 4, NULL)){
		return "";
	}else{
		return sb;
	}
}

function GetInformationRatioTimePeriods(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so are excluded from the string used to check if default value

	try{
		sb += ((getElementById(ddlInformationRatio1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlInformationRatio1Year).selectedIndex == 2 && getElementById(txtInformationRatio1Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtInformationRatio1Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlInformationRatio3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlInformationRatio3Year).selectedIndex == 2 && getElementById(txtInformationRatio3Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtInformationRatio3Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlInformationRatio5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlInformationRatio5Year).selectedIndex == 2 && getElementById(txtInformationRatio5Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtInformationRatio5Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlInformationRatio10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlInformationRatio10Year).selectedIndex == 2 && getElementById(txtInformationRatio10Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtInformationRatio10Year).value.trim()) : NULL;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue3(sb_check, 4, NULL)){
		return "";
	}else{
		return sb;
	}
}

function GetTrackingErrorTimePeriods(){
	var sb = "";
	var sb_check = "";
	var sb_temp = "";
	//The ComparisonOperator elements affect how the filter is applied
	//but do not affect whether the filter is applied.
	//so are excluded from the string used to check if default value

	try{
		sb += ((getElementById(ddlTrackingError1YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlTrackingError1Year).selectedIndex == 2 && getElementById(txtTrackingError1Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtTrackingError1Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlTrackingError3YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlTrackingError3Year).selectedIndex == 2 && getElementById(txtTrackingError3Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtTrackingError3Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlTrackingError5YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = ((getElementById(ddlTrackingError5Year).selectedIndex == 2 && getElementById(txtTrackingError5Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtTrackingError5Year).value.trim()) : NULL) + SEPERATER;
		sb += sb_temp;
		sb_check += sb_temp;

		sb += ((getElementById(ddlTrackingError10YearComparisonOperator).selectedIndex == 0) ? GREATER_THAN : LESS_THAN) + SEPERATER;
		sb_temp = (getElementById(ddlTrackingError10Year).selectedIndex == 2 && getElementById(txtTrackingError10Year).value.length > 0) ? GetInvariantFormattedNumber(getElementById(txtTrackingError10Year).value.trim()) : NULL;
		sb += sb_temp;
		sb_check += sb_temp;
	}
	catch(ex){
	}

	if ("" == CheckDefaultValue3(sb_check, 4, NULL)){
		return "";
	}else{
		return sb;
	}
}

function GetInvariantFormattedNumber(value){
	var ret = NULL;
	try{
		ret = Number(value);
		if (isNaN(ret)) ret = NULL;
	}
	catch(ex){
		ret = NULL;
	}
	return ret;
}

function GetTNA(){
	try{
		return getElementById(TNAValue).value != "1~6" ? getElementById(TNAValue).value : "";
	}
	catch(ex){
		return null;
	}
}

function ChangeStatusDropDownList(ddl, txt){
		var ddl_ref = getElementById(ddl);
		var txt_ref = getElementById(txt);
		if (ddl_ref == null || txt_ref == null) return;

		if (ddl_ref.selectedIndex == 2){
			txt_ref.disabled = false;
			removeClass(txt_ref, "textbox_disabled");
		}else{
			txt_ref.disabled = true;
			applyClass(txt_ref, "textbox_disabled");
		}
		
		GetSearchSum();
}

function ChangeStatusDropDownList(ddl, txt, compOperator){
	ChangeStatusDropDownList(ddl, txt, compOperator, true);
}

function ChangeStatusDropDownList(ddl, txt, compOperator, callGetSearchSum){
	var ddl_ref = getElementById(ddl);
	var txt_ref = getElementById(txt);
	var compOperator = getElementById(compOperator);

	if (ddl_ref==null || txt_ref==null) return;

	if (ddl_ref.selectedIndex == 2){
		txt_ref.disabled = false;
		removeClass(txt_ref, "textbox_disabled");

		if (compOperator != null){
			compOperator.disabled = false;
		}
	}else{
		txt_ref.disabled = true;
		applyClass(txt_ref, "textbox_disabled");

		if (compOperator != null){
			compOperator.selectedIndex = 0;
			compOperator.disabled = true;
		}
	}

	if (callGetSearchSum != false){
		GetSearchSum();
	}
}

function GetGreaterOrLessThanFromDropdownValue(sDropdownID, sMinParamName, sMaxParamName){
	var sb = "";

	if (sDropdownID != null){
		if (sDropdownID.selectedIndex > 0){
			try{
				var sValues = sDropdownID[sDropdownID.selectedIndex].value.split(DROPDOWN_VALUE_SEPERATER);

				for (i = 0; i < sValues.length; i++){
					if (sValues[i].indexOf(GREATER_THAN) == 0){
						sb+= "&" + sMinParamName + "=" + sValues[i].substr(GREATER_THAN.length);
					}else if (sValues[i].indexOf(LESS_THAN) == 0){
						sb+= "&" + sMaxParamName + "=" + sValues[i].substr(LESS_THAN.length);
					}
					i++;
				}
			}
			catch(ex){
				return NULL;
			}
		}
	}
	
	return sb;
}

String.prototype.trim = function(){
	return this.replace(/^\s+|\s+$/g,"");
}