function submitForm(formId) {
	var day = document.getElementById('day').value;
	var month = document.getElementById('month').value;
	var year = document.getElementById('year').value;
	var errors = "";
	if(day == 0 ||month==0 || year==0 ) {
		document.getElementById("errors").style.display = "block";
		errors +='<bean:message bundle="section" key="pregcal.dateinvalid" />';	
		document.getElementById('errors').innerHTML = errors;
	} else {
		document.getElementById(formId).submit();
	}
	return false;
} 

function showDiv(myDiv) {
	document.getElementById("main").style.display = "none";
	document.getElementById("tab1").style.display = "none";
	document.getElementById("tab2").style.display = "none";
	document.getElementById("tab3").style.display = "none";
	document.getElementById(myDiv).style.display = "block";
	document.getElementById("errors").style.display = "none";
	oldBtnTxt = document.getElementById("oldBtnTxt").value;
	document.getElementById(oldBtnTxt).style.display = "none";
	oldBtnID = document.getElementById("oldBtnID").value;
	document.getElementById(oldBtnID).style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_act_bg.gif')";	
	
	if (myDiv == "tab1") {
		document.getElementById("oldBtnTxt").value = "btntxt4";
		document.getElementById("oldBtnID").value = "btn4";
		document.getElementById("btntxt4").style.display = "inline";
		document.getElementById("btn4").style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_inact_bg.gif')";
	}
	
	if (myDiv == "tab2") {
		document.getElementById("oldBtnTxt").value = "btntxt13";
		document.getElementById("oldBtnID").value = "btn13";
		document.getElementById("btntxt13").style.display = "inline";
		document.getElementById("btn13").style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_inact_bg.gif')";
	}
	
	if (myDiv == "tab3") {
		document.getElementById("oldBtnTxt").value = "btntxt26";
		document.getElementById("oldBtnID").value = "btn26";
		document.getElementById("btntxt26").style.display = "inline";
		document.getElementById("btn26").style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_inact_bg.gif')";
	}
}

function showbtnTxt(btnTxtID, btnID){
	oldBtnTxt = document.getElementById("oldBtnTxt").value;
	document.getElementById(oldBtnTxt).style.display = "none";
	document.getElementById(btnTxtID).style.display = "inline";
	document.getElementById("oldBtnTxt").value = btnTxtID;
	
	oldBtnID = document.getElementById("oldBtnID").value;
	document.getElementById(oldBtnID).style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_act_bg.gif')";	
	document.getElementById(btnID).className = "selectedbtn";
	document.getElementById(btnID).style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_inact_bg.gif')";
	document.getElementById("oldBtnID").value = btnID;
}

function rollOverImg(btnID) {
	oldBtnID = document.getElementById("oldBtnID").value;
	if (oldBtnID != btnID) {
		document.getElementById(btnID).style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_inact_bg.gif')";
	}
}

function rollOutImg(btnID) {
	oldBtnID = document.getElementById("oldBtnID").value;
	if (oldBtnID != btnID) {
		document.getElementById(btnID).style.backgroundImage = "url('${applicationScope['cdn_path_enUS']}/${profile.locale}/section/images/preg_cal_act_bg.gif')";
	}
}
