//Global Variables
 var tempX = 0;
 var tempY = 0;
 var m_show = 0;

// smart quotes/buy/ sell/company snapshot/compan/ news/financial summary/Chartin
 var m_urls = Array('/Markets/CompanyInfo/SharePrice.do?reqCode=sharePriceInfo','../InvestSmartIndiaNew/Profiles/shareprice.asp?pageOpt=8','../Profiles/shareprice.asp?pageOpt=8','../profile/SnapShot.aspx?mno=4&index=0&id=1','../profile/GenInfoPage.aspx?mno=4&index=0&id=4','../profile/FinanceSummary.aspx?mno=4&index=0&id=16','../profile/SharePricePage.aspx?mno=4&index=0&id=7');
  
 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("popup").style.left = tempX + "px";
 	document.getElementById("popup").style.top = tempY + "px";
 	document.getElementById("popup").style.visibility = "visible";
 	m_show = 1;
 }
 //Revamp
  
 
 function hide_popup1()
 {
 	if(m_show == 0)
 		document.getElementById("popup").style.visibility = "hidden";
 }
 function id_click(m_id)
 {
 	var path=document.URL;		
 	var i=path.indexOf("Markets");
 	if(i>0)
 		path=path.substring(0,i);	
 	if(m_id == 1)
 	{
 		document.getElementById('selectOption').value="Smart Quotes";
 		document.getElementById('coName').value=""; 		
 		document.getElementById('coCode').value=f_im_id;
 		document.getElementById('popupForm').action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		
 		document.getElementById('popupForm').submit();		
 		}
 	else if(m_id == 2) 				 		
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 3) 		
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 4)
 	{ 		
 		document.getElementById('selectOption').value="Company Snapshot";
 		document.getElementById('coName').value=""; 		
 		document.getElementById('coCode').value=f_im_id;
 		document.getElementById('popupForm').action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		
 		document.getElementById('popupForm').submit();	 	
 		}
 	else if(m_id == 5)
 	{
 		document.getElementById('selectOption').value="Company News";
 		document.getElementById('coName').value=""; 		
 		document.getElementById('coCode').value=f_im_id;
 		document.getElementById('popupForm').action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		
 		document.getElementById('popupForm').submit();	
 		}
	else if(m_id == 6)
	{ 
 		document.getElementById('selectOption').value="Balance Sheet";
 		document.getElementById('coName').value=""; 		
 		document.getElementById('coCode').value=f_im_id;
 		document.getElementById('popupForm').action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=3";
 		
 		document.getElementById('popupForm').submit();
 		}
	else if(m_id == 7)
	{ 		
 		document.getElementById('selectOption').value="Charting";
 		document.getElementById('coName').value=""; 		
 		document.getElementById('coCode').value=f_im_id;
 		document.getElementById('popupForm').action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		
 		document.getElementById('popupForm').submit(); 		
 		}
	else if(m_id == 8)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 9)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 10)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;	
 	else
 		window.location = m_urls[m_id-1] + f_im_id; 
 	
 }
 
 function id_click_index(m_id)
 { 	
 	var path=document.URL;	 	 
 	var i=path.indexOf("Markets"); 	 
 	if(i>0)
 	 	path=path.substring(0,i);	
 				 
 	if(m_id == 1)
 	{
 		 
 		document.forms[0].selectOption.value="Smart Quotes";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		document.forms[0].submit(); 				
 		}
 	else if(m_id == 2)		 		
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 3)
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 4)
 	{
 		document.forms[0].selectOption.value="Company Snapshot";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		document.forms[0].submit(); 
 		}
 	else if(m_id == 5)
 	{
 		document.forms[0].selectOption.value="Company News";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 6)
	{
		document.forms[0].selectOption.value="Balance Sheet";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=3";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 7)
	{
		document.forms[0].selectOption.value="Charting";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/CompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 8)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 9)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 10)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;	
 	else
 		window.location = m_urls[m_id-1] + f_im_id; 
 	
 } 
//For Revamp 

function indexRevamp(m_id)
 { 	
 	var path=document.URL;	 	 
 	var i=path.indexOf("index"); 	 
 	if(i>0)
 	{
 		path=path.substring(0,i);	
 		 
 	}			 
 	if(m_id == 1)
 	{	 
 		 
 		document.forms("popupForm").selectOption.value="Smart Quotes";
 		document.forms("popupForm").coName.value="";
 		document.forms("popupForm").coCode.value=f_im_id;
 		document.forms("popupForm").action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		document.forms("popupForm").submit(); 	 		  		 				
 	}
 	else if(m_id == 2)		 		
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 3)
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 4)
 	{
 		document.forms[0].selectOption.value="Company Snapshot";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		document.forms[0].submit(); 
 		}
 	else if(m_id == 5)
 	{
 		document.forms[0].selectOption.value="Company News";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 6)
	{
		document.forms[0].selectOption.value="Balance Sheet";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=3";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 7)
	{
		document.forms[0].selectOption.value="Charting";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 8)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 9)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 10)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;	
 	else
 		window.location = m_urls[m_id-1] + f_im_id; 
 	
 } 
 
 
 function indexRevamp1(m_id)
 { 	
 	var path=document.URL;	 	 
 	var i=path.indexOf("index"); 	 
 	if(i>0)
 	{
 		path=path.substring(0,i);	
 		 
 	}			 
 	if(m_id == 1)
 	{	 
 		 
 		document.forms("popupForm").selectOption.value="Smart Quotes";
 		document.forms("popupForm").coName.value="";
 		document.forms("popupForm").coCode.value=f_im_id;
 		document.forms("popupForm").action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		document.forms("popupForm").submit(); 	 		  		 				
 	}
 	else if(m_id == 2)		 		
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 3)
 		window.location="http://trade.hsbcinvestdirect.co.in"; 		
 	else if(m_id == 4)
 	{
 		document.forms[0].selectOption.value="Company Snapshot";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		document.forms[0].submit(); 
 		}
 	else if(m_id == 5)
 	{
 		document.forms[0].selectOption.value="Company News";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=0";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 6)
	{
		document.forms[0].selectOption.value="Balance Sheet";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=3";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 7)
	{
		document.forms[0].selectOption.value="Charting";
 		document.forms[0].coName.value="";
 		document.forms[0].coCode.value=f_im_id;
 		document.forms[0].action=path+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=1";
 		document.forms[0].submit(); 
 		}
	else if(m_id == 8)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 9)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 10)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;	
 	else
 		window.location = m_urls[m_id-1] + f_im_id; 
 	
 } 
//

function submitValues(tabName)
{
if(tabName == 'FundSnapshot')
	{
	actVar  ="../../Markets/MutualFund/FundInfo.do?reqCode=fundDropDown";
	document.forms[0].action=actVar				
	document.forms[0].selectOption.value = "FundSnapshot";
	document.forms[0].submit();	
	return;
	}	
	if(tabName == 'InOut')
	{
	actVar  ="../../Markets/MutualFund/FundInfo.do?reqCode=fundDropDown";
	document.forms[0].action=actVar				
	document.forms[0].selectOption.value = "InOut";
	document.forms[0].submit();	
	return;
	}	
	if(tabName == 'HistoricalNAV')
	{
	actVar  ="../../Markets/MutualFund/FundInfo.do?reqCode=fundDropDown";
	document.forms[0].action=actVar				
	document.forms[0].selectOption.value = "HistoricalNAV";
	document.forms[0].submit();	
	return;
	}
}		
			
 

function callFundSnapshot(schemeCode)
{

	actVar  ="../../Markets/MutualFund/FundInfo.do?reqCode=snapShotDetails";
	document.forms[0].action=actVar				
	document.forms[0].scheme.value = schemeCode;	
	document.forms[0].submit();	
	return;
}

function callGetQuotes(symbol,exchange,expDate)
{	
	actVar  ="../../Markets/Commodity/QuotesHome.do?reqCode=performanceReviewDetails";	
	document.forms[2].compName.value = symbol;
	document.forms[2].exchange.value = exchange;
	document.forms[2].expDate.value = expDate;
	document.forms[2].action=actVar		
	document.forms[2].submit();	
	return;
}

function changeColumn()
{
	var colName=document.getElementById('catCode').value;
	document.forms[0].period.value=colName;
	document.forms[0].submit();	
}


function changeCategoryname(selectedValue)
{
	var selectedvalues=selectedValue.options[selectedValue.selectedIndex].text;
	document.forms[0].action="../../Markets/MutualFund/FundInfo.do?reqCode=schemeProfileDetails";
	document.forms[0].categoryName.value=selectedvalues;
	document.forms[0].submit();
}


function changeSchemeName()
{
	var selectedValue=document.getElementById("scheme");
	var selectedvalues=selectedValue.options[selectedValue.selectedIndex].text;
	document.forms[0].action="../../Markets/MutualFund/FundInfo.do?reqCode=historicalDetails";
	document.forms[0].scheme.value=selectedvalues;
	document.forms[0].submit();
}

function fillScheme()
{
   document.forms[0].action="../MutualFund/FundInfo.do?reqCode=schemeDropDown";
   document.forms[0].submit();
}

function validateSelection()
{
  if(document.getElementsByName("scheme")[0].value=='0')
  {
  alert(" Select Scheme !");
  document.forms[0].action="../../Markets/MutualFund/FundInfo.do?reqCode=fundDropDown";
  return false;
  }
	var selectedValue=document.getElementById("scheme");
	var selectedvalues=selectedValue.options[selectedValue.selectedIndex].value;
  document.forms[0].schemeName.value=selectedvalues;
  
  return true;
}

function submitScheme()
{
	var selectedValue=document.getElementById("scheme");
	var selectedvalues=selectedValue.options[selectedValue.selectedIndex].text;
  document.forms[0].schemeName.value=selectedvalues;
  
  return true;
}

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;	
}

function showSnap(optionValue)
{
	actVar  ="../MutualFund/FundInfo.do?reqCode=snapShotDetails";
	document.forms[0].action=actVar;
	document.forms[0].snapShotChart.value=optionValue;
	document.forms[0].submit();
	return;
}

function showSnapdropDown(optionValue)
{
	actVar  ="../MutualFund/FundInfo.do?reqCode=snapShotDetails";
	document.forms[0].action=actVar;
	document.forms[0].assetAllocationChart.value=optionValue;
	document.forms[0].submit();
	return;
}

function ShowSubOptions0(){
	document.getElementById("niftyTable").style.display ="inline";
	document.getElementById("ShowM0").style.display ="inline";
	document.getElementById("nse").style.display ="inline";
	document.getElementById("bse").style.display ="none";
	document.getElementById("sensexTable").style.display ="none";
	document.getElementById("ShowM1").style.display ="none";
}
function ShowSubOptions1(){
	document.getElementById("niftyTable").style.display ="none";
	document.getElementById("ShowM0").style.display ="none";
	document.getElementById("nse").style.display ="none";
	document.getElementById("sensexTable").style.display ="inline";
	document.getElementById("ShowM1").style.display ="inline";
	document.getElementById("bse").style.display ="inline";
}
