/*--formatDate.js------------------------------------------------------------------------------
 - Purpose : addSlashes takes a number input of at least 7 digits and adds the
 		slashes to make it a proper date value.  This allows for easy input as the 
		user does not need to worry about finding the slash key to enter their dates
- Parameters :
		 - name = name of the field to be "slashed"
		 - value = string value sent in to be "slashed"
 - Author : Ryan Putman
 - Updates: 3/16/2004 - converted from vbScript to Javascript
---------------------------------------------------------------------------------------------------*/
function addSlashes(name)
{
		var mon="",day="",yr="",newVal;
		var curVal = document.getElementById(name).value;
		if(!(isDate(curVal)))
		{
			for(var i=0;i<curVal.length;i++)
				if(i<=1)
					mon +=  curVal.charAt(i);
				else if(i<=3)
					day += curVal.charAt(i);
				else
					yr += curVal.charAt(i);
			if(parseInt(yr) < 54)
				yr = parseInt(yr) + 2000;
			else if(parseInt(yr) < 100)
				yr = parseInt(yr) + 1900;
				
			newVal = mon + "/" + day + "/" + yr;
			if(isDate(newVal))
				document.getElementById(name).value = newVal;
			else
				alert("Not a Valid Date or number-to-date value - " + curVal + " (" + newVal + ")")
		}else
			document.getElementById(name).value = curVal;
}
	
function addSlashesValue(value)
{
		var mon = "",day = "",yr = "",newVal;
		var curVal = value;
			for(var i=0;i<curVal.length;i++)
			{
				if(i<=1)
					mon += curVal.charAt(i);
				else if(i<=3)
					day += curVal.charAt(i);
				else
					yr += curVal.charAt(i);
			}
			if(parseInt(yr) < 54)
				yr = parseInt(yr) + 2000;
			else if(parseInt(yr) < 100)
				yr = parseInt(yr) + 1900;
			newVal = mon + "/" + day + "/" + yr;
			if(isDate(newVal) != "")
				return value;
			else
				return newVal;
}
