/*News popup*/



function CreateXmlHttpNews()
{
	try
	{
		XmlHttpNews = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpNews = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpNews = null;				
		}
	}
	if(!XmlHttpNews && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpNews = new XMLHttpRequest();
	}
}

function GetMore(cocode)
{
    var wind_new;
    wind_new=window.open("../Watchlist/News/News.aspx?cocode="+cocode+" ", "", "status = 1, height = 450, width =540, resizable = 0,scrollbars=1,left=200,top=200" )
} 

function GetMoreann(cocode)
{
    var wind_new;
    wind_new = window.open("../Watchlist/News/Announcements.aspx?cocode=" + cocode + " ", "", "status = 1, height = 450, width =540, resizable = 0,scrollbars=1,left=200,top=200")
}

function GetMoreanalyst(cocode)
{
    var wind_new;
    wind_new = window.open("../Watchlist/News/Analysis.aspx?cocode=" + cocode + " ", "", "status = 1, height = 450, width =540, resizable = 0,scrollbars=1,left=200,top=200")
} 

function GetNewsinner(SrNo,compname)
{
  
//  var wind_new;
//  wind_new=window.open("News/NewsInner.aspx?srno="+srno+"&dat="+dt+"&comp="+compname+"", "", "status = 1, height = 450, width =540, resizable = 0,scrollbars=1,left=200,top=200" )

        var currentDivObj = document.getElementById(SrNo);
		
		var browser=navigator.appName;
        var trr;
        if(browser=="Microsoft Internet Explorer")
	    {
	        trr = "inline";
	    }
	    else
	    {
	        trr = "table-cell";
	    }		
		
		if(currentDivObj.style.display==trr)
		{
				currentDivObj.style.display ='none';
				eval("document.IMG"+SrNo+".src = 'images/narrow.gif'");
		}
		else
		{
				
				currentDivObj.style.display =trr;
				eval("document.IMG"+SrNo+".src = 'images/narrowdown.gif'");
				var tblObj=document.getElementById("NewsId").getElementsByTagName("td");
				var IdName;

				for(var i=1;i<tblObj.length;i++)
				{
					IdName = tblObj[i].id;
					//alert(IdName.id)
					if(IdName)
					
						if(IdName!=SrNo)
						{
							document.getElementById(IdName).style.display = "none";
							eval("document.IMG"+IdName+".src = 'images/narrow.gif'");
						}
				}
				if(currentDivObj.innerHTML=="")
				{
					currentDivObj.innerHTML ="<img src=images/loading2.gif>";
					CreateXmlHttpNews();
					document.body.style.cursor = "progress";
					var requestUrl = "../Watchlist/News/AnnInner.aspx?srno=" + SrNo + "&comp=" + compname + "&IpTrack=" + window.location.hostname + "&timeStamp=" + new Date().getTime();
					
					if(XmlHttpNews)	{
								XmlHttpNews.onreadystatechange = function(){getNewsDetResp(SrNo);};
								XmlHttpNews.open("GET", requestUrl,  true);
								XmlHttpNews.send(null);
							}
				}
			}	

} 

function getNewsDetResp(SrNo)
{
	
	if(XmlHttpNews.readyState == 4)
	{
		if(XmlHttpNews.status == 200)
		{
			document.getElementById(SrNo).innerHTML = XmlHttpNews.responseText;
			document.body.style.cursor = "auto";
		}
		else
			document.getElementById(SrNo).innerHTML = "<img src='images/loading2.gif'>";
	}
}

function GetAnninner(SrNo,compname)
{
//  var wind_new;
//  wind_new=window.open("News/AnnInner.aspx?srno="+srno+"&comp="+compname+"", "", "status = 1, height = 450, width =550, resizable = 0,scrollbars=1,left=200,top=200" )    

    var currentDivObj = document.getElementById(SrNo);
		
		var browser=navigator.appName;
        var trr;
        if(browser=="Microsoft Internet Explorer")
	    {
	        trr = "inline";
	    }
	    else
	    {
	        trr = "table-cell";
	    }		
		
		if(currentDivObj.style.display==trr)
		{
				currentDivObj.style.display ='none';
				eval("document.IMG"+SrNo+".src = 'images/narrow.gif'");
		}
		else
		{
				
				currentDivObj.style.display =trr;
				eval("document.IMG"+SrNo+".src = 'images/narrowdown.gif'");
				var tblObj=document.getElementById("NewsId131").getElementsByTagName("td");
				var IdName;

				for(var i=1;i<tblObj.length;i++)
				{
					IdName = tblObj[i].id;
					//alert(IdName.id)
					if(IdName)
					
						if(IdName!=SrNo)
						{
							document.getElementById(IdName).style.display = "none";
							eval("document.IMG"+IdName+".src = 'images/narrow.gif'");
						}
				}
				if(currentDivObj.innerHTML=="")
				{
					currentDivObj.innerHTML ="<img src=images/loading2.gif>";
					CreateXmlHttpNews();
					document.body.style.cursor = "progress";
					var requestUrl = "../Watchlist/News/AnnInner.aspx?srno=" + SrNo + "&comp=" + compname + "&IpTrack=" + window.location.hostname + "&timeStamp=" + new Date().getTime();
					if(XmlHttpNews)	{
								XmlHttpNews.onreadystatechange = function(){getNewsDetResp131(SrNo);};
								XmlHttpNews.open("GET", requestUrl,  true);
								XmlHttpNews.send(null);
							}
				}
			}  

}

function getNewsDetResp131(SrNo)
{
	
	if(XmlHttpNews.readyState == 4)
	{
		if(XmlHttpNews.status == 200)
		{
			document.getElementById(SrNo).innerHTML = XmlHttpNews.responseText;
			document.body.style.cursor = "auto";
		}
		else
			document.getElementById(SrNo).innerHTML = "<img src='images/loading2.gif'>";
	}
}

function GetAnainner(SrNo,compname)
{
//    var wind_new;
//    wind_new=window.open("News/AnalysisInner.aspx?srno="+srno+"&comp="+compname+"", "", "status = 1, height = 450, width =550, resizable = 0,scrollbars=1,left=200,top=200" )    

      var currentDivObj = document.getElementById(SrNo);
		
		var browser=navigator.appName;
        var trr;
        if(browser=="Microsoft Internet Explorer")
	    {
	        trr = "inline";
	    }
	    else
	    {
	        trr = "table-cell";
	    }		
		
		if(currentDivObj.style.display==trr)
		{
				currentDivObj.style.display ='none';
				eval("document.IMG"+SrNo+".src = 'images/narrow.gif'");
		}
		else
		{
				
				currentDivObj.style.display =trr;
				eval("document.IMG"+SrNo+".src = 'images/narrowdown.gif'");
				var tblObj=document.getElementById("NewsId121").getElementsByTagName("td");
				var IdName;
			
				for(var i=1;i<tblObj.length;i++)
				{
					IdName = tblObj[i].id;
					//alert(IdName.id)
					if(IdName)
					
						if(IdName!=SrNo)
						{
							document.getElementById(IdName).style.display = "none";
							eval("document.IMG"+IdName+".src = 'images/narrow.gif'");
						}
				}
				if(currentDivObj.innerHTML=="")
				{
					currentDivObj.innerHTML ="<img src=images/loading2.gif>";
					CreateXmlHttpNews();
					document.body.style.cursor = "progress";
					var requestUrl = "../Watchlist/News/AnalysisInner.aspx?srno=" + SrNo + "&comp=" + compname + "&IpTrack=" + window.location.hostname + "&timeStamp=" + new Date().getTime();
					if(XmlHttpNews)	{
								XmlHttpNews.onreadystatechange = function(){getNewsDetResp121(SrNo);};
								XmlHttpNews.open("GET", requestUrl,  true);
								XmlHttpNews.send(null);
							}
				}
			}  

}


function getNewsDetResp121(SrNo)
{
	
	if(XmlHttpNews.readyState == 4)
	{
		if(XmlHttpNews.status == 200)
		{
			document.getElementById(SrNo).innerHTML = XmlHttpNews.responseText;
			document.body.style.cursor = "auto";
		}
		else
			document.getElementById(SrNo).innerHTML = "<img src='images/loading2.gif'>";
	}
}

function GetHomeNewsDetail(Sr_no,title,cocode)
{
	var NewsWin;
	
	NewsWin = document.getElementById("cm_window").style.display='inline';
	NewsWin = document.getElementById("cm_window").style.top='400';
	
	var currentDivObj,currentTitle
	currentTitle = document.getElementById("Title");
	
	currentDivObj = document.getElementById("NewsId1");
		//alert(document.getElementById("NewsId1"));
	currentDivObj.innerHTML ="<img src=images/loading.gif>";
		//currentTitle.innerHTML = title
		
	CreateXmlHttpNews();
	document.body.style.cursor = "progress";
	var requestUrl = "../Watchlist/testnews.aspx?&SrNo=" + Sr_no + "&cocode=" + cocode + "";	
	
	if(XmlHttpNews)
	{
		XmlHttpNews.onreadystatechange = function(){getHomeDetails();};
		XmlHttpNews.open("GET", requestUrl,  true);
		XmlHttpNews.send(null);
	}	
}
function getHomeDetails()
{
	// To make sure receiving response data from server is completed
	
	if(XmlHttpNews.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNews.status == 200)
		{
				document.getElementById("NewsId1").innerHTML = XmlHttpNews.responseText;
				document.body.style.cursor = "auto";
		}
		

	}
}


function getDetails(opt)
{
	// 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)
		{
			if(opt=="in")
				
				document.getElementById("NewsId1").innerHTML = XmlHttp.responseText;
				document.body.style.cursor = "auto";
		}
		else
		{
			
			if(opt=="in")
				document.getElementById("NewsId1").innerHTML = "<img src='images/loading.gif'>";
		}
	}
}


