function getMouseXY(e) 
	{	
		if(IE)
		{
			tempX = event.clientX + document.body.scrollLeft;
			tempY = event.clientY + document.body.scrollTop;
		}
		else if(e.pageX || e.pageY)
		{
			tempX = e.pageX;
			tempY = e.pageY;
		}
		else if (e.clientX || e.clientY)
		{
			tempX = e.clientX + document.body.scrollLeft;
			tempY = e.clientY + document.body.scrollTop;
		}
		return true;
	}

	function show_options(m_sc_id, m_sc_dispid, m_sc_comp, m_topic_id,f_sc_ex1,f_ind1,url)
	{
		//alert('tt');
		f_sc_id = m_sc_id;
		f_sc_dispid = m_sc_dispid;
		f_sc_comp = m_sc_comp;
		f_topic_id = m_topic_id;
		f_sc_ex=f_sc_ex1;
		f_ind=f_ind1;
		f_url=url;
		//alert(screen.height);

		document.getElementById("head1").innerHTML = "Company: " + f_sc_comp;

		if(screen.height == 600)
			m_dir = 180;
		else
			m_dir = 320;
			//alert(document.body.scrollTop);
		if(tempY - document.body.scrollTop < m_dir)
			document.getElementById("popup").style.top = tempY + "px";
		else
			document.getElementById("popup").style.top = tempY - 10 + "px";
		document.getElementById("popup").style.left = tempX - 100 + "px";
		document.getElementById("popup").style.visibility = "visible";
		m_show = 1;
		//alert(document.getElementById("popup").style.top);
	}
	function hide_options()
	{
		if(m_show == 0)
			document.getElementById("popup").style.visibility = "hidden";
	}

	function id_click(m_id)
	{
		//alert(m_urls[m_id-1] + ":" + f_sc_id + ":" + f_sc_dispid + ":" + f_sc_comp + ":" + f_topic_id);
		if(m_id == 1)
			window.location = m_urls[m_id-1] + f_buy_id;
		else if(m_id == 2)
			window.location = m_urls[m_id-1] + f_buy_id;
		else if(m_id == 3)
			window.location = f_url;
			//window.location = m_urls[m_id-1] + f_sc_dispid;
		else if(m_id == 4)
			window.location = m_urls[m_id-1] + f_sc_comp+"/companyname/" + f_sc_comp + "/marketprice/" + f_sc_dispid;
		else if(m_id == 5)
			window.location = m_urls[m_id-1] + f_topic_id;
		else if(m_id == 6)
			window.location = m_urls[m_id-1] + f_sc_dispid;
		else if(m_id == 7)
			window.location = m_urls[m_id-1] + f_sc_comp;
		else if(m_id == 8)
			window.location = m_urls[m_id-1] + f_sc_id;
		else if(m_id == 9)
			window.location = m_urls[m_id-1] + f_sc_id;
		else if(m_id == 10)
			window.open('http://www.moneycontrol.com/india/bestportfoliomanager/'+hrm+'/nsebse/graph/scid/' + f_sc_id + '/scex/'+ f_sc_ex + '/company/' + f_sc_comp,'Chart','toolbar=no,menubar=no,location=no,scrollbars=no,titlebar=no,height=500,resizable=no,width=470,left=50,top=25');
		else if(m_id == 11)
		{
			if(f_sc_ex=='B')
				optex="BSE";
			else
				optex="NSE";
			window.location = m_urls[m_id-1] + optex + '&indcode=' + f_ind;
		}
		else if(m_id == 12)
			window.location = m_urls[m_id-1] + f_sc_dispid;
		else if(m_id == 13)
		{
			alert("The changes will take a few minutes to reflect in the portfolio");
			window.location = m_urls[m_id-1] + f_buy_id;
			}
	}

	function showbsense(ex,sc_id)
	{
		if(ex=='B')	
		{
				//document.getElementById('bsensegraph').src="http://www.moneycontrol.com/mcplus/portfolio/line_intraday_bsense_msgboard.php?sc_id="+sc_id+"&sc_ex="+ex;
				document.getElementById('tab51_1').style.display="block";
				document.getElementById('tab51_2').style.display="none";
				
				document.getElementById("bse").innerHTML="BSE";
				document.getElementById("nse").innerHTML="<a href=\"Javascript:void(0)\" onclick=\"showbsense('N','"+sc_id+"')\" class='blue_11'><u>NSE</u></a>";
		}
		else
		{
			
			document.getElementById('tab51_2').style.display="block";
			document.getElementById('tab51_1').style.display="none";
			//document.getElementById('bsensegraph').src="http://www.moneycontrol.com/mcplus/portfolio/line_intraday_bsense_msgboard.php?sc_id="+sc_id+"&sc_ex="+ex;
			document.getElementById("nse").innerHTML="NSE";
			document.getElementById("bse").innerHTML="<a href=\"Javascript:void(0)\" onclick=\"showbsense('B','"+sc_id+"')\" class='blue_11'><u>BSE</u></a>";	
		}		
		
	}
