﻿// JScript File

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;
  }

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}



var url;
var containerid="contentarea";
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""


var browser = new Browser();
 var dragObj = new Object();
dragObj.zIndex = 0;
function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

var clockTimeoutID;
//Global Variables
var XmlHttp;
var XmlHttp2;
var XmlHttp3;
var XmlHttp4;
var XmlHttpTOP;
var XmlHttpNews;
var XmlHttptest;

function CreateXmlHttp()
{
	try
		{
			XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttp = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttp && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttp = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttp=false;
	        }
        }
        if (!XmlHttp && window.createRequest) 
        {
	        try 
	        {
		        XmlHttp = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttp=false;
	        }
        }
}


function CreateXmlHttp1()
	{
if ( window.XMLHttpRequest )
 {
  // code for all new browsers
  XmlHttptest  = new XMLHttpRequest();
 }
 else if ( window.ActiveXObject )
 {
  // code for IE5 and IE6
  XmlHttptest  = new ActiveXObject('Microsoft.XMLHTTP');
 }
	}	
	

function CreateXmlHttp4()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttp4 = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttp4 = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttp4 = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttp4 && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttp4 = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttp4=false;
	        }
        }
        if (!XmlHttp4 && window.createRequest) 
        {
	        try 
	        {
		        XmlHttp4 = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttp4=false;
	        }
        }
	}
	
	function CreateXmlHttpNews()
	{
//Creating object of XmlHttp in IE
		if ( window.XMLHttpRequest )
 {
  // code for all new browsers
  XmlHttpNews  = new XMLHttpRequest();
 }
 else if ( window.ActiveXObject )
 {
  // code for IE5 and IE6
  XmlHttpNews  = new ActiveXObject('Microsoft.XMLHTTP');
 }

	
	}	
//For top performers data
function loadGLData(Period,Category,TopGl)
{
//alert("as");
	CreateXmlHttp()
	document.body.style.cursor = "progress";
	var TopGl;
	if(Period=='')
		Period = "1YEAR";
	if(Category=='')	
		Category="ALL";
	var UserId=document.getElementById("inp_hid1").value;
	var requestUrl = "AjaxFundData.aspx?Period="+ Period +"&Category="+ Category +"&TopGl="+ TopGl+"&UserId="+UserId;

	
	if(XmlHttp)	{
				XmlHttp.onreadystatechange = function(){GLResponse(TopGl)}
				XmlHttp.open("GET", requestUrl,  true);
				XmlHttp.send(null);
			}
}	
	
	function GLResponse(TopGl)
{
            var FundPerformance = document.getElementById("FundPerformance");
			
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK

		if(XmlHttp.status == 200)
		{	
			var strGlData = XmlHttp.responseText
			
				FundPerformance.innerHTML = strGlData;
			 
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			
				FundPerformance.innerHTML = "There was a problem retrieving data from the server.";
			
			
			document.body.style.cursor = "auto";
		}
	}
}	


function CreateXmlHttpHM()
	
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttpHM = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttpHM = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpHM = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttpHM && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttpHM = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttpHM=false;
	        }
        }
        if (!XmlHttpHM && window.createRequest) 
        {
	        try 
	        {
		        XmlHttpHM = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttpHM=false;
	        }
        }
	
	}




function loadCatRetHM(option)
	{	
	
	var Selec = option.substring(0,2);
	
	if(Selec == "3M")
	{
        document.getElementById("3M").className = "HomeSelect";
        document.getElementById("6M").className = "HomeUnSelect";
        document.getElementById("5Y").className = "HomeUnSelect";
        document.getElementById("1Y").className = "HomeUnSelect";
        document.getElementById("3Y").className = "HomeUnSelect";
	}
	
	   if(Selec == "6M")
	    {
            document.getElementById("3M").className = "HomeUnSelect";
            document.getElementById("6M").className = "HomeSelect";
            document.getElementById("5Y").className = "HomeUnSelect";
            document.getElementById("1Y").className = "HomeUnSelect";
            document.getElementById("3Y").className = "HomeUnSelect";
        }
      
            if(Selec == "3Y")
	        {
                document.getElementById("5Y").className = "HomeUnSelect";
                document.getElementById("6M").className = "HomeUnSelect";
                document.getElementById("3Y").className = "HomeSelect";
                document.getElementById("1Y").className = "HomeUnSelect";
                document.getElementById("3M").className = "HomeUnSelect";
            }
            
                if(Selec == "1Y")
	            {
                    document.getElementById("5Y").className = "HomeUnSelect";
                    document.getElementById("6M").className = "HomeUnSelect";
                    document.getElementById("3M").className = "HomeUnSelect";
                    document.getElementById("1Y").className = "HomeSelect";
                    document.getElementById("3Y").className = "HomeUnSelect";
                }
                
                    if(Selec == "5Y")
	                {
                        document.getElementById("3Y").className = "HomeUnSelect";
                        document.getElementById("6M").className = "HomeUnSelect";
                        document.getElementById("3M").className = "HomeUnSelect";
                        document.getElementById("1Y").className = "HomeUnSelect";
                        document.getElementById("5Y").className = "HomeSelect";
                     }
                
            
          
        

	
	document.getElementById("hdType").value = option;
	var Type = document.getElementById("inp_Type").value;
	//var opt = document.getElementById("ChartType").value;

//        ShowChart(option,Type);
		CreateXmlHttpHM();
		document.body.style.cursor = "progress";
		
	var requestUrl = HostUrlForPages+"/Mutual-Fund/AjaxCategoryData.aspx?Type="+Type+"&option="+option+"&TimeStamp="+new Date().getTime();
		if(XmlHttpHM)	
			{
					XmlHttpHM.onreadystatechange = function(){CatRetResponseHM();}; 
					XmlHttpHM.open("GET", requestUrl,  true);
					XmlHttpHM.send(null);
			}
		ShowChart(option,Type,'3DBar');	
	}	
	
	//Called when response comes back from server Only For Category Return
	function closeallMFC()
{
    for(var i=1;i<=3;i++)
    {
        document.getElementById("MFC"+i).className="HomeUnSelect";
    }
}
function CatRetResponseHM()
{
var MFFundID   = document.getElementById("MFFundID12");
	// To make sure receiving response data from server is completed
	if(XmlHttpHM.readyState == 4)
	{
	
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpHM.status == 200)
		{			
			//var MFFundID   = document.getElementById("MFFundID12");
			
          
			var strData = XmlHttpHM.responseText;
			if(strData != "")
			{
				MFFundID.innerHTML   = strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			MFFundID.innerHTML = "There was a problem retrieving data from the server.";
	
			document.body.style.cursor = "auto";
		}
	}
}


function CategoryCtrlHM(Type)
{
        document.getElementById("inp_Type").value = Type;
     
        var option = document.getElementById("hdType").value;   
       	var opt = '3DBar';
       	
       	
       	  closeallMFC();
    
       	
       	
       if(Type=='EQUITY')
       {
       
       
       document.getElementById("MFC1").className="HomeSelect";
	    
       }
      if(Type=='Hybrid')
       {
       
         document.getElementById("MFC2").className="HomeSelect";
       }
       if(Type=='Debt')
       
       {
       
         document.getElementById("MFC3").className="HomeSelect";
       }
        
	var requestUrl = HostUrlForPages+"/Mutual-Fund/AjaxCategoryData.aspx?Type="+Type+"&option="+option+"&timeStamp="+ new Date().getTime();
	
		CreateXmlHttp4();
		document.body.style.cursor = "progress";
		if(XmlHttp4)	
			{
					XmlHttp4.onreadystatechange = function(){CatRetCtrlResponseHM();}; 
					XmlHttp4.open("GET", requestUrl,  true);
					XmlHttp4.send(null);
			}
			
        ShowChart(option,Type,'3DBar');
}

function CatRetCtrlResponseHM()
{
var MFFundID   = document.getElementById("MFFundID12");
	// To make sure receiving response data from server is completed
	if(XmlHttp4.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp4.status == 200)
		{			
		//	var MFFundID   = document.getElementById("MFFundID12");
          
			var strData = XmlHttp4.responseText;
			if(strData != "")
			{
				MFFundID.innerHTML   = strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			MFFundID.innerHTML = "There was a problem retrieving data from the server.";
	
			document.body.style.cursor = "auto";
		}
	}
}
function ShowChart(Option,Type,opt)
{

var ChartType = opt;

			var so = new SWFObject(HostUrlForPages+"/amcolumn/amcolumn.swf", "CategoryRet", "219", "175", "8", "#f1f1f1");
			
		so.addVariable("path", HostUrlForPages+"/amcolumn/");
		so.addVariable("settings_file", encodeURIComponent(HostUrlForPages+"/amcolumn/amcolumn_settings.xml"));
		var Url = HostUrlForPages+"/Mutual-Fund/AjaxCategoryRet.aspx?Option="+Option+"&timeStamp="+ new Date().getTime() +"&Type="+Type+"&opt="+ChartType; 
	    so.addParam("wmode","opaque");
		so.addVariable("data_file", encodeURIComponent(Url));
	    so.write("SectorAllocFlash");
		so.addParam("wmode","opaque");


}

	 
 function ItemMouseOver(currentRow)
    {
        oRow = document.getElementById(currentRow);

            oRow.originalBackgroundColor = oRow.style.backgroundColor
            oRow.style.backgroundColor = '#e5f3fe';
            
    }

    function ItemMouseOut(currentRow)
    {
        oRow = document.getElementById(currentRow);

            oRow.style.backgroundColor = oRow.originalBackgroundColor;

    }
    
    
 


	
function HomeMFNews()
{
  // alert(XmlHttpNews);
 var UserId = document.getElementById("inp_hid1").value;
		var requestUrl = "../mutua-fund/AjaxHomeNews.aspx?UserId="+ UserId +"&timeStamp="+ new Date().getTime();
	//alert(requestUrl);
		CreateXmlHttpNews();
		document.body.style.cursor = "progress";
		if(XmlHttpNews)	
			{
					XmlHttpNews.onreadystatechange = function(){HomeMFNewsResponse();}; 
					XmlHttpNews.open("GET", requestUrl,  true);
					XmlHttpNews.send(null);
			}
}

function HomeMFNewsResponse()
{

	// To make sure receiving response data from server is completed
	
	//alert(XmlHttpNews.readyState);
	if(XmlHttpNews.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNews.status == 200)
		{			
			var HomeMFNewsTd   = document.getElementById("HomeMFNews");
        
			HomeMFNewsTd.innerHTML = XmlHttpNews.responseText;					
			document.body.style.cursor = "auto";	
		}
		else
		{
			HomeMFNewsTd.innerHTML = "There was a problem retrieving data from the server.";
	
			document.body.style.cursor = "auto";
		}
	}
}



/*MF new fundOffers*/

 function showDefaultSel(Option)
	{

			var strURL = window.location.href;
			var prdval="";
			
			if(strURL.indexOf("Period=less1yr")>=0)
			{
			prdval="less1yr";
			}
			if(strURL.indexOf("Period=gtreq1year")>=0)
			{
			prdval="gtreq1year";
			}
			if(strURL.indexOf("Period=All")>=0)
			{
			prdval="All";
			}
		
			
			
			
		 if(strURL.indexOf("Option=ENFO")>=0)
			Option ="ENFO";
		else if(strURL.indexOf("Option=FNFO")>=0)
			Option ="FNFO";
		else if(strURL.indexOf("Option=FMP")>=0)
		{
			Option = "FMP";
		}
		else
		{
		Option = "ENFO";
		}
			
		if(Option == 'ENFO')
			{
			    document.getElementById("maintabs").style.display = 'inline';
			    document.getElementById("tblFirst").style.display = 'inline';		
		        document.getElementById("tblSecond").style.display = 'none';
		        document.getElementById("tblThird").style.display = 'none';
		        //document.getElementById("ctl00_ContentPlaceHolder1_lblPage").style.display = 'inline'; //false//
		        document.getElementById("FMP").style.display = 'none'; //true//
		        
		    }
		    else if(Option=="FMP")
		    {
		  
		        document.getElementById("tblFirst").style.display = 'none';		
		        document.getElementById("tblSecond").style.display = 'none';
		        document.getElementById("tblThird").style.display = 'inline';
		        document.getElementById("maintabs").style.display = 'none';
		       // document.getElementById("ctl00_ContentPlaceHolder1_lblPage").style.display = 'none';//flase//
		        //chkrd(prdval);
		  
		        
		    }
	        else 
	        {   
	            document.getElementById("maintabs").style.display = 'inline';
	            document.getElementById("tblFirst").style.display = 'none';		
		        document.getElementById("tblSecond").style.display = 'inline';
		        document.getElementById("tblThird").style.display = 'none';
		       // document.getElementById("ctl00_ContentPlaceHolder1_lblPage").style.display = 'inline'; //false//
		          document.getElementById("FMP").style.display = 'none';
		
		    }
		    
   }
   
   function ShowData(exchgVal,Option)
    {	   
    
      document.location = "nfo-updates.aspx?Option=" + Option; 
    }
 
 function loadMFData(Perfromance)
{
//alert("as");
	CreateXmlHttp()
	document.body.style.cursor = "progress";
	
	
	var requestUrl = "AjaxPerformanceData.aspx?status="+ Perfromance ;

	
	    document.location.href(requestUrl);

}	
 
 function loadTopGLData(Period,Category,TopGl)
{
//alert("as");
	CreateXmlHttp()
	document.body.style.cursor = "progress";
	var TopGl;
	if(Period=='')
		Period = "1YEAR";
	if(Category=='')	
		Category="ALL";
	
	var requestUrl = "performance.aspx?id=11&Period="+ Period +"&Category="+ Category +"&TB="+ TopGl;
    document.location.href(requestUrl);
	//alert(requestUrl);
//	if(XmlHttp)	{
//				XmlHttp.onreadystatechange = function(){TopGLResponse(TopGl)}
//				XmlHttp.open("GET", requestUrl,  true);
//				XmlHttp.send(null);
//			}
}	
	
	function TopGLResponse(TopGl)
{
            var FundPerformance = document.getElementById("FundPerformance");
			
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK

		if(XmlHttp.status == 200)
		{	
			var strGlData = XmlHttp.responseText
			
				FundPerformance.innerHTML = strGlData;
			 
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			
				FundPerformance.innerHTML = "There was a problem retrieving data from the server.";
			
			
			document.body.style.cursor = "auto";
		}
	}
}	
 
 
 function CreateXmlHttpNFO()
{
	try
	{
		XmlHttpNFO = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpNFO = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpNFO = null;				
		}
	}
	if(!XmlHttpNFO && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpNFO = new XMLHttpRequest();
	}
}
 
 
 
 
 
 
 
 
 
    function NFOUpdateCtrl(Option)
{

					
		LoadNFOUpdate(Option);
	
}


function LoadNFOUpdate(Option)
	{		
		CreateXmlHttpNFO();
		document.body.style.cursor = "progress";
		var UserId = document.getElementById("inp_hid1").value;
		var requestUrl = "AjaxNFOUpdateData.aspx?&Option="+Option+"&UserId="+UserId;
		
		if(XmlHttpNFO)	
			{
					
					XmlHttpNFO.onreadystatechange = function(){NFOUpdateResponse();}; 
					XmlHttpNFO.open("GET", requestUrl,  true);
					XmlHttpNFO.send(null);
			}
	}
	
	
	function NFOUpdateResponse()
{

	// To make sure receiving response data from server is completed
	if(XmlHttpNFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNFO.status == 200)
		{	
		//alert("in respnse OK")	;	
			var NFOId   = document.getElementById("NFOId");
			
			var strData = XmlHttpNFO.responseText;
			//alert(strData);
			if(strData != "")
			{
			
				NFOId.innerHTML   = strData;
				

			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			NFOId.innerHTML = "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}
	



 
 
 function Filename()
{

    var MFfiles = document.getElementById("ctl00_ContentPlaceHolder1_MFDownload_ddlMFfiles");
    if(MFfiles.value != "")
     {
       document.location.href = "MFHome.aspx?Srno="+MFfiles.value;
        
     }
 }

function CreateXmlHttpMFfile()
{
	try
	{
		XmlHttpMFfile = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpMFfile = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpMFfile = null;				
		}
	}
	if(!XmlHttpMFfile && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpMFfile = new XMLHttpRequest();
	}
}



function GetFile(file)
{

   var FundType=document.getElementById("ctl00_ContentPlaceHolder1_MFDownload_ddlAMC");
    var MFfiles = document.getElementById("ctl00_ContentPlaceHolder1_MFDownload_ddlMFfiles");

 




     if(FundType.value != "")
     {
//        document.getElementById("MFHeading").display.style = 'inline';
//        document.getElementById("MutualFundFiles").display.style = 'inline';
       //document.location.href = "../mutua-fund/AjaxMutualFundFiles.aspx?AmcCode="+FundType.value;
       var requestUrl = "AjaxMutualFundFiles.aspx?AmcCode="+FundType.value
      // alert(requestUrl);
        
     }
	CreateXmlHttpMFfile();
   // window.open(requestUrl) 
	if(XmlHttpMFfile!=null)	
	        {
				XmlHttpMFfile.onreadystatechange = function(){getResp(MFfiles)}
				XmlHttpMFfile.open('GET', requestUrl,  true);
				XmlHttpMFfile.send(null);
			}
			 return false; 
			 

}

function getResp(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpMFfile.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpMFfile.status == 200)
		{
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpMFfile.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];
					ig_.options[i].text = arrSchmCode[1];
				}
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "File 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";		
		}
	}
}

//for MF News Control
function getMFNews_Home(secid,subsecid,type)
{
  CreateXmlHttpLN();
  document.getElementById("NewsMFTD").innerHTML = "<table align=center><tr><td ><img src =../App_Themes/Common/images/ajax-loader.gif /></td></tr></table>";
  document.body.style.cursor = "progress";

    var requestUrl="../Mutual-Fund/AjaxMFHomeNews.aspx?Sec="+secid+"&SubSec="+subsecid+"&timeStamp="+new Date().getTime();
   
	if(XmlHttp_LN)
	{
		
		XmlHttp_LN.onreadystatechange=function(){getMFNewsData();};
		XmlHttp_LN.open("GET",requestUrl,true);
		XmlHttp_LN.send(null);
	}
}
function CreateXmlHttpLN()
{
    //Creating object of XMLHTTP in IE
	try
	{
	    XmlHttp_LN = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttp_LN = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp_LN = null;	
		}
	} 
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp_LN && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp_LN = new XMLHttpRequest();
	}
}

function getMFNewsData()
{
    if(XmlHttp_LN.readyState==4)
	{
	    if(XmlHttp_LN.status == 200)
		{
   		    document.getElementById("NewsMFTD").innerHTML=XmlHttp_LN.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			document.getElementById("NewsMFTD").innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}

function CreateXmlHttpNFO()
	{
		try
		{
			XmlHttpNFO = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpNFO = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpNFO = null;
					
			}
		}
		if(!XmlHttpNFO && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpNFO = new XMLHttpRequest();
		}
	}
	
	function GetNFO()
	{	
	//alert(Exchg);	
		CreateXmlHttpNFO();
		document.body.style.cursor = "progress";
		//document.getElementById("NFOID").innerHTML = " <img src='../App_Themes/Common/images/loading.gif'>";
		//if(Exchg=="NSE"){document.NseTickImg.src="../images/NSEon.gif";document.BseTickImg.src="../images/BSEoff.gif";}else{document.NseTickImg.src="../images/NSEoff.gif";document.BseTickImg.src="../images/BSEon.gif";}
		var requestUrl = "AjaxNFOData.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
		
		if(XmlHttpNFO){
			XmlHttpNFO.onreadystatechange = function(){getDataResponseGetNFO();};
			XmlHttpNFO.open("GET", requestUrl,  true);
			XmlHttpNFO.send(null);
		}
}
function getDataResponseGetNFO()
{
	if(XmlHttpNFO.readyState == 4)
	{	
	
		if(XmlHttpNFO.status == 200)
		{				
		
			
			var TalkingStockTD = document.getElementById("NFOID");
			var NewData = XmlHttpNFO.responseText;
			//alert(NewData);
						
			if(NewData != "")
		
				TalkingStockTD.innerHTML = NewData;				
				document.body.style.cursor = "auto";
				
		}
		
		//else
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}
function loadPerformData(Period,Category,TopGl)
{
    
	document.body.style.cursor = "progress";
	var TopGl;
	if(Period=='')
		Period = "1YEAR";
	if(Category=='')	
		Category="ALL";
	
	var requestUrl = "AjaxFundData.aspx?Period="+ Period +"&Category="+ Category +"&TopGl="+ TopGl;
    ajaxpage(1,requestUrl,'FundPerformance');
}

function ajaxpage(id,url, containerid)
{

    document.getElementById(containerid).innerHTML = "<table cellspacing=0 cellpadding=0 width=100%><tr><td height=60></td></tr><tr><td align=center><img src='../App_Themes/Common/images/ajax-loader.gif'></td></tr></table>";

    var page_request = false
        if (window.XMLHttpRequest) // if Mozilla, Safari etc
        page_request = new XMLHttpRequest()
        else if (window.ActiveXObject)
        { // if IE
                try {
                    page_request = new ActiveXObject("Msxml2.XMLHTTP")
                    } 
                catch (e){
                        try{
                            page_request = new ActiveXObject("Microsoft.XMLHTTP")
                            }
                        catch (e){}
                        }
        }


        page_request.onreadystatechange=function()
        {
            loadpage(page_request, containerid)
        }
        if (bustcachevar) //if bust caching of external page
        bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
        page_request.open('GET', url+bustcacheparameter, true)
         document.body.style.cursor = "auto";	
        page_request.send(null)    
}
function loadpage(page_request, containerid)
{
 //alert(page_request.status)
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
 {   
   
    document.getElementById(containerid).innerHTML=page_request.responseText}
}

