
//--------------Function For Home Page Popup Window------------//
function GetNewsDetail1(SrNo,secId,SubSecId,opt)
{	
    //window.open("NewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&SrNo="+ SrNo+"&opt="+opt,"A","toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=no,width=520px,height=320px,left=200px,top=230px");
	var strUrl="http://www.cmlinks.in/moneyvistas/NewsData.aspx?srno="+SrNo+"&secid="+secId+"&Subsecid="+SubSecId+"&opt="+opt;    
    var newWin=window.open(strUrl,'FavWindow','x=0,y=0,toolbar=no,titlebar=no,location=no,directories=no,status=no,scrollbars=no,resizable=0,copyhistory=no,width=515,height=420,screenX=0,screenY=0,left=260,top=70');	
    newWin.focus();		
}	
function GetNewsDetail(SrNo,secId,SubSecId,opt)
{	
    //window.open("NewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&SrNo="+ SrNo+"&opt="+opt,"A","toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=no,width=520px,height=320px,left=200px,top=230px");
	var strUrl="http://www.cmlinks.in/moneyvistas/NewsData.aspx?srno="+SrNo+"&secid="+secId+"&Subsecid="+SubSecId+"&opt="+opt;    
    var newWin=window.open(strUrl,'FavWindow','x=0,y=0,toolbar=no,titlebar=no,location=no,directories=no,status=no,scrollbars=no,resizable=0,copyhistory=no,width=515,height=420,screenX=0,screenY=0,left=260,top=70');	
    newWin.focus();		
}	

//-----------Fucntion for Home ticker ---------------------//

function gettickdata(Exchg)
{
   if(Exchg=="BSE")
   {
      document.getElementById("tdbse").className ="Tickseltab";
      document.getElementById("tdnse").className ="Tickunseltab";
   }
   else
   {
      document.getElementById("tdbse").className ="Tickunseltab";
      document.getElementById("tdnse").className ="Tickseltab";       
   }       
   var url="Tickerdata.aspx?Exchg="+Exchg;
   document.getElementById("tdtickerdata").innerHTML="<table cellspacing='0' cellpadding='0' width='100%' height='19px' border='0'><img src='images/loading.gif'></table>";
   var ajax =new Ajax.Updater('tdtickerdata',url);
   window.setTimeout('tickerStart()',1000);
}
function tickerStart()
{   
	if(document.getElementById('marq')!=null)
	{
		document.getElementById('marq').start();       
	}
	else
	{
		window.setTimeout('tickerStart()',1000);
	}		
}
//---------Function for Home chart-------------------------//

function showchart(Exchg)
{
   if(Exchg=="NSE")
   {
      document.getElementById("tdnseon").style.display="inline"
      document.getElementById("tdbseon").style.display="none"       
   }
   else if(Exchg=="BSE")
   {
       document.getElementById("tdbseon").style.display="inline"
       document.getElementById("tdnseon").style.display="none"       
   }
  document.getElementById("tdchart").innerHTML="<table cellspacing='0' cellpadding='0' width='100%' align='center' border='0'><tr><td align='center' valign='middle' height='160px'><img src='images/loading.gif'></td></tr></table>";
  var url ="ChartData.aspx?Exchg="+Exchg;
   var ajax =new Ajax.Updater('tdchart',url);  
}

function PeerCompareCompany_paging(PageNo)
{
    var Last1 = document.getElementById("Lastpage1");
    var Prev1 = document.getElementById("PrevPage1");
    var Next1 = document.getElementById("NextPage1");
	
    var cocode = document.getElementById("Fcode").value;
    //alert(cocode);
	
    var PeerCompanyData = document.getElementById("PeerCompanyData");
    //BulkDealsvalue.innerHTML = "<img src='../images/loading1.gif'>";
    var Peer_Url1 = "PeerCompareCompList.aspx?PageNo1=0&cocode="+cocode; 
    if (PageNo =="P")
    {
        var Peer_Url1 = "PeerCompareCompList.aspx?PageNo1="+Prev1.value+"&cocode="+cocode;
    }
    else if (PageNo =="N")
    {
        var Peer_Url1 = "PeerCompareCompList.aspx?PageNo1="+Next1.value+"&cocode="+cocode;
    }
    //alert(Peer_Url1);
    var ajax = new Ajax.Updater('PeerCompanyData',Peer_Url1);
}	
     
function Newspopup(SrNo,secId,SubSecId,opt) 					
{	
    var strUrl="http://www.cmlinks.in/moneyvistas/NewsDetails.aspx?srno="+SrNo+"&secid="+secId+"&Subsecid="+SubSecId+"&opt="+opt;
    //document.getElementById("NewsId").innerHTML="<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center'><img src='../images/loadig1.gif'></td></tr></table>";
    var newWin=window.open(strUrl,'FavWindow','x=0,y=0,toolbar=no,titlebar=no,location=no,directories=no,status=no,scrollbars=no,resizable=0,copyhistory=no,width=515,height=430,screenX=0,screenY=0,left=260,top=70');	
    newWin.focus();
}	

//---------------Function for Company profile quote finder.aspx
var XmlHttpComp;
function CreateXmlHttpComp()
{
	
		try
		{
			XmlHttpComp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpComp= new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpComp= null;
					
			}
		}
		if(!XmlHttpComp && typeof XMLHttpRequest != "undefined")
    {
        XmlHttpComp= new XMLHttpRequest();
    }
    return XmlHttpComp;
}

function searchcomp()
 {
	var txtGQuotes= document.getElementById("txtGQuotes");
		if(txtGQuotes.value=="Enter Company Name")
		{
			alert("Please Enter some text");
		}
		else
		{
 			var SearchResult = document.getElementById("complist");
			document.getElementById("complist").style.display="inline";
			if(document.getElementById("tdCompDrop")!=null)
			    document.getElementById("tdCompDrop").style.display="inline";
		
			CreateXmlHttpComp();
			document.body.style.cursor = "progress";
			var requestUrl = "../CompanyProfile/QuoteFindData.aspx?schtxt="+escape(txtGQuotes.value);			
			if(XmlHttpComp) 
			{
				XmlHttpComp.onreadystatechange = function(){fillCompResp(SearchResult)};
				XmlHttpComp.open("GET", requestUrl, true);
				XmlHttpComp.send(null);
			}
		}
	}

	function fillCompResp(ig_)	
	{	
		if(XmlHttpComp.readyState == 4)
		{
			if(XmlHttpComp.status == 200)
			{
			 var strData = XmlHttpComp.responseText;
				if(strData != "") 
				{
					var arrComp = strData.split("|");
					ig_.length = 0;

					for(i=0; i<arrComp.length-1; i++) 
					{	
					var strComp = arrComp[i];
					var arrCoCode = strComp.split("~");
	
					ig_.options[i] = new Option();
					ig_.options[i].value = arrCoCode[0];
					ig_.options[i].text = arrCoCode[1];
				}

			}
			else
			{
				ig_.length = 0;
				ig_.options[0] = new Option();
				ig_.options[0].value = "";
				ig_.options[0].text = "No Data Found";
			}
			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";
		 }
		}
	}
	
//-----------Function for derivates ticker page----------------//
function showtickdata(Exchg,opt)
{
   if(Exchg=="")
      Exchg=document.getElementById("hdExchg").value;
  
   if(opt=="")
      opt="FUT";
   if(opt=="FUT")
   {
      document.getElementById("tdfut").className ="Tickseltab";
      document.getElementById("tdopt").className ="Tickunseltab";
   }
   else
   {
      document.getElementById("tdfut").className ="Tickunseltab";
      document.getElementById("tdopt").className ="Tickseltab";       
   }    
   if(Exchg=="IND")
   {
      document.getElementById("tdindex").className ="Tickseltab";
      document.getElementById("tdstock").className ="Tickunseltab";
   }
   else
   {
      document.getElementById("tdindex").className ="Tickunseltab";
      document.getElementById("tdstock").className ="Tickseltab";       
   }      
   document.getElementById("hdExchg").value=Exchg;  
   var url="../Derivatives/DeriTickerData.aspx?opt="+opt+"&Exchg="+Exchg;
   //alert(url);
   document.getElementById("tdDeriTick").innerHTML="<table cellspacing='0' cellpadding='0' width='100%' height='19px' border='0'><tr><td align='center'><img src='../images/loading.gif'></td></tr></table>";
   var ajax =new Ajax.Updater('tdDeriTick',url);
   window.setTimeout('tickerStart1()',1000);
}
function tickerStart1()
{   
	if(document.getElementById('marq')!=null)
	{
		document.getElementById('marq').start();       
	}
	else
	{
		window.setTimeout('tickerStart1()',1000);
	}		
}
