function getFormatedDate(local, theDate) {

	var sDateFormat	= "";



	var sTheMonth	= theDate.getMonth() + 1;

	sTheMonth		= ((sTheMonth) <= 9) ? "0" + sTheMonth : sTheMonth;



	var sTheDay		= theDate.getDate();

	sTheDay			= (sTheDay <= 9) ? "0" + sTheDay : sTheDay;

	var nTheYear	= theDate.getFullYear();





	if (local == "ja") {

		// FORMAT: YYYY/MM/DD

		sDateFormat = nTheYear + "/" + sTheMonth + "/" + sTheDay;

	} else if ((local == "de") || (local == "es") || (local == "fr")) {

		// FORMAT: DD/MM/YYYY

		sDateFormat = sTheDay + "/" + sTheMonth + "/" + nTheYear;

	} else {

		// FORMAT: MM/DD/YYYY

		sDateFormat = sTheMonth + "/" + sTheDay + "/" + nTheYear;

	}

	return sDateFormat;

}



function setDateFromString(local, theDate) {

	var theDateObject   = null;

	var theDateArray    = theDate.split("/");



	if (local == "ja") {

		// FORMAT: YYYY/MM/DD

		theDateObject = new Date(theDateArray[0], theDateArray[1]-1, theDateArray[2]);

	} else if ((local == "de") || (local == "es") || (local == "fr")) {

		// FORMAT: DD/MM/YYYY

		theDateObject = new Date(theDateArray[2], theDateArray[1]-1, theDateArray[0]);

	} else {

		// FORMAT: MM/DD/YYYY

		theDateObject = new Date(theDateArray[2], theDateArray[0]-1, theDateArray[1]);

	}



	//alert("theDateObject: " + theDateObject);

	if ((theDateObject == "Invalid Date") || (isNaN(theDateObject))) {

		theDateObject = null;

	}

	return theDateObject;

}



/*

This function is necessary because as of now the multiDisplayCalendar.js needs an empty form to process the curent dates

*/

function fnClearFormField(pDate) {

	if ((pDate == "MM/DD/YYYY") || (pDate == "DD/MM/YYYY") || (pDate == "YYYY/MM/DD")) {



		//clear it

		pDate = "";

	}

	return pDate;

}