var xmlHttp10
function showFundPerform(TB)
{ 
	var Per = document.getElementById("performer");
	document.getElementById("txtHint").innerHTML = "<table cellpadding='0' cellspacing='0' border='0' width=100% ><tr><td height='113'><img src='../Images/loading1.gif'></td></tr></table>";
	if (TB == "T")
		{
			document.getElementById("id").value = 'T';	
			Per.src = "images/topPerformers.gif";
		}
	if (TB == "F")
		{
			document.getElementById("id").value = 'F';	
			Per.src = "images/BottomPerformers.gif";
		}
	var url="TopPF.aspx?id="+document.getElementById("id").value+"&fid=" + Math.random() + "&gltype=T&duration=" + document.getElementById("TopPerformance1_cmbDuration").value+ "&stype=" + document.getElementById("TopPerformance1_cmbScheme").value+"&SchIndex="+document.getElementById("TopPerformance1_cmbScheme").selectedIndex+"&PeriodIndex="+document.getElementById("TopPerformance1_cmbDuration").selectedIndex
	//	alert(url);
	xmlHttp10=GetXmlHttpObject(stateChanged)
	xmlHttp10.open("GET", url , true)
	xmlHttp10.send(null)
}
var xmlHttp10
function showFundPerformIn(TB)
{ 
	var Per = document.getElementById("performer");
	document.getElementById("txtHint").innerHTML = "<table cellpadding='0' cellspacing='0' border='0' width=100% ><tr><td height='113'><img src='../Images/loading1.gif'></td></tr></table>";
	if (TB == "T")
		{
			document.getElementById("id").value = 'T';	
			Per.src = "images/topPerformers.gif";
		}
	if (TB == "F")
		{
			document.getElementById("id").value = 'F';	
			Per.src = "images/BottomPerformers.gif";
		}
	var url="FundPerform.aspx?id="+document.getElementById("id").value+"&fid=" + Math.random() + "&gltype=T&duration=" + document.getElementById("InTopPerform1_cmbDuration").value+ "&stype=" + document.getElementById("InTopPerform1_cmbScheme").value
	//alert(url);
	xmlHttp10=GetXmlHttpObject(stateChangedIn)
	xmlHttp10.open("GET", url , true)
	xmlHttp10.send(null)
}
function stateChanged() 
{ 
	if (xmlHttp10.readyState==4 || xmlHttp10.readyState=="complete")
	{ 
		document.getElementById("txtHint").innerHTML=xmlHttp10.responseText 
	}
	else
	{
		document.getElementById("txtHint").innerHTML = "<table cellpadding='0' cellspacing='0' border='0'><tr><td height='113'><img src='../Images/loading1.gif'></td></tr></table>";
	} 
}
function stateChangedIn() 
{ 
	if (xmlHttp10.readyState==4 || xmlHttp10.readyState=="complete")
	{ 
		document.getElementById("txtHint").innerHTML=xmlHttp10.responseText 
	}
	else
	{
		document.getElementById("txtHint").innerHTML = "<table cellpadding='0' cellspacing='0' border='0'><tr><td height='113'><img src='../Images/loading1.gif'></td></tr></table>";
	} 
}
function Browser() {
  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
var browser = new Browser();
var clockTimeoutID;
	
function winpopupFull(strUrl)
{	
	 window.location = strUrl;
}
function winpopup(strUrl)
{	
	window.location = strUrl;
}

function loadCatRet(Period)
	{
		CreateXmlHttp1();
		document.body.style.cursor = "progress";
		if(Period=='')
			Period = "1YEAR";
		var requestUrl = "CategoryRetData.aspx?Period="+Period;
		if(XmlHttp1)	{
					XmlHttp1.onreadystatechange = CatRetResponse;
					XmlHttp1.open("GET", requestUrl,  true);
					XmlHttp1.send(null);
				}
	}	
function CatRetResponse()
	{
	if(XmlHttp1.readyState == 4)
	{
		if(XmlHttp1.status == 200)
		{			
			var EquityId   = document.getElementById("CategoryRetCtrl1_EquityId");
			var DebtId     = document.getElementById("CategoryRetCtrl1_DebtId");
			var BalancedId = document.getElementById("CategoryRetCtrl1_BalancedId");
			var strData = XmlHttp.responseText
			if(strData != "")
			{
				var arrDateSplit = strData.split("|");
				EquityId.innerHTML   = arrDateSplit[0];
				DebtId.innerHTML     = arrDateSplit[1];
				BalancedId.innerHTML = arrDateSplit[2];
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			EquityId.innerHTML = "There was a problem retrieving data from the server.";
			DebtId.innerHTML = "There was a problem retrieving data from the server.";
			BalancedId.innerHTML = "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}
var XmlHttp2;
function CreateXmlHttp2()
{
	try
	{
		XmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp2 = null;	
		}
	}
	if(!XmlHttp2 && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp2 = new XMLHttpRequest();
	}
}

function SelectScheme(ig_,ig_a,ig_b)
{
	var fund = document.getElementById("BaseProfile1_drp_FundHouse");
	var scheme = document.getElementById("BaseProfile1_drp_Scheme");
	if (fund.value=="")
	{
		//alert("select a fund")
		scheme.length = 0;
		scheme.options[0] = new Option(); 
		scheme.options[0].value = "";
		scheme.options[0].text = "Select a scheme";
		return false;
	}
	else
	{
	CreateXmlHttp2();
	document.body.style.cursor = "progress";
	var requestUrl = "MF_SchemeData.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+ new Date().getTime() +"&Fund="+ fund.value +"&Category=";
	
	if(XmlHttp2)
		{
			XmlHttp2.onreadystatechange = function(){getSchemeResp(scheme)};
			XmlHttp2.open("GET", requestUrl,  true);
			XmlHttp2.send(null);
		}
	}	
	
}
function SelectSchemeFund(ig_,ig_a,ig_b)
{
	var category = document.getElementById("FundHouse1_drp_Category");
	var scheme = document.getElementById("FundHouse1_drp_Scheme");
	if (category.value == "")
	{
		scheme.length = 0;
		scheme.options[0] = new Option(); 
		scheme.options[0].value = "";
		scheme.options[0].text = "Select a scheme";
		return false;
	}
	else
	{
	CreateXmlHttp2();
	document.body.style.cursor = "progress";
	var requestUrl = "MF_SchemeData.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+ new Date().getTime() +"&Category="+ category.value +"&Fund=";
	if(XmlHttp2)	{
				XmlHttp2.onreadystatechange = function(){getSchemeResp(scheme)};
				XmlHttp2.open("GET", requestUrl, true);
				XmlHttp2.send(null);
			}
	}			
}

function getSchemeResp(ig_)
{
	if(XmlHttp2.readyState == 4)
	{
		if(XmlHttp2.status == 200)
		{
			var strData = XmlHttp2.responseText
			if(strData != "") {	
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
				for(i=0; i<arrSchm.length-1; i++) {	
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");
					ig_.options[i] = new Option();
					ig_.options[i].value = arrSchmCode[0];
					//if (arrSchmCode[1].indexOf("-") > 0)
					//{ig_.options[i].text = arrSchmCode[1].substring(arrSchmCode[1].indexOf("-"));	}
					//else	{
						ig_.options[i].text = arrSchmCode[1];
					//}
				}
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Scheme is not available";			
			}
			document.body.style.cursor = "auto";	
		}
		else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "server is not ready";
					document.body.style.cursor = "auto";		
		}
	}
}		
