// JavaScript for All Functions
// (created by Shagin K Sasi)
//-------------------------------------------------------------------------------------
	 //This Function ..required for showing Symbol
 	// invoke the server side program.... only for the selection of Instname
    // wrong combinations will not fill the Symbol


function Story(type,sno,secid,subsecid)
{	
	fileName = "http://www.cmlinks.com/skp/NewsDetails.asp?type="+ type+"&sno="+ sno+"&secid="+ secid+"&subsecid="+ subsecid;
  	var w1=screen.width;
 	 w1-=300;
 	 var h1=screen.height;
 	 h1-=200;
	 var newWin=window.open(fileName,'win1','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=580,height=360,screenX=0,screenY=0,left=300,top=237');	
}


function checkquote()
{
	var getquote=document.frmQuotes.txtQuotes.value;
	var PageOpt=document.frmQuotes.PageOpt.value;
	if (getquote=="" || getquote=="enter company name")
	{
		alert('Please Enter First few Characters Of a Company')
		document.frmQuotes.txtQuotes.focus()
		window.status='Please Enter First few Characters of a company';
		return false;
	}
	else{
	document.frmQuotes.action="skpresearch.asp?target=companylist.asp|txtQuotes="+ getquote+"~pageOpt="+ PageOpt;
	document.frmQuotes.submit();
	}
}

function empty()
{
if (document.frmQuotes.txtQuotes.value=="enter company name")
{
  document.frmQuotes.txtQuotes.value="";
 }
}

function fill()
{

	var getquote=document.frmQuotes.txtQuotes.value;
	if (getquote=="")
	{
		document.frmQuotes.txtQuotes.value="enter company name";
	}
}

function ChangeComp(opt){
	if(opt !='')
	{
	var objRS = RSGetASPObject("GetSymbol.asp"); 
	var objResult = objRS.fillsymbol(opt); 
	var strNames = objResult.return_value; 
	document.getq_form.Symbol.length=0;
	if(strNames != "undefined")
	{	
		document.getq_form.Symbol.options[0] = new Option(); 
		document.getq_form.Symbol.options[0].value='';
		document.getq_form.Symbol.options[0].text='Select symbol Type';
			
		var arrCatNames = strNames.split("|"); 	
		for(i=0; i<arrCatNames.length-1; i++)
		{	
			var strid=arrCatNames[i];
			document.getq_form.Symbol.options[i+1] = new Option(); 
			document.getq_form.Symbol.options[i+1].value=strid;
			document.getq_form.Symbol.options[i+1].text=strid;
		}
	}
	}	
}


//-------------------------------------------------------------------------------------
	 //This Function ..required for showing Expiry Date
 	// invoke the server side program.... only for the selection of symbol
    // wrong combinations will not fill the strike price
function ChangeExpDate(sym){
	var opt=document.getq_form.InstType[document.getq_form.InstType.selectedIndex].value;
	if(opt !='' && sym != '')
	{
	var objRS = RSGetASPObject("GetExpDate.asp"); 
	var objResult = objRS.fillexpdate(sym); 
	var strNames = objResult.return_value; 
	document.getq_form.ExpDate.length=0;
	if(strNames != "undefined")
	{	
		document.getq_form.ExpDate.options[0] = new Option(); 
		document.getq_form.ExpDate.options[0].value='';
		document.getq_form.ExpDate.options[0].text='Select Expiry Date';
		var arrCatNames = strNames.split("|"); 
			
		for(i=0; i<arrCatNames.length-1; i++)
		{	
			var strid=arrCatNames[i];
			document.getq_form.ExpDate.options[i+1] = new Option(); 
			document.getq_form.ExpDate.options[i+1].value=strid;
			document.getq_form.ExpDate.options[i+1].text=strid;
		}
	}
	}	
}
//-------------------------------------------------------------------------------------
	 //This Function ..required for showing Option Types
 	// This Function invokes  only the combinations (InstName = OPTIDX or  InstName = OPTSTK ) it shows the table id named "OptTable"
	// if the instname equals OPTIDX then opttype is PE or CE Else OptType is PA or CA
    // wrong combinations will not shows the table			
function ShowTypes(opt){
	if(opt=='OPTIDX' || opt=='OPTSTK')
	{
		OptTable.style.display='inline';
			if(opt =='OPTIDX')
			{
					document.getq_form.OptType.length=3;
					document.getq_form.OptType.options[0].value="";
					document.getq_form.OptType.options[0].text='Select Option Type';
					document.getq_form.OptType.options[1].value='PE';
					document.getq_form.OptType.options[1].text='PE';
					document.getq_form.OptType.options[2].value='CE';
					document.getq_form.OptType.options[2].text='CE';					
			 }	
			 else
			 {
					document.getq_form.OptType.length=3;
					document.getq_form.OptType.options[0].value="";
					document.getq_form.OptType.options[0].text='Select Option Type';
					document.getq_form.OptType.options[1].value='PA';
					document.getq_form.OptType.options[1].text='PA';
					document.getq_form.OptType.options[2].value='CA';
					document.getq_form.OptType.options[2].text='CA';			 
			 }
	 }
	 else
	 {
		OptTable.style.display='none';
	 }	
}

//-------------------------------------------------------------------------------------
	 //This Function ..required for showing Strike Prices
 	// invoke the server side program.... only the combinations (InstName, Symbol, ExpDate, OptType) not equal to space 
    // wrong combinations will not fill the strike price
function ShowStrikes(){
	var OptType = document.getq_form.OptType[document.getq_form.OptType.selectedIndex].value;
	var InstName = document.getq_form.InstType[document.getq_form.InstType.selectedIndex].value;
	var Symbol = document.getq_form.Symbol[document.getq_form.Symbol.selectedIndex].value;
	var ExpDate = document.getq_form.ExpDate[document.getq_form.ExpDate.selectedIndex].value;
	if(InstName != '' && Symbol !='' && ExpDate != '' && OptType !='')
	{
		var OptStr = InstName +"|"+ Symbol +"|"+ ExpDate +"|"+ OptType
		var objRS = RSGetASPObject("GetStkPrice.asp"); 
		var objResult = objRS.fillstkprice(OptStr); 
		var strNames = objResult.return_value; 
		document.getq_form.StkPrice.length=0;
		if(strNames != "undefined")
		{	
			document.getq_form.StkPrice.options[0] = new Option(); 
			document.getq_form.StkPrice.options[0].value="";
			document.getq_form.StkPrice.options[0].text='Select Stroke Price';
			
			var arrCatNames = strNames.split("|"); 	
			for(i=0; i<arrCatNames.length-1; i++)
			{	
				var strid=arrCatNames[i];
				document.getq_form.StkPrice.options[i+1] = new Option(); 
				document.getq_form.StkPrice.options[i+1].value=strid;
				document.getq_form.StkPrice.options[i+1].text=strid;
			}
		}
	}
}


//-------------------------------------------------------------------------------------
	 //final check ..required since any change during final submission will
 	// unnecessarily invoke the server side program.... only the combinations
    // wrong combinations will shows the alert message
function validate(){
	var InstType = document.getq_form.InstType.options[document.getq_form.InstType.selectedIndex].value
	var Symbol =  document.getq_form.Symbol.options[document.getq_form.Symbol.selectedIndex].value
	var ExpDate =  document.getq_form.ExpDate.options[document.getq_form.ExpDate.selectedIndex].value
	var OptType =  document.getq_form.OptType.options[document.getq_form.OptType.selectedIndex].value
	var StkPrice =  document.getq_form.StkPrice.options[document.getq_form.StkPrice.selectedIndex].value
	var msg = "Please select "		
		if(InstType==""){
			alert(msg + "Instrument Type ...!")
			return false;
		}
		if(Symbol==""){
			alert(msg + "Symbol ...!")
			return false;
		}
		if(ExpDate==""){
			alert(msg + "Expiry Date ...!")
			return false;
		}
		if(InstType=='OPTIDX' || InstType=='OPTSTK'){
			if(OptType==""){
				alert(msg + "Otion Type ...!")
				return false;
			}
			if(StkPrice==""){
				alert(msg + "Strike Price ...!")
				return false;
			}
		}					
}

//-------------------------------------------------------------------------------------
//final check ..For Commodity get quotes
function CommValidate(){
	var Exchng = document.getq_form.Exchng.options[document.getq_form.Exchng.selectedIndex].value
	var Symbol =  document.getq_form.Symbol.options[document.getq_form.Symbol.selectedIndex].value
	var ExpDate =  document.getq_form.ExpDate.options[document.getq_form.ExpDate.selectedIndex].value

	var msg = "Please select "		
		if(Exchng==""){
			alert(msg + "Commodity Exchange ...!")
			return false;
		}
		if(Symbol==""){
			alert(msg + "Symbol ...!")
			return false;
		}
		if(ExpDate==""){
			alert(msg + "Expiry Date ...!")
			return false;
		}
}

function onChange(pgName){
   document.getq_form.action = pgName
   document.getq_form.submit();
}

function onChangeSymbol(pgName){
   document.frmMain.action = pgName
   document.frmMain.submit();
}

function submitMktRpt(InstName,Sym) {
	window.location = "foMktReport.asp?InstType="+ InstName +"&Sym="+ Sym
}

function showpopup(opt)
{
if(opt!="SE")
document.location=opt;
}



function pagelink(urlname,opt,glopt,Exchng,PageOpt){
if(urlname != '' && opt !='' && glopt != '' && Exchng !=''){ 
		document.location= urlname +"?Exchg="+ Exchng +"&VAL="+ glopt +"&Fld="+ opt+"&PageOpt="+ PageOpt
} 
}

function pagelinkNSE(urlname,opt,glopt,Exchng,PageOpt){
if(urlname != '' && opt !='' && glopt != '' && Exchng !=''){ 
		document.location= urlname +"?Exchg="+ Exchng +"&VAL="+ glopt +"&Fld="+ opt+"&PageOpt="+ PageOpt
} 
}

function pagelinkMW(urlname,opt,Exchng){
if(urlname != '' && opt !='' && Exchng !=''){ 
		document.location= urlname +"?Exchg="+ Exchng+"&Val="+ opt
} 
}


function TradeLink(option){
switch (option){ 
	case 'NI' : 
		document.location= "NseTopQty.asp?PageOpt=9&Fld=NI&FldG=R&Exchg=NSE"
	break; 
	case 'NJ' : 
		document.location= "NseTopQty.asp?PageOpt=9&Fld=NJ&FldG=R&Exchg=NSE"
	break; 
	case 'OT' : 
		document.location= "NseTopQty.asp?PageOpt=9&Fld=OT&FldG=R&Exchg=NSE"
	break; 
	case 'AL' : 
		document.location= "NseTopQty.asp?PageOpt=9&Fld=AL&FldG=R&Exchg=NSE"
	break; 
} 
}
function TradeValue(option){
switch (option){ 
	case 'NI' : 
		document.location= "NseTopValue.asp?PageOpt=3&FLd=NI&Exchg=NSE"
	break; 
	case 'NJ' : 
		document.location= "NseTopValue.asp?PageOpt=3&FLd=NJ&Exchg=NSE"
	break; 
	case 'OT' : 
		document.location= "NseTopValue.asp?PageOpt=3&Fld=OT&Exchg=NSE"
	break; 
	case 'AL' : 
		document.location= "NseTopValue.asp?PageOpt=3&FLd=AL&Exchg=NSE"
	break; 
} 
}
function Highlink(option){
switch (option){ 
	case 'NI' : 
		document.location= "NseHL.asp?Exchg=NSE&pageOpt=6&Fld=NI"
	break; 
	case 'NJ' : 
		document.location= "NseHL.asp?Exchg=NSE&pageOpt=6&Fld=NJ"
	break; 
} 
}
function NseHighLow(option){
switch (option){ 
	case 'NI' : 
		document.location= "Nse52HighLow.asp?PageOpt=4&FLd=NI&Exchg=NSE"
	break; 
	case 'NJ' : 
		document.location= "Nse52HighLow.asp?PageOpt=4&FLd=NJ&Exchg=NSE"
	break; 
	case 'OT' : 
		document.location= "Nse52HighLow.asp?PageOpt=4&FLd=OT&Exchg=NSE"
	break; 
	case 'AL' : 
		document.location= "Nse52HighLow.asp?PageOpt=4&FLd=AL&Exchg=NSE"
	break; 
} 
}

function PagelinkTrade(option){

switch (option){ 
	case 'A' : 
		document.location= "BseTopQty.asp?Fld=A&FldG=R&Exchg=BSE&PageOpt=9"
	break; 
	case 'B1' : 
		document.location="BseTopQty.asp?Fld=B1&FldG=R&Exchg=BSE&PageOpt=9"
	break; 
	case 'B2' : 
		document.location= "BseTopQty.asp?Fld=B2&FldG=R&Exchg=BSE&PageOpt=9"
	break; 
	case 'T' : 
		document.location= "BseTopQty.asp?Fld=T&FldG=R&Exchg=BSE&PageOpt=9"
	break; 
	case 'Z' : 
		document.location= "BseTopQty.asp?Fld=Z&FldG=R&Exchg=BSE&pageOpt=9"
	break; 
	case 'ALL' : 
		document.location= "BseTopQty.asp?Fld=ALL&FldG=R&Exchg=BSE&pageOpt=9"
	break;
} 
}

function PagelinkHighLow(option){
switch (option){ 
	case 'A' : 
		document.location= "Bse52HighLow.asp?PageOpt=4&Fld=A&FldG=R&Exchg=BSE"
	break; 
	case 'B1' : 
		document.location="Bse52HighLow.asp?PageOpt=4&Fld=B1&FldG=R&Exchg=BSE"
	break; 
	case 'B2' : 
		document.location= "Bse52HighLow.asp?PageOpt=4&Fld=B2&FldG=R&Exchg=BSE"
	break; 
	case 'T' : 
		document.location= "Bse52HighLow.asp?PageOpt=4&Fld=T&FldG=R&Exchg=BSE"
	break; 
	case 'Z' : 
		document.location= "Bse52HighLow.asp?PageOpt=4&Fld=Z&FldG=R&Exchg=BSE"
	break; 
	case 'ALL' : 
		document.location= "Bse52HighLow.asp?PageOpt=4&Fld=ALL&FldG=R&Exchg=BSE"
	break;
} 
}

function PagelinkAdv(option){
switch (option){ 
case 'A' : 
document.location= "BseAdvDec.asp?Fld=A&FldG=R&Exchg=BSE"
break; 
case 'B1' : 
document.location="BseAdvDec.asp?Fld=B1&FldG=R&Exchg=BSE"
break; 
case 'B2' : 
document.location= "BseAdvDec.asp?Fld=B2&FldG=R&Exchg=BSE"
break; 
case 'T' : 
document.location= "BseAdvDec.asp?Fld=T&FldG=R&Exchg=BSE"
break; 
case 'Z' : 
document.location= "BseAdvDec.asp?Fld=Z&FldG=R&Exchg=BSE"
break; 
case 'ALL' : 
document.location= "BseAdvDec.asp?Fld=ALL&FldG=R&Exchg=BSE"
break;
} 
}

function Pagelink(option){
switch (option){ 
case 'S' : 
document.location= "BseHL.asp?PageOpt=6&FldG=R&Exchg=BSE&Fld="
break; 
case 'A' : 
document.location= "BseHL.asp?PageOpt=6&Fld=A&FldG=R&Exchg=BSE"
break; 
case 'B1' : 
document.location="BseHL.asp?PageOpt=6&Fld=B1&FldG=R&Exchg=BSE"
break; 
case 'B2' : 
document.location= "BseHL.asp?PageOpt=6&Fld=B2&FldG=R&Exchg=BSE"
break; 
} 
}

function PagelinkValue(option){
switch (option){ 
	case 'A' : 
		document.location= "BseTopValue.asp?PageOpt=3&Fld=A&FldG=R&Exchg=BSE"
	break; 
	case 'B1' : 
		document.location="BseTopValue.asp?PageOpt=3&Fld=B1&FldG=R&Exchg=BSE"
	break; 
	case 'B2' : 
		document.location= "BseTopValue.asp?PageOpt=3&Fld=B2&FldG=R&Exchg=BSE"
	break; 
	case 'T' : 
		document.location= "BseTopValue.asp?PageOpt=3&Fld=T&FldG=R&Exchg=BSE"
	break; 
	case 'Z' : 
		document.location= "BseTopValue.asp?PageOpt=3&Fld=Z&FldG=R&Exchg=BSE"
	break; 
	case 'ALL' : 
		document.location= "BseTopValue.asp?PageOpt=3&Fld=ALL&FldG=R&Exchg=BSE"
	break;
} 
}
//function showData()
//{
	//document.frmComm.submit() 
//}

function showAD(T1,T2,T3){
	//alert(T1)
	//alert(T2)
	//alert(T3)
	if (T1=="S"){
	return false;
	}
	document.location= "AdvDec_Details.asp?pageOpt=12&PageName="+ T1+"&CType="+ T2+"&Exchg="+ T3
}
//window.history.forward(1);
function SubmitAlpha()
	{
		document.mutual1.action="mf_schemepro.asp?mutcode="+ document.mutual1.mutcode.options[document.mutual1.mutcode.selectedIndex].value+"&Modopt=MF"
		document.mutual1.submit();
		return false;
		}

	function SubmitAlpha1(pageOpt)
	{
	document.mutual1.action = "mf_schemepro.asp?mutcode="+ document.mutual1.mutcode.options[document.mutual1.mutcode.selectedIndex].value+"&class="+ document.mutual1.classes.options[document.mutual1.classes.selectedIndex].value+"&Modopt=MF&pageOpt="+pageOpt
	document.mutual1.submit();
	return false;
	}

    function SubmitAlpha2(pageOpt)
	{
	if (document.mutual1.scheme.options[document.mutual1.scheme.selectedIndex].value=="all")
	{
	alert("Select a scheme")
	}
	else
	{
	document.mutual1.action="mf_profile.asp?schcode="+ document.mutual1.scheme.options[document.mutual1.scheme.selectedIndex].value+"&tick=1&Modopt=MF&pageOpt="+pageOpt
    document.mutual1.submit();
    }
    return false;
	}
   function SubmitAlpha7(pageOpt)
	{
	if (document.mutual.amc.options[document.mutual.amc.selectedIndex].value!="SE"){
	document.mutual.action="mf_address.asp?amccode="+ document.mutual.amc.options[document.mutual.amc.selectedIndex].value+"&tick=1&Modopt=ADD&pageOpt="+pageOpt
	document.mutual.submit();
	}
	else{
	alert("Select AMC")
	return false;
	}
    }
		
	function SubmitAlphanew2(pageOpt)
	{
	if (document.mutual1.scheme.options[document.mutual1.scheme.selectedIndex].value=="all")
	{
	alert("Select a scheme")
	}
	else
	{
	document.mutual1.action="performancetest.asp?scheme="+ document.mutual1.scheme.options[document.mutual1.scheme.selectedIndex].value+"&Modopt=MF&pageOpt="+pageOpt
    document.mutual1.submit();
    }
    return false;
	}

    function SubmitAlpha4(pageOpt)
	{
		document.mutual1.action="mf_schemepro.asp?mutcode="+ document.mutual1.mutcode.options[document.mutual1.mutcode.selectedIndex].value+"&Modopt=MF&pageOpt="+pageOpt
		document.mutual1.submit();
		return false;
	}	
    function SubmitAlpha5(pageOpt)
	{
		document.mutual1.action="mf_address.asp?mutcode="+ document.mutual1.mutcode.options[document.mutual1.mutcode.selectedIndex].value+"&Modopt=MF&pageOpt="+pageOpt
		document.mutual1.submit();
		return false;
	}	

function pop6(r1,r2,r3,r4)
{
	url="MF_Profile.asp?showpage=" + r1 + "&code=" + r2 + "&coname=" + r3+"&pageOpt="+r4
	window.open(url ,"ros2","height=400,width=730,left=50,top=100,scrollbars=yes" )
}

	function pop4(r1,r2,r3,r4)
	{
		url="MF_Profile.asp?showpage=" + r1 + "&code=" + r2 + "&coname=" + r3+"&pageOpt="+r4				
		window.open(url ,"ros2","height=400,width=730,left=50,top=100,scrollbars=yes" )
	}
	function pop3(r1,r2,r3,r4)
	{
		url="MF_Profile.asp?showpage=" + r1 + "&code=" + r2 + "&coname=" + r3+"&pageOpt="+r4
		window.open(url ,"ros2","height=400,width=730,left=50,top=100,scrollbars=yes" )
	}
	function popaddress(r1,r2,r3,r4)
	{
		 url="mf_amcdet.asp?addressdet=" + r1 + "&mfcomp=" + r2+"&amcname="+escape(r3) +"&pageOpt="+r4
		News=window.open(url ,"ros2","height=355,width=770,left=55,top=82,scrollbars=yes")
		if(!News.focus())
		News.focus()
	}
	function winnav(r1,r2)
	{
	url="mf_histnav.asp?schcode=" + r1 + "&coname="+escape(r2)
	News=window.open(url ,"ros2","height=375,width=635,left=55,top=82,scrollbars=yes" )
	if(!News.focus())
	News.focus()
	}	

		function popback(r1,r2)
		{
			 url="mf_background.asp?amcval=" + r1+"&amcname="+escape(r2)
			News=window.open(url ,"ros2","height=300,width=635,left=55,top=82,scrollbars=yes")
			if(!News.focus())
		News.focus()
		}
		function popback(r1,r2)
		{
			 url="mf_background.asp?amcval=" + r1+"&amcname="+escape(r2)
			News=window.open(url ,"ros2","height=300,width=635,left=55,top=82,scrollbars=yes")
			if(!News.focus())
		News.focus()
		}
function checkNav()
{
var getquote = document.GetQuoteFrm.cmpalpha.value;
if (getquote=="")
{
	alert('Please enter few Characters')
	document.form2.cmpalpha.focus()
	window.status='Please enter first few Characters of a company';
	return false;
}
document.GetQuoteFrm.submit()
}
function checkqsuote(frmQuotes)
{
	var getquote=document.frmQuotes.txtQuotes.value;
	var PageOpt=document.frmQuotes.PageOpt.value;
	if (getquote=="" || getquote=="enter company name")
	{
		alert('Please Enter First few Characters Of a Company')
		document.frmQuotes.txtQuotes.focus()
		window.status='Please Enter First few Characters of a company';
		return false;
	}
	//document.form1.ifSubmit.value = "Y";
	window.location = "skpresearch.asp?target=companylist.asp|txtQuotes="+ getquote+"~pageOpt="+ PageOpt
}

function showContract(opt){
if(opt!="SE"){
switch (opt){ 	
	case '1' :
		document.location="foMostActContract.asp?SortOrder=TradedQty&pageOpt=1"
	break; 
	case '2' :
		document.location="foMostActContract.asp?SortOrder=TradedQty&InstType=FUTIDX&symbol=nifty&pageOpt=2"
	break; 
	case '3' :
		document.location="foMostActContract.asp?SortOrder=TradedQty&InstType=OPTIDX&symbol=nifty&pageOpt=3"
	break; 
	case '4' :
		document.location="foMostActContract.asp?SortOrder=TradedQty&InstType=FUTIDX&symbol=CNXIT&Sym=S&pageOpt=4"
	break; 
	case '5' :
		document.location="foMostActContract.asp?SortOrder=TradedQty&InstType=OPTIDX&symbol=CNXIT&Sym=S&pageOpt=5"
	break; 
	case '6' :
		document.location="foMostActContract.asp?SortOrder=TradedQty&InstType=FUTSTK&Sym=SP&pageOpt=6"
	break; 
	case '7' :
		document.location="foMostActContract.asp?SortOrder=TradedQty&InstType=OPTSTK&Sym=SP&pageOpt=7"
	break; 
} 
}
}


//************************************************ For NSE INDICES

	var isIE=(document.all)?1:0;
	var isNS4=(document.layers)?1:0;
	var isNS6=((document.getElementById)&&(navigator.appName=='Netscape'))?1:0;
	var isNS=((isNS4)||(isNS6))?1:0;
	var DHTML=(isIE||isNS4||isNS6)?1:0;
	function handleError() {return true;}	window.onerror = handleError; capEvents();

var index_type = "";
var fromday = "";
var frommon = "";
var fromyr = "";
var today = "";
var tomon = "";
var toyr = "";
var flag = false;
var fromflag=false;
var toflag=false;

	function validate()
	{


		index_type = document.indform.IndexType.selectedIndex;

			if(index_type != 0 )
			{
				//alert("selected");
				//alert(document.indform.IndexType.options[document.indform.IndexType.selectedIndex].value);

				//alert(".....From day value is....."+fromday);

				fromday = eval(document.indform.Fromday.options[document.indform.Fromday.selectedIndex].value);
				//alert(".....From day value is....."+fromday);

				if(fromday != 0)
				{
					//alert(".....From day value is"+fromday);

					frommon = eval(document.indform.Frommon.options[document.indform.Frommon.selectedIndex].value);

					//alert("From month value is"+frommon);

					if(frommon != 0)
					{
						//alert("From month value is"+frommon);

						fromyr = eval(document.indform.Fromyr.options[document.indform.Fromyr.selectedIndex].value);

						if(fromyr != 0)
						{
							//alert("From year value is"+fromyr);

							today = eval(document.indform.Today.options[document.indform.Today.selectedIndex].value);

							if(today != 0)
							{
								//alert("To day value is"+today);

								tomon = eval(document.indform.Tomon.options[document.indform.Tomon.selectedIndex].value);

								if(tomon != 0)
								{
									//alert("To month value is"+tomon);

									toyr = eval(document.indform.Toyr.options[document.indform.Toyr.selectedIndex].value);

									if(toyr != 0)
									{
										//alert("To year value is"+toyr);

											// Date Validator function to be called
											//alert("value of from flag before func"+fromflag);
											//alert("value of flag before func"+flag);

											date_validator();

											//alert("value of flag after func"+flag);
											//alert("value of from flag after func"+fromflag);
											//alert("value of to flag after func"+toflag);

											if(fromflag == true && toflag == true)
											{
												// checking from date vals & to date vals
												if(fromyr == toyr || fromyr < toyr)
												{
														if(fromyr == toyr)
														{
																if(frommon == tomon || frommon < tomon)
																{
																		if(frommon == tomon)
																		{
																				if(fromday == today || fromday < today)
																				{
																					//return false;
																					return true;
																				}
																				else
																				{
																					alert("From date cannot be greater than to date");
																					return false;
																				}
																		}
																		else
																		{
																		//return false;
																		return true;
																		}
																}
																else
																{
																	alert("From month cannot be greater than to month");
																	return false;
																}
														}
														else
														{
														//return false;
														return true;
														}
												}
												else
												{
													alert("From year cannot be greater than to year");
													return false;
												}
										 	}
										 	else
											return false;

									}
									else
									{
										alert("Please Enter To Year Before You Proceed");
										return false;
									}
								}
								else
								{
									alert("Please Enter To Month Before You Proceed");
									return false;
								}

							}
							else
							{
								alert("Please Enter To Day Before You Proceed");
								return false;
							}

						}
						else
						{
							alert("Please Enter From Year Before You Proceed");
							return false;
						}

					}
					else
					{
						alert("Please Enter From Month Before You Proceed");
						return false;
					}

				}
				else
				{
					alert("Please Enter From Day Before You Proceed");
				 	return false;
				}


				return false;
			}
			else
			{
				 alert("Please Select The Index Type Before You Proceed");
	   			  return false;
			}

	}

function date_validator()
{
		//alert("In date validator function");
		//alert("From month value entered is"+frommon);
		//alert("From date value entered is"+fromday);
		//alert("From year value entered is"+fromyr);

		var yrVal = "";
		var monthVal = "";
		var dayVal = "";
		var To_yrVal = "";
		var To_dayVal = "";
		var To_monthVal = "";

		yrVal = fromyr;
		monthVal = frommon;
		dayVal = fromday;

		To_yrVal = toyr;
		To_monthVal = tomon;
		To_dayVal = today;

		//alert("Day value entered is"+dayVal);
		//alert("Month value entered is"+monthVal);
		//alert("Year value entered is"+yrVal);


		//alert("To year value entered is"+To_yrVal);
		//alert("To month value entered is"+To_monthVal);
		//alert("To day value entered is"+To_dayVal);

// ********************************
// Validating From date values

	   	//check for month with 30 days
		if((monthVal==4||monthVal==6||monthVal==9||monthVal==11)&& dayVal > 30)
		{
		   alert("From month cannot have more than 30 days");
		   fromflag = false;
		   //alert("value of flag "+fromflag);
		}
		else
		{
			//check for feb
			if(monthVal==2)
			{
				if((yrVal % 4 !=0 && yrVal % 400 !=0) && dayVal > 28)
				{
				  alert(" February cannot have more than 28 days in this year");
				  fromflag = false;
				}
				else
				{
				   if ((yrVal % 4 ==0 || yrVal % 400 ==0) && dayVal > 29)
				   {
					   alert(" February cannot have more than 29 days in this year");
					   fromflag = false;
				   }
				   else
				   {
				       fromflag = true;
				   }
				}

			}
			else
			{
				  if(dayVal > 31)
				  {
				   alert(" You cannot have more than 31 days for this month");
			       fromflag = false;
				  }
				  else
				  {
				    fromflag = true;
				  }
			}
		}//valid year check



// End of Validating From date values
// ******************************************

// *****************************************
// Validating To date values

	//check for month with 30 days
			if((To_monthVal==4||To_monthVal==6||To_monthVal==9||To_monthVal==11)&& To_dayVal > 30)
			{
			   alert("To month cannot have more than 30 days");
			   toflag = false;
			}
			else
			{
				//check for feb
				if(To_monthVal==2)
				{
					if((To_yrVal % 4 !=0 && To_yrVal % 400 !=0) && To_dayVal > 28)
					{
					  alert(" February cannot have more than 28 days in this year");
					  toflag = false;
					}
					else
					{
					   if ((To_yrVal % 4 ==0 || To_yrVal % 400 ==0) && To_dayVal > 29)
					   {
						   alert(" February cannot have more than 29 days in this year");
						   toflag = false;
					   }
					   else
					   {
					       toflag = true;
					   }
					}

				}
				else
				{
					  if(To_dayVal > 31)
					  {
					   alert(" You cannot have more than 31 days for this To month");
				       toflag = false;
					  }
					  else
					  {
					    toflag = true;
					  }
				}
			}

//End of Validating To date values
// *****************************************

//alert("value of from flag ..."+fromflag);
//alert("value of To flag ..."+toflag);

}


	function DivSub()
	{
		if ((document.Dividend.DivMth.selectedIndex ==0) && (document.Dividend.Fund.selectedIndex ==0) && (document.Dividend.Cat.selectedIndex ==0)&& (document.Dividend.SType.selectedIndex ==0)) 
		{
			alert('Select a Criteria')
			return false
		}
		else
		{
			document.Dividend.submit();
			return false;
		}
	}



function Show_MG(id) 
{
	if (id == "MG") 
	{
	NG.style.display = "none";
	MG.style.display = "inline";
	}
}
function Show_NG(id) 
{
	if (id == "NG") 
	{
	MG.style.display = "none";
	NG.style.display = "inline";
	}
}
function Show_ML(id) 
{
	if (id == "ML") 
	{
	NL.style.display = "none";
	ML.style.display = "inline";
	}
}
function Show_NL(id) {
	if (id == "NL") {
	ML.style.display = "none";
	NL.style.display = "inline";
	}
}	
function Show_NV(id) {
	if (id == "NV") {
	MV.style.display = "none";
	NV.style.display = "inline";
	}
}
function Show_MV(id) 
{
	if (id == "MV")
	{
	NV.style.display = "none";
	MV.style.display = "inline";
	}
}
function Show_NA(id) {
	if (id == "NA") {
	MA.style.display = "none";
	NA.style.display = "inline";
	}
}
function Show_MA(id) {
	if (id == "MA") {
	NA.style.display = "none";
	MA.style.display = "inline";
	}
}
function Show_ND(id) 
{
	if (id == "ND") 
	{
	MD.style.display = "none";
	ND.style.display = "inline";
	}
}
function Show_MD(id) {
	if (id == "MD") {
	ND.style.display = "none";
	MD.style.display = "inline";
	}
}
function Show_NC(id) 
{
	if (id == "NC") 
	{
	MC.style.display = "none";
	NC.style.display = "inline";
	}
}
function Show_MC(id) 
{
	if (id == "MC")
	{
	NC.style.display = "none";
	MC.style.display = "inline";
	}
}

function Ticker(id) 
{
	if (id == "BSE")
	{
	NseTicker.style.display = "none";
	BseTicker.style.display = "inline";
	}
	if (id == "NSE") {
	NseTicker.style.display = "inline";
	BseTicker.style.display = "none";
	}
}


function Show_TopG(id) 
{
	if (id == "BSE") 
	{
	BseTopG.style.display = "inline";
	SelBseG.style.display = "inline";
	SelNseG.style.display = "none";
	NseTopG.style.display = "none";
	}
	if (id == "NSE") {
	NseTopG.style.display = "inline";
	SelNseG.style.display = "inline";
	SelBseG.style.display = "none";
	BseTopG.style.display = "none";
	}
}

function Show_TopL(id) 
{
	if (id == "BSE") 
	{
	BseTopL.style.display = "inline";
	SelBseL.style.display = "inline";
	SelNseL.style.display = "none";
	NseTopL.style.display = "none";
	}
	if (id == "NSE") {
	NseTopL.style.display = "inline";
	SelNseL.style.display = "inline";
	SelBseL.style.display = "none";
	BseTopL.style.display = "none";
	}
}

function ShowG_Nse()
{	
	BseGraph.style.display = "none"; 
	NseGraph.style.display = "inline";
	BseOn.style.display = "none";
	NseOn.style.display = "inline";
}

function ShowG_Bse()
{	
	NseGraph.style.display = "none";
	BseGraph.style.display = "inline";
	BseOn.style.display = "inline";
	NseOn.style.display = "none";

}


function ShowNews(id)
{	
	if(id == "P")
	{
		MktComm.style.display = "none";
		PreSession.style.display = "inline";
		MidSession.style.display = "none";
		EndSession.style.display = "none";
	}
	if(id == "M")
	{
		MktComm.style.display = "none";
		PreSession.style.display = "none";
		MidSession.style.display = "inline";
		EndSession.style.display = "none";
	}
	if(id == "E")
	{
		MktComm.style.display = "none";
		PreSession.style.display = "none";
		MidSession.style.display = "none";
		EndSession.style.display = "inline";
	}
	
}


function Show_MG(id)
{
	if (id == "MG") 
	{
	NG.style.display = "none";
	MG.style.display = "inline";
	}
}
function Show_NG(id) {
	if (id == "NG") {
	MG.style.display = "none";
	NG.style.display = "inline";
	}
}
function Show_ML(id) {
	if (id == "ML") {
	NL.style.display = "none";
	ML.style.display = "inline";
	}
}
function Show_NL(id) 
{
	if (id == "NL") 
	{
	ML.style.display = "none";
	NL.style.display = "inline";
	}
}	
function Show_NV(id) {
	if (id == "NV") {
	MV.style.display = "none";
	NV.style.display = "inline";
	}
}
function Show_MV(id) 
{
	if (id == "MV") 
	{
	NV.style.display = "none";
	MV.style.display = "inline";
	}
}
function Show_NA(id) 
{
	if (id == "NA") 
	{
	MA.style.display = "none";
	NA.style.display = "inline";
	}
}
function Show_MA(id) 
{
	if (id == "MA") 
	{
	NA.style.display = "none";
	MA.style.display = "inline";
	}
}
function Show_ND(id) 
{
	if (id == "ND") 
	{
	MD.style.display = "none";
	ND.style.display = "inline";
	}
}
function Show_MD(id) 
{
	if (id == "MD") 
	{
	ND.style.display = "none";
	MD.style.display = "inline";
	}
}
function Show_NC(id) 
{
	if (id == "NC") 
	{
	MC.style.display = "none";
	NC.style.display = "inline";
	}
}
function Show_MC(id) {
	if (id == "MC") {
	NC.style.display = "none";
	MC.style.display = "inline";
	}
}

function Ticker(id) {
	if (id == "BSE") {
	NseTicker.style.display = "none";
	BseTicker.style.display = "inline";
	}
	if (id == "NSE") {
	NseTicker.style.display = "inline";
	BseTicker.style.display = "none";
	}
}


function ShowMFnews(srno)
 {
window.open("MF_news.asp?srno="+srno+"","gop", 'x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=580,height=360,screenX=0,screenY=0,left=300,top=237');
 }
