function goGetFlash() {
	document.location.href = '/us/ecards/getflash.asp';
}

function getTemplates(iCatID, sCatName) {
	document.cardcat.catid.value = iCatID;
	document.cardcat.catname.value = sCatName;
	document.cardcat.submit();
}

function addRecipient() {
	document.card.action.value = 'addrcpt';
	document.card.submit();
}

function previewCard() {
	document.card.action.value = 'preview';
	document.card.submit();
}

function resetCard() {
	document.card.action.value = '';
	document.card.submit();
}

function sendCard() {
	document.card.action.value = 'send';
	document.card.submit();
}

function updateCard() {
	document.card.action.value = 'update';
	document.card.submit();
}

function adjustDate() {
	var iYear, iMonth, iDay, iJSNdx, iYNdx, iMNdx, iSelectedNdx;
	var oDay, oMonth;

	iYear = document.card.year.value;
	iMonth = document.card.month.value;
	iDay = document.card.day.value;

	for (iJSNdx=0; iJSNdx<aryJSPSBDates.length; iJSNdx++)
		if (iYear == aryJSPSBDates[iJSNdx][0]) {
			iYNdx = iJSNdx;
			break;
		}

	oMonth = eval('document.card.month.options');
	if (iMonth < aryJSPSBDates[iYNdx][1][0][0] || iMonth > aryJSPSBDates[iYNdx][1][aryJSPSBDates[iYNdx][1].length-1][0] || oMonth[0].value != aryJSPSBDates[iYNdx][1][0][0] || oMonth[oMonth.length-1].value != aryJSPSBDates[iYNdx][1][aryJSPSBDates[iYNdx][1].length-1][0]) {
		oMonth.length = 0;
		iSelectedNdx = 0;
		for (iJSNdx=0; iJSNdx<aryJSPSBDates[iYNdx][1].length; iJSNdx++) {
			oMonth[iJSNdx] = new Option(aryJSPSBDates[iYNdx][1][iJSNdx][0], aryJSPSBDates[iYNdx][1][iJSNdx][0]);
			if (iMonth == aryJSPSBDates[iYNdx][1][iJSNdx][0]) iSelectedNdx = iJSNdx;
		}
		if (iSelectedNdx == 0 && iMonth > oMonth[oMonth.length-1].value) iSelectedNdx = oMonth.length - 1;
		oMonth.selectedIndex = iSelectedNdx;
		iMonth = oMonth[oMonth.selectedIndex].value;
	}

	for (iJSNdx=0; iJSNdx<aryJSPSBDates[iYNdx][1].length; iJSNdx++)
		if (iMonth == aryJSPSBDates[iYNdx][1][iJSNdx][0]) {
			iMNdx = iJSNdx;
			break;
		}

	oDay = eval('document.card.day.options');
	if (iDay < aryJSPSBDates[iYNdx][1][iMNdx][1] || iDay > aryJSPSBDates[iYNdx][1][iMNdx][2] || oDay[0].value != aryJSPSBDates[iYNdx][1][iMNdx][1] || oDay[oDay.length-1].value != aryJSPSBDates[iYNdx][1][iMNdx][2]) {
		oDay.length = 0;
		iSelectedNdx = 0;
		for (iJSNdx=0; iJSNdx<=(aryJSPSBDates[iYNdx][1][iMNdx][2]-aryJSPSBDates[iYNdx][1][iMNdx][1]); iJSNdx++) {
			oDay[iJSNdx] = new Option(aryJSPSBDates[iYNdx][1][iMNdx][1]+iJSNdx, aryJSPSBDates[iYNdx][1][iMNdx][1]+iJSNdx);
			if (iDay == aryJSPSBDates[iYNdx][1][iMNdx][1]+iJSNdx) iSelectedNdx = iJSNdx;
		}

		if (iSelectedNdx == 0 && iDay > oDay[oDay.length-1].value) iSelectedNdx = oDay.length - 1;
		oDay.selectedIndex = iSelectedNdx;
		iDay = oDay[oDay.selectedIndex].value;
	}

	return true;
}

function checkLength(oInput, iLenLimit) {
	if (oInput.value.length > iLenLimit) {
		alert('Please limit your message to less than ' + iLenLimit.toString() + ' characters.');
		oInput.value = oInput.value.substr(0, iLenLimit);
	}
	return true;
}
