function underlyingList_Onchange()
{
	document.certificate.action = 'search.asp';
	document.certificate.submit();
}

function goSearch(form)
{
	eval('document.' + form + '.submit()');
} 

function getDateFromSelectBox()
{
	var theform 		= document.certificate;	
	theform.period.selectedIndex = 0;
 	if(!checkDateSelectBox(document.certificate, 'search')) 
	{
		theform.Day_search.selectedIndex   = currentDate.getDate()-1;
		theform.Month_search.selectedIndex = currentDate.getMonth();
		theform.Year_search.selectedIndex  = 10;
	}
 
}

function getDateFromPeriod()
{
	var theform 		= document.certificate;	
	var currentDate		= new Date;
	var selectedDate;
	switch(theform.period.options[theform.period.selectedIndex].value)
	{
		case '6M':
					selectedDate = new Date(currentDate.getFullYear(), currentDate.getMonth()+6, currentDate.getDate());
					break;
		case '1Y':
					selectedDate = new Date(currentDate.getFullYear()+1, currentDate.getMonth(), currentDate.getDate());
					break;
		case '3Y':
					selectedDate = new Date(currentDate.getFullYear()+3, currentDate.getMonth(), currentDate.getDate());
					break;
		case '5Y':
					selectedDate = new Date(currentDate.getFullYear()+5, currentDate.getMonth(), currentDate.getDate());
					break;
		default:
					selectedDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
					break;
	}
		theform.Day_search.selectedIndex   = selectedDate.getDate()-1;
		theform.Month_search.selectedIndex = selectedDate.getMonth();
		theform.Year_search.selectedIndex  = selectedDate.getFullYear() - (currentDate.getFullYear()-10);
}

function checkboxForUse(elementName)
{
	var theElement = eval('document.certificate.' + elementName)
	if(elementName=='noDate') hideExpirationByCheckBox();
	if(theElement.checked)
		theElement.value = 1;
	else
		theElement.value = 0;
}

function hideExpirationByCheckBox()
{
	var theform 		= document.certificate;	
	var currentDate 	= new Date;
	if (theform.noDate.checked)
		{
			theform.Day_search.disabled = true;
			theform.Day_search.value = '';
			theform.Month_search.disabled = true;
			theform.Month_search.value = '';
			theform.Year_search.disabled = true;
			theform.Year_search.value = '';										
			theform.period.value = 0;
			theform.period.disabled = true;
		}
	else
		{
			theform.Day_search.disabled = false;
			theform.Month_search.disabled = false;
			theform.Year_search.disabled = false;
			theform.period.disabled = false;		
			theform.Day_search.selectedIndex   = currentDate.getDate()-1;
			theform.Month_search.selectedIndex = currentDate.getMonth();
			theform.Year_search.selectedIndex  = currentDate.getFullYear() - (currentDate.getFullYear()-10);			
		}
}
