// Home page Right Panel - Tabs ---------------------------------------------------

//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/RevampCompanyInfo/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.documentElement.scrollLeft;
		tempY = event.clientY + document.documentElement.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)
{

	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="../Markets/RevampCompanyInfo/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="../Markets/RevampCompanyInfo/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="../Markets/RevampCompanyInfo/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="../Markets/RevampCompanyInfo/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="../Markets/RevampCompanyInfo/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="../Markets/RevampCompanyInfo/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="../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="../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="../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="../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; 
	
} 

var vpath= "../";

function hometabDisplay(n)
{
	for(i=1; i<=4; i++){ 	
	if(i!=n)
		{
		document.getElementById('tabId'+i).style.display="none";
 		document.getElementById('tabtitleId'+i).className="";
		}
	}
		document.getElementById('tabId'+n).style.display="block";
		document.getElementById('tabtitleId'+n).className="sel";	
}

 function homeTab(n)
{
 document.getElementById('TDCONTENT11').style.display='inline';
 document.getElementById('TDCONTENT15').style.display='none';
 document.getElementById('TDCONTENT13').style.display='inline';
 document.getElementById('TDCONTENT16').style.display='none'; 
 document.getElementById('BSEBSEID5').style.fontWeight='normal';
 document.getElementById('NSENSEID5').style.fontWeight='normal';
 document.getElementById('BSEBSEID3').style.fontWeight='normal';
 document.getElementById('NSENSEID3').style.fontWeight='normal';

	for(i=1; i<=6; i++){ 	
	if(i!=n)
		{
		document.getElementById('tabContent'+i).style.display="none";
		document.getElementById('tabTitle'+i).className="";
		}
	}	
	document.getElementById('tabContent'+n).style.display="block";
	document.getElementById('tabTitle'+n).className="selected";
	/*if(n==2)
	{			
			turl =  'BSENSEClose.do?reqCode=getNSEClose&rnd='+Math.random();			 
			 ajaxnseclose(turl);	
	}*/
	 if(n==3)
	{
			//turl =  'Home/Gainer/MarketHome.do?reqCode=marketRightPane';
			 
			//var strBSEtgl = ajaxAsyn(turl, document.getElementById('TDCONTENT11'));
			showBSE(3);
			//document.getElementById('TDCONTENT11').innerHTML= strBSEtgl;
	}
	if(n==4)
	{
			/*turl =  'Home/Advance/MarketHome.do?reqCode=marketRightPane';
			 
			var stradvBSE = ajaxInstant(turl);
			 
			document.getElementById('advBSE').innerHTML= stradvBSE;*/
			showBSE(4);
	} 
	if(n==5)
	{
			/*turl =  'Home/High/MarketHome.do?reqCode=marketRightPane';
			 
			var strhwloBSE = ajaxInstant(turl);
			 
			document.getElementById('TDCONTENT13').innerHTML= strhwloBSE;*/
			showBSE(5);
	}  
	if(n==6)
	{
			turl =  'Home/MarketHome.do?reqCode=marketHotPursuit&rnd='+Math.random();
			 
			var strtopstry = ajaxAsyn(turl,document.getElementById('topstory'));
			 
			//document.getElementById('topstory').innerHTML= strtopstry;
	}    
	
} 
//
function homeTab1(n)
{
	if(document.getElementById('tabContent1'+n).style.display != 'none') {
		document.getElementById('tabContent1'+n).style.display = "none";
		document.getElementById('tabTitle1'+n).className = "";
		return;
	}
	for(i=1; i<=2; i++){ 	
	if(i!=n)
		{
		document.getElementById('tabContent1'+i).style.display="none";
		document.getElementById('tabTitle1'+i).className="";
	         
		}
	}	
  		document.getElementById('tabContent1'+n).style.display="block";
		document.getElementById('tabTitle1'+n).className="selected";

	
	if(n==1)
	{
			turl =  'Markets/MutualFund/MFUpdate.do?reqCode=getPerformanceRevampTop';
			 
			var strpftop = ajaxInstant(turl);
			 
			//document.getElementById('listTOP').innerHTML= strpftop;
	}
	if(n==2)
	{
		showFutures(1);
	}
}

function homeTab2(n)
{
	if(document.getElementById('tabContent2'+n).style.display != 'none') {
		document.getElementById('tabContent2'+n).style.display = "none";
		document.getElementById('tabTitle2'+n).className = "";
		return;
	}
	document.getElementById("tabContent22").style.display = 'none';
	document.getElementById("tabContent25").style.display = 'none';
	for(i=1; i<=4; i++){ 	
		document.getElementById('tabContent2'+i).style.display="none";
		document.getElementById('tabTitle2'+i).className="";        
	}
	document.getElementById('tabContent2'+n).style.display="block";
	document.getElementById('tabTitle2'+n).className="selected";
  	
	var path = document.getElementById('down22').src;
	if(path.indexOf("rpanel_title_bg11.gif")!=-1) // if down
	{
		document.getElementById('tabContent2'+n).style.display="block";
		document.getElementById('tabTitle2'+n).className="selected"; 
	}
	else
	{
		document.getElementById("tabContent22").style.display = 'none';
		document.getElementById("tabContent25").style.display = 'none';	
	}
	
	if(n==1)
	{
			turl =  'Markets/Ipo/IpoUpdate.do?reqCode=openIssuesRight&rnd='+Math.random();
			var stripoupdt = ajaxAsyn(turl,document.getElementById('openIssues'));
			//document.getElementById('forthipo').innerHTML= stripoupdt;
	}    
	if(n==2)
	{
			//turl =  'Markets/Ipo/IpoUpdate.do?reqCode=newListingRevampBSE&rnd='+Math.random();			 
			//var strlstbse = ajaxAsyn(turl,document.getElementById('listBSE'));
			showBSENewList(2);
			//document.getElementById('listBSE').innerHTML= strlstbse;
	}  
	if(n==3)
	{
			turl =  'Markets/Ipo/ExchangeInfo.do?reqCode=basisalotRevamp&rnd='+Math.random();
			var strbasalot = ajaxAsyn(turl,document.getElementById('basall'));
			//document.getElementById('basall').innerHTML= strbasalot;
	}  
	if(n==4)
	{
			turl =  'Markets/RevampIpo/ExchangeInfo.do?reqCode=ipoNews&AjaxFlag=AJAX&rnd='+Math.random();
			var striponews = ajaxAsyn(turl,document.getElementById('iponews'));
			//document.getElementById('iponews').innerHTML= striponews;
	}
}
function homeTab4(n)
{	 
	if(document.getElementById('tabContent4'+n).style.display != 'none') {
		document.getElementById('tabContent4'+n).style.display="none";
		document.getElementById('tabTitle4'+n).className="";
		return;
	}
	document.getElementById("tabContent41").style.display = 'none';
	document.getElementById("tabContent44").style.display = 'none';
	
	for(i=1; i<=3; i++){ 	
	if(i!=n)
	{
		document.getElementById('tabContent4'+i).style.display="none";
		document.getElementById('tabTitle4'+i).className="";
	}
	}
	
	document.getElementById('tabContent4'+n).style.display="block";
	document.getElementById('tabTitle4'+n).className="selected";
	
	var path = document.getElementById('down41').src;
	if(path.indexOf("rpanel_title_bg11.gif")!=-1) // if down
	{
		document.getElementById('tabContent4'+n).style.display="block";
		document.getElementById('tabTitle4'+n).className="selected";
	} else
	{
		document.getElementById("tabContent41").style.display = 'none';
		document.getElementById("tabContent44").style.display = 'none';	
	}
	if(n==1)
	{
			showTop(1);				
	}     	
	if(n==2)
	{
			//$('#tabContent4'+n).slideToggle("fast");
			turl =  'Markets/MutualFund/FundInfo.do?reqCode=schemeProfileDetailsRevamp&rnd='+Math.random();			 
			var strcatret = ajaxAsyn(turl,document.getElementById('catretu'));			 
			//document.getElementById('catretu').innerHTML= strcatret;
			document.getElementById('tabTitle42').style.fontWeight='bold';
			document.getElementById('tabTitle43').style.fontWeight='normal';
	}
	if(n==3)
	{
		//$('#tabContent4'+n).slideToggle("fast");
		turl = "Markets/RevampMutualFund/MFUpdate.do?reqCode=getNews&AjaxFlag=AJAX&rnd="+Math.random();
		ajaxAsyn(turl, document.getElementById("TDCONTENT12"));
		document.getElementById('tabTitle43').style.fontWeight='bold';
		document.getElementById('tabTitle42').style.fontWeight='normal';
	} 
}
//End 

// News ---------------------------------------------------------------------------
var count=1;
function newsNext()
{
	$("#news"+count).fadeOut("fast");
	count++;
	$("#news"+count).show("slow");
	
	if(count>$('.faqs p').length)
	{
		count--;
		$("#news"+count).fadeOut("fast");
		count = 1;
		$("#news"+count).show("slow");
	}
}

function newsBack()
{
	$('#news'+count).fadeOut("fast");	
	count--;
	$("#news"+count).show("slow");
	if(count<1)
	{
		count++;
		$("#news"+count).fadeOut("fast");
		count = 3;
		$("#news"+count).show("slow");
	}
}



// Rollover Fuction ------------------------------------------------------------------
function swapGif(img, newimage) {
 
      img.src = 'images/Revamp/' + newimage + ".gif";
      
}

function swapJpg(img, newimage) {
      img.src = 'images/Revamp/' + newimage + ".jpg";
}

function swapGif76(img, newimage) {
      img.src = 'images/Revamp/' + newimage + ".gif";

}


function swapGif1(img, newimage) {
      img.src = '../images/Revamp/' + newimage + ".gif";

}
//for Dynamic sections
function swapGif2(img, newimage) {
      img.src = '../../images/Revamp/'+newimage+".gif";
}
 function swapGifRevamp(img, newimage) {
 
      img.src = '../../images/Revamp/' + newimage + ".gif";
      
}
 
 function swapPng(img, newimage) {
     img.src = 'images/Revamp/' + newimage + ".png";
}

// Equal Columns HEIGHT ------------------------------------------------------------------
matchColumns=function(){ 

     var divs,contDivs,maxHeight,divHeight,d; 
	
     // get all <div> elements in the document 

     divs=document.getElementsByTagName('div'); 

     contDivs=[]; 

     // initialize maximum height value 

     maxHeight=0; 

     // iterate over all <div> elements in the document 

     for(var i=0;i<divs.length;i++){ 

          // make collection with <div> elements with class attribute 'container' 

          if(/\bequalColumn\b/.test(divs[i].className)){ 

                d=divs[i]; 

                contDivs[contDivs.length]=d; 

                // determine height for <div> element 

                if(d.offsetHeight){ 

                     divHeight=d.offsetHeight; 					

                } 

                else if(d.style.pixelHeight){ 

                     divHeight=d.style.pixelHeight;					 

                } 

                // calculate maximum height 

                maxHeight=Math.max(maxHeight,divHeight); 

          } 

     } 

     // assign maximum height value to all of container <div> elements 

     for(var i=0;i<contDivs.length;i++){ 

          contDivs[i].style.height=maxHeight + "px"; 

     } 

} 

// Runs the script when page loads 

window.onload=function(){ 
     if(document.getElementsByTagName){ 
          matchColumns();
		      }
} 

function knowMore() {
	 $("#moreContent").slideToggle("fast");	
	 $("span").toggle();

	}
	

function kMore(n){
 
for(var i=1; i<=10; i++){
		if(document.getElementById('moreInfo'+i)!=null){
			if(i!=n){
		   document.getElementById('moreInfo'+i).style.display = 'none';
		   document.getElementById('kmore'+i).className = 'knowMore';
			}
		}
		else { break;}
}

	var contentId = document.getElementById('moreInfo'+n);
	var contentClassN = document.getElementById('kmore'+n);
    // Toggle 
	
	contentId.style.display == "block" ? contentId.style.display = "none" : 
	contentId.style.display = "block";
		
	if(contentClassN.className == 'knowMore')
      {
         contentClassN.className = 'knowMoreup';
         classname = 'knowMoreup';
      } 
	  else{
	  contentClassN.className = 'knowMore';
	  classname = 'knowMore';
	  }

}

function showhide(a)
		{
			for(i=1; i<=10; i++)
				{
				if(document.getElementById('overView' + i)!=null) {
				  document.getElementById('overView' + i).style.display="none";
				  document.getElementById('tab' + i).className="";
				}
				else{
					break;
					}
				}
				document.getElementById('overView' + a).style.display="block";
				document.getElementById('tab' + a).className="selected";
		}

		
function showCatogary(a)
{
	var a;
	var len = 0;
	var divs = document.getElementsByTagName("div");
	for(var i=0;i<divs.length;i++) { 
        if(/catagoryTab/.test(divs[i].className)){
        	len++;
          }
	 }
	for(i=1; i<=len; i++) {
	  if(document.getElementById('cont' + i) != null)
		  document.getElementById('cont' + i).style.display="none";
	  document.getElementById('tab' + i).className="";
	}
	if(document.getElementById('cont' + a) != null)	
		document.getElementById('cont' + a).style.display="block";
	document.getElementById('tab' + a).className="selected";
}
		
function overlay(n)
{
	var wid = $(window).width();
	var hwid = (wid/2) - 280;
	
	//alert(hwid);
	
	document.getElementById('back').style.width = document.body.clientWidth + "px";
	document.getElementById('back').style.height = document.body.clientHeight +"px";
	document.getElementById('back').style.display = 'block';
	$('#backInner'+n).css({"margin-left" : hwid, "margin-top": '22px'});
	document.getElementById('backInner'+n).style.display = 'block';
	//document.getElementById('backInner').style.margin-left
	window.location.href = "#";

	//alert($(window).width());
	
}


function closeoverlay(n){
	document.getElementById('back').style.display = 'none';
	document.getElementById('backInner'+n).style.display = 'none';
	}


function mainsubmenu(n){

	for(i=1;i<=10;i++)
	{
			if(document.getElementById('mainsubmenu'+i)!=null){
			document.getElementById('mainsubmenu'+i).style.display = 'none';
			document.getElementById('leftSubmenu'+i).className = '';
			}
			else{
				break;
				}
	}
	document.getElementById('mainsubmenu'+n).style.display = 'block';
	document.getElementById('leftSubmenu'+n).className = 'select1';
 
}
function trisk(n){


//alert(len);
for(var i=1; i<=5; i++){
		if(i!=n){
			document.getElementById("trisk"+i).style.display = 'none';
			
			}
			}

document.getElementById("trisk"+n).style.display = "block";


	
	}
	//start
	function toption(n){


//alert(len);
for(var i=1; i<=6; i++){
		if(i!=n){
			document.getElementById("toption"+i).style.display = 'none';
			
			}
		
			}	

document.getElementById("toption"+n).style.display = "block";


	
	}
	//end
	
function showAns(n){
for(i=1;i<=40;i++)
{
if(document.getElementById('show'+i)!=null){
document.getElementById('show'+i).style.display = 'none';

}
else{
	break;
	}
}
	document.getElementById('show'+n).style.display = 'block';
}
function subshowAns(a){	
for(i=1;i<=40;i++)
{
if(document.getElementById('subAns'+i)!=null){
document.getElementById('subAns'+i).style.display = 'none';
}
else{
	break;
	}
}
	document.getElementById('subAns'+a).style.display = 'block';
}
	
	

	
function scrollpage_anim(height_scroll)
{
	//alert(height_scroll);
	//$('html, body').animate({scrollTop:height_scroll}, 'slow');
}



function faq_link() {
	if(document.URL.toString().indexOf('=') != "-1")
	{	
		var faq = document.URL.toString().substr(document.URL.toString().indexOf('=') + 1);
		var faq1 = document.URL.toString().substr(document.URL.toString().indexOf('=') + 1);
		var faq2 = document.URL.toString().substr(document.URL.toString().indexOf('=') + 1);
		var faq3 = document.URL.toString().substr(document.URL.toString().indexOf('=') + 1);
		
		if(faq1=="true")
		{
			showTab(3,7);
		}
		else
		if(faq2=="true1")
		{
			showTab(1,7);
		}
		else
		if(faq3=="true2")
		{
			showTab(6,7);
		}
	}
}

function showTab(m,n)
{
	for(i=1; i<=n; i++)
		{
			document.getElementById('overView' + i).style.display="none";
			document.getElementById('tab' + i).className="";
		}	
		if(m==1)
		{
			scrollpage_anim(600);	
		}
		document.getElementById('overView' + m).style.display="block";
		document.getElementById('tab' + m).className="selected";
}


function pageInfoDisplay(a){
	
	for(i=1; i<=2; i++)
		{
			document.getElementById('pageInfo'+i).style.display="none";
			document.getElementById('spage'+i).className="BlueLinkNormal";
		}	
	document.getElementById('pageInfo'+a).style.display="block";
	document.getElementById('spage'+a).className="sel";
	
	
	}
	
	
function pageInfoDisplay1(a){

	for(i=1; i<=5; i++)
		{
			document.getElementById('pagebigInfo'+i).style.display="none";
			document.getElementById('page'+i).className="BlueLinkNormal";
		}	
	document.getElementById('pagebigInfo'+a).style.display="block";
	
	document.getElementById('page'+a).className="sel";
	}
	
function showDemo(n)
{


	//$('#moreInfo'+n).slideToggle();
	document.getElementById('moreInfo'+n).style.display = 'block';
}



function calculate(n){
for(var i=1; i<=10; i++){
		if(document.getElementById('moreInfo'+i)!=null){
			if(i!=n){
		   document.getElementById('moreInfo'+i).style.display = 'none';
		   document.getElementById('kmore'+i).className = 'calculate';
			}
		}
		else { break;}
}

	var contentId = document.getElementById('moreInfo'+n);
	var contentClassN = document.getElementById('kmore'+n);
    // Toggle 
	
	contentId.style.display == "block" ? contentId.style.display = "none" : 
	contentId.style.display = "block";
		
	if(contentClassN.className == 'calculate')
      {
         contentClassN.className = 'knowMoreup';
         classname = 'knowMoreup';
      } 
	  else{
	  contentClassN.className = 'calculate';
	  classname = 'calculate';
	  }

}
function tollfree(a){
	
	
		
$("#tollInfo"+a).slideToggle('medium');
	
	}


function youmightInt(){

$("#youmightInfo").slideToggle('medium');

	
}

function showLoser(n) {
	 
	document.getElementById('gainTable'+n).className = 'derivative loseTab';
	document.getElementById('gain'+n).style.fontWeight = 'normal';
	document.getElementById('lose'+n).style.fontWeight = 'bold';
	/*$("#gainTable"+n).removeClass('gainTab').addClass('loseTab');
	$("#lose"+n).css("font-weight","bold");
	$("#gain"+n).css("font-weight","normal");*/
}

function showGainer(n) {
	document.getElementById('gainTable'+n).className = 'derivative gainTab';
	document.getElementById('gain'+n).style.fontWeight = 'bold';
	document.getElementById('lose'+n).style.fontWeight = 'normal';	
	/*$("#gainTable"+n).removeClass('loseTab').addClass('gainTab');
	$("#gain"+n).css("font-weight","bold");
	$("#lose"+n).css("font-weight","normal");*/
}

function showLoserHoliday(n) {
	document.getElementById('gainTable'+n).className = 'gainTab derivativePagenation';
	//$("#gainTable"+n).addClass('loseTab');
	document.getElementById('lose'+n).style.fontWeight = 'bold';
	document.getElementById('gain'+n).style.fontWeight = 'normal';
	//document.getElementById('gain'+n).style.display = 'none';
	//document.getElementById('lose'+n).style.display = 'block';	
}

function showGainerHoliday(n) {
	
	document.getElementById('gainTable'+n).className = 'gainTab derivativePagenation';
	//$("#gainTable"+n).addClass('gainTab');
	document.getElementById('gain'+n).style.fontWeight = 'bold';
	document.getElementById('lose'+n).style.fontWeight = 'normal';
	//document.getElementById('gain'+n).style.display = 'block';
	//document.getElementById('lose'+n).style.display = 'none';	
	
}

function showLoserMF(n) {

	document.getElementById("gainTable"+n).className = 'derivative loseTabMF';
	//$("#gainTable"+n).addClass('loseTab');
	document.getElementById("lose"+n).style.fontWeight = "bold";
	document.getElementById("gain"+n).style.fontWeight = "normal";
	//document.getElementById('gain'+n).style.display = 'none';
	//document.getElementById('lose'+n).style.display = 'block';	
}

function showGainerMF(n) {
	
	document.getElementById("gainTable"+n).className = 'derivative gainTab';
	//$("#gainTable"+n).addClass('gainTab');
	document.getElementById("gain"+n).style.fontWeight = "bold";
	document.getElementById("lose"+n).style.fontWeight = "normal";
	//document.getElementById('gain'+n).style.display = 'block';
	//document.getElementById('lose'+n).style.display = 'none';	
	
}
function showLoserMFPerform(n) {

	document.getElementById('gainTable'+n).className = 'loseTabMFPerform';
	document.getElementById('lose'+n).style.fontWeight = 'bold';
	document.getElementById('gain'+n).style.fontWeight = 'normal';
	
	//document.getElementById('lose'+n).style.display = 'block';	
}

function showGainerMFPerform(n) {
	
	document.getElementById('gainTable'+n).className = 'gainTab';
	document.getElementById('lose'+n).style.fontWeight = 'normal';
	document.getElementById('gain'+n).style.fontWeight = 'bold';

	//document.getElementById('gain'+n).style.display = 'block';
	//document.getElementById('lose'+n).style.display = 'none';	
	
}
function showLoserMFAGM(n) {

	document.getElementById("gainTable"+n).removeClass('gainTab').addClass('loseTabMFAGM');
	//$("#gainTable"+n).addClass('loseTab');
	document.getElementById("lose"+n).style.fontWeight = "bold";
	document.getElementById("gain"+n).style.fontWeight = "normal";
	//document.getElementById('gain'+n).style.display = 'none';
	//document.getElementById('lose'+n).style.display = 'block';	
}

function showGainerMFAGM(n) {
	
	document.getElementById("gainTable"+n).removeClass('loseTabMFAGM').addClass('gainTab');
	//$("#gainTable"+n).addClass('gainTab');
	document.getElementById("gain"+n).style.fontWeight = "bold";
	document.getElementById("lose"+n).style.fontWeight = "normal";
	//document.getElementById('gain'+n).style.display = 'block';
	//document.getElementById('lose'+n).style.display = 'none';	
	
}

function showLoserProducts(n) {

	document.getElementById("gainTable"+n).style.className = 'derivative loseTabProducts derivativePagenation';
	//$("#gainTable"+n).addClass('loseTab');
	document.getElementById("lose"+n).style.fontWeight = "bold";
	document.getElementById("gain"+n).style.fontWeight = "normal";
	//document.getElementById('gain'+n).style.display = 'none';
	//document.getElementById('lose'+n).style.display = 'block';	
}

function showGainerProducts(n) {
	
	document.getElementById("gainTable"+n).style.className  = 'derivative gainTab derivativePagenation';
	//$("#gainTable"+n).addClass('gainTab');
	document.getElementById("gain"+n).style.fontWeight = "bold";
	document.getElementById("lose"+n).style.fontWeight = "normal";
	//document.getElementById('gain'+n).style.display = 'block';
	//document.getElementById('lose'+n).style.display = 'none';	
	
}

function showAttention()
{
	document.getElementById('pop1').style.display = 'block';	
}

function hideAttention()
{
	document.getElementById('pop1').style.display = 'none';	
}

function showPic(n)
{
	document.getElementById('tab'+n).style.display = 'block';	
}


function showInterest(){
	if(document.getElementById('interest').style.display == 'none')
		document.getElementById('interest').style.display = 'block';
	else
		document.getElementById('interest').style.display = 'none';

	
	}

function delay(){
	var	t = setTimeout("hideInterest()",5000);
	
	}
function hideInterest(){
	
	document.getElementById('interest').style.display = 'none';
	
}

function showToll(){
	document.getElementById('toll').style.display = 'block';
	document.getElementById('interestIm').style.display = 'none';
	document.getElementById('interest').style.display = 'none';

	
	}

function delayToll(){
var	t = setTimeout("hideToll()",5000);
	
	}
function hideToll(){
	
	document.getElementById('toll').style.display = 'none';
	document.getElementById('interestIm').style.display = 'block';
	
}

///

function showBSE(n){
	for(i=1; i<=6; i++){ 
		if(i!=n){
		document.getElementById('tabContent'+i).style.display='none';
		}
	}
	if(n==3){
		turl =  'Home/Gainer/MarketHome.do?reqCode=marketRightPane&rnd='+Math.random();
		 
	var strBSEtgl = ajaxAsyn(turl, document.getElementById('TDCONTENT11'));
	
	document.getElementById('tabTitle3').className='selected';
	//document.getElementById('tabTitle3').style.display='inline';
	document.getElementById('tabContent3').style.display='inline';
	document.getElementById('TDCONTENT11').style.display='inline';
	document.getElementById('TDCONTENT15').style.display='none';
	document.getElementById('BSEBSEID3').style.fontWeight='bold';
	document.getElementById('NSENSEID3').style.fontWeight='normal';
	 
	  
	}
	if(n==4){
		turl =  'Markets/MarketInfo/MarketLive.do?reqCode=marketAdvanceDeclinesBSE&rnd='+Math.random();
		 
		var stradvBSE = ajaxAsyn(turl,document.getElementById('advBSE'));
		document.getElementById('tabTitle4').className='selected';
		//document.getElementById('tabTitle3').style.display='inline';
		document.getElementById('tabContent4').style.display='inline';
		document.getElementById('advBSE').style.display='block';
		document.getElementById('advNSE').style.display='none';
		document.getElementById('NSENSEID4').style.fontWeight='normal';
		document.getElementById('BSEBSEID4').style.fontWeight='bold';
	}
	if(n==5){
		turl =  'Home/High/MarketHome.do?reqCode=marketRightPane&rnd='+Math.random();
		 
		var strhwloBSE = ajaxAsyn(turl,document.getElementById('TDCONTENT13'));

	//document.getElementById('tabTitle5').style.display='inline';
	document.getElementById('tabContent5').style.display='inline';
	document.getElementById('tabTitle5').className='selected';
	document.getElementById('TDCONTENT13').style.display='inline';
	document.getElementById('TDCONTENT16').style.display='none';
	document.getElementById('BSEBSEID5').style.fontWeight='bold';
	document.getElementById('NSENSEID5').style.fontWeight='normal';
	 
	}
}


function showNSE(n){
 
for(i=1; i<=6; i++){ 
if(i!=n){
document.getElementById('tabContent'+i).style.display='none';
}
}
if(n==3){
  
  
   turl =  'Home/NseGainer/MarketHome.do?reqCode=marketRightPaneRevamp&rnd='+Math.random();			  
	var strNSEtgl = ajaxAsyn(turl,document.getElementById('TDCONTENT15'));			 
	//document.getElementById('TDCONTENT15').innerHTML= strNSEtgl;
	
	document.getElementById('tabTitle3').className='selected';
	//document.getElementById('tabTitle3').style.display='inline';
	document.getElementById('tabContent3').style.display='inline';
	document.getElementById('TDCONTENT15').style.display='block';
	document.getElementById('TDCONTENT11').style.display='none';
	document.getElementById('NSENSEID3').style.fontWeight='bold';
	document.getElementById('BSEBSEID3').style.fontWeight='normal';
	
}
if(n==4){
	turl =  'Markets/MarketInfo/MarketLive.do?reqCode=marketAdvanceDeclinesNSE&rnd='+Math.random();			  
	var strNSEtgl = ajaxAsyn(turl,document.getElementById('advNSE'));			 
	//document.getElementById('TDCONTENT15').innerHTML= strNSEtgl;
	
	document.getElementById('tabTitle4').className='selected';
	//document.getElementById('tabTitle3').style.display='inline';
	document.getElementById('tabContent4').style.display='inline';
	document.getElementById('advNSE').style.display='block';
	document.getElementById('advBSE').style.display='none';
	document.getElementById('NSENSEID4').style.fontWeight='bold';
	document.getElementById('BSEBSEID4').style.fontWeight='normal';
}
if(n==5){

	turl =  'Home/NseHigh/MarketHome.do?reqCode=marketRightPaneRevamp&rnd='+Math.random();			  
	var strhwloNSE = ajaxAsyn(turl,document.getElementById('TDCONTENT16') );			 
	//document.getElementById('TDCONTENT16').innerHTML= strhwloNSE;


//document.getElementById('tabTitle5').style.display='inline';
document.getElementById('tabContent5').style.display='inline';
document.getElementById('tabTitle5').className='selected';
document.getElementById('TDCONTENT13').style.display='none';
document.getElementById('TDCONTENT16').style.display='inline';
document.getElementById('NSENSEID5').style.fontWeight='bold';
document.getElementById('BSEBSEID5').style.fontWeight='normal';
}
}

//

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();
}

//Start
function showBSENewList(n)
{
	for(i=1; i<=4; i++)
	{ 	
		if(i!=n)
		{	
			document.getElementById('tabContent2'+i).style.display='none';
		}
	}
	//$('#tabContent4'+n).slideToggle("fast");
	//$('#tabTitle4'+n).toggleClass("selected")
	document.getElementById("BSEBSEID").style.fontWeight = "bold";
	document.getElementById("NSENSEID").style.fontWeight ="normal";
	document.getElementById("tabContent22").style.display = 'inline';
	document.getElementById("tabContent25").style.display = 'none';
	
	turl =  'Markets/Ipo/IpoUpdate.do?reqCode=newListingRevampBSE&rnd='+Math.random();	
	var strlstnse = ajaxAsyn(turl,document.getElementById('tabContent22'));	
	var contentBSE = document.getElementById("BSEBSEID").innerHTML; 
	
		
		/*$('#tabContent2'+i).slideUp("medium");
		$('#tabTitle2'+i).removeClass("selected");
          
	}
	}	
  	
	$('#tabContent2'+n).slideToggle("fast");
	$('#tabTitle2'+n).toggleClass("selected");
	 
	document.getElementById("tabContent22").style.display = 'inline';
	
	turl =  'Markets/Ipo/IpoUpdate.do?reqCode=newListingRevampBSE&rnd='+Math.random();			  
	var strlstnse = ajaxAsyn(turl,document.getElementById('tabContent22'));	
	var contentBSE = document.getElementById("BSEBSEID").innerHTML;
	 
	if(contentBSE)
	{	 	   
		document.getElementById("BSEBSEID").style.fontWeight = "bold";
		document.getElementById("NSENSEID").style.fontWeight ="normal";
	}*/
} 
function showNSENewList(n)
{
	for(i=1; i<=4; i++)
	{ 	
		if(i!=n)
		{	
			document.getElementById('tabContent2'+i).style.display='none';
		}
	}
	//$('#tabContent4'+n).slideToggle("fast");
	//$('#tabTitle4'+n).toggleClass("selected")
	document.getElementById("NSENSEID").style.fontWeight = "bold";
	document.getElementById("BSEBSEID").style.fontWeight ="normal";
	document.getElementById("tabContent25").style.display = 'inline';
	document.getElementById("tabContent22").style.display = 'none';
	
	turl =  'Markets/Ipo/IpoUpdate.do?reqCode=newListingRevampNSE&rnd='+Math.random();			  
	var strlstnse = ajaxAsyn(turl,document.getElementById('tabContent25'));			 
	var content = document.getElementById("NSENSEID").innerHTML;
	
	/*for(i=1; i<=4; i++){ 	
	if(i!=n)
	{		 		  
		$('#tabContent2'+i).slideUp("medium");
		$('#tabTitle2'+i).removeClass("selected");
          
	}
	}	
  	
	$('#tabContent2'+n).slideToggle("fast");
	$('#tabTitle2'+n).toggleClass("selected");
	
	document.getElementById("tabContent22").style.display = 'inline';
	 

	turl =  'Markets/Ipo/IpoUpdate.do?reqCode=newListingRevampNSE&rnd='+Math.random();			  
	var strlstnse = ajaxAsyn(turl,document.getElementById('tabContent22'));			 
	var content = document.getElementById("NSENSEID").innerHTML;
	
	if(content)
	{	 	   
		document.getElementById("NSENSEID").style.fontWeight = "bold";
		document.getElementById("BSEBSEID").style.fontWeight ="normal";
	}	*/	
}

function showTop(n)
{
	for(i=1; i<=3; i++)
	{ 	
		if(i!=n)
		{		 		  
			document.getElementById('tabContent4'+i).style.display='none';			
			//$('#tabContent4'+i).slideUp("medium");
			//$('#tabTitle4'+i).removeClass("selected");	          
		}
	}
	//$('#tabContent4'+n).slideToggle("fast");
	//$('#tabTitle4'+n).toggleClass("selected")
	document.getElementById("TOPID").style.fontWeight = "bold";
	document.getElementById("BOTTOMID").style.fontWeight ="normal";
	document.getElementById("tabContent41").style.display = 'inline';
	document.getElementById("tabContent44").style.display = 'none';
	
	turl =  'Markets/MutualFund/MFUpdate.do?reqCode=getPerformanceRevampTop&rnd='+Math.random();
	var strperfbott = ajaxAsyn(turl,document.getElementById('tabContent41'));
	 
	
	//document.getElementById("listBOTTOM").style.display = 'none';	 
	var contentTOP = document.getElementById("TOPID").innerHTML;
	 
	/*if(contentTOP)
	{	 	   
		document.getElementById("TOPID").style.fontWeight = "bold";
		document.getElementById("BOTTOMID").style.fontWeight ="normal";
	}*/
} 
function showBottom(n)
{	
	/*for(i=1; i<=3; i++)
	{ 	
		if(i!=n)
		{		 		  
			$('#tabContent4'+i).slideUp("medium");
			$('#tabTitle4'+i).removeClass("selected");	          
		}
	}	
	
  	
	//$('#tabContent4'+n).slideToggle("fast");
	$('#tabTitle4'+n).toggleClass("selected")
	
	alert(n+' Bottom');
	alert('tabContent44 : ' + document.getElementById("tabContent44").style.display);
	alert('tabContent41 : ' + document.getElementById("tabContent41").style.display);	
	
	//if (document.getElementById("tabContent41").style.display != 'inline')
	{document.getElementById("tabContent44").style.display = 'inline';}
	//else
	{document.getElementById("tabContent41").style.display = 'none';}*/
	
	for(i=1; i<=3; i++)
	{ 	
		if(i!=n)
		{		 		  
			document.getElementById('tabContent4'+i).style.display='none';			
			//$('#tabContent4'+i).slideUp("medium");
			//$('#tabTitle4'+i).removeClass("selected");	          
		}
	}
	//$('#tabContent4'+n).slideToggle("fast");
	//$('#tabTitle4'+n).toggleClass("selected")
	document.getElementById("TOPID").style.fontWeight = "normal";
	document.getElementById("BOTTOMID").style.fontWeight ="bold";
	document.getElementById("tabContent44").style.display = 'inline';
	document.getElementById("tabContent41").style.display = 'none';
	
	turl =  'Markets/MutualFund/MFUpdate.do?reqCode=getPerformanceRevampBottom&rnd='+Math.random();
	var strperfbott = ajaxAsyn(turl,document.getElementById('tabContent44'));
			 
	var content = document.getElementById("BOTTOMID").innerHTML;
	
	/*if(content)
	{	 	   
		document.getElementById("BOTTOMID").style.fontWeight = "bold";
		document.getElementById("TOPID").style.fontWeight ="normal";
	}*/
	 
}
//

//For AJAX Call


	 
						
			var xmlhttp;			
			function ajaxTOP(url){
			
				xmlhttp=GetXmlHttpObject();
				 
				if (xmlhttp==null){
				  alert ("Your browser does not support XMLHTTP!");
				  return;
				}

				xmlhttp.onreadystatechange=TopChg;
				xmlhttp.open("GET",url,true);				
				xmlhttp.send(null);				
			}	
			 
			function GetXmlHttpObject(){
				if (window.XMLHttpRequest){
				  // code for IE7+, Firefox, Chrome, Opera, Safari
				  return new XMLHttpRequest();
				}
				if (window.ActiveXObject){
				  // code for IE6, IE5
				  return new ActiveXObject("Microsoft.XMLHTTP");
				}
				return null;
			}
			
			
			
			function TopChg(){
						  		
				if(xmlhttp.readyState ==4 && xmlhttp.status==200){
				  var tmp = xmlhttp.responseText;	
				  		 
				  if(tmp!='')
				  {				
				  	toOpenDivInnerHTML = xmlhttp.responseText;  				  		
				  	 	    							  	 				 
				  	}
				  	document.getElementById('replace').innerHTML = toOpenDivInnerHTML;
			}
			} 
	
	/*For NSE Close Ajax*/
	var xmlhttp;			
			function ajaxnseclose(url){
			
				xmlhttp=GetXmlHttpObject();
				 
				if (xmlhttp==null){
				  alert ("Your browser does not support XMLHTTP!");
				  return;
				}

				xmlhttp.onreadystatechange=TopChg;
				xmlhttp.open("GET",url,true);				
				xmlhttp.send(null);				
			}	
			 
			function GetXmlHttpObject(){
				if (window.XMLHttpRequest){
				  // code for IE7+, Firefox, Chrome, Opera, Safari
				  return new XMLHttpRequest();
				}
				if (window.ActiveXObject){
				  // code for IE6, IE5
				  return new ActiveXObject("Microsoft.XMLHTTP");
				}
				return null;
			}
			
			
			
			function TopChg(){
						  		
				if(xmlhttp.readyState ==4 && xmlhttp.status==200){
				  var tmp = xmlhttp.responseText;	
				  		 
				  if(tmp!='')
				  {				
				  	toOpenDivInnerHTML = xmlhttp.responseText;  				  		
				  	 	    							  	 				 
				  	}
				  	document.getElementById('nseclose').innerHTML = toOpenDivInnerHTML;
			}
			} 
			
			function ajaxbseclose(url){
				
				xmlhttp=GetXmlHttpObject();
				 
				if (xmlhttp==null){
				  alert ("Your browser does not support XMLHTTP!");
				  return;
				}

				xmlhttp.onreadystatechange=TopBseChg;
				xmlhttp.open("GET",url,true);				
				xmlhttp.send(null);				
			}	
			function TopBseChg(){
		  		
				if(xmlhttp.readyState ==4 && xmlhttp.status==200){
				  var tmp = xmlhttp.responseText;	
				  		 
				  if(tmp!='')
				  {				
				  	toOpenDivInnerHTML = xmlhttp.responseText;  				  		
				  	 	    							  	 				 
				  	}
				  	document.getElementById('bseclose').innerHTML = toOpenDivInnerHTML;
			}
			}			 
			 
			
			function ajaxInstant(url){ 
			 
				xmlhttp=GetXmlHttpObject();
				 	  
				if (xmlhttp==null){
				  alert ("Your browser does not support XMLHTTP!");
				  return;
				}
				xmlhttp.open("GET",url,true);
				xmlhttp.send(null);
				return xmlhttp.responseText;
			}
			
			function ajaxAsyn(url, ctrl){ 
				 
				xmlhttp=GetXmlHttpObject();
				if (xmlhttp==null){
				  alert ("Your browser does not support XMLHTTP!");
				  return;
				}
				xmlhttp.onreadystatechange=function()
				  {
				  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				  {
					  ctrl.innerHTML = xmlhttp.responseText;
				  }
				  };
				xmlhttp.open("GET",url,true);
				xmlhttp.send(null);
				ctrl.innerHTML = "<img src='images/loading1.gif' alt='loading...' title='loading...' width='51' height='7' />";
			}
			 
			function GetXmlHttpObject(){
				if (window.XMLHttpRequest){
				  // code for IE7+, Firefox, Chrome, Opera, Safari
				  return new XMLHttpRequest();
				}
				if (window.ActiveXObject){
				  // code for IE6, IE5
				  return new ActiveXObject("Microsoft.XMLHTTP");
				}
				return null;
			}
					
			 	
		 
	/*************** starts  markets - companyInfo - GenInformation.jsp  *************/
function showDetailGenInfo(coName)
{
    
	coName = coName.replace("(","XXOBXX").replace(")","XXCBXX").replace("&","XXAMPXX");
     
	document.forms[0].coName.value=coName;
	
	// alert("2 " + document.forms[0].coName.value);
	document.forms[0].selectOption.value=document.forms[1].selectOption.value;
	// alert("3 " + document.forms[0].coName.value);
	javascript:submitForm('');
}
/*************** ends  markets - companyInfo - GenInformation.jsp   *************/

/*************** starts  markets - companyInfo -Includes - IndexSearchLookUp.jsp   *************/
function submitForm(Symbolform)
{
	
	if (Symbolform == 'LeftNavCompanySnapshot')
	{
		Symbolform = 'Company Snapshot';;
	}
	if (Symbolform == 'LeftNavSmartQuotes')
	{
		Symbolform = 'Smart Quotes';
	}	
	if (Symbolform == 'LeftNavBoardOfDirectors')
	{
		Symbolform = 'Board Of Directors';
	}	
	if (Symbolform == 'LeftNavResults')
	{
		Symbolform = 'Results';
	}	
	if (Symbolform == 'LeftNavValuationRatio')
	{
		Symbolform = 'Valuation Ratio';
	}	
	if (Symbolform == 'LeftNavDividendHistory')
	{
		Symbolform = 'Dividend History';
	}	
	if (Symbolform == 'LeftNavAnnouncements')
	{
		Symbolform = 'Announcements';
	}	
	if (Symbolform == 'LeftNavLatestEquity')
	{
		Symbolform = 'Latest Equity';
	}	
	
	
	if(Symbolform != '')
	{
		which = Symbolform;
		document.forms[0].selectOption.value = Symbolform;
	}
	else
	{
		which = document.forms[0].selectOption.value;
		 
	}
	actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo";

	if(which == 'Company Background' || which=='Company Snapshot'|| which=='Company History'|| which=='Company News')
	{
		actVar  = actVar + "&page=0";
	}	
	else if(which == 'Detailed Quote' || which=='Smart Quotes'|| which=='Historical Prices'|| which=='Charting')
	{
		actVar  = actVar + "&page=1";
	}	
	else if(which == 'Announcements' || which == 'Book Closure' || which == 'Bonus - Rights' || which == 'De-listed Shares' || which == 'Market Turnover' || which == 'Change of Name')
	{
		actVar  = actVar + "&page=6";
	}
	else if(which == "Dividend History" || which == "Chairmans Speech" || which == "Directors Report" || which == "Fo.Board Meeting")
	{
		actVar  = actVar + "&page=5";
	}
	else if(which == "Board Of Directors" || which == "Share Holding" || which == "Branches" || which == "Products" || which == "Compare company" || which == "Peer Group")
	{
		actVar  = actVar + "&page=2";

	}
	else if(which == "Results" || which == "PL Account" || which == "Balance Sheet" || which == "Cash Flows" || which == "Research Reports" )
	{
		actVar  = actVar + "&page=3";
	}

	else if(which == "Valuation Ratio" || which == "Financial Ratios" || which == "Scoreboard" || which == "Earnings" )
	{
	actVar  = actVar + "&page=4";
	}

    else if(which == "Latest Equity" || which == "Equity History" || which == "Bonus History" || which == "MF Holdings" )
	{
		actVar  = actVar + "&page=7";
	}

 
	
	if(which == 'prev')
	{
		actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=0&navigation=prev";
		document.forms[1].action=actVar	;			
		document.forms[1].selectOption.value = document.forms[0].selectOption.value;
		document.forms[1].coName.value = document.forms[0].coName.value;
		document.forms[1].submit();	
		return;
	}
	if(which == 'next')
	{
		actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=0&navigation=next";
		document.forms[1].action=actVar	;			
		document.forms[1].selectOption.value = document.forms[0].selectOption.value;
		document.forms[1].coName.value = document.forms[0].coName.value;
		document.forms[1].submit();	
		return;
	}
	
	if(which == 'ResultsQuaters')
	{
		actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=3";
		document.forms[1].action=actVar	;			
		document.forms[1].selectOption.value = "ResultsQuaters";
		document.forms[1].coName.value = document.forms[0].coName.value;
		document.forms[1].submit();	
		return;
	}
	

	if(which == 'BranchesDetail')
	{
		actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo";
		document.forms[1].action=actVar	;		
		document.forms[1].selectOption.value = "BranchesDetail";
		document.forms[1].coName.value = document.forms[0].coName.value;
		document.forms[1].submit();	
		return;
	}

	if(which == 'History')
	{
		document.forms[1].submit();	
		return;
	}	
	 
 
	document.forms[0].action=actVar	;	
	document.forms[0].submit();
 
}

function checkKey(e)
{
	if(e.keyCode==13)
	{
		submitFormISL('');
	}
}
/*************** ends  markets - companyInfo -Includes - IndexSearchLookUp.jsp   *************/		


function showLoser1(n) {

	document.getElementById("gainTable"+n).style.className = 'derivative loseTab1';
	document.getElementById("lose"+n).style.fontWeight = 'bold';
	document.getElementById("gain"+n).style.fontWeight = 'normal';
}

function showGainer1(n) {

	document.getElementById('gainTable'+n).className = 'derivative gainTab';
	document.getElementById('gain'+n).style.fontWeight = 'bold';
	document.getElementById('lose'+n).style.fontWeight = 'normal';	
}


//Market Announcements


function submitAction(symbol)
{

if(symbol == 'BSEAnnouncement')
	{
		var actVar="../../Markets/RevampMarketInfo/Announcements.do?reqCode=bseAnnouncement";
		// alert(2);
		document.forms[1].action="../../Markets/RevampMarketInfo/Announcements.do?reqCode=bseAnnouncement";
		document.forms[1].submit();
		document.forms("latestAnnouncement").action=actVar;
		document.forms("latestAnnouncement").submit();	
		return;
	}

else if(symbol == 'NSEAnnouncement')
	{
		var actVar  ="../../Markets/RevampMarketInfo/Announcements.do?reqCode=nseAnnouncement";
		document.forms("latestAnnouncement").action=actVar;
		document.forms("latestAnnouncement").submit();
		return;
	}

else if(symbol == 'Announcement')
	{
		var actVar  ="../../Markets/RevampMarketInfo/Announcements.do?reqCode=announcement";
		document.forms("latestAnnouncement").action=actVar;				
		document.forms("latestAnnouncement").submit();	
		return;
	}

else if(symbol == 'ResultsAnnounced')
	{
		var actVar  ="../../Markets/RevampMarketInfo/Announcements.do?reqCode=resultsAnnounced";
		document.forms("latestAnnouncement").action=actVar;				
		document.forms("latestAnnouncement").submit();	
		return;
	}
	
	
	else if(symbol == 'EconomyWatch')
	{
		var actVar  ="../../Markets/RevampMarketInfo/MarketNews.do?reqCode=economyWatch";
		document.forms("marketNews").action=actVar;				
		document.forms("marketNews").submit();	
		return;
	}
	
	else if(symbol == 'MarketSummary')
	{
		var actVar  ="../../Markets/RevampMarketInfo/MarketNews.do?reqCode=marketSummary";
		document.forms("marketNews").action=actVar;				
		document.forms("marketNews").submit();	
		return;
	}
	
	else if(symbol == 'HotPursuit')
	{
		var actVar  ="../../Markets/RevampMarketInfo/MarketNews.do?reqCode=hotPursuit";
		document.forms("marketNews").action=actVar;				
		document.forms("marketNews").submit();	
		return;
	}
	
	else if(symbol == 'SectorNews')
	{
		var actVar  ="../../Markets/RevampMarketInfo/MarketNews.do?reqCode=sectorNews";
		document.forms("marketNews").action=actVar;				
		document.forms("marketNews").submit();	
		return;
	}
		else if(symbol == 'MarketBeat')
	{
		var actVar  ="../../Markets/RevampMarketInfo/MarketNews.do?reqCode=marketBeat";
		document.forms("marketNews").action=actVar;				
		document.forms("marketNews").submit();	
		return;
	}
	else if(symbol == 'SectorNewsDetails')
	{
	
if (document.forms[0].selectedSectorid.value=="")
return false;

		var actVar  ="../../Markets/RevampMarketInfo/MarketNews.do?reqCode=sectorNewsDetails";
		document.forms("marketSector").action=actVar;				
		document.forms("marketSector").submit();	
		return;
	}
	}
					
//

/* Below function is used in PeerGroupSearch.jsp file to check at least one check box is checked */		
function CheckBoxValidation()
	{
		var check;
		var cnt = 0;
		for (var i = 0; i<=document.getElementsByName("chkSelected").length-1;i++)
		{
			if(document.getElementsByName("chkSelected").item(i).checked==true)
			{
			check=true;
			cnt++;
			}
		}
			
		 if (cnt==0)
		 {
		 alert("Select atleast one company");
		 return false;
		 }
		 else if (cnt >4)
		 {
		  alert("You can select maximium 4 companies at a time");
		  return false;
		 }
		 else if(cnt>=1 && cnt<=4)
		 {
			actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page=2";
			document.forms[1].action=actVar				
			document.forms[1].selectOption.value = "PeerGroupComp";
			document.forms[1].coName.value = document.forms[0].coName.value;
			document.forms[1].submit();	
			return;
		 }
	 }				
				
//
 

function changeCategorynameAjax(selectedValue)
{  
	var selectedvalues=selectedValue.options[selectedValue.selectedIndex].value;	
	  
	turl='MutualFund/FundInfo.do?reqCode=getCorpRetAjax&schCatName='+selectedvalues+'&rnd='+Math.random();	
	
	var strcatret = ajaxAsyn(turl,document.getElementById('replaceCategory'));
			 
	//document.getElementById('replaceCategory').innerHTML= strcatret;
}

function changeCategoryname(selectedValue)
{
	var selectedvalues=selectedValue.options[selectedValue.selectedIndex].text;
	document.forms[0].action="../MutualFund/FundInfo.do?reqCode=schemeProfileDetails";
	document.forms[0].categoryName.value=selectedvalues;
	document.forms[0].submit();
}

function callFundSnapshot(schemeCode)
{
	actVar  ="../MutualFund/FundInfo.do?reqCode=snapShotDetails";
	document.forms[0].action=actVar;
	document.forms[0].scheme.value = schemeCode;
	document.forms[0].submit();	
	return;
}

function callFundSnapshotMarket(schemeCode)
{
	actVar  ="../../MutualFund/FundInfo.do?reqCode=snapShotDetails";
	document.forms[0].action=actVar;
	document.forms[0].scheme.value = schemeCode;
	document.forms[0].submit();	
	return;
}
function callRevampFundSnapshot(schemeCode)
{
	actVar  ="../../MutualFund/FundInfo.do?reqCode=snapShotDetails";

	document.forms[0].action=actVar;
	document.forms[0].scheme.value = schemeCode;
	document.forms[0].submit();	
	return;
}

function changeColumn()
{
	var colName=document.getElementById('catCode').value;
	document.forms[0].period.value=colName;
	document.forms[0].submit();	
}


function ShowData1()
{ 
  			 var period = document.getElementById("period");
  			 
    		 selectedOption1 = period.options[period.selectedIndex].value;  
  			 
  			 var schCode = document.getElementById("schCode");  		
  		
    		 selectedOption2 = schCode.options[schCode.selectedIndex].value; 
  			 
		 
			turl =  'PerformanceRevampTopAjax.do?reqCode=getTopAjax&period='+ selectedOption1 + '&schCode='+selectedOption2+'&rnd='+Math.random();
			 
			 var strtopper = ajaxAsyn(turl,document.getElementById('replace'));
			 
			//document.getElementById('replace').innerHTML= strtopper;
} 

function ShowData()
{ 
  			 var periodBot = document.getElementById("periodBot");
  			
    		 selectedOption1 = periodBot.options[periodBot.selectedIndex].value;  

  			 var schCodeBot = document.getElementById("schCodeBot");  	  

    		 selectedOption2 = schCodeBot.options[schCodeBot.selectedIndex].value; 	  			  
  				
		 
			turl =  'PerformanceRevampTopAjax.do?reqCode=getBottomAjax&period='+ selectedOption1 + '&schCode='+selectedOption2+'&rnd='+Math.random();
		 	
		 	var strbotper = ajaxAsyn(turl,document.getElementById('replaceBottom'));
			 
			//document.getElementById('replaceBottom').innerHTML= strbotper;
			
		 	 			 
	
} 


/*
Markets->Company InformationPage:  Below function is to populate appropriate pages values in pages dropdown as value is selected in section dropdown used in QuoteFinder.jsp
*/
function ChangePgDropDownQF()
	{
		var arr_0 = new Array("Smart Quotes");
		var arr_1 = new Array("Company Background","Company Snapshot","Company History","Company News");	
		var arr_2 = new Array("Smart Quotes","Historical Prices","Charting");
		var arr_3 = new Array("Board Of Directors","Share Holding","Branches","Products","Compare company","Peer Group");
		var arr_4 = new Array("Results","PL Account","Balance Sheet","Cash Flows","Research Reports" );
		var arr_5 = new Array("Valuation Ratio","Financial Ratios","Scoreboard","Earnings");
		var arr_6 = new Array("Dividend History","Chairmans Speech","Directors Report","Fo.Board Meeting");
		var arr_7 =  new Array("Announcements","Book Closure","Bonus - Rights","De-listed Shares","Market Turnover","Change of Name");
		var arr_8 = new Array("Latest Equity","Equity History","Bonus History","MF Holdings");
		
		var arraytoCopy  = eval('arr_' + document.getElementById("DD_Quotes").value)
	
	
		var selectOption = document.getElementById("selectOption");
		if(selectOption ==null )
		{
			var selectOptionArr = document.getElementsByName("selectOption");
			selectOption = selectOptionArr[0];
		}	
		
		selectOption.options.length = arraytoCopy.length;
	
		var setPage1 = document.getElementById("DD_Quotes").value ;
		
		var setPage= setPage1 - 1 ;
		
		document.getElementById("pageId").value = setPage ;
		for(i = 0; i<arraytoCopy.length;i++)
		{
			selectOption.options[i].text = arraytoCopy[i];
			selectOption.options[i].value = arraytoCopy[i];
		}	
	}
/* Market -> CompanyInfo below function is called on click of submit button on QuoteFinder used in QuoteFinder.jsp*/
function RevampSearchQuote()
{	 

if (document.getElementById("coName").value.indexOf("'")!=-1)
{
alert("invalid");
return false;
}
	 
	var srchComp = document.getElementById("coName");
	if(srchComp ==null )
	{
		var srchCompArr = document.getElementsByName("coName");
		srchComp = srchCompArr[0];
	}	
	
	var selectOption = document.getElementById("selectOption");
	if(selectOption ==null )
	{
		var selectOptionArr = document.getElementsByName("selectOption");
		selectOption = selectOptionArr[0];
	}	
	
	var PageId = document.getElementById("pageId").value;
	
	var SrchComp1=srchComp.value;				
	var bFind=false;
	var iIndex=-1;

	while(!bFind)
	{
		// Replace & characher with "%26"
		SrchComp1=SrchComp1.replace(/&/,"%26");
		// Replace single quotes (''') characher with "" (empty)
		SrchComp1=SrchComp1.replace(/'/,"");
		// Replace double quotes (") characher with "" (empty)
		SrchComp1=SrchComp1.replace(/"/,"");
		
		iIndex=SrchComp1.lastIndexOf("&");			
		if (iIndex==-1)
		{
			iIndex=SrchComp1.lastIndexOf("'");
			if (iIndex==-1)
			{
				iIndex=SrchComp1.lastIndexOf('"');
				if (iIndex==-1)
				{
					bFind=true;
				}
			}
		}
	}
	
	if(TrimSpaces(SrchComp1)=="")
	{
		alert("Please enter company Name ..!!!");
		actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page="+PageId;		
		document.forms[0].action=actVar
		document.forms[0].submit();
		return;			
	}
	else
	{	
	actVar  ="../../Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page="+PageId;		
	document.forms[0].action=actVar;			
	document.forms[0].submit();	
	}
}

/* Below is utility function used to trim the space in String */
function TrimSpaces(checkString)
{
    newString = "";    
    for (i = 0; i < checkString.length; i++) 
    {
        ch = checkString.substring(i, i+1);
        if (ch != " " ) 
        {
            newString += ch;
        }
    }
        return newString;
}
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 Show1(Tab1,Tab2)
{
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';

}
function Show4(Tab1,Tab2,Tab3,Tab4)
{
var GTableId = document.getElementById(Tab1);
var LTableId = document.getElementById(Tab2);
var BGTableId = document.getElementById(Tab3);
var BLTableId = document.getElementById(Tab4);

//var Tab1 = document.getElementById(Tab3);
//var Tab2 = document.getElementById(Tab4);

GTableId.style.display = 'inline';
LTableId.style.display = 'none';
BGTableId.style.display = 'none';
BLTableId.style.display = 'none';

//Tab1.className = 'mbgon';
//Tab2.className = 'mbgof';

}
function Show2(Tab1,Tab2)
{
 

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';

}
function Show3(Tab1,Tab2,Tab3)
{
 

var FTableId = document.getElementById(Tab1);
var STableId = document.getElementById(Tab2);
var TGTableId = document.getElementById(Tab3);

FTableId.style.display = 'inline';
STableId.style.display = 'none';
TGTableId.style.display = 'none';


















/*function ShowBRS(Tab1,Tab2,Tab3)
{
var GTableId = document.getElementById(Tab1);
var LTableId = document.getElementById(Tab2);
var TTableId = document.getElementById(Tab3);
//var Tab1 = document.getElementById(Tab3);
//var Tab2 = document.getElementById(Tab4);

GTableId.style.display = 'inline';
LTableId.style.display = 'none';
TTableId.style.display = 'none';
//Tab1.className = 'mbgon';
//Tab2.className = 'mbgof';
*/
}

function showFutures(n) 
{
turl =  'derivatives/MarketOverview.do?reqCode=getTopGainLoseRight&rnd='+Math.random();
document.getElementById("DERFUT1").style.fontWeight = "bold";
document.getElementById("DEROPT1").style.fontWeight = "normal";
ajaxAsyn(turl,document.getElementById("tabContent12"));
}
function showOptions(n) 
{
turl =  'derivatives/MarketOverview.do?reqCode=getTopPutCallRight&rnd='+Math.random();
document.getElementById("DEROPT1").style.fontWeight = "bold";
document.getElementById("DERFUT1").style.fontWeight = "normal";
ajaxAsyn(turl,document.getElementById("tabContent12"));
}
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";
}
function getAjaxResultSelect(url, id){
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	  {
		  var obj = document.getElementById(id);
		  var len;
		  var resArray = xmlhttp.responseText.split(",");

		  var selLen = obj.length;
		  for(var itr=selLen;itr >= 0 ; itr--)
			  obj.remove(itr);
		  for ( var len = 0 ; len < resArray.length-1;len++ ) {
			var itm = new Option(resArray[len],resArray[len]);
			try
			{
				obj.add(itm,null); // standards compliant
			}
			catch(ex)
			{
				obj.add(itm); // IE only
			}
		}
	}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function getAjaxResultTbl(url, id)
{
	var obj = document.getElementById(id);
	xmlhttp = GetXmlHttpObject();
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	  {
		  obj.innerHTML = xmlhttp.responseText;
	  }
	  };
	  xmlhttp.open("GET",url,true);
	  xmlhttp.send(null);
	  obj.innerHTML = "<img align='middle' src='../images/loading1.gif' alt='loading...' width='51' height='7' /> ";
}
function changeImg(id){
	var path = document.getElementById(id).src;
	if(path.indexOf("rpanel_title_bg11.gif")!=-1){
		document.getElementById(id).src = "images/Revamp/rpanel_title_bg12.gif";
		document.getElementById(id).alt = "Up";
		document.getElementById(id).title = "Up";
	} else {
		document.getElementById(id).src = "images/Revamp/rpanel_title_bg11.gif";
		document.getElementById(id).alt = "Down";
		document.getElementById(id).title = "Down";
	}
}


function showBSEHoliday(x)
{
	
	if(x == 'B')
	{
	
		document.getElementById('nseholi').style.display= 'none';
		document.getElementById('bseholi').style.display= 'inline';
		document.getElementById('BSEHOLIDY').style.fontWeight='bold';
		document.getElementById('NSEHOLIDY').style.fontWeight='normal';
			
	}
	if(x == 'N')
	{
		document.getElementById('bseholi').style.display= 'none';
		document.getElementById('nseholi').style.display= 'inline';
		document.getElementById('NSEHOLIDY').style.fontWeight='bold';
		document.getElementById('BSEHOLIDY').style.fontWeight='normal';
		//$('#NSEHOLIDY').addClass("selected");
		//$('#BSEHOLIDY').removeClass("selected");
		document.getElementById('NSEHOLIDY').className='selected';
		
	}
	
}
function showTbleNse(n)
{
	document.getElementById("gainTable"+n).style.className = 'derivative gainTab';
    document.getElementById("NSEOff"+n).style.fontWeight = 'bold';
	document.getElementById("NONNSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("BSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("NONBSEOff"+n).style.fontWeight = 'normal';
	
}
function showTblenonNse(n)
{	document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn2';
    /*document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn2';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn2';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn2';*/
      
	document.getElementById("NONNSEOff"+n).style.fontWeight = 'bold';
	document.getElementById("NSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("BSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("NONBSEOff"+n).style.fontWeight = 'normal';
	
}
function showTbleBse(n)
{
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn3';
    /*document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn3';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn3';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn3';*/
	document.getElementById("BSEOff"+n).style.fontWeight = 'bold';
	document.getElementById("NONNSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("NSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("NONBSEOff"+n).style.fontWeight = 'normal';
	
}
function showTblenonBse(n)
{
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn4';
    /*document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn4';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn4';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabLLTurn4';*/
	document.getElementById("NONBSEOff"+n).style.fontWeight = 'bold';
	document.getElementById("NSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("BSEOff"+n).style.fontWeight = 'normal';
	document.getElementById("NONNSEOff"+n).style.fontWeight = 'normal';
	
}
function showFirstBRS(n)
{	document.getElementById("gainTable"+n).style.className = 'derivative gainTab';
    /*document.getElementById("gainTable"+n).style.className = 'derivative gainTab';
    document.getElementById("gainTable"+n).style.className = 'derivative gainTab';*/
    
      
	document.getElementById("firstBRS"+n).style.fontWeight = 'bold';
	document.getElementById("secondBRS"+n).style.fontWeight = 'normal';
	document.getElementById("thirdBRS"+n).style.fontWeight = 'normal';
	
	
}
function showSecondBRS(n)
{
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabBRS2';
    /*document.getElementById("gainTable"+n).style.className = 'derivative loseTabBRS2';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabBRS2';*/
    
	document.getElementById("secondBRS"+n).style.fontWeight = 'bold';
	document.getElementById("firstBRS"+n).style.fontWeight = 'normal';
	document.getElementById("thirdBRS"+n).style.fontWeight = 'normal';
	
}
function showThirdBRS(n)
{
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabBRS3';
   /* document.getElementById("gainTable"+n).style.className = 'derivative loseTabBRS3';
    document.getElementById("gainTable"+n).style.className = 'derivative loseTabBRS3';*/
  
	document.getElementById("firstBRS"+n).style.fontWeight = 'normal';
	document.getElementById("secondBRS"+n).style.fontWeight = 'normal';
	document.getElementById("thirdBRS"+n).style.fontWeight = 'bold';
	
}

function getMonth(strMonthNameMMM)
{
	strMonthNameMMM = strMonthNameMMM.toUpperCase();
	if(strMonthNameMMM=='JAN')
	{ return "01"; }
	if(strMonthNameMMM=='FEB')
	{ return "02"; }
	if(strMonthNameMMM=='MAR')
	{ return "03"; }
	if(strMonthNameMMM=='APR')
	{ return "04"; }
	if(strMonthNameMMM=='MAY')
	{ return "05"; }
	if(strMonthNameMMM=='JUN')
	{ return "06"; }
	if(strMonthNameMMM=='JUL')
	{ return "07"; }
	if(strMonthNameMMM=='AUG')
	{ return "08"; }
	if(strMonthNameMMM=='SEP')
	{ return "09"; }
	if(strMonthNameMMM=='OCT')
	{ return "10"; }
	if(strMonthNameMMM=='NOV')
	{ return "11"; }
	if(strMonthNameMMM=='DEC')
	{ return "12"; }
	return "01";
}
function isValidDate(dateStr)
{
	// Checks for the following valid date formats:
	// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year

	var matchArray = dateStr.match(datePat); // is the format ok?
	if (matchArray == null) 
	{
		//alert(dateStr + " Date is not in a valid format.")
		return false;
	}
	month = matchArray[1]; // parse date into variables
	day = matchArray[3];
	year = matchArray[4];
	if (month < 1 || month > 12) 
	{ // check month range
		//alert("Month must be between 1 and 12.");
		return false;
	}
	if (day < 1 || day > 31) 
	{
		//alert("Day must be between 1 and 31.");
		return false;
	}
	if ((month==4 || month==6 || month==9 || month==11) && day==31) 
	{
		//alert("Month "+month+" doesn't have 31 days!")
		return false;
	}
	if (month == 2) 
	{ // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day>29 || (day==29 && !isleap)) 
		{
			//alert("February " + year + " doesn't have " + day + " days!");
			return false;
	   	}
	}
	return true;
}

function isValidTime(timeStr) 
{
	// Checks if time is in HH:MM:SS AM/PM format.
	// The seconds and AM/PM are optional.	
	var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;

	var matchArray = timeStr.match(timePat);
	if (matchArray == null) 
	{
		//alert("Time is not in a valid format.");
		return false;
	}
	hour = matchArray[1];
	minute = matchArray[2];
	second = matchArray[4];
	ampm = matchArray[6];

	if (second=="") { second = null; }
	if (ampm=="") { ampm = null }

	if (hour < 0  || hour > 23) 
	{
		//alert("Hour must be between 1 and 12. (or 0 and 23 for military time)");
		return false;
	}
	if (hour <= 12 && ampm == null) 
	{
		if (confirm("Please indicate which time format you are using.  OK = Standard Time, CANCEL = Military Time")) {
			//alert("You must specify AM or PM.");
			return false;
   		}
	}
	if  (hour > 12 && ampm != null) 
	{
		//alert("You can't specify AM or PM for military time.");
		return false;
	}
	if (minute < 0 || minute > 59) 
	{
		alert ("Minute must be between 0 and 59.");
		return false;
	}
	if (second != null && (second < 0 || second > 59)) 
	{
		//alert ("Second must be between 0 and 59.");
		return false;
	}
	return true;
}

function assignDays(strDate, obj, obj1) 
{
	var oArrDate, sCurrDate="", sDate="";
	var date1 = new Date();
	var date2 = new Date();
	var diff  = new Date();

	<!--
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	
	if(month<=9)
	{ month="0"+""+month; }
	if(day<=9)
	{ day="0"+""+day; }
	sCurrDate = month + "/" + day + "/" + year;
	//-->
	//alert(sCurrDate);			
	if(strDate!="")
	{
		oArrDate = strDate.split("-");
		if(oArrDate.length>1)
		{
			//alert(oArrDate[0]);
			//alert(oArrDate[1]);
			//alert(oArrDate[2]);
			//alert(oArrDate[0]<=9);
			if (oArrDate[0]<=9)
			{	strDate = getMonth(oArrDate[1])+"/0"+oArrDate[0]+"/"+oArrDate[2];  }
			else
			{	strDate = getMonth(oArrDate[1])+"/"+oArrDate[0]+"/"+oArrDate[2]; }
		}
		else
			return false;
	}
	else
		return false;

	if (isValidDate(sCurrDate)) // && isValidTime(dateform.firsttime.value)) 
	{ // Validates first date 
		date1temp = new Date(sCurrDate + " 00:00:00");
		date1.setTime(date1temp.getTime());
	}
	else 
		return false; // otherwise exits

	if (isValidDate(strDate)) // && isValidTime(dateform.secondtime.value)) 
	{ // Validates second date 
		date2temp = new Date(strDate + " 00:00:00");
		date2.setTime(date2temp.getTime());
	}
	else 
		return false; // otherwise exits

	// sets difference date to difference of first date and second date
	diff.setTime(Math.abs(date1.getTime() - date2.getTime()));
	timediff = diff.getTime();
	//weeks = Math.floor(timediff / (1000 * 60 * 60 * 24 * 7));
	//timediff -= weeks * (1000 * 60 * 60 * 24 * 7);

	days = Math.floor(timediff / (1000 * 60 * 60 * 24)); 
	//timediff -= days * (1000 * 60 * 60 * 24);

	//hours = Math.floor(timediff / (1000 * 60 * 60)); 
	//timediff -= hours * (1000 * 60 * 60);

	//mins = Math.floor(timediff / (1000 * 60)); 
	//timediff -= mins * (1000 * 60);

	//secs = Math.floor(timediff / 1000); 
	//timediff -= secs * 1000;	
	//dateform.difference.value = weeks + " weeks, " + days + " days, " + hours + " hours, " + mins + " minutes, and " + secs + " seconds";
	obj.value = days;
	obj1.value = eval(days/365);
	return false; // form should never submit, returns false
}

function Trim( str ) 
{
	var resultStr = "";
	
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);
	
	return resultStr;
}

function TrimLeft( str ) 
{
	var resultStr = "";
	var i = len = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";

	if (str.length == 0) 
		resultStr = "";
	else 
	{	
  		// Loop through string starting at the beginning as long as there
  		// are spaces.
//	  	len = str.length - 1;
		len = str.length;
		
  		while ((i <= len) && (str.charAt(i) == " "))
			i++;

   	// When the loop is done, we're sitting at the first non-space char,
 		// so return that char plus the remaining chars of the string.
  		resultStr = str.substring(i, len);
  	}

  	return resultStr;
} // end TrimLeft


function TrimRight( str ) 
	{
	var resultStr = "";
	var i = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";
	
	if (str.length == 0) 
		resultStr = "";
	else 
	{
  		// Loop through string starting at the end as long as there
  		// are spaces.
  		i = str.length - 1;
  		while ((i >= 0) && (str.charAt(i) == " "))
 			i--;
 			
 		// When the loop is done, we're sitting at the last non-space char,
 		// so return that char plus all previous chars of the string.
  		resultStr = str.substring(0, i + 1);
  	}
  	
  	return resultStr;  	
} // end TrimRight

/* Numeric validations */
//check for valid numeric strings
function chkNumeric(strString)
{
	var strValidChars = "0123456789.";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
	   {
	   strChar = strString.charAt(i);
	   if (strValidChars.indexOf(strChar) == -1)
	      {
	      blnResult = false;
	      }
	   }
	var oArr = strString.split(".");
	if(oArr.length>2)
		blnResult = false;
	return blnResult;
}

