function copySelected(obj) 
	{
		myform = eval ("document.ChartForm."+ obj.value)
		if (obj.checked==true)
		{	
			if(document.ChartForm.ChartType.selectedIndex==0)
				{
					switch (obj.value) { 
					   case "AccumulationDistribution" :
						  alert("Cannot be plotted for IntradayCharts")
                          			  obj.checked=false 
						  return false
						  break
					   case "TypicalPrice" : 
						  alert("Cannot be plotted for IntradayCharts")
						  obj.checked=false
						  return false
						  break
					   case "MedianPrice" : 
						  alert("Cannot be plotted for IntradayCharts")
						  obj.checked=false	
						  return false
						  
						  break
					   case "WeightedClose" : 
						  alert("Cannot be plotted for IntradayCharts")
                          			  obj.checked=false
						  return false
						  break
				  }
				}

			launch(obj.value)
			document.ChartForm.NumberOfIndicators.value=parseInt(document.ChartForm.NumberOfIndicators.value) + 1
		}
		else
		{
			myform.value=""
			document.ChartForm.NumberOfIndicators.value=parseInt(document.ChartForm.NumberOfIndicators.value) - 1
		}

	}


function launch(IndicatorName){

	switch (IndicatorName) {
		case "MovingAverage":
			url = "MovingAverage.htm";
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=410,height=1"
			break;
		case "ROC":
			url = "ROC.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=500,height=120"
			break;
		case "MACD":
			url = "MACD.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=540,height=120"
			break;
		case "Envelope":
			url = "Envelope.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=350,height=130"
			break;
		case "EaseofMovement":
			url = "EaseofMovement.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=380,height=130"
			break;
		case "AccumulationDistribution":
			url = "AccumulationDistribution.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=250,height=120"
			break;
		case "MedianPrice":
			url = "MedianPrice.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=250,height=50"
			break;
		case "TypicalPrice":
			url = "TypicalPrice.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=250,height=50"
			break;
		case "WeightedClose":
			url = "WeightedClose.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=250,height=50"
			break;
		case "BollingerBands":
			url = "BollingerBands.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=410,height=120"
			break;
		case "KST":
			url = "KST.htm"
			winname = "Indicator"
			features = "resizable=yes,top=50, left=50, width=410,height=175"
			break;
	}
	newwin = window.open(url,winname,features);
}

function setIndicatorValue(paramList,IndicatorName)
	{
		myObject = 	myform = eval ("document.ChartForm."+ IndicatorName)
		myObject.value=paramList
	}
function getChart(){
	makeUrl()
}

function makeUrl(){

	if (document.ChartForm.Scrip.value.length < 3 )
	{
		alert("Please enter atleast 3 characters");
		return false;
	}

	Scrip = document.ChartForm.Scrip.value
	ChartType = document.ChartForm.ChartType.value
	PlotType  = document.ChartForm.PlotType.value
	StartDate = document.ChartForm.StartDate.value;
	if(document.ChartForm.ChartType.selectedIndex==0)
	{		
		StartDate = document.ChartForm.StartDate.value;
	}
	if(document.ChartForm.ChartType.selectedIndex==1)
	{		
		StartDate = document.ChartForm.StartDate1.value;
	}
	if(document.ChartForm.ChartType.selectedIndex==2)
	{	
		StartDate = document.ChartForm.StartDate3.value;
	}
	if(document.ChartForm.ChartType.selectedIndex==3)
	{	
		StartDate = document.ChartForm.StartDate6.value;
	}
	if(document.ChartForm.ChartType.selectedIndex==4)
	{
	
		StartDate = document.ChartForm.StartDateD.value;
	}
		
	EndDate   = document.ChartForm.EndDate.value
	Exchange = document.ChartForm.Exchange.value
	Volume = document.ChartForm.Volume.value
	CompareWith=document.ChartForm.CompareWith.selectedIndex
	NumberOfIndicators = document.ChartForm.NumberOfIndicators.value
	IndicatorParams = "";
	myobj=document.ChartForm.select1
	for (var i=0;i<myobj.length;i++) 
	{	
		if (myobj[i].checked==true)
		{
			myform = eval ("document.ChartForm."+ myobj[i].value)
			IndicatorParams = IndicatorParams + myform.value + "^"
		}
	}
	IndicatorParams = IndicatorParams.slice(0,(IndicatorParams.length -1))
	window.location.href="charts.asp?" + "Scrip=" + Scrip + "&Exchange=" + Exchange + "&Volume=" + Volume + "&ChartType=" + ChartType + "&PlotType=" + PlotType + "&NumberOfIndicators=" + NumberOfIndicators + "&IndicatorParams=" + IndicatorParams + "&StartDate=" + StartDate + "&EndDate=" + EndDate + "&CompareWith=" + CompareWith
	
}


function checkIndicatorsForIntraday()
{
	if(document.ChartForm.ChartType.selectedIndex==1)
		{
			obj=document.ChartForm.select1
			for (i=0;i<obj.length ;i++ )
			{
				if (obj[i].checked==true)
				{
					switch (obj[i].value) 
					{ 
					   case "AccumulationDistribution" :
						  alert("AccumulationDistribution Cannot be plotted for IntradayCharts")
                          			  obj[i].checked=false 
						  break
					   case "TypicalPrice" : 
						  alert("TypicalPrice Cannot be plotted for IntradayCharts")
						  obj[i].checked=false 
						  break
					   case "MedianPrice" : 
						  alert("MedianPrice Cannot be plotted for IntradayCharts")
						  obj[i].checked=false 
						  break
					   case "WeightedClose" : 
						  alert("WeightedClose Cannot be plotted for IntradayCharts")
                          obj[i].checked=false 
						  break
				   }
				 }
			}
		}
}

