// JavaScript Document
/*To load page inside iFrame: start here*/
function loadURL(pageURL){
document.location.href = pageURL;
}
/*To load page inside iFrame: end here*/

/*Function to show-hide Stock chart on Home Page: starts here*/
function stockChart(sId1, sId2,linkId1,linkId2,spanId1,spanId2){
	document.getElementById(sId1).style.display='inline';
	document.getElementById(sId2).style.display='none';	
	document.getElementById(spanId1).className='redtxt';
	document.getElementById(spanId2).className='bluetxt';		
	document.getElementById(linkId1).className='mbgon';
	document.getElementById(linkId2).className='mbgof';	
}
/*Function to show-hide Stock chart on Home Page: ends here*/

/* To search topnav.jsp: start here */
function ScripNameOnFocus()
{	
	var txtScripName = document.getElementById("Top1_TxtQuotes");
		
	if(txtScripName.value=='Scrip Name')
	{
		txtScripName.value="";
		return true;
	}	
	return false;
}
function ScripNameOnBlur()
{	
	var txtScripName = document.getElementById("Top1_TxtQuotes");	
		
	if(TrimSpaces(txtScripName.value)=='')
	{
		txtScripName.value="Scrip Name";
		return true;
	}	
	return false;
}

function winpopup(strUrl)
{	
	 var 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=350,screenX=0,screenY=0,left=210,top=200');	
	 newWin.focus();
}

function goToIndustry(indName)
{

	var industryName=new Array('FMCG','Telecom','Media','Information Technology','Power','Automobiles','Pharma','Financial Services','Cement');

	var industryCode=new Array('00000054','00000090','00000047','00000027','00000076','00000008','00000070','00000051','00000018');

	var indCode;
	for(i = 0; i<industryName.length;i++)
		{
			if(industryName[i]==indName)
			{
				indCode=industryCode[i];
				break;
				}
		}
	document.location="../Markets/MarketInfo/sectorWatchAction.do?reqCode=getIndustry&industry="+indCode;	
}


/**/
	/* Below is utility function used to trim the space in String */
	function TrimSpaces(checkString)
	{
	    newString = "";    // REVISED/CORRECTED STRING
	    for (i = 0; i < checkString.length; i++) 
	    {
	        ch = checkString.substring(i, i+1);
	        if (ch != " " ) 
	        {
	            newString += ch;
	        }
	    }
	        return newString;
	}
	
	
function Show(Tab1,Tab2,Tab3,Tab4)
{
var GTableId = document.getElementById(Tab1);
var LTableId = document.getElementById(Tab2);
var Tab1 = document.getElementById(Tab3);
var Tab2 = document.getElementById(Tab4);

GTableId.style.display = 'inline';
LTableId.style.display = 'none';
Tab1.className = 'mbgon';
Tab2.className = 'mbgof';

/*ShowColumn('NseGainTable','NseLoseTable','P','G1','G2')
ShowColumn('NseATable','NseDTable','P','g3','g4')
ShowColumn('NseHTable','NseLowTable','P','g5','g6')*/
}

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("popup").style.left = tempX + "px";
 	document.getElementById("popup").style.top = tempY + "px";
 	document.getElementById("popup").style.visibility = "visible";
 	m_show = 1;
 }	