﻿//-------------------------------------------------------------------DROPDOWN
function topDrop(id, over, element) {
	if (element) {
		if (over) {
			element.style.visibility='visible';
			document.getElementById("topMenuBn"+id).style.backgroundImage="url(Root/Layout/tabSmallBehind.png)";
			document.getElementById("topMenuBn"+id).style.backgroundPosition="bottom";
			return false;
			}
		else {
			element.style.visibility='hidden';
			document.getElementById("topMenuBn"+id).style.backgroundImage="none";
			return false;
			}
		}
	else {
		if (over) {
			document.getElementById("topDropDiv"+id).style.visibility="visible";
			document.getElementById("topMenuBn"+id).style.backgroundImage="url(Root/Layout/tabSmallBehind.png)";
			document.getElementById("topMenuBn"+id).style.backgroundPosition="bottom left";
			return false;
			}
		else {
			document.getElementById("topDropDiv"+id).style.visibility="hidden";
			document.getElementById("topMenuBn"+id).style.backgroundImage="none";
			return false;
			}
		}
	}
	
function topDropLogin(id, over, element) {
	if (element) {
		if (over) {
			element.style.visibility='visible';
			return false;
			}
		else {
			element.style.visibility='hidden';
			return false;
			}
		}
	else {
		if (over) {
			document.getElementById("topDropDiv"+id).style.visibility="visible";
			return false;
			}
		else {
			document.getElementById("topDropDiv"+id).style.visibility="hidden";
			return false;
			}
		}
	}

//-------------------------------------------------------------------IMG SWAP
function imgSwap(element, name, typ, over, down) {
	if (over) {
		element.src = "Root/Layout/"+name+"2."+typ;
		}
	else {
		element.src = "Root/Layout/"+name+"."+typ;
		}
	if (down) {
		element.src = "Root/Layout/"+name+"3."+typ;
		}
	}

//-------------------------------------------------------------------TOP 4H-logo HOVER
function topHover(hover, where) {
		if (hover) {
			if (where=="4h") {
			document.getElementById("topHoverTxt").innerHTML="<h3>4H...</h3><p>...&auml;r en f&ouml;rening av ungdomar, f&ouml;r ungdomar<br /> ...finns i &ouml;ver 80 l&auml;nder<br /> ...&auml;r politiskt och religi&ouml;st obundet<br /> ...&auml;r att m&ouml;ta m&auml;nniskor, hemma och p&aring; andra sidan jorden</p>";
			document.getElementById("topHover").style.width="400px";
			document.getElementById("topHover").style.height="150px";
			document.getElementById("topHover").style.left="350px";
			document.getElementById("topHover").style.top="43px";
			}
			if (where=="head") {
			document.getElementById("topHoverTxt").innerHTML="<h3>Huvud</h3><p>Kunskap</p>";
			document.getElementById("topHover").style.width="250px";
			document.getElementById("topHover").style.height="150px";
			document.getElementById("topHover").style.left="500px";
			document.getElementById("topHover").style.top="43px";
			}
			if (where=="heart") {
			document.getElementById("topHoverTxt").innerHTML="<h3>Hj&auml;rta</h3><p>Medk&auml;nsla</p>";
			document.getElementById("topHover").style.width="250px";
			document.getElementById("topHover").style.height="150px";
			document.getElementById("topHover").style.left="500px";
			document.getElementById("topHover").style.top="43px";
			}
			if (where=="hand") {
			document.getElementById("topHoverTxt").innerHTML="<h3>Hand</h3><p>F&auml;rdighet</p>";
			document.getElementById("topHover").style.width="250px";
			document.getElementById("topHover").style.height="150px";
			document.getElementById("topHover").style.left="500px";
			document.getElementById("topHover").style.top="43px";
			}
			if (where=="health") {
			document.getElementById("topHoverTxt").innerHTML="<h3>H&auml;lsa</h3><p>En sund livsstil</p>";
			document.getElementById("topHover").style.width="250px";
			document.getElementById("topHover").style.height="150px";
			document.getElementById("topHover").style.left="500px";
			document.getElementById("topHover").style.top="43px";
			}
		document.getElementById("topHover").style.visibility="visible";
		}
			else {
			document.getElementById("topHover").style.visibility="hidden";
			}
	}


//-------------------------------------------------------------------TEXTREDIGERAREN
function preDelete() {
	var conf=confirm('Du håller på att ta bort allt innehåll i ingressen!');
	if (conf==true)
	  {
	  document.getElementById('txAreaEditPre').innerHTML = "<p><br></p>";
	  divHideShow('txAreaEditPre', 'txInsertPreamble');
	  divHideShow('preDelete', 'dummyDiv');
	  }
	return false;
	}

function doFormat(cmd, txValue, txImg, txClass) {
															// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Vad händer här? funklar pre?
	if (txImg) {
	strImg=escape(txValue+'\"'+' class=\"'+txClass);
	document.execCommand(cmd, null, strImg);
	document.getElementById('txAreaEdit').innerHTML = unescape(document.getElementById('txAreaEdit').innerHTML);
	document.getElementById('txAreaEditPre').innerHTML = unescape(document.getElementById('txAreaEditPre').innerHTML);
	}
	else {
	document.execCommand(cmd, null, txValue);
	}
	return false;
}

function addTable () {
	document.getElementById('txAreaEdit').innerHTML = unescape(document.getElementById('txAreaEdit').innerHTML) + unescape("<p><br></p><table border='1' class='textTable' style='width:100%; height:150px;'><thead><tr><td>Kolumn 1</td><td>Kolumn 2</td><td>Kolumn3</td><td>Kolumn 4</td></tr></thead><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr></tbody></table><p><br></p>");
}

function viewSource(source)
{
  if (source) {
    document.getElementById('txTag').value = document.getElementById('txAreaEdit').innerHTML;
	document.getElementById('txAreaEdit').style.visibility="hidden";
	document.getElementById('txAreaEditPre').style.visibility="hidden";
	document.getElementById('txImg').style.visibility="hidden";
	document.getElementById('txControl').style.visibility="hidden";
	document.getElementById('bodyRightUpload').style.visibility="hidden";
	document.getElementById('calendarHeader').style.visibility="hidden";
	document.getElementById('headerSizeDiv').style.visibility="hidden";
	document.getElementById('txTagDiv').style.visibility="visible";
	document.getElementById('preDelete').style.visibility="hidden";
	document.getElementById('txInsertPreamble').style.visibility="hidden";
  } else {
	document.getElementById('txAreaEdit').innerHTML = document.getElementById('txTag').value;
	document.getElementById('txImg').style.visibility="visible";
	document.getElementById('txControl').style.visibility="visible";
	document.getElementById('bodyRightUpload').style.visibility="visible";
	document.getElementById('txTagDiv').style.visibility="hidden";
	document.getElementById('txAreaEdit').style.visibility="visible";
	document.getElementById('txAreaEditPre').style.visibility="visible";
	document.getElementById('calendarHeader').style.visibility="visible";
	document.getElementById('headerSizeDiv').style.visibility="visible";
	document.getElementById('preDelete').style.visibility="visible";
  }
}

function viewSourcePre(source)
{
  if (source) {
    document.getElementById('txTagPre').value = document.getElementById('txAreaEditPre').innerHTML;
	document.getElementById('txAreaEdit').style.visibility="hidden";
	document.getElementById('txAreaEditPre').style.visibility="hidden";
	document.getElementById('txImg').style.visibility="hidden";
	document.getElementById('txControl').style.visibility="hidden";
	document.getElementById('bodyRightUpload').style.visibility="hidden";
	document.getElementById('calendarHeader').style.visibility="hidden";
	document.getElementById('headerSizeDiv').style.visibility="hidden";
	document.getElementById('txTagDivPre').style.visibility="visible";
	document.getElementById('preDelete').style.visibility="hidden";
	document.getElementById('txInsertPreamble').style.visibility="hidden";
  } else {
	document.getElementById('txAreaEditPre').innerHTML = document.getElementById('txTagPre').value;
	document.getElementById('txImg').style.visibility="visible";
	document.getElementById('txControl').style.visibility="visible";
	document.getElementById('bodyRightUpload').style.visibility="visible";
	document.getElementById('txTagDivPre').style.visibility="hidden";
	document.getElementById('txAreaEdit').style.visibility="visible";
	document.getElementById('txAreaEditPre').style.visibility="visible";
	document.getElementById('calendarHeader').style.visibility="visible";
	document.getElementById('headerSizeDiv').style.visibility="visible";
	document.getElementById('preDelete').style.visibility="visible";
  }
}

function wait()
{
	document.getElementById('contentUpload').style.display="none";
	document.getElementById('wait').style.visibility="visible";
}

function imgHide(imgId) {
	var sure=confirm("Vill du radera bilden "+imgId+" permanent? \n Tänk på att den försvinner från alla sidor där den används!");
	if (sure==true)
		{
	loading();
    document.getElementById(imgId).src = "Root/Layout/imgDelete.png";
	document.getElementById(imgId+'a').style.visibility="hidden";
	document.getElementById(imgId+'b').style.visibility="hidden";
	document.getElementById(imgId+'c').style.visibility="hidden";
	document.getElementById(imgId+'d').style.visibility="hidden";
		document.myTextUpdateForm.saveExit.value="nej";
		document.myTextUpdateForm.deleteImgID.value=imgId;
		document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
		document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;
		document.myTextUpdateForm.submit();
		}
    return false;
}

function updateParent() {
    opener.window.location.reload();
    self.close();
    return false;
}

//-------------------------------------------------------------------SHOW/HIDE DIV
function divHideShow(hideA, showA) {
	if (document.getElementById(hideA)==null||hideA=='') {document.getElementById('dummyDiv').style.visibility="hidden";}
	else {document.getElementById(hideA).style.visibility="hidden";}
	if (document.getElementById(showA)==null||showA=='') {document.getElementById('dummyDiv').style.visibility="visible";}
	else {document.getElementById(showA).style.visibility="visible";}
    return false;
}

function loading()
{
	document.getElementById('pageLoading').style.display = 'inline';
	document.getElementById('shade').style.display = 'none';
	return false;
}

//-------------------------------------------------------------------INPUT

function removeMember(fullAddress)
	{
	var fromBox=confirm('Du håller på att ta bort en gruppmedlem!');
	if (fromBox==true)
	  {
	  this.location.href = fullAddress;
	  }
	return false;
	}
	
function newGroupName(fullAddress, oldName)
	{
	var newName=prompt('Nytt gruppnamn:', oldName);
	if (newName.toString!='null')
		{
		this.location.href = fullAddress + '&newGroupName=' + newName + '#admGroup';
		}
	return false;
	}
	
function newGroupEmail(fullAddress, oldEmail)
	{
	var newEmail=prompt('Ny e-post:', oldEmail);
	if (newEmail.toString!='null')
		{
		this.location.href = fullAddress + '&newEmail=' + newEmail + '#admGroup';
		}
	return false;
	}
	
function delGroup(fullAddress, oldName)
	{
	var delConfirm=confirm('OBS. Du håller på att ta bort gruppen ' + oldName + ' permanent! \n Alla data kopplade till gruppen kommer bli otillgängliga.');
	if (delConfirm)
		{
			if (confirm('En borttagning går inte att ångra!'))
			{
			this.location.href = fullAddress;
			}
		}
	return false;
	}

function checkString(str, id, mejl, tfn, uName, pWord, empty, pWord2)
	{
	document.getElementById(id).style.backgroundColor='#FFF';
	document.getElementById(id+"-Claim").style.visibility='hidden';
	document.getElementById(id+"-Accept").style.visibility='visible';
	if (str == "")
		{
		if (empty)
			{
			document.getElementById(id+"-Accept").style.visibility='hidden';
			}
		else
			{
			document.getElementById(id).style.backgroundColor='#FCC';
			document.getElementById(id+"-Claim").style.visibility='visible';
			document.getElementById(id+"-Accept").style.visibility='hidden';
			return false;
			}
		}
	else if (mejl)
		{
		if (str.indexOf('@') == -1 || str.indexOf('.') == -1)
			{
			if (str != "")
				{
				document.getElementById(id).style.backgroundColor='#FCC';
				document.getElementById(id+"-Claim").style.visibility='visible';
				document.getElementById(id+"-Accept").style.visibility='hidden';
				return false;
				}
			}
		}
	else if (tfn)
		{
		if (str.length < 7 || isNaN(str))
			{
			document.getElementById(id).style.backgroundColor='#FCC';
			document.getElementById(id+"-Claim").style.visibility='visible';
			document.getElementById(id+"-Accept").style.visibility='hidden';
			return false;
			}
		}
	else if (uName)
		{
		if (str != str.toLowerCase())
			{
			document.getElementById(id).style.backgroundColor='#FCC';
			document.getElementById(id+"-Claim").style.visibility='visible';
			document.getElementById(id+"-Accept").style.visibility='hidden';
			document.getElementById("redDomain1").style.visibility='visible';
			return false;
			}
		}
	else if (pWord)
		{
		if (str.length < 6)
			{
			document.getElementById(id).style.backgroundColor='#FCC';
			document.getElementById(id+"-Claim").style.visibility='visible';
			document.getElementById(id+"-Accept").style.visibility='hidden';
			return false;
			}
		}
	else if (pWord2)
		{
		if (str!=document.getElementById("pwStrHandlerLongNamePpRrOoTtEeCcTtOr").value)
			{
			document.getElementById(id).style.backgroundColor='#FCC';
			document.getElementById(id+"-Claim").style.visibility='visible';
			document.getElementById(id+"-Accept").style.visibility='hidden';
			return false;
			}
		}
	}

function checkRegUserForm()
	{
	if (document.regUserForm.firstName.value=="" || document.regUserForm.lastName.value=="")
		{
		alert("Du måste ange För- och Efternamn");
		return false;
		}
		
	else if (document.regUserForm.userName.value=="" || document.regUserForm.userName.value != document.regUserForm.userName.value.toLowerCase())
		{
		alert("Du måste ange ett användarnamn med små bokstäver");
		return false;
		}
		
	else if (document.regUserForm.pwStrHandlerLongNamePpRrOoTtEeCcTtOr.value.length < 6)
		{
		alert("Du måste ange ett lösenord med minst 6 tecken");
		return false;
		}
	
	else
		{
		document.regUserForm.submit();
		}
	}

function checkRegUserFormNewPw()
	{
	if (document.regUserForm.pwStrHandlerLongNamePpRrOoTtEeCcTtOrOld.value=="")
		{
		document.regUserForm.submit();
		}
	else
		{
		if (document.regUserForm.pwStrHandlerLongNamePpRrOoTtEeCcTtOr.value.length < 6)
			{
			alert("Ett lösenord måste innehålla minst 6 tecken");
			return false;
			}
		else if (document.regUserForm.pwStrHandlerLongNamePpRrOoTtEeCcTtOr.value!=document.regUserForm.pwStrHandlerLongNamePpRrOoTtEeCcTtOr2.value)
			{
			alert("Fälten Nytt lösenord och Upprepa lösenord stämmer inte överens");
			return false;
			}
		else
			{
			document.regUserForm.submit();
			}
		}
	}

function delUserConfirm(userFullName)
	{
	var fromBox=confirm('Vill du radera '+userFullName+'s användarkonto och alla personliga inställningar, vilket gör\r\n att '+userFullName+' inte längre kan logga in på 4H:s hemsidor?');
	if (fromBox==true)
	  {
	  document.delUserForm.submit();
	  }
	else
	  {
	  return false;
	  }
	}
	
	
	

function getScrollPosition()
{
	var ScrollTop = document.body.scrollTop;
	 
	if (ScrollTop < 1)
	{
		if (window.pageYOffset)
			ScrollTop = window.pageYOffset;
		else
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	try {
		document.getElementById('scrollPosition').value = ScrollTop;
		return ScrollTop
		}
	catch(err)
		{
		}
	return '0';
}

function setScrollPosition()
{
	try{
		var scrollTop = document.getElementById('scrollPosition').value;
		return scrollTop;
		}
	catch (err)
		{
		}
	return '0';
}


//-------------------------------------------------------------------BOOMHANDLER
function deletePost()
	{
	var sure=confirm("Vill du radera posten permanent?");
	if (sure==true)
		{
		loading();
		document.delPostForm.submit();
		}
	return false;
	}
function updatePostToBin()
	{
	loading();
	document.myPostForm.dateStart.value="1999-01-01";
	document.myPostForm.submit();
	return false;
	}
function setPostImg(img)
	{
	document.myPostForm.boomImg.value=img;
	return false;
	}
function updatePostReload()
	{
	loading();
	document.myPostForm.saveExit.value="nej";
	getScrollPosition();
	document.myPostForm.submit();
	return false;
	}
function imgHidePost(imgId) {
	var sure=confirm("Vill du radera bilden "+imgId+" permanent? \n Tänk på att den försvinner från alla sidor där den används!");
	if (sure==true)
		{
		loading();
	    document.getElementById(imgId).src = "Root/Layout/imgDelete.png";
		document.getElementById(imgId+'a').style.visibility="hidden";
		document.myPostForm.saveExit.value="nej";
		document.myPostForm.deleteImgID.value=imgId;
		document.myPostForm.submit();
		}
    return false;
}
	
//-------------------------------------------------------------------TEXTHANDLER

function deleteText()
	{
	var sure=confirm("Vill du radera texten permanent?");
	if (sure==true)
		{
		loading();
		document.myTextDeleteForm.submit();
		}
	return false;
	}
function updateTextReload()
	{
	loading();
	document.myTextUpdateForm.saveExit.value="nej";
	document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
	document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;
	getScrollPosition();
	document.myTextUpdateForm.submit();
	return false;
	}
function updateTextReloadNewForm(newFormID)
	{
	loading();
	document.myTextUpdateForm.saveExit.value="nej";
	document.myTextUpdateForm.newFormID.value=newFormID;
	document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
	document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;
	document.myTextUpdateForm.submit();
	return false;
	}
function updateTextReloadDeleteFile(deleteFileID)
	{
	loading();
	document.myTextUpdateForm.saveExit.value="nej";
	document.myTextUpdateForm.deleteFileID.value=deleteFileID;
	document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
	document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;
	document.myTextUpdateForm.submit();
	return false;
	}
function updateTextReloadDeleteFormPermanent(deleteFormID, deleteFormName)
	{
	var sure=confirm("Vill du radera formuläret "+deleteFormName+" permanent? \n Tänk på att det försvinner från alla sidor där det används!");
	if (sure==true)
		{
		loading();
		document.myTextUpdateForm.saveExit.value="nej";
		document.myTextUpdateForm.deleteFormID.value=deleteFormID;
		document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
		document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;
		document.myTextUpdateForm.submit();
		}
	return false;
	}
function updateTextReloadDeleteForm(delFormTextBoxID, delFormSubFormID)
	{
	loading();
	document.myTextUpdateForm.saveExit.value="nej";
	document.myTextUpdateForm.delFormTextBoxID.value=delFormTextBoxID;
	document.myTextUpdateForm.delFormSubFormID.value=delFormSubFormID;
	document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
	document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;
	document.myTextUpdateForm.submit();
	return false;
	}
function updateText()
	{
	document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
	document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;

	ok=true;
		if (document.myTextUpdateForm.calendarDate1.value!="")
		{
			if (document.myTextUpdateForm.calendarHeader.value=="")
			{
			alert('Du måste ange en rubrik om du vill visa något i Kalendern!');
			ok=false;
			}
		}
		else if (document.myTextUpdateForm.news.checked)
		{
			if (document.myTextUpdateForm.calendarHeader.value=="")
			{
			alert('Du måste ange en rubrik om du vill visa något som en Nyhet!');
			ok=false;
			}
		}
		else if (document.myTextUpdateForm.sidemenu.checked)
		{
			if (document.myTextUpdateForm.calendarHeader.value=="")
			{
			alert('Du måste ange en rubrik om du vill visa något i På sidan!');
			ok=false;
			}
		}
		else if (document.myTextUpdateForm.likebutton.checked)
		{
			if (document.myTextUpdateForm.calendarHeader.value=="")
			{
			alert('Du måste ange en rubrik om du vill visa Gillar-knappen!');
			ok=false;
			}
		}
		
		else if (document.myTextUpdateForm.comment.checked)
		{
			if (document.myTextUpdateForm.calendarHeader.value=="")
			{
			alert('Du måste ange en rubrik om du vill visa Kommentars-fältet!');
			ok=false;
			}
		}
		
		else if (document.myTextUpdateForm.featured.checked)
		{
			if (document.myTextUpdateForm.preamble.value.length<15)
			{
			alert('Du måste skriva en ingress om du vill visa ingressen på startsidan!');
			ok=false;
			}
		}
		
		if (ok)
		{
		loading();
		document.myTextUpdateForm.submit();
		return false;
		}
	}
function updateTextToBin()
	{
	loading();
	document.myTextUpdateForm.mainContent.value=document.getElementById('txAreaEdit').innerHTML;
	document.myTextUpdateForm.preamble.value=document.getElementById('txAreaEditPre').innerHTML;
	document.myTextUpdateForm.dateStart.value="1999-01-01";
	document.myTextUpdateForm.submit();
	return false;
	}
function calDateView(ID)
	{
	document.getElementById('calDate'+ID).style.visibility='visible';
	
	if (ID==2) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate1.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate1.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate1.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate1.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate2.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==3) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate2.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate2.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate2.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate2.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate3.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==4) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate3.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate3.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate3.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate3.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate4.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==5) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate4.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate4.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate4.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate4.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate5.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==6) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate5.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate5.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate5.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate5.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate6.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==7) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate6.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate6.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate6.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate6.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate7.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==8) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate7.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate7.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate7.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate7.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate8.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==9) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate8.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate8.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate8.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate8.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate9.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==10) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate9.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate9.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate9.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate9.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate10.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==11) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate10.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate10.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate10.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate10.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate11.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==12) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate11.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate11.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate11.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate11.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate12.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==13) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate12.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate12.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate12.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate12.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate13.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==14) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate13.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate13.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate13.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate13.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate14.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==15) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate14.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate14.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate14.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate14.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate15.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==16) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate15.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate15.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate15.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate15.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate16.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==17) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate16.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate16.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate16.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate16.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate17.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==18) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate17.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate17.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate17.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate17.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate18.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==19) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate18.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate18.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate18.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate18.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate19.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	else if (ID==20) {thisMonth=parseInt(document.myTextUpdateForm.calendarDate19.value.substr(5,7), 10); thisYear=parseInt(document.myTextUpdateForm.calendarDate19.value.substr(0,4), 10); thisMonthMax=getThisMonthMax(thisMonth, thisYear); nextDay=parseInt(document.myTextUpdateForm.calendarDate19.value.substr(8,10), 10)+1; if (nextDay<10) {nextDay='0'+nextDay}; nextMonth=parseInt(document.myTextUpdateForm.calendarDate19.value.substr(5,7), 10); if (nextDay==thisMonthMax+1) {nextDay='01'; nextMonth=nextMonth+1}; if (nextMonth<10) {nextMonth='0'+nextMonth}; if (nextMonth==13) {nextMonth='01'; thisYear=thisYear+1}; document.myTextUpdateForm.calendarDate20.value=thisYear+'-'+nextMonth+'-'+nextDay;}
	return false;
	}
function getThisMonthMax(thisMonth, thisYear)
	{
	if (thisMonth==1) {thisMonthMax=31}
	else if (thisMonth==2)
		{
		thisMonthMax=28
		if (thisYear==2012) {thisMonthMax=29}
		else if (thisYear==2016) {thisMonthMax=29}
		else if (thisYear==2020) {thisMonthMax=29}
		else if (thisYear==2024) {thisMonthMax=29}
		else if (thisYear==2028) {thisMonthMax=29}
		}
	else if (thisMonth==3) {thisMonthMax=31}
	else if (thisMonth==4) {thisMonthMax=30}
	else if (thisMonth==5) {thisMonthMax=31}
	else if (thisMonth==6) {thisMonthMax=30}
	else if (thisMonth==7) {thisMonthMax=31}
	else if (thisMonth==8) {thisMonthMax=31}
	else if (thisMonth==9) {thisMonthMax=30}
	else if (thisMonth==10) {thisMonthMax=31}
	else if (thisMonth==11) {thisMonthMax=30}
	else if (thisMonth==12) {thisMonthMax=31}
	return thisMonthMax;
	}
	
function setTextSubID(value)
	{
	document.myTextUpdateForm.textSubID.value=value;
	return false;
	}
function setTextPageIDa()
	{
	document.myTextUpdateForm.textPageID.value=0;
	document.myTextUpdateForm.textSubID.value=0;
	document.myTextUpdateForm.textSubID0.value=0;
	
	document.myTextUpdateForm.textSubID0.style.visibility='visible';
	document.myTextUpdateForm.textSubID1.style.visibility='hidden';
	document.myTextUpdateForm.textSubID2.style.visibility='hidden';
	document.myTextUpdateForm.textSubID3.style.visibility='hidden';
	document.myTextUpdateForm.textSubID4.style.visibility='hidden';
	document.myTextUpdateForm.textSubID5.style.visibility='hidden';
	document.myTextUpdateForm.textSubID6.style.visibility='hidden';
	return false;
	}
function setTextPageIDb()
	{
	document.myTextUpdateForm.textPageID.value=1;
	document.myTextUpdateForm.textSubID.value=0;
	
	document.myTextUpdateForm.textSubID0.style.visibility='hidden';
	document.myTextUpdateForm.textSubID1.style.visibility='visible';
	document.myTextUpdateForm.textSubID2.style.visibility='hidden';
	document.myTextUpdateForm.textSubID3.style.visibility='hidden';
	document.myTextUpdateForm.textSubID4.style.visibility='hidden';
	document.myTextUpdateForm.textSubID5.style.visibility='hidden';
	document.myTextUpdateForm.textSubID6.style.visibility='hidden';
	return false;
	}
function setTextPageIDc()
	{
	document.myTextUpdateForm.textPageID.value=2;
	document.myTextUpdateForm.textSubID.value=0;
	
	document.myTextUpdateForm.textSubID0.style.visibility='hidden';
	document.myTextUpdateForm.textSubID1.style.visibility='hidden';
	document.myTextUpdateForm.textSubID2.style.visibility='visible';
	document.myTextUpdateForm.textSubID3.style.visibility='hidden';
	document.myTextUpdateForm.textSubID4.style.visibility='hidden';
	document.myTextUpdateForm.textSubID5.style.visibility='hidden';
	document.myTextUpdateForm.textSubID6.style.visibility='hidden';
	return false;
	}
function setTextPageIDd()
	{
	document.myTextUpdateForm.textPageID.value=3;
	document.myTextUpdateForm.textSubID.value=0;
	
	document.myTextUpdateForm.textSubID0.style.visibility='hidden';
	document.myTextUpdateForm.textSubID1.style.visibility='hidden';
	document.myTextUpdateForm.textSubID2.style.visibility='hidden';
	document.myTextUpdateForm.textSubID3.style.visibility='visible';
	document.myTextUpdateForm.textSubID4.style.visibility='hidden';
	document.myTextUpdateForm.textSubID5.style.visibility='hidden';
	document.myTextUpdateForm.textSubID6.style.visibility='hidden';
	return false;
	}
function setTextPageIDe()
	{
	document.myTextUpdateForm.textPageID.value=4;
	document.myTextUpdateForm.textSubID.value=0;
	
	document.myTextUpdateForm.textSubID0.style.visibility='hidden';
	document.myTextUpdateForm.textSubID1.style.visibility='hidden';
	document.myTextUpdateForm.textSubID2.style.visibility='hidden';
	document.myTextUpdateForm.textSubID3.style.visibility='hidden';
	document.myTextUpdateForm.textSubID4.style.visibility='visible';
	document.myTextUpdateForm.textSubID5.style.visibility='hidden';
	document.myTextUpdateForm.textSubID6.style.visibility='hidden';
	return false;
	}
function setTextPageIDf()
	{
	document.myTextUpdateForm.textPageID.value=5;
	document.myTextUpdateForm.textSubID.value=0;
	document.myTextUpdateForm.textSubID5.value=0;
	
	document.myTextUpdateForm.textSubID0.style.visibility='hidden';
	document.myTextUpdateForm.textSubID1.style.visibility='hidden';
	document.myTextUpdateForm.textSubID2.style.visibility='hidden';
	document.myTextUpdateForm.textSubID3.style.visibility='hidden';
	document.myTextUpdateForm.textSubID4.style.visibility='hidden';
	document.myTextUpdateForm.textSubID5.style.visibility='visible';
	document.myTextUpdateForm.textSubID6.style.visibility='hidden';
	return false;
	}
function setTextPageIDg()
	{
	document.myTextUpdateForm.textPageID.value=6;
	document.myTextUpdateForm.textSubID.value=0;
	
	document.myTextUpdateForm.textSubID0.style.visibility='hidden';
	document.myTextUpdateForm.textSubID1.style.visibility='hidden';
	document.myTextUpdateForm.textSubID2.style.visibility='hidden';
	document.myTextUpdateForm.textSubID3.style.visibility='hidden';
	document.myTextUpdateForm.textSubID4.style.visibility='hidden';
	document.myTextUpdateForm.textSubID5.style.visibility='hidden';
	document.myTextUpdateForm.textSubID6.style.visibility='visible';
	return false;
	}
