﻿// JScript File




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 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 = null;				
		}
	}
	if(!XmlHttp && typeof XMLHttpRequest != "undefined")
	{
		XmlHttp = new XMLHttpRequest();
	}
}



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 = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttp4 && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttp4 = new XmlHttpRequest();
		}
	}
	
	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,typ)
{
//alert("as");


 if(typ == 'Top')
     {
      document.getElementById("tdtop").className="TabSelected";
	  document.getElementById("tdbottom").className="TabUNselectedwhite";
	 
	  
	
     }
     if(typ =='Bott')
     {
     document.getElementById("tdtop").className="TabUNselectedwhite";
	  document.getElementById("tdbottom").className="TabSelected";
	
	 
     }
	CreateXmlHttp()
	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+"&typ="+typ;

	
	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 loadCatRet(option)
//	{		
//		//alert(Period);
//		var Type = document.getElementById("drptype").value;
//		CreateXmlHttp1();
//		document.body.style.cursor = "progress";
//		
//		
//		var requestUrl = "AjaxCategoryData.aspx?option="+option + "&Type="+Type;
//	//	alert(requestUrl);
//		if(XmlHttptest)	
//			{
//					//alert("hi");
//					XmlHttptest.onreadystatechange = function(){CatRetResponse();}; 
//					XmlHttptest.open("GET", requestUrl,  true);
//					XmlHttptest.send(null);
//			}
//	}	
	
//	//Called when response comes back from server Only For Category Return
//function CatRetResponse()
//{
//	// To make sure receiving response data from server is completed
//	if(XmlHttptest.readyState == 4)
//	{
//		// To make sure valid response is received from the server, 200 means response received is OK
//		if(XmlHttptest.status == 200)
//		{			
//			var EquityId   = document.getElementById("EquityId");
//          
//			var strData = XmlHttptest.responseText;
//			if(strData != "")
//			{
//				EquityId.innerHTML   = strData;
//			}
//			document.body.style.cursor = "auto";	
//		}
//		else
//		{
//			EquityId.innerHTML = "There was a problem retrieving data from the server.";
//	
//			document.body.style.cursor = "auto";
//		}
//	}
//}


//function CategoryCtrl(Type)
//{
//        
//      
//    var option = document.getElementById("PeriodDropList").value;
//		var requestUrl = "AjaxCategoryData.aspx?Type="+Type+"&option="+option;
//	//alert(requestUrl);
//		CreateXmlHttp4();
//		document.body.style.cursor = "progress";
//		if(XmlHttp4)	
//			{
//					XmlHttp4.onreadystatechange = function(){CatRetCtrlResponse();}; 
//					XmlHttp4.open("GET", requestUrl,  true);
//					XmlHttp4.send(null);
//			}
//}

//function CatRetCtrlResponse()
//{

//	// 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 EquityId   = document.getElementById("EquityId");
//          
//			var strData = XmlHttp4.responseText;
//			if(strData != "")
//			{
//				EquityId.innerHTML   = strData;
//			}
//			document.body.style.cursor = "auto";	
//		}
//		else
//		{
//			EquityId.innerHTML = "There was a problem retrieving data from the server.";
//	
//			document.body.style.cursor = "auto";
//		}
//	}
//}
	 
 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 = "../MutualFund/AjaxHomeNews.aspx?timeStamp="+ new Date().getTime()+ "&UserId="+UserId;
	//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 = "NewFundOffers.aspx?id=12&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 LoadNFOUpdateExst(Option)
	{	
	
		CreateXmlHttpNFOExst();
		document.body.style.cursor = "progress";
		
		var requestUrl = "AjaxNFOUpdateDataExst.aspx?Option="+Option;
		
		if(XmlHttpNFOExst)	
			{
					
					XmlHttpNFOExst.onreadystatechange = function(){NFOUpdateResponseExst();}; 
					XmlHttpNFOExst.open("GET", requestUrl,  true);
					XmlHttpNFOExst.send(null);
			}
	}
	
	
	function NFOUpdateResponseExst()
{

	// To make sure receiving response data from server is completed
	if(XmlHttpNFOExst.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNFOExst.status == 200)
		{	
		//alert("in respnse OK")	;	
			var NFOExstId   = document.getElementById("NFOExstId");
			
			var strData = XmlHttpNFOExst.responseText;
			//alert(strData);
			if(strData != "")
			{
			
				NFOExstId.innerHTML   = strData;
				

			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			NFOExstId.innerHTML = "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}


function CreateXmlHttpNFOExst()
{
	try
	{
		XmlHttpNFOExst = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpNFOExst = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpNFOExst = null;				
		}
	}
	if(!XmlHttpNFOExst && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpNFOExst = new XMLHttpRequest();
	}
}



 
 
 
 function LoadNFOUpdateForth(Option)
	{	
	
		CreateXmlHttpNFOForth();
		document.body.style.cursor = "progress";
		
		var requestUrl = "AjaxNFOUpdateDataForth.aspx?&Option="+Option;
		
		if(XmlHttpNFOForth)	
			{
					
					XmlHttpNFOForth.onreadystatechange = function(){NFOUpdateResponseForth();}; 
					XmlHttpNFOForth.open("GET", requestUrl,  true);
					XmlHttpNFOForth.send(null);
			}
	}
	
	
	function NFOUpdateResponseForth()
{

	// To make sure receiving response data from server is completed
	if(XmlHttpNFOForth.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNFOForth.status == 200)
		{	
		//alert("in respnse OK")	;	
			var NFOForthId   = document.getElementById("NFOForthId");
			
			var strData = XmlHttpNFOForth.responseText;
			//alert(strData);
			if(strData != "")
			{
			
				NFOForthId.innerHTML   = strData;
				

			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			NFOForthId.innerHTML = "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}


function CreateXmlHttpNFOForth()
{
	try
	{
		XmlHttpNFOForth = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpNFOForth = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpNFOForth = null;				
		}
	}
	if(!XmlHttpNFOForth && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpNFOForth = new XMLHttpRequest();
	}
}


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=""






function MFajaxpage(id,url, containerid,fincode)
{

//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/loading.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){}
                }
}
else
return false
page_request.onreadystatechange=function()
{
    MFloadpage(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)
page_request.send(null)
}


function MFloadpage(page_request, containerid)
{
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
  //alert(page_request.responseText)
    document.getElementById(containerid).innerHTML=page_request.responseText
}

 function MFGetNewsDetail(secId,SubSecId,NewsID,opt)
	{
	     document.getElementById("divNews").style.display='inline';
		 var requestUrl = "../PopupNewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&NewsID="+NewsID+"&timeStamp="+new Date().getTime()+"opt="+opt;
		 MFajaxpage('1',requestUrl,'TdNews');
	}
	
	
	
	
	
	
	// ADD by pankaj 13-03-2009 for MF Home Page
	
	
	var XmlHttpTS;

function CreateXmlHttpTS()
	{
		try
		{
			XmlHttpTS = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpTS = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpTS = null;
					
			}
		}
		if(!XmlHttpTS && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpTS = new XMLHttpRequest();
		}
	}
	
	
	
	
	
	
	
	function GetTalkingStockHot(SecID,SubSec)
	{	
	//alert(SecID);	
		CreateXmlHttpTS();
		document.body.style.cursor = "progress";
//		document.getElementById("TalkingStockTD").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 = "TalkingStockAjax.aspx?Sec="+ SecID +"&SubSec="+SubSec+"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
		//alert(requestUrl);
		if(XmlHttpTS){
			XmlHttpTS.onreadystatechange = function(){getDataResponseTalkingStock(SecID,SubSec);};
			XmlHttpTS.open("GET", requestUrl,  true);
			XmlHttpTS.send(null);
		}
}
function getDataResponseTalkingStock(SecID,SubSec)
{
	if(XmlHttpTS.readyState == 4)
	{	
	
		if(XmlHttpTS.status == 200)
		{				
		
		 if(document.getElementById("TalkingStockTD")==null)
		 {
		   GetTalkingStockHot(SecID,SubSec);
		 }
			
			var TalkingStockTD = document.getElementById("TalkingStockTD");
			var NewData =XmlHttpTS.responseText;
			//alert(NewData);
						
			if(NewData != "")
		
				TalkingStockTD.innerHTML = NewData;				
				document.body.style.cursor = "auto";
				
		}
		
		//else
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}

var XmlHttp1;

function CreateXmlHttp1()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttp1 = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttp1 = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttp1 = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttp1 && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttp1 = new XmlHttpRequest();
		}
	}







	
	
	
//	function loadCatRet_new(Type,option)
//	{		
//	
//		CreateXmlHttp1();
//	
//		document.body.style.cursor = "progress";
//		
//		var requestUrl = "AjaxCategoryData.aspx?Type="+Type+"&option="+option;
//		//alert(requestUrl);
//		if(XmlHttp1)	
//			{
//					
//					XmlHttp1.onreadystatechange = function(){CatRetResponse(Type,option);}; 
//					XmlHttp1.open("GET", requestUrl,  true);
//					XmlHttp1.send(null);
//			}
//			
//	}	
//	
	

//	
//	//Called when response comes back from server Only For Category Return
//function CatRetResponse(Type,option)
//{
//	// To make sure receiving response data from server is completed
//	if(XmlHttp1.readyState == 4)
//	{
//		// To make sure valid response is received from the server, 200 means response received is OK
//		if(XmlHttp1.status == 200)
//		{
//          
//		if(option=='1MONTHRET')
//		{
//		    document.getElementById("1W").className ="MFOptionSelected";
//		    document.getElementById("6M").className ="MFOptionUnSelected"; 
//		    document.getElementById("3M").className ="MFOptionUnSelected";
//		    document.getElementById("1Y").className ="MFOptionUnSelected"; 
//		    //document.getElementById("3Y").className ="MFOptionUnSelected";
//		    document.getElementById("hdneak").value="1W";
//		}
//		if(option=='6MONTHRET')
//		{
//		       document.getElementById("1W").className ="MFOptionUnSelected";
//		    document.getElementById("6M").className ="MFOptionSelected"; 
//		    document.getElementById("3M").className ="MFOptionUnSelected";
//		    document.getElementById("1Y").className ="MFOptionUnSelected"; 
//		   // document.getElementById("3Y").className ="MFOptionUnSelected";
//		    document.getElementById("hdneak").value="6M";
//		}
//		if(option=='3MONTHRET')
//		{
//		      document.getElementById("1W").className ="MFOptionUnSelected";
//		    document.getElementById("6M").className ="MFOptionUnSelected"; 
//		    document.getElementById("3M").className ="MFOptionSelected";
//		    document.getElementById("1Y").className ="MFOptionUnSelected"; 
//		    //document.getElementById("3Y").className ="MFOptionUnSelected";
//		     document.getElementById("hdneak").value="3M";
//		}
//		if(option=='1YEARRET')
//		{
//		    document.getElementById("1W").className ="MFOptionUnSelected";
//		    document.getElementById("6M").className ="MFOptionUnSelected"; 
//		    document.getElementById("3M").className ="MFOptionUnSelected";
//		    document.getElementById("1Y").className ="MFOptionSelected"; 
//		    //document.getElementById("3Y").className ="MFOptionUnSelected";
//		    document.getElementById("hdneak").value="1Y";
//		}
//		if(option=='3YEARRET')
//		{
//		
//		      document.getElementById("1W").className ="MFOptionUnSelected";
//		    document.getElementById("1M").className ="MFOptionUnSelected"; 
//		    document.getElementById("3M").className ="MFOptionUnSelected";
//		    document.getElementById("1Y").className ="MFOptionUnSelected"; 
//		    document.getElementById("3Y").className ="MFOptionSelected";
//		       document.getElementById("hdneak").value="3Y";
//		}






//	
//			var EquityId   = document.getElementById("EquityId");
//			
//			var strData = XmlHttp1.responseText;
//			//alert(strData);
//			if(strData != "")
//			{
//				
//				EquityId.innerHTML   = strData;
//				
//			}
//			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 XmlHttpNFO;

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'>";
	}
}
	
	
	
	var XmlHttpLoadPerform;

        function CreateXmlHttpLoadPerform()
	        {
		        try
		        {
			        XmlHttpLoadPerform = new ActiveXObject("Msxml2.XMLHTTP");
		        }
		        catch(e)
		        {
			        try
			        {
				        XmlHttpLoadPerform = new ActiveXObject("Microsoft.XMLHTTP");
			        } 
			        catch(oc)
			        {
				        XmlHttpLoadPerform = null;
        					
			        }
		        }
		        if(!XmlHttpLoadPerform && typeof XMLHttpRequest != "undefined") 
		        {
			        XmlHttpLoadPerform = new XMLHttpRequest();
		        }
	        }
         
	
	
	
	
	
	
	
	
function loadPerformData(Period,Category,TopGl)
{

	CreateXmlHttpLoadPerform();
	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;

	
	if(XmlHttpLoadPerform)	{
				XmlHttpLoadPerform.onreadystatechange = function(){GLResponse(TopGl)}
				XmlHttpLoadPerform.open("GET", requestUrl,  true);
				XmlHttpLoadPerform.send(null);
			}
}	
	
	function GLResponse(TopGl)
{
     
            var FundPerformance = document.getElementById("FundPerformance");
			
	// To make sure receiving response data from server is completed
	if(XmlHttpLoadPerform.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK

		if(XmlHttpLoadPerform.status == 200)
		{	
			var strGlData = XmlHttpLoadPerform.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 SearchCompany()
{

var Fund=document.getElementById("ctl00_ContentPlaceHolder1_FundCatCtrl1_ddlAMC");
var Cat=document.getElementById("ctl00_ContentPlaceHolder1_FundCatCtrl1_ddlCategory");
var Scheme=document.getElementById("ctl00_ContentPlaceHolder1_FundCatCtrl1_ddlScheme");
var HFund = document.getElementById("ctl00_ContentPlaceHolder1_FundCatCtrl1_txtFund").value=Fund.value ;
var HCat = document.getElementById("ctl00_ContentPlaceHolder1_FundCatCtrl1_txtScheme").value =Cat.value;
var HScheme = document.getElementById("ctl00_ContentPlaceHolder1_FundCatCtrl1_txtCategory").value =Scheme.value;

 //alert(Fund.value);

if(Fund.value=="" && Cat.value=="")
{
alert("Please Select Fund or Category");
Fund.focus();
return false;
}
else if(Scheme.value=="")
{
alert("Please Select Scheme");
Scheme.focus();
return false;
}
else
{

var strUrl="SnapShot.aspx?id=2&FundCode=" + HFund + "&Category=" + HCat+ "&SchemeCode=" + HScheme ;
//alert(strUrl);


 window.location.href=strUrl;
// var newWindow = window.open(strUrl, '_parent'); 
			
//newWindow.focus(); 
return false; 
}



}

   
    
    
//    
//    
//   function CategoryCtrl_New(Type)
//{
//	     var Type;
//    
//		document.getElementById("hdType").value =Type;
//		
//		
////		if(document.getElementById("hdneak").value=="1W")
////		{
////		    loadCatRet_new(Type,'1WEEKRET');
////		}
//		 if( document.getElementById("hdneak").value=="1W")
//		{
//		    loadCatRet_new(Type,'1MONTHRET');
//		}
//		else if( document.getElementById("hdneak").value=="3M")
//		{
//		    loadCatRet_new(Type,'3MONTHRET');
//		}
//			else if( document.getElementById("hdneak").value=="1Y")
//		{
//		    loadCatRet_new(Type,'1YEARRET');
//		}	
//		else if( document.getElementById("hdneak").value=="3Y")
//		{
//		    loadCatRet_new(Type,'3YEARRET');
//		}
//				
//			
//}

	
	//M
	function CreateXmlHttpNew1()
	{
		//Creating object of XMLHTTP in IE
		 
		try
		{
			XmlHttpFO = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttpFO = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpFO = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttpFO && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttpFO = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttpFO=false;
	        }
        }
        if (!XmlHttpFO && window.createRequest) 
        {
	        try 
	        {
		        XmlHttpFO = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttpFO=false;
	        }
        }
	}
	
    function openNews(NewsID)
    {
 
       //  document.getElementById("NewsDetails").style.display="inline";
        
        	CreateXmlHttpNew1();
        	document.getElementById("divNews").style.display = "inline";
		document.body.style.cursor = "progress";
		
		var requestUrl = "DerNews.aspx?timeStamp="+ new Date().getTime() +"&SecId=&SubSecID=&NewsID="+NewsID;
		//alert(requestUrl)
		if(XmlHttpFO)	{
					XmlHttpFO.onreadystatechange = function(){getNewsResp()};
					XmlHttpFO.open("GET", requestUrl,  true);
					XmlHttpFO.send(null);
				}
    }
    
    function getNewsResp()
{

	if(XmlHttpFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		
	   // alert(XmlHttpFO.status)
		if(XmlHttpFO.status == 200)//
		{
		//alert(NewTd.innerHTML);
		
			//var NewTd = document.getElementById("TDNews");
			//NewTd.innerHTML = XmlHttpFO.responseText;
		document.getElementById("TdHomeNews").innerHTML=XmlHttpFO.responseText;
			
			
						
			document.body.style.cursor = "auto";		
		}
		else
		{
			document.getElementById("TdHomeNews").innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}


