﻿/* Script For News Details*/


function Newspopup(SrNo,secId,SubSecId,opt,cocode) 					
{	
    document.getElementById("cm_window").style.display='inline';	
    var strUrl="../News/NewsDetails.aspx?srno="+SrNo+"&secid="+secId+"&Subsecid="+SubSecId+"&opt="+opt+"&cocode="+cocode;
    document.getElementById("NewsId").innerHTML="<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center' class='NoData'>Please Wait...</td></tr></table>";
    var ajax = new Ajax.Updater('NewsId',strUrl);    
    //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=480,height=320,screenX=0,screenY=0,left=260,top=70');	
    //newWin.focus();
}
function Annpopup(Exchg,cocode) 					
{	
    document.getElementById("cm_window").style.display='inline';	
    var strUrl="../HomeControls/AnnounceDetails.aspx?Exchg="+Exchg+"&cocode="+cocode;
    //alert(strUrl);
    document.getElementById("NewsId").innerHTML="<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center' class='NoData'>Please Wait...</td></tr></table>";
    var ajax = new Ajax.Updater('NewsId',strUrl);    
    //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=480,height=320,screenX=0,screenY=0,left=260,top=70');	
    //newWin.focus();
}		

function ShowA2Z1(redUrl_,Index)
{
	    //alert(redUrl_);
	    //alert(Index);
		var A2ZIndexId = document.getElementById("A2ZTd");
		//if(A2ZIndexId.innerHTML=="")
				//{
			var A2Z="";A2ZClass ="",A2ZClass1 ="";
			A2Z +="<table cellpadding='0' cellspacing='0' width='90%' border='0'><tr>"
				for(i=65; i<=90; i++)
					
					{
					var Alpha = String.fromCharCode(i);
					A2ZClass = (Index==Alpha) ? "AlphaLnkBold" : "AlphaLnk";
					A2Z += "<td width='18px' height='17px'><a href='"+redUrl_+"&Index="+ Alpha +"' class="+ A2ZClass+ "><span class="+A2ZClass+">"+ Alpha +"</span></a></td>";
				}
				A2ZClass = (Index=="0-9") ? "AlphaLnkBold" : "AlphaLnk";	
			 
				A2ZClass1 = (Index=="") ? "AlphaLnkBold" : "AlphaLnk";	
				A2ZIndexId.innerHTML = A2Z + "<td width='35px' height='17px'><a href='"+redUrl_+"&Index=0-9' class="+ A2ZClass +"><span class="+A2ZClass+">0-9</span></a></td><td width='35px' height='17px'><a href='"+redUrl_+"&Index=' class="+ A2ZClass1 +"><span class="+A2ZClass1+">All</span></a></td></tr></table>";
		 			 
	}
	
	
	// Company Profile 
var arrFAO		=  new Array('ALL Contracts','ALL Futures','ALL Options','NIFTY Futures','NIFTY Options','BANKNIFTY Futures','BANKNIFTY Options','CNXIT Futures','CNXIT Options','STOCK Futures','STOCK Options');
var arrFAOCode	=  new Array('','FUT','OPT','FUTIDX|NIFTY','OPTIDX|NIFTY','FUTIDX|BANKNIFTY','OPTIDX|BANKNIFTY','FUTIDX|CNXIT','OPTIDX|CNXIT','FUTSTK','OPTSTK');
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/GetQuote.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 sector watch-------------------
 function fun12(symb,clt,op,op1,hg,lo,wh52,wl52,cl,bby,bsel,dat,vol)
{	
	var tempStr
	tempStr="<TABLE cellSpacing=0 cellPadding=0 width='100%' height='275px' align=center border=0 bordercolor=lavender bgcolor=white >"
	tempStr=tempStr+"<TR>"
	 tempStr=tempStr+"<TD     style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial, Verdana;color:#FFFFFF;size:10px' colspan=2 align=center bgcolor=#FF7700>"+symb+"</TD></TR>"
		tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial, Verdana;padding-left:5px;'><font size=2>Last Price</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+clt+"</TD></TR>"
	 tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>Change</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+op+"</TD></TR>"
	  tempStr=tempStr+"<TR>"
	   tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>% Change</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+op1+"</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>High</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+hg+"</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>Low</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+lo+"</TD></TR>"
	 tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>Prev Closing</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+cl+"</TD></TR>"
	 tempStr=tempStr+"<TR>"
		 tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>Volume</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+vol+"</TD></TR>"
	  
	  
	  tempStr=tempStr+"<TR>"
	   tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>Best Buy</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+bby+"</TD></TR>"
	  tempStr=tempStr+"<TR>"
	   tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>Best Sell</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+bsel+"</TD></TR>"
	  tempStr=tempStr+"<TR>"
	   tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>Traded Date</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+dat+"</TD></TR>"
	  tempStr=tempStr+"<TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>52 Week High</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+wh52+"</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;font-weight:bold;FONT-FAMILY:Arial,  Verdana;padding-left:5px;'><font size=2>52 Week Low</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid;FONT-FAMILY:Arial,  Verdana;'><font size=2>"+wl52+"</TD></TR>"
	  //tempStr=tempStr+"<TR>"
		//tempStr=tempStr+"<TD></TD>"
		tempStr=tempStr+"</TABLE>"
		
	//dispdet=document.getElementById("dispdet");
	document.getElementById("dispdet").innerHTML=tempStr;
	//window.dispdet.innerHTML=symb;
	}
 function fun13(){
	var tempStr
	tempStr="<TABLE cellSpacing=0 cellPadding=0 width='100%' height='275' align=center border=0 bordercolor=lavender bgcolor=white>"
	tempStr=tempStr+"<TR>"
	 tempStr=tempStr+"<TD   style='border-bottom:#D4D0C8 1px solid' colspan=2 align=center ><font size=2>&nbsp;</TD></TR>"
		  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	 
	 tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  tempStr=tempStr+"<TR>"
		 tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TR>"
		 tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TR>"
		 tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  tempStr=tempStr+"<TR>"
		tempStr=tempStr+"<TR>"
		 tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD>"
		tempStr=tempStr+"<TD  style='border-bottom:#D4D0C8 1px solid'><font size=1>&nbsp;</TD></TR>"
	  //tempStr=tempStr+"<TR>"
		//tempStr=tempStr+"<TD></TD>"
		tempStr=tempStr+"</TABLE>"
		//dispdet=document.getElementById("dispdet");
	window.dispdet.innerHTML=tempStr
}
function ShowCalendar(FromDt)
{
	Calendar.setup({
	button         :   "image1",
	inputField     :   FromDt,   //name of the textbox where date is entered..
	ifFormat       :   "%m/%d/%Y",
	eventName	   :   "click",
	singleClick	   :   true
				});
}

function ShowCalendar1(ToDt)
{
	Calendar.setup({
	button         :   "image2",
	inputField     :   ToDt,   //name of the textbox where date is entered..
	ifFormat       :   "%m/%d/%Y",
	eventName	   :   "click",
	singleClick	   :   true
				});
}


