
//-------------------------------------------------------------------------------------
// Derivatives Get Quotes Select Starts here
var XmlHttpFO;
var InstIndex="";
var SymbIndex="";
var ExpIndex ="";
var TypeIndex="";
var StrikeIndex="";

var ExpiryDate="";
var OptionType="";
var InstrumentTypeVal="";
var SymbolVal="";
var StrikeVal="";


function dateConvert(strDate){
	//strDate = "21/01/2006"
	var strMon=0;
	monthArr = new Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	strMon = strDate.substring(3,5);
	if(strMon.substring(0,1)==0)strMon=strMon.substring(1,2);
	return strDate.substring(0,2) + "-" + monthArr[strMon] + "-" + strDate.substring(6) 	
}
/*Start Here By Anuradha*/
function CreateXmlHttpNew()
{
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttpFO = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpFO= new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
		XmlHttpFO=null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari
	if (!XmlHttpFO && typeof XmlHttpRequest != "undefined")
	{
		XmlHttpFO = new XmlHttpRequest();
	}
}

function Get_Symbol()
{
	
	var InstName =document.getElementById('InstrumentType');
	//alert(InstName.value);
	var Symbol = document.getElementById("Symbol"); 	
	var OptionType = document.getElementById("OptionType");
	var StrikePrice = document.getElementById("StrikePrice");
	
	StrikePrice.length = 0;
	StrikePrice.options[0] = new Option();
	StrikePrice.options[0].value="";
	StrikePrice.options[0].text="Select Strike Price";
	
	CreateXmlHttpNew();
	document.body.style.cursor="progress";
	var requestUrl="FO_Symbol.aspx?timeStamp="+ new Date().getTime() +"&InstName="+InstName.value;
	//alert(requestUrl);
	if (XmlHttpFO)
	{
		XmlHttpFO.onreadystatechange = function(){getSymbolResp(Symbol,InstName)};
		XmlHttpFO.open("GET", requestUrl,  true);
		XmlHttpFO.send(null);
	}
}
//Called when response comes back from server Only For Symbol
function getSymbolResp(ig_,ig_2)
{
	// To make sure receiving response data from server is completed
	if(XmlHttpFO.readyState == 4)
	{		
		// To make sure valid response is received from the server, 200 means response received is OK
		
		if(XmlHttpFO.status == 200)
		{		
			
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpFO.responseText			
			if(strData != "") {				    
				var arrSchm = strData.split("|");
				ig_.length = 0; 					
				for(i=0; i<arrSchm.length-1; i++) {									
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");					
					ig_.options[i] = new Option();					
					ig_.options[i].value = arrSchmCode[0];
					ig_.options[i].text = arrSchmCode[1];
				}				
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Symbol not available";			
			}
			document.body.style.cursor = "auto";	
		}
		else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "server is not ready";
					document.body.style.cursor = "auto";		
		}
		Get_Options(ig_2);
	}
}

function Get_Options(Inst)
{
	var InstName =document.getElementById('InstrumentType');//document.getElementById("Foquotes1_InstrumentType");		
	var Symbol = document.getElementById("Symbol"); 	
	var OptionType = document.getElementById("OptionType");
	var StrikePrice = document.getElementById("StrikePrice");   		
	  	
	        
	CreateXmlHttpNew();
	var requestUrl = "FO_Option.aspx?timeStamp="+ new Date().getTime() +"&InstName="+InstName.value;	
	//alert(requestUrl);	
	document.body.style.cursor = "progress";		
	if(XmlHttpFO)	
	{
		XmlHttpFO.onreadystatechange = function(){getOptionResp(OptionType)};
		XmlHttpFO.open("GET", requestUrl,  true);
		XmlHttpFO.send(null);
	}		
}
function getOptionResp(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpFO.status == 200)
		{			
			var strData = XmlHttpFO.responseText
			if(strData != "")
			 {				    
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
				
				for(i=0; i<arrSchm.length-1; i++) {	
								
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");
					
					ig_.options[i] = new Option();
					
					ig_.options[i].value = arrSchmCode[0];
					ig_.options[i].text = arrSchmCode[1];
				}
				
			}
			else
			 {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Option not available";			
			}
			document.body.style.cursor = "auto";	
		}
		else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "server is not ready";
					document.body.style.cursor = "auto";		
		}
	}
}

 function Get_ExpDate1()
 { 
 		var InstName = document.getElementById('InstrumentType'); 		
 		var Symbol = document.getElementById("Symbol");
 		var ExpiryDate = document.getElementById("ExpiryDate");
 		
 		Symbol=Symbol.value;
 		Symbol=Symbol.replace('&','*');
 				
		CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "FO_ExpDate.aspx?timeStamp="+ new Date().getTime() +"&InstName="+InstName.value +"&Symbol="+Symbol;		
		//alert(requestUrl);
		if(XmlHttpFO)	{
					XmlHttpFO.onreadystatechange = function(){getDateResp1(ExpiryDate)};
					XmlHttpFO.open("GET", requestUrl,  true);
					XmlHttpFO.send(null);
				}
		
 }
 //Called when response comes back from server Only For Symbol
function getDateResp1(ig_)
{
	// To make sure receiving response data from server is completed
	//alert(XmlHttpFO.responseText)
	if(XmlHttpFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpFO.status == 200)
		{
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpFO.responseText
			if(strData != "") {	
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
				for(i=0; i<arrSchm.length-1; i++) {	
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");
					ig_.options[i] = new Option();
					ig_.options[i].value = arrSchmCode[0];
					ig_.options[i].text = arrSchmCode[1];
				}
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Date not available";			
			}
			document.body.style.cursor = "auto";	
		}
		else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "server is not ready";
					document.body.style.cursor = "auto";		
		}
	}
}
function Get_StrikePrice()
 {
 
 		var InstName = document.getElementById('InstrumentType');
 		var Symbol = document.getElementById("Symbol");
 		var ExpiryDate = document.getElementById("ExpiryDate");
 		var OptionType = document.getElementById("OptionType");
 		var StrikePrice = document.getElementById("StrikePrice"); 
 		
 		Symbol=Symbol.value;
 		Symbol=Symbol.replace('&','*');
 		
 		//alert(ExpiryDate.value)		
		CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "FO_StrikePrice.aspx?timeStamp="+ new Date().getTime() +"&InstName="+InstName.value +"&Symbol="+Symbol+"&ExpDate="+ExpiryDate.value+"&OptionType="+OptionType.value;
	    
	   
		
		if(XmlHttpFO)	{
					XmlHttpFO.onreadystatechange = function(){Get_StrikePriceResp(StrikePrice)};
					XmlHttpFO.open("GET", requestUrl,  true);
					XmlHttpFO.send(null);
				}
				
		
 }
 //Called when response comes back from server Only For Strike Price
function Get_StrikePriceResp(ig_)
{
	// To make sure receiving response data from server is completed
	if(XmlHttpFO.readyState == 4)
	{
	//alert(XmlHttpFO.status)
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpFO.status == 200)
		{
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpFO.responseText;			
			if(strData != "") {	
			    
				var arrPrice = strData.split("|");
				ig_.length = 0; 	
				
				for(i=0; i<arrPrice.length-1; i++) {	
								
					var strPrice = arrPrice[i];
					var arrPriceCode = strPrice.split("~");
					
					ig_.options[i] = new Option();
					
					ig_.options[i].value = arrPriceCode[0];
					ig_.options[i].text = arrPriceCode[1];
				}
				
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Price not available";			
			}
			document.body.style.cursor = "auto";	
		}
		else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "server is not ready";
					document.body.style.cursor = "auto";		
		}
	}
}

function ValidateForm()
{
	var InstType = document.getElementById('InstrumentType');
	var Symbol   = document.getElementById("Symbol");
	var ExpDate  = document.getElementById("ExpiryDate");
	var OptType  = document.getElementById("OptionType");
	var StkPrice = document.getElementById("StrikePrice"); 
	
		if(InstType.value=="")
		{
			alert("Please select the Instrument Type before you proceed")
			return false;
		}
		else if((InstType.value=="OPTIDX")||(InstType.value=="OPTSTK"))
		{
			if(Symbol.value=="Select Symbol")	
			{
			alert("Please select Symbol before you proceed")
			return false;
			}
			else if(OptType.value=="")
			{
			alert("Please select Option Type before you proceed")
			return false;
			}
			else if(StkPrice.value=="Select Strike Price"|| StkPrice.value=="")
			{
			alert("Please select Price before you proceed")
			return false;
			}
		}
		else 
		{
			if(Symbol.value=="Select Symbol")	
			{
			alert("Please select Symbol before you proceed")
			return false;
			}
		}
		//var url="InstType="+InstType.value+"&Symbol="+Symbol.value+"&ExpDate="+ExpDate.value+"&OptType="+OptType.value+"&StkPrice="+StkPrice.value+"";
		
	Fillvalue();
} 

function Fillvalue()
{
	var InstType = document.getElementById('InstrumentType').value;
	var Symbol=document.getElementById("Symbol").value;
	var ExpDate=document.getElementById("ExpiryDate").value;
	var OptType=document.getElementById("OptionType").value;
	var StkPrice=document.getElementById("StrikePrice").value;

	var OptTypeFUT="XX";
	var StkPriceFUT="0";
	//alert(InstType);
	
	if(InstType=="FUTIDX" || InstType=="FUTSTK")
	{
		//alert("FUT");
		document.location="FOQuotesHome.aspx?InstType="+ InstType +"&Symbol="+ Symbol +"&ExpDate="+ ExpDate+"&OptType="+ OptTypeFUT +"&StkPrice="+ StkPriceFUT;

	}
	else 
	{
		//alert("OPT");
		document.location="FOQuotesHome.aspx?InstType="+ InstType +"&Symbol="+ Symbol +"&ExpDate="+ ExpDate+"&OptType="+ OptType +"&StkPrice="+ StkPrice;
	}
}
/*End Here By Anuradha*/

function Fetch_Symbol()
{
 var InstType = document.getElementById('InstrumentType');
 //alert(InstType);
 var Symbol   = document.getElementById("Symbol");
 var ExpDate  = document.getElementById("ExpiryDate");
 var OptType  = document.getElementById("OptionType");
 var StkPrice = document.getElementById("StrikePrice");
 
 if((InstType.options[InstType.selectedIndex].value)=="FUTIDX") {
	Symbol.options.length =4;
	Symbol.options[0].value ="";
	Symbol.options[0].text ="Select Symbol";
	Symbol.selectedIndex=0;

	Symbol.options[1].value ="NIFTY";
	Symbol.options[1].text  ="NIFTY";
	Symbol.options[2].value ="CNXIT";
	Symbol.options[2].text  ="CNXIT";
	Symbol.options[3].value ="BANKNIFTY";
	Symbol.options[3].text  ="BANKNIFTY";

	ExpDate.options.length =4;
	ExpDate.selectedIndex=0;

	for (i=1;i<=3;i++){
		ExpDate.options[i].value = e[i];
		ExpDate.options[i].text = dateConvert(e[i]);
	}

	OptType.options.length =1;
	OptType.options[0].value ="";
	OptType.options[0].text ="Select Option Type";
	OptType.selectedIndex=0;

	StkPrice.options.length =1;
	StkPrice.options[0].value ="";
	StkPrice.options[0].text ="Select Strike Price";
	StkPrice.selectedIndex=0;
 }
 else if((InstType.options[InstType.selectedIndex].value)=="FUTSTK")
 {
   val=1;
   for (i=1;i<s.length;i++)
	 {
  	    //code to identify if symbol starts with NSE
  	    if(s[i].indexOf("NSE",0)==-1)val++;
      }

	 // Symbol.options.length =s.length;
  	 Symbol.options.length = val;
	 Symbol.options[0].value = "";
	 Symbol.options[0].text = "Select Symbol";
	 Symbol.selectedIndex=0;

	 /*for (i=1;i<s.length;i++)
	 	 {
	 	 Symbol.options[i].value = s[i];
	 	 Symbol.options[i].text = s[i];

     }*/
    val=1;
    for (i=1;i<s.length;i++)
	  {
	  	   //code to identify if symbol starts with NSE
	  	   if(s[i].indexOf("NSE",0)==-1){
	  		 Symbol.options[val].value = s[i];
	  		 Symbol.options[val].text  = s[i];
	  		 val++;
	  	   }

	   }
  	 ExpDate.options.length =4;
	 ExpDate.selectedIndex=0;


	for (i=1;i<=3;i++){
		ExpDate.options[i].value = e[i];
		ExpDate.options[i].text = dateConvert(e[i]);
	}

	OptType.options.length =1;
	OptType.options[0].value ="";
	OptType.options[0].text ="Select Option Type";
	OptType.selectedIndex=0;

	StkPrice.options.length =1;
	StkPrice.options[0].value ="";
	StkPrice.options[0].text ="Select Strike Price";
	StkPrice.selectedIndex=0;

 }
 else if((InstType.options[InstType.selectedIndex].value)=="FUTINT")
 {
	//length has to only symbols which belongs to FUTINT
	var len =1;
	for (i=1;i<s.length;i++){
		//code to identify if symbol starts with NSE
  		if(s[i].indexOf("NSE",0)!=-1){
  		len++;
  		}
 }

	 Symbol.options.length =len;
 	 Symbol.options[0].value ="";
 	 Symbol.options[0].text ="Select Symbol";
 	 Symbol.selectedIndex=0;

     len=1;
 	 for (i=1;i<s.length;i++){
 	 	//code to identify if symbol starts with NSE
 	 	if(s[i].indexOf("NSE",0)!=-1){
 	 	 Symbol.options[len].value = s[i];
 	 	 Symbol.options[len].text  = s[i];
 	 	 len++;
 	 	 }
      }

	ExpDate.options.length =e.length;
	ExpDate.selectedIndex=0;

	for (i=1;i<e.length;i++) {
		ExpDate.options[i].value = e[i];
		ExpDate.options[i].text = dateConvert(e[i]);
	}

 OptType.options.length =1;
 OptType.options[0].value ="";
 OptType.options[0].text ="Select Option Type";
 OptType.selectedIndex=0;

 StkPrice.options.length =1;
 StkPrice.options[0].value ="";
 StkPrice.options[0].text ="Select Strike Price";
 StkPrice.selectedIndex=0;

 }
 else if((InstType.options[InstType.selectedIndex].value)=="OPTIDX")
 {
	Symbol.options.length =4;
	Symbol.options[0].value ="";
	Symbol.options[0].text ="Select Symbol";
	Symbol.selectedIndex=0;

	Symbol.options[1].value ="NIFTY";
	Symbol.options[1].text ="NIFTY";
	Symbol.options[2].value ="CNXIT";
	Symbol.options[2].text ="CNXIT";
	Symbol.options[3].value ="BANKNIFTY";
	Symbol.options[3].text ="BANKNIFTY";

	ExpDate.options.length =4;
	ExpDate.selectedIndex=0;

	for (i=1;i<=3;i++){
		ExpDate.options[i].value = e[i];
		ExpDate.options[i].text = dateConvert(e[i]);
	}

	 OptType.options.length =3;
	 OptType.options[0].value ="";
	 OptType.options[0].text ="Select Option Type";
	 OptType.options[1].value ="PE";
	 OptType.options[1].text ="PE";
	 OptType.options[2].value ="CE";
	 OptType.options[2].text ="CE";

	 /*OptType.options[3].value ="PE";
	 OptType.options[3].text ="PE";
	 OptType.options[4].value ="CE";
	 OptType.options[4].text ="CE";*/
	 }
 else
 {
	val=1;
    for (i=1;i<s.length;i++) {
  	  	//code to identify if symbol starts with NSE
	    if(s[i].indexOf("NSE",0)==-1){
  	  	val++;
  	}

 }
	Symbol.options.length =val;
	Symbol.options[0].value ="";
	Symbol.options[0].text ="Select Symbol";
	Symbol.selectedIndex=0;
	
	/*for (i=1;i<s.length;i++) {
	 Symbol.options[i].value = s[i];
	 Symbol.options[i].text = s[i];
	}*/

	val=1;
    for (i=1;i<s.length;i++) {
  	  	//code to identify if symbol starts with NSE
  	 	if(s[i].indexOf("NSE",0)==-1){
  	  	 	Symbol.options[val].value = s[i];
  	  	 	Symbol.options[val].text = s[i];
  	  	 	val++;
  	  	}

	}

	ExpDate.options.length =4;
	ExpDate.selectedIndex=0;

	for (i=1;i<=3;i++)  {
		ExpDate.options[i].value = e[i];
		ExpDate.options[i].text = dateConvert(e[i]);
	}

	OptType.options.length =3;
	OptType.options[0].value ="";
	OptType.options[0].text  ="Select Option Type";
	OptType.options[1].value ="PA";
	OptType.options[1].text  ="PA";
	OptType.options[2].value ="CA";
	OptType.options[2].text  ="CA";

	 /*OptType.options[3].value ="PE";
	 OptType.options[3].text ="PE";
	 OptType.options[4].value ="CE";
	 OptType.options[4].text ="CE";*/
 }
fillStrikePrice();
}

function populate()
{
 var InstType = document.getElementById('InstrumentType');
 var Symbol   = document.getElementById("Symbol");
 var ExpDate  = document.getElementById("ExpiryDate");
 var OptType  = document.getElementById("OptionType");
 var StkPrice = document.getElementById("StrikePrice");
 
 // Code to dynamically populate the drop downs
 	Symbol.options.length =s.length;
 	ExpDate.options.length = e.length;
 	StkPrice.options.length=1;
 // works in browsers which support HTML 4.0
 // OptType.disabled=true;

 	InstType.selectedIndex=0;
 	Symbol.selectedIndex=0;
 	ExpDate.selectedIndex=0;
 	OptType.selectedIndex=0;
 	StkPrice.selectedIndex=0;
 	
 for (i=1;i<s.length;i++) {
 	Symbol.options[i].value = s[i];
 	Symbol.options[i].text = s[i];
 }

 for (i=1;i<e.length;i++) {
	ExpDate.options[i].value = e[i];
	ExpDate.options[i].text = dateConvert(e[i]);
 }
}


function fillStrikePrice()
{
	var InstType = document.getElementById('InstrumentType');
	var Symbol   = document.getElementById("Symbol");
	var ExpDate  = document.getElementById("ExpiryDate");
	var OptType  = document.getElementById("OptionType");
	var StkPrice = document.getElementById("StrikePrice");
	
	InstrumentTypeVal=InstType.options[InstType.selectedIndex].value;
	InstIndex=InstType.selectedIndex;
	
 	SymbolVal=Symbol.options[Symbol.selectedIndex].value;
	SymbIndex=Symbol.selectedIndex;
	 
	ExpiryDate=ExpDate.options[ExpDate.selectedIndex].value;
	ExpIndex =ExpDate.selectedIndex;

	if(InstrumentTypeVal=="FUTIDX"||InstrumentTypeVal=="FUTSTK"||InstrumentTypeVal=="FUTINT") {
		OptionType="-";
		TypeIndex=0;
	}
	else{
		OptionType=OptType.options[OptType.selectedIndex].value;
		TypeIndex=OptType.selectedIndex;
	}

	if(InstIndex!=0) {
		if(SymbIndex!=0) {
			if(ExpIndex!=0) {
				if(TypeIndex!=0 && (InstrumentTypeVal!="FUTIDX"||InstrumentTypeVal!="FUTSTK"||InstrumentTypeVal!="FUTINT")) {
					unique_key = InstrumentTypeVal+SymbolVal+ExpiryDate+OptionType
					if(!populateStrikePrice(unique_key)) {
						alert("No Strike Price Is Available For The Selected Combination...Try Again");
						StkPrice.options.length =1;
						StkPrice.options[0].value ="";
						StkPrice.options[0].text ="Select Strike Price";
						StkPrice.selectedIndex=0;
					}
				}
				else if(TypeIndex==0 && (InstrumentTypeVal=="FUTIDX"||InstrumentTypeVal=="FUTSTK"||InstrumentTypeVal!="FUTINT")) {
					unique_key=InstrumentTypeVal+SymbolVal+ExpiryDate+OptionType;
				}
			}
		}
	}
}

function populateStrikePrice(unique_key)
{
	var InstType = document.getElementById("InstrumentType");
	var Symbol   = document.getElementById("Symbol");
	var ExpDate  = document.getElementById("ExpiryDate");
	var OptType  = document.getElementById("OptionType");
	var StkPrice = document.getElementById("StrikePrice");
	
	avail_flag=false;
	// since zero element text is SelectStrikePrice and we need to fill from first element
	// hence counter =1
	StkPrice.options.length =1;
	StkPrice.options[0].value ="";
 	StkPrice.options[0].text ="Select Strike Price";
	StkPrice.selectedIndex=0;
	counter=1;
	for (i=1;i<u.length;i++) {
	 	 if(u[i].indexOf(unique_key) != -1) {
	 		avail_flag=true;
	 		StkPrice.options.length = counter + 1;
 			StkPrice.options[counter].value = u[i].substring(unique_key.length,u[i].length),u[i].substring(unique_key.length,u[i].length);
			StkPrice.options[counter].text = u[i].substring(unique_key.length,u[i].length),u[i].substring(unique_key.length,u[i].length);
			counter++;
		 }
	}
	return (!avail_flag)?false:true
}

 function finalcheck(unique_key)
 {
	avail_flag=false;
	for (i=1;i<u.length;i++) {
		if(u[i].indexOf(unique_key) != -1) {
		 	 avail_flag=true;
			 break;
		 }
	}
	return (!avail_flag)?false:true
 }

 function validate1()
 {
		//final check ..required since any change during final submission will
		// unnecessarily invoke the server side program.... only the combinations
		//available needs to be checked at the server end...
		// wrong combinations will increase unwarranted calls to controller servlet
		var InstType = document.getElementById('InstrumentType');
		var Symbol   = document.getElementById("Symbol");
		var ExpDate  = document.getElementById("ExpiryDate");
		var OptType  = document.getElementById("OptionType");
		var StkPrice = document.getElementById("StrikePrice"); 

		 InstrumentTypeVal=InstType.options[InstType.selectedIndex].value;
		 InstIndex=InstType.selectedIndex;
		 if(InstIndex!=0) {
			SymbolVal=Symbol.options[Symbol.selectedIndex].value;
			SymbIndex=Symbol.selectedIndex;
			
			if(SymbIndex!=0) {
				ExpiryDate=ExpDate.options[ExpDate.selectedIndex].value;
				ExpIndex =ExpDate.selectedIndex;
				
				if(ExpIndex!=0) {
					if(InstrumentTypeVal=="FUTIDX"||InstrumentTypeVal=="FUTSTK"||InstrumentTypeVal=="FUTINT") {
			 				OptionType="-";
			 				TypeIndex=0;
			 				StrikePriceVal="-";
			 				StrikeIndex=0;

			 				if(SymbolVal.match(/&/g))
			 				SymbolVal=SymbolVal.replace("&","%26");
			 				unique_key=InstrumentTypeVal+SymbolVal+ExpiryDate+OptionType+StrikePriceVal;
							urlText = "InstType="+ InstrumentTypeVal +"&Symbol="+ SymbolVal +"&ExpDate="+ ExpiryDate +"&OptType=XX&StkPrice=0"
							
							//document.frmGetQuotes.action = "fogetquotes.asp?opt=2&"+ urlText
							getFOQuotes(urlText);
			 				return true; // to me made true
					}
					else{
			 				OptionType=OptType.options[OptType.selectedIndex].value;
			 				TypeIndex=OptType.selectedIndex;

			 				if(TypeIndex!=0) {
			 					StrikePriceVal=StkPrice.options[StkPrice.selectedIndex].value;
								StrikeIndex=StkPrice.selectedIndex;

								if(StrikeIndex !=0) {
									unique_key=InstrumentTypeVal+SymbolVal+ExpiryDate+OptionType+StrikePriceVal;
									//alert(unique_key);
									if(finalcheck(unique_key)) {
										if(SymbolVal.match(/&/g))
			 		 						SymbolVal=SymbolVal.replace("&","%26");
					 						urlText = "InstType="+ InstrumentTypeVal +"&Symbol="+ SymbolVal +"&ExpDate="+ ExpiryDate +"&OptType="+ OptionType +"&StkPrice="+ StrikePriceVal						 
											//document.frmGetQuotes.action = "fogetquotes.asp?opt=2&"+ urlText
											getFOQuotes(urlText);
											return true; // to return true
									}
									else{
									alert("No Strike Price Is Available For The Selected Combination...Try Again");
 									return false;
 									}
								}
								else {
						 			alert("Please Select Strike Price Before You Proceed");
	 	 							return false;
								}
							}
							else {
			 					alert("Please Select Option Type Before You Proceed");
	 	 						return false;
							}

						}
					}
				else {
						alert("Please Select Expiry Date Before You Proceed");
	 					return false;
				}
			}
			else {
		 			alert("Please Select The Symbol Before You Proceed");
					return false;
			}
		}
		else {
				alert("Please Select The Instrument Type Before You Proceed");
				return false;
		}
 }
 //============================================================
 


