/*For News Popup*/
function CreateXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpCom = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpCom = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpCom = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpCom && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpCom = new XMLHttpRequest();
		}
		
	}


	
function WinPopup(strUrl)
{	
	 var newWin=window.open(strUrl,'MyWindow2','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=580,height=450,screenX=0,screenY=0,left=210,top=200');	
}	
function EnterScript(e,id)
{
	if(e.keyCode==13)	
	{
		var Scripid = document.getElementById(id);
		Scripid.click();
	}
}
function Dataempty()
{
	if (document.getElementById("txtQuote").value=="Enter Scrip")
	{
  		document.getElementById("txtQuote").value="";
	}
}
function details(sno,secid,subsecid)
 {
	var wind_new;
	wind_new=window.open("../newsdetails.aspx?sno="+sno+"&secid="+secid+"&subsecid="+subsecid+"", "DetailNews", "status = 1, height = 350, width =500, resizable = 0,scrollbars=1,left=200,top=200" )
	wind_new.focus();
 }







var tempX = 0;
 var tempY = 0;
 var m_show = 0;
 var f_sc_id = "";
 var f_sc_dispid = "";
 var f_sc_comp = "";
 var f_topic_id = 0;
 var f_buy_id =0;
// smart quotes/buy/ sell/company snapshot/compan/ news/financial summary/chartin
 var m_urls = Array('../profiles/CorpInfo.aspx?&id=12','../profiles/CorpInfo.aspx?id=13','../profiles/CorpInfo.aspx?id=14','../profiles/CorpInfo.aspx?id=18','../profiles/CorpInfo.aspx?id=17','../profiles/CorpInfo.aspx?id=19','../profiles/CorpInfo.aspx?id=16');
 

 //setInterval("hide_popup1()",1000);
 
 var IE = document.all?true:false
 
 if (!IE) document.captureEvents(Event.MOUSEMOVE)
 document.onmousemove = getMouseXY;
 
 function getMouseXY(e) 
 {
 	if(IE)
 	{
 	    tempX = event.clientX + document.body.scrollLeft;
 		tempY = event.clientY + document.body.scrollTop;
 	}
 	else
 	{
 		tempX = e.pageX;
 	    tempY = e.pageY;
 	}
 	return true;
 }



function show_popup1(m_im_id, m_im_shortdesc, m_im_desc, m_ff_desc, m_ff_id, m_fundclass)
 {
 	f_im_id = m_im_id;
 	f_im_shortdesc = m_im_shortdesc;
 	f_im_desc = m_im_desc;
 	f_ff_desc = m_ff_desc;
 	f_ff_id = m_ff_id;
 	f_fundclass = m_fundclass;
 
 	//document.getElementById("head1").innerHTML = " Company Profile " ;
 	document.getElementById("popup").style.left = tempX + "px";
 	document.getElementById("popup").style.top = tempY + "px";
 	document.getElementById("popup").style.visibility = "visible";
 	m_show = 1;
 }
  function hide_popup1()
 {
 	if(m_show == 0)
 		document.getElementById("popup").style.visibility = "hidden";
 }
 
 function id_click(m_id)
 {
 //alert(m_id)
 //alert(m_urls[m_id-1] + "+" + f_im_id);
 	//return false;
 
 	if(m_id == 1)
 		window.location = m_urls[m_id-1]+"&code=" + f_im_id  ;
 	else if(m_id == 2)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
 	else if(m_id == 3)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
 	else if(m_id == 4)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
 	else if(m_id == 5)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 6)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;	
	else if(m_id == 7)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else
 		window.location = m_urls[m_id-1] + f_im_id;
 
 	
 }
 
 function ShowA2Z(redUrl_,Index){
 
	var A2ZIndexId = document.getElementById("A2ZTd");
	if(A2ZIndexId.innerHTML==""){
		var A2Z="";A2ZClass ="";
			for(i=65; i<=90; i++)
				
				{
				var Alpha = String.fromCharCode(i);
				A2ZClass = (Index==Alpha) ? "IndexLinkSel" : "IndexLink";
				A2Z += "<a href='"+redUrl_+"&Index="+ Alpha +"' class="+ A2ZClass+ ">"+ Alpha +"</a>";
			}
			A2ZClass = (Index=="0-9") ? "IndexLinkSel" : "IndexLink";	
			A2ZIndexId.innerHTML = A2Z + "<a href='"+redUrl_+"&Index=0-9' class="+ A2ZClass +">0-9</a>";
	}
	else
		A2ZIndexId.innerHTML = "";			
}
 
function A2ZIndex(Index,Group,id,Opt){
	var A2ZIndexId = document.getElementById("A2ZIndex");
	if(A2ZIndexId.innerHTML==""){
		var A2Z="",A2ZClass ="";
			for(i=65; i<=90; i++)
			{
				var Alpha = String.fromCharCode(i);
				A2ZClass = (Index==Alpha) ? "IndexLinkSel" : "IndexLink";
				A2Z += "<a href='marketstat.aspx?id="+id+"&Index="+ Alpha +"&Group="+Group+"&Opt="+Opt+"' class="+ A2ZClass +" >"+ Alpha +"</a>";
			}
			A2ZClass = (Index=="0-9") ? "IndexLinkSel" : "IndexLink";	
			A2ZIndexId.innerHTML = A2Z + "<a href='marketstat.aspx?id="+id+"&Index=0-9&Group="+Group+"&Opt="+Opt+"' class="+ A2ZClass +" >0-9</a>";
	}
	else
		A2ZIndexId.innerHTML = "";
				
	}
	
	function SelectNewScheme()
	{
		var fund = document.getElementById("_ctl0_drp_FundHouse");
		var category = document.getElementById("_ctl0_drp_Category");
		var scheme = document.getElementById("_ctl0_drp_Scheme");
		scheme.length = 0;
		scheme.options[0] = new Option(); 
		scheme.options[0].value = "";
		scheme.options[0].text = "Select Scheme";	
		CreateXmlHttpNew();		
		document.body.style.cursor = "progress";
		var requestUrl = "MF_CategoryData.aspx?Fund="+ fund.value;
		if(XmlHttpCom)	{
					XmlHttpCom.onreadystatechange = function(){getSchemeResp1(category);};
					XmlHttpCom.open("GET", requestUrl,  true);
					XmlHttpCom.send(null);
				}
	}
	
	
	
	function getSchemeResp1(ig_)
{
	
	// To make sure receiving response data from server is completed
	if(XmlHttpCom.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpCom.status == 200)
		{
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpCom.responseText
			if(strData != "") {	
				var arrSchm = strData.split("|");
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Select Category";	
				for(i=1; i<arrSchm.length; 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 = "No Categories 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";		
		}
	}
}

function SelectScheme(ig_,ig_a,ig_b)
	{

		
		var fund = document.getElementById("_ctl0_drp_FundHouse");
		var category = document.getElementById("_ctl0_drp_Category");
		var scheme = document.getElementById("_ctl0_drp_Scheme");
		
		CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "MF_SchemeData.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+ new Date().getTime() +"&Fund="+ fund.value +"&Category="+category.value;
		
		if(XmlHttpCom)	{
					XmlHttpCom.onreadystatechange = function(){getSchemeResp(scheme)};
					XmlHttpCom.open("GET", requestUrl,  true);
					XmlHttpCom.send(null);
				}
	}
	
//Called when response comes back from server Only For MF_SchemeData
function getSchemeResp(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpCom.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpCom.status == 200)
		{
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpCom.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 = "Scheme 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";		
		}
	}
}

function SearchQuote()
	{
		
		var SrchQuote = document.getElementById("txt_Symbol").value;
		var PageId = document.getElementById("DD_Options").value;	
		var StrUrl = "CompSearch.aspx?schtxt="+SrchQuote+"&id="+PageId;
		if(SrchQuote !="")
		{
			window.location = StrUrl;
		}
		else
		{
			alert("Please enter company name ..!!!");
			return false;
		}
				
   }
   
function Event(e,id)
{
{
		if(e.keyCode==13)	
		{
			//var Scripid = document.getElementById(id);
			var boolval = SearchQuote();
			if(boolval)
			return true;
			else
			return false;
		}
	}
}

function EnterScript1(e,id)
{
	if(e.keyCode==13)	
	{
		var Scripid = document.getElementById(id);
		Scripid.click();
	}
}

function Compempty()
{

if (document.getElementById("txt_Quote2").value=="Change Company")
{
  	document.getElementById("txt_Quote2").value="";
 }
}

function Compfill()
{
	var getquote=document.getElementById("txt_Quote2").value;
	if (getquote=="")
	{
		document.getElementById("txt_Quote2").value="Change Company";
	}
}

 function CompValidate()
	{
		
		var SrchQuote = document.getElementById("txt_Quote2");
		
		var StrUrl = "../Profiles/CompSearch.aspx?id=12&schtxt="+SrchQuote.value;
		
			
		if((SrchQuote.value=="") ||(SrchQuote.value=="Change Company"))
		{
			alert("Please enter company name ..!!!");
		}
		else
		{
			window.location = StrUrl;
		}
		
}

function applyformWinPopup(strUrl)
{	
	 var newWin=window.open(strUrl,'MyWindow2','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=580,height=430,screenX=0,screenY=0,left=210,top=200');	
}





