function showvolume()
{
	if (document.Chartfrm.show.checked == true)
	{
	 volrow.style.display='inline';
	}
	else
	{
	 volrow.style.display='none';
	}
}

function check()
{

	if (document.Chartfrm.SPeriod.value == "Other Period")
	{
		document.Chartfrm.forcheck.value = "1"
		document.Chartfrm.RangeButton.disabled = true
		range1.style.display='inline';
		range2.style.display='inline';
		range3.style.display='inline';
	}
	else
	{
		document.Chartfrm.forcheck.value = ""
		document.Chartfrm.RangeButton.disabled = false
		range1.style.display='none';
		range2.style.display='none';
		range3.style.display='none';
	}
}

function Vaildate_Date()
{
if (document.Chartfrm.forcheck.value == "1")
{
	if (validateDate('S')==false)
		{
			return false
		}
	if (validateDate('E')==false)
		{
			return false
		}
	
	fday = document.Chartfrm.SdayOfDate.options[document.Chartfrm.SdayOfDate.selectedIndex].value
	fmonth = document.Chartfrm.SmonthOfDate.options[document.Chartfrm.SmonthOfDate.selectedIndex].value
	fyear = document.Chartfrm.SyearOfDate.options[document.Chartfrm.SyearOfDate.selectedIndex].value
	
	if (fday.length == 1)
		fday = "0" + fday
	
	if (fmonth.length == 1)
		fmonth = "0" + fmonth
		
	fdate = fyear+"."+fmonth+"."+fday
	
	Eday = document.Chartfrm.EdayOfDate.options[document.Chartfrm.EdayOfDate.selectedIndex].value
	Emonth = document.Chartfrm.EmonthOfDate.options[document.Chartfrm.EmonthOfDate.selectedIndex].value
	Eyear = document.Chartfrm.EyearOfDate.options[document.Chartfrm.EyearOfDate.selectedIndex].value
	
	if (Eday.length == 1)
		Eday = "0" + Eday
	
	if (Emonth.length == 1)
		Emonth = "0" + Emonth
	
	Edate = Eyear + "." + Emonth + "." + Eday
	
	if (fdate > Edate)
		{
			alert ("Start Date must be less than End Date")
			return false
		}
	return true
}
return true
}

function validateDate(dateOpt)
{
var dateOpt;
 	var bvalid1 ;   
	bvalid1=true

	a2=0; b2=0; c2=0;
	if (dateOpt == 'S')
		{
			a1 = eval("document.Chartfrm.SyearOfDate")
			b1 = eval("document.Chartfrm.SmonthOfDate")
			c1 = eval("document.Chartfrm.SdayOfDate")
			a2 = eval("document.Chartfrm.SyearOfDate.options[document.Chartfrm.SyearOfDate.selectedIndex].value")
			b2 = eval("document.Chartfrm.SmonthOfDate.options[document.Chartfrm.SmonthOfDate.selectedIndex].value")
			c2 = eval("document.Chartfrm.SdayOfDate.options[document.Chartfrm.SdayOfDate.selectedIndex].value")
		}
	  else
	  	{
			a1 = eval("document.Chartfrm.EyearOfDate")
			b1 = eval("document.Chartfrm.EmonthOfDate")
			c1 = eval("document.Chartfrm.EdayOfDate")		
			a2=eval("document.Chartfrm.EyearOfDate.options[document.Chartfrm.EyearOfDate.selectedIndex].value")
			b2=eval("document.Chartfrm.EmonthOfDate.options[document.Chartfrm.EmonthOfDate.selectedIndex].value")
			c2=eval("document.Chartfrm.EdayOfDate.options[document.Chartfrm.EdayOfDate.selectedIndex].value")		
		}
			if (a2 == 0 && b2 == 0 && c2 == 0)	
			{
				alert ("Invalid date format")
				c1.focus();
				bvalid1 = false;
			}
			else
			{
				if (a2 == 0 || b2 == 0 || c2 == 0)
				{
					alert ("Invalid date format")
					c1.focus();
					bvalid1 = false;
				}
			}	
 switch(eval(b2))
 {
	case 4: 
		if (c2 > 30)
        {
			alert("Invalid date format")
			c1.focus();
			bvalid1 = false;
		}
		break;
	case 6: 
		if (c2 > 30)
		{
			alert("Invalid  date format")
			c1.focus();
            bvalid1 = false; 
        }
        break;
	case 9:
		if (c2 > 30)
        {
			alert("Invalid  date format")
			c1.focus();
            bvalid1 = false; 
        }
        break;
	case 11:        
		if (c2 > 30)
        {
			alert("Invalid  date format")
			c1.focus();
            bvalid1 = false; 
        }
        break;
	case 2: 
		if(((a2 % 4 == 0) && (a2 %100 != 0 || a2 % 400 == 0)))
		{
			if (c2 > 29)
				{ 	
					alert("Invalid  date format");
					c1.focus();
					bvalid1 = false;
				}	
		}
		else
		{
			if (c2 > 28) 
				{
					alert("Invalid  date format");
					c1.focus();
					bvalid1 = false;
				}	
		}
		break;	
	}
	if (bvalid1 != true) 
	 	{
			return false;
		}
	else
	{
		return true;
	}
}


function pchart()
{
  var	urlstr = location.href
  var	urlstr1 = location.pathname
  var	urlstr2= location.search
   	
nav_link = "http://www.cmlinks.com/gmr/pricechart.asp" + urlstr2;
document.writeln('<script language=JavaScript src="'+ nav_link +'">');
document.writeln('</script>');
}

function chartShow(exch)
{
	if (exch == "N")
	{
		document.getElementById("bserow").style.display = "none";
		document.getElementById("nserow").style.display = "inline";
		document.Chart.src="images/NseOn1.gif" ;						
	}
	else
	{
		document.getElementById("bserow").style.display = "inline";
		document.getElementById("nserow").style.display = "none";
		document.Chart.src="images/BseOn1.gif" ;						
	}
}
