function checkRadioButton(field,errorMessage)
{
	var radioSelected = false;
	if ( field.checked )
	{	return true;	}
	else
  	{
		for (counter=0; counter<field.length; counter++)
  		{	if (field[counter].checked)	{	radioSelected = true;	}	}
		if (radioSelected){	return true;	}
  		else
  		{	alert(errorMessage); return false;	}
	}
}

function checkCurrency(field) 
{
	var errMsg1 = "Price is not entered correctly.  Please try again.";
	var errMsg2 = "We do not accept negative number.";
	var num = field.value;
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	{	return defaultAlert(field,errMsg1);	}
	if (num!=Math.abs(num))
	{	return defaultAlert(field,errMsg2);	}
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
	if (cents=="00")
		field.value = num;
	else
		field.value = num + '.' + cents ;
	return true;
}

function checkEmailAddress(field)
{
	var errMsg1 = "Please enter an e-mail address.";
	var errMsg2 = "Please enter a valid e-mail address.";
	field = trimSpaces(field);
	if ( field.value == null || field.value == "")
	{	return defaultAlert(field,errMsg1);	}
	if (/^\w+([\.\-\/']?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(field.value))
	{	return true;	}
	else
	{	return defaultAlert(field,errMsg2);	}
}

function checkEmailAddressValue(sValue)
{
	sValue = trimStringSpaces(sValue);
	if ( sValue == null || sValue == "")
	{	return false;	}
	if (/^\w+([\.\-\/']?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(sValue))
	{	return true;	}
	else
	{	return false;	}
}

function checkTextField(field, errorMessage)
{
	field = trimSpaces(field);
	if ( field.value == null || field.value == "" )
	{	return defaultAlert(field,errorMessage);	}
	else
	{	return true;	}
}

function checkFTPUserName(field,errMsg)
{
	field = trimSpaces(field);
	if (field.value.length<5 || field.value.length>30)
	{	return defaultAlert(field,errMsg);	}
	else
	{	for (var j=0;j<field.value.length;j++)
		{
			var valChar = field.value.charAt(j);
			if (!((valChar>="a" && valChar<="z") || (valChar>="A" && valChar<="Z") || (valChar>="0" && valChar<="9")))
			{	return defaultAlert(field,errMsg);	}
		}
		return true;
	}
}
function checkFTPPasswordField(field)
{
	var number = 4;
	var errMsg = "Please enter a password";
	var errMsg1 = "Password must have at least " + number + " characters long";
	var errMsg2 = "Password can not be password , please enter again.";
	var errMsg3 = "Password can not contain @ character , please enter again.";
	if ( field.value == "" || field.value == null )
	{	return defaultAlert(field,errMsg);	}
	if ( field.value.length < number )
	{	return defaultAlert(field,errMsg1);	}
	else
	{	for (var j=0;j<field.value.length;j++)
		{	if (field.value.charAt(j)=="@")
			{	return defaultAlert(field,errMsg3);	}
		}
		if ( field.value.length==8 && field.value.toLowerCase()=="password" )
		{	return defaultAlert(field,errMsg2);	}
		else
		{	return true;	}
	}
}
function checkPasswordField(field)
{
	var number = 5;
	var errMsg = "Please enter a password";
	var errMsg1 = "Password must have at least "+number+" characters long";
	var errMsg2 = "Password can not be password , please enter again.";
	if ( field.value == "" || field.value == null )
	{	return defaultAlert(field,errMsg);	}
	if ( field.value.length < number )
	{	return defaultAlert(field,errMsg1);	}
	else
	{
		if ( field.value.length==8 && field.value.toLowerCase()=="password" )
		{	return defaultAlert(field,errMsg2);	}
		else
		{	return true;	}
	}
}

function checkDropDown(field,errorMessage)
{
	if ( field.selectedIndex=="-1" )
	{	alert(errorMessage); return false;	}
	else
	{	return true;	}
}

function checkPhoneNumberField(field, errorMessage)
{
	field = trimSpaces(field);
	var errMsg = field.value + " is not a valid number. Please enter again.";
	var tempValue="";
	if ( field.value == "" || field.value == null )
	{	return defaultAlert(field,errorMessage);	}
	for (var i = 0; i < field.value.length; i++)
	{
		var oneChar = field.value.charAt(i)			
		if ( !(oneChar=="-" || oneChar==" ") )
		{	tempValue = tempValue + oneChar;	}
	}
	if (isInteger(tempValue, errorMessage))
	{	return true;	}
	else
	{	return defaultAlert(field,errMsg);	}
}

function checkState(field,errMsg)
{
	if ( field.selectedIndex=="0" )
	{	alert(errMsg); return false;	}
	else
	{	return true;	}
}

function checkZip(field,errMsg)
{
	errMsg = "Zip is required for US address.";
	errMsg2 = field.value + " is not a valid U.S zip code. Please enter again.";
	field = trimSpaces(field);
	if (field.value=="" || field.value==null)
	{	return defaultAlert(field,errMsg);	}
	else
	{	if (field.value.length!=5)
		{	return defaultAlert(field,errMsg2);	}
		if (isInteger(field.value, errMsg))
		{	return true;	}
		else
		{	return defaultAlert(field,errMsg2);	}
	}
}

function checkNYSEAcctNo(field)
{
	var errMsg1 = "Account No must be filled in.";
	var errMsg2 = "Account Number format is not entered correctly.";
	var tempValue= "";
	field = trimSpaces(field);
	if (field.value=="")
	{	return defaultAlert(field,errMsg1);	}
	if (field.value.charAt(2)!="-")
	{	return defaultAlert(field,errMsg2);	}
	if (field.value.length!=8)
	{	return defaultAlert(field,errMsg2);	}
	for (var i=0; i < field.value.length; i++)
	{
		if (i!=2)
		{	tempValue = tempValue + field.value.charAt(i);	}
	}
	var errMsg3 = tempValue + " is not number. Please enter again.";
	if (isInteger(tempValue,errMsg1))
	{	return true;	}
	else
	{	return defaultAlert(field,errMsg3);	}
}

function isInteger(Value, errorMessage)
{
	if ( Value == "" || Value==null )
	{	alert(errorMessage); return false;	}
	var inputStr = Value.toString()
	for (var i=0; i<inputStr.length; i++)
	{
		var oneChar = inputStr.charAt(i)			
		if ( oneChar<"0" || oneChar>"9" )
		{	return false;	}
	}
	return true;
}

function checkMarkField(form, errorMessage)
{
	var optionChecked=false;
	for (var i=0; i<form.elements.length; i++)
	{	if (form.elements[i].checked==true)	{	optionChecked = true;	}	}
	if (optionChecked==false)
	{	alert(errorMessage);	}
	return optionChecked;
}

function resetAll(form)
{
	for (var i=0; i<form.elements.length; i++)
	{
	    if (form.elements[i].type.toUpperCase()=="TEXT")
	    {	if (form.elements[i].value!="")	{	form.elements[i].value="";	}	}
	    if (form.elements[i].type.toUpperCase()=="RADIO" || form.elements[i].type.toUpperCase()=="CHECKBOX")
	    {	if (form.elements[i].checked==true) {	form.elements[i].checked=false;	}	}
	}
}

function hasCheckMarkEachRow(form,errorMessage)
{
	var isPicked = false;
	var noCheckField=true;
	var currName="";
	var newName="";
	var newElement;

	for (var i=0; i<form.elements.length; i++)
	{
	   if (form.elements[i].type.toUpperCase()=="CHECKBOX" || form.elements[i].type.toUpperCase()=="RADIO") 
	   {
		noCheckField = false;
		newName = form.elements[i].name;
		newElement = form.elements[i];

		if (currName=="")
		{
			if (newElement.checked==true)
			{	isPicked=true;	}
			currName=newName;
		}
		else
		{
			if (currName==newName && !isPicked)
			{
				if (newElement.checked==true)
				{	isPicked=true;	}
			}
			else
			{
				if (currName!=newName)
				{
					if (!isPicked)
					{	alert(errorMessage); return false;	}
					else
					{
						isPicked=false;
						if (newElement.checked==true)
						{	isPicked=true;	}
						currName = newName;
					}
				}
			}		
		}
	    }
	}
	if (!isPicked && !noCheckField)
	{	alert(errorMessage); return false;	}
	return true;
}

function highlightRow(field) 
{
	var browserName=navigator.appName;
	var is_major = parseInt(navigator.appVersion,10);
	if (browserName=="Microsoft Internet Explorer")
	{	var is_ie4up = is_major>=4;		}
	if (browserName=="Netscape")
	{	var is_nav6up = is_major>=5;		}
	var orgField = field;
	if (is_ie4up || is_nav6up)
	{
		var isChecked = field.checked
		while (field.tagName.toUpperCase() != 'TR' && field != null)
		{	field = document.all ? field.parentElement : field.parentNode;	}
		if (field && isChecked)
		{
			// change the highlighted row color by assigning different style sheet classess into the TR tag.
			// if class of the tag is not available but bgColor is available, change the color directly.
			if (field.className==null || field.className=="")
			{	field.value="";	field.className = "rowChecked";	}
			else
			{	if (field.className!="rowChecked")
				{	field.value = field.className;	field.className = "rowChecked";	}
			}
   		}
		else
		{	if ( field.value!=null ) { field.className = field.value;	}	}
		// change the color of the hyperlink color by assigning different style sheet classes into the A tag.
		// currently yellow is highlighted, blue is non-highlighted.
		if (is_ie4up)
		{
			for(var i=0;i < field.all.length; i++)
			{
				if (field.all[i].tagName.toUpperCase()=="A") 
				{
					if (isChecked) { field.all[i].className = "highlightAtag";	}
					else {	field.all[i].className = "";	}
				}
			}
		}
		if (is_nav6up)
		{
			var child=field.childNodes;
			for (var j=0; j<child.length; j++)
			{
				if (child[j].nodeType==1)
				{
					for (var m=child[j].firstChild; m!=null; m=m.nextSibling)
					{
						if (m.nodeType==1)
						{
							if (m.tagName.toUpperCase()=="A")
							{
								if (isChecked) { m.className="highlightAtag";	}
								else {	m.className="";	}
							}
						}
					}
				}
			}
		}
	}
}

function checkAll(from,field,turnOnHL)
{
	if (field.length!=null)
	{
		for (var i=0; i<field.length;i++)
		{	checkCB(from,field[i],turnOnHL);	}
	}
	else
	{	checkCB(from,field,turnOnHL);	}
}

function checkCB(from,field,turnOnHL)
{
	var browserName=navigator.appName;
	var is_major = parseInt(navigator.appVersion,10);
	if (browserName=="Microsoft Internet Explorer")
	{	var is_ie4up = is_major>=4;		}
	if (browserName=="Netscape")
	{	var is_nav6up = is_major>=5;		}

	if (from.checked)
	{
		if (!field.checked)
		{
			field.checked = from.checked;	
			if (turnOnHL) {	if (is_ie4up || is_nav6up) { highlightRow(field);	}	}
		}
	}
	else
	{
		if (field.checked)
		{	
			field.checked = from.checked;
			if (turnOnHL) {	if (is_ie4up || is_nav6up) { highlightRow(field);	}	}
		}
	}
}

function compareDate(from, to, errorMessage) 
{
	var errMsg1 = "Please enter the Start Date";
	var errMsg2 = "Please enter the End Date";
	var toValueIsEmpty = false;
	var validDate = false;

	from = trimSpaces(from);
	if (from.value=="")
	{	alert("Date must be entered");	}
	else 
	{
		to = trimSpaces(to);
		if (to.value=="")
		{	toValueIsEmpty=true; to.value=from.value;	}
		if ( checkDate(from,errMsg1) && checkDate(to,errMsg2) )
		{
			if (Date.parse(from.value) > Date.parse(to.value)) 
			{	alert(errorMessage);	}
			else 
			{
				var today = new Date();
				if (Date.parse(from.value) > today)
				{	alert("Date must be chosen before today's date.");	}
				else
				{	if (Date.parse(to.value) > today)
					{	alert("End Date must be chosen before today's date.");	}
					else
					{	return true;	}
				}
			}
		}
	}
	if (validDate==false)
	{	
		if (toValueIsEmpty) { to.value="";	}
		return false;
	}
}

function checkDate(objName,errMsg) 
{
	var datefield = objName;
	if (chkdate(objName) == false) 
	{	return defaultAlert(datefield,errMsg);	}
	else 
	{	return true;   	}
}

function chkdate(objName) 
{
	var datefield=objName;
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var intday;
	var intMonth;
	var intYear;
	var booFound = false;
	var strSeparatorArray = new Array("-"," ","/",".");
	var err = 0;
	strDate = datefield.value;
	if (datefield.value.length < 6) 
	{
		return false;
	}
	for (var i=0; i<strSeparatorArray.length; i++) 
	{
		if (strDate.indexOf(strSeparatorArray[i]) != -1) 
		{
			strDateArray = strDate.split(strSeparatorArray[i]);
			if (strDateArray.length != 3) 
			{
				err = 1;
				return false;
			}
			else 
			{
				if (strDateArray[0].length>2)	return false;
				else	strMonth = strDateArray[0];
				if (strDateArray[1].length>2)	return false;
				else	strDay = strDateArray[1];
				if (strDateArray[2].length>4)	return false;
				else	strYear = strDateArray[2];
				break;
			}
		}
	}
	intday = parseInt(strDay, 10);
	if ( isNaN(intday) ) 
	{	return false;	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) 
	{	return false;	}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) 
	{	return false;	}
	if (intMonth>12 || intMonth<1) 
	{	return false;	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) 
	{	return false;	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) 
	{	return false;	}
	if (intMonth == 2) 
	{
		if (intday < 1) 
		{	return false;	}
		if (LeapYear(intYear) == true) 
		{
			if (intday > 29) 
			{	return false;	}
		}
		else 
		{
			if (intday > 28) 
			{	return false;	}
		}
	}
	if (strDay.length==1) strDay = "0"+strDay;
	if (strMonth.length==1) strMonth = "0"+strMonth;
	if (strYear.length==2)
	{	if (strYear.charAt(0)=="0") strYear = "20"+strYear; else strYear="19"+strYear;	}
	objName.value = strMonth+"/"+strDay+"/"+strYear;
	return true;
}

function LeapYear(intYear) 
{
	if (intYear % 100 == 0) 
	{
		if (intYear % 400 == 0) 
		{ return true; }
	}
	else 
	{
		if ((intYear % 4) == 0) 
		{ return true; }
	}
	return false;
}

function defaultAlert(field,errMsg)
{
	if (field.type!="select-one" && field.type!="select-multiple")
	{	field.select();	}
	alert(errMsg);
	field.focus();
	return false;		
}

function trimSpaces(field)
{
	while(''+field.value.charAt(0)==' ')
	{	field.value=field.value.substring(1,field.value.length);	}
	while(''+field.value.charAt(field.value.length-1)==' ')
	{	field.value=field.value.substring(0,field.value.length-1);	}
	return field;	
}

function trimStringSpaces(sValue)
{
	sValue = new String(sValue);
	while(''+sValue.charAt(0)==' ')
	{	sValue = sValue.substring(1,sValue.length);	}
	while(''+sValue.charAt(sValue.length-1)==' ')
	{	sValue = sValue.substring(0,sValue.length-1);	}
	return sValue;
}

function checkTime(field,errMsg,withSec) 
{
	field = trimSpaces(field);
	if (withSec)
	{	var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?$/;	}
	else
	{	var timePat = /^(\d{1,2}):(\d{2})?$/;	}
	var matchArray = field.value.match(timePat);
	if (matchArray == null) 
	{	return defaultAlert(field,errMsg);	}
	strHour = matchArray[1]; 
	strMin = matchArray[2];
	hour = parseInt(matchArray[1],10);
	minute = parseInt(matchArray[2],10);
	if (matchArray[4]==null || matchArray[4]=="")
	{	 second="";	}
	else { second = parseInt(matchArray[4],10);	}

	if (hour < 1  || hour > 12) 
	{	return defaultAlert(field,"Hour must be between 1 and 12.");	}
	if (minute<0 || minute > 59) 
	{	return defaultAlert(field,"Minute must be between 0 and 59.");	}
	if (withSec)
	{	if (second != "")
		{	if (second < 0 || second > 59)
			{	return defaultAlert(field,"Second must be between 0 and 59.");	}
		}
		else
		{	field.value = strHour+":"+strMin+":00";	}
	}
	return true;
}

function compareTime(from,fromAMPM,withFromSec,to,toAMPM,withToSec,errorMessage) 
{
	var errMsg1 = "Please enter the Start Time";
	var errMsg2 = "Please enter the End Time";
	var errMsg3 = "Begin Time must come before End Time";
	var timePat;
	
	from = trimSpaces(from);
	to = trimSpaces(to);
	if ( checkTime(from,errMsg1,withFromSec) && checkTime(to,errMsg2,withToSec) )
	{
		if (fromAMPM.value.toUpperCase()==toAMPM.value.toUpperCase())
		{
			if (withFromSec)
			{	timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?$/;	}
			else
			{	timePat = /^(\d{1,2}):(\d{2})?$/;	}
			var matchArray = from.value.match(timePat);
			fromHour = parseInt(matchArray[1],10);
			fromMinute = parseInt(matchArray[2],10);
			if (matchArray[4]==null || matchArray[4]=="")
			{	 fromSecond="";	}
			else { fromSecond = parseInt(matchArray[4],10);	}

			if (withToSec)
			{	timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?$/;	}
			else
			{	timePat = /^(\d{1,2}):(\d{2})?$/;	}
			matchArray = to.value.match(timePat);
			toHour = parseInt(matchArray[1],10);
			toMinute = parseInt(matchArray[2],10);
			if (matchArray[4]==null || matchArray[4]=="")
			{	 toSecond="";	}
			else { toSecond = parseInt(matchArray[4],10);	}

			if (fromHour>toHour)
			{	return defaultAlert(from,errMsg3);	}
			else
			{
				if (fromHour==toHour)
				{
					if (fromMinute>toMinute)
					{	return defaultAlert(from,errMsg3);	}
					else
					{
						if (fromMinute==toMinute)
						{
							if (withFromSec && withToSec)
							{
								if (fromSecond>toSecond)
								{	return defaultAlert(from,errMsg3);	}
								else
								{	return true;	}	
							}
							else
							{	return true;	}
						}
						else
						{	return true;	}
					}
				}
				else
				{	return true;	}
			}
		}
		else
		{
			if (fromAMPM.value.toUpperCase()=="PM" && toAMPM.value.toUpperCase()=="AM")
			{	return defaultAlert(from,errMsg3);	}
			else
			{	return true;	}	
		}
	}
	return false;
}

function nonDownloadable()
{
	alert("This \"delta\" file is empty: there are no changes."); 
}

function specialChkDateTime(objName,defaultYear)
{
	trimSpaces(objName);
	var timeValue;
	var dateValue;
	var timeIsValid = false;
	var dateIsValid = false;
	var strDateTimeArray;
	var datefield = objName;
	var returnDateValue = "", returnTimeValue="";
	strDate = datefield.value;
	if (strDate.length < 3)
	{	return false;	}
	if (strDate.indexOf(" ") != -1) 
	{	strDateTimeArray = strDate.split(" ");
		if (strDateTimeArray.length==1)
		{	timeIsValid = specialChkTime(strDateTimeArray[0]);	
			dateIsValid = specialChkdate(strDateTimeArray[0],defaultYear);
			if (timeIsValid || dateIsValid)
			{	if (timeIsValid!=false)
					objName.value = timeIsValid;
				else
					objName.value = dateIsValid;				
				return true;	
			}
			else
			{	return false;	}
		}
		else
		{	if (strDateTimeArray.length==2)
			{	if (strDateTimeArray[1].toLowerCase()=="am" || strDateTimeArray[1].toLowerCase()=="pm")
				{	timeIsValid = specialChkTime(strDateTimeArray[0]+strDateTimeArray[1]);
					if (timeIsValid)
					{	objName.value = timeIsValid;
						return true;	
					}
					else
					{	return false;	}
				}
				else
				{	dateIsValid = specialChkdate(strDateTimeArray[0],defaultYear);
					timeIsValid = specialChkTime(strDateTimeArray[1]);
					if (timeIsValid && dateIsValid)
					{	objName.value = dateIsValid + " " + timeIsValid;
						return true;	
					}
					else
					{	return false;	}
				}
			}
			else
			{	if (strDateTimeArray.length==3)
				{	dateIsValid = specialChkdate(strDateTimeArray[0],defaultYear);
					timeIsValid = specialChkTime(strDateTimeArray[1]+strDateTimeArray[2]);
					if (timeIsValid && dateIsValid)
					{	objName.value = dateIsValid + " " + timeIsValid;
						return true;	
					}
					else
					{	return false;	}
				}
				else
				{	err = 1;
					return false;
				}
			}
		}
	}
	else
	{
		timeIsValid = specialChkTime(strDate);	
		dateIsValid = specialChkdate(strDate,defaultYear) ;
		if (timeIsValid || dateIsValid)
		{	if (timeIsValid!=false)
				objName.value = timeIsValid;
			else
				objName.value = dateIsValid;				
			return true;	}
		else
		{	return false;	}
	}
}
function specialChkdate(strDate,defaultYear) 
{
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear="";
	var intday;
	var intMonth;
	var intYear="";
	var tmpDate;
	var booFound = false;
	var strSeparatorArray = new Array("-","/",".");
	var err = 0;
	for (var i=0; i<strSeparatorArray.length; i++) 
	{	if (strDate.indexOf(strSeparatorArray[i]) != -1) 
		{	strDateArray = strDate.split(strSeparatorArray[i]);
			if (strDateArray.length < 2 || strDateArray.length > 3) 
			{	err = 1;
				return false;
			}
			else 
			{	if (strDateArray[0].length>2)
				{	return false;	}
				else
				{	strMonth = strDateArray[0];	}
				if (strDateArray[1].length>2)
				{	return false;	}
				else
				{	strDay = strDateArray[1];	}
				if (strDateArray[2]!=null)
				{	if (strDateArray[2].length>4)
					{	return false;	}
					else
					{	strYear = strDateArray[2];	}
				}
				break;
			}
		}
	}
	intday = parseInt(strDay, 10);
	if ( isNaN(intday) ) 
	{	return false;	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) 
	{	return false;	}
	if (strYear!="")
	{	intYear = parseInt(strYear, 10);
		if (isNaN(intYear)) 
		{	return false;	}
		if (strYear.length==2)
		{	if (intYear > 70)
			{	intYear = 1900+(intYear-0); }
			else 
			{	intYear = 2000+(intYear-0); }
			strYear = intYear.toString();
		}
	}
	if (intMonth>12 || intMonth<1) 
	{	return false;	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) 
	{	return false;	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) 
	{	return false;	}
	if (intMonth == 2) 
	{
		if (intday < 1) 
		{	return false;	}
		if (intYear!="")
		{	if (LeapYear(intYear) == true) 
			{	if (intday > 29) 
				{	return false;	}
			}
			else 
			{	if (intday > 28) 
				{	return false;	}
			}
		}
	}
	if (strYear=="")
		strDate = strMonth + "/" + strDay + "/" + defaultYear;
	else
		strDate = strMonth + "/" + strDay + "/" + strYear;
	return strDate;
}
function specialChkTime(timeValue)
{
	var timePat, matchArray, second="", last2Chrs;
	last2Chars = timeValue.substring(timeValue.length-2,timeValue.length);
	if (last2Chars.toLowerCase()=="am" || last2Chars.toLowerCase()=="pm")
	{	timeValue = timeValue.substring(0,timeValue.length-2);	}
	else
	{	last2Chars = "";	}
	timePat = /^(\d{1,2}):(\d{2})?$/;
	matchArray = timeValue.match(timePat);
	if (matchArray == null) 
	{	timePat = /^(\d{1,2}):(\d{2}):(\d{2})?$/;
		matchArray = timeValue.match(timePat);
		if (matchArray == null) 
		{	return false;	}
	}
	strHour = matchArray[1];
	if (matchArray[2]==null || matchArray[2]=="")
	{	matchArray[2] = "00";	}
	strMin = matchArray[2];
	hour = parseInt(matchArray[1],10);
	minute = parseInt(matchArray[2],10);
	if (matchArray.length>2)
	{	if (matchArray[3]==null || matchArray[3]=="")
		{	second = "";	}
		else 
		{	second = parseInt(matchArray[3],10);	}
	}
	if (hour < 1  || hour > 23) 
	{	return false;	}
	if (hour >= 1 && hour <= 12)
	{	if (last2Chars=="")
		{	last2Chars = "am";	}
	}
	else
	{	hour = hour - 12;
		strHour = hour.toString();
		if (last2Chars=="")
		{	last2Chars = "pm";	}
	}
	if (minute < 0 || minute > 59) 
	{	return false;	}
	if (second != "")
	{	if (second < 0 || second > 59)
		{	return false;	}
	}
	else
	{	timeValue = strHour + ":" + strMin + ":00";	}
	if (last2Chars!="")
	{	timeValue = timeValue + " " + last2Chars;	}
	return timeValue;
}