// JavaScript Document 
 
 // DateComparison Function-- Date Format : MMM/DD/YYYY (May-05-2005)
 // This function is to check whether the "To Date" is greater than "From Date" 
 // Return values are either TRUE or FALSE.
 
	function checkDate(fromDate,toDate,alertMessage) { 

	if(document.LearningHistoryForm.history_sections.value=="-2")
	{
		alert("Section needs to be selected");
		return false;
	}		

	
	//## START          : Edited by M.Balachandar -- May-10-2005
	//## CHANGE REQUEST : Adding the Calendar in the UI and Changes in the Date Format.
	
	var dateFlag=0;
	var monthArray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	var str1 = new String(fromDate);
	//Getting the Start Date and split in to pieces by giving "-" symbol	
	 

	//Getting the End Date and split in to pieces by giving "-" symbol	
	var str2 = new String(toDate); 
	 

	if(str1!="" && str2!="")
	{
	str1 = str1.split("-");
	str2 = str2.split("-"); 
	
	
		//Finding the Month in Number
		for(i=0;i<11;i++)  
		  if (str1[0] == monthArray[i]) 
			 str1[0] = i+1; 
			  
		
		
		//Finding the Month in Number
		for(i=0;i<11;i++)  
		  if (str2[0] == monthArray[i]) 
			 str2[0] = i+1; 
		 
			 		 				
			
		if (str2[2] >  str1[2]) 
		{
			return true; 
		}
		else if (str2[2] ==  str1[2]) 
		{
			  if (str2[0] >  str1[0]) 
			  { 
					return true; 
			  }
			  else if (str2[0] ==  str1[0]) 
					  { 
						  if (str2[1] >= str1[1]) 
							{
								return true;
							}
						   else	   
							{ 
								alert(alertMessage); 
								return false;  
							}
					 }
					 else	   
					 { 
						alert(alertMessage); 
						return false;  
					 }
        }
		else	   
		{
			alert(alertMessage); 
			return false;  
		}  

			                     
  }
  else
  {
  return true;
  }
	
	
}
	
	
	
 