function switchIfDone(this_div, next_div, num)
	{
	var complete = true;

	if (eval ("hiddenformz.worry1_" + num + ".value") == "")
		complete = false;
	else if (eval ("hiddenformz.worry2_" + num + ".value") == "")
		complete = false;
	else if (eval ("hiddenformz.worry3_" + num + ".value") == "")
		complete = false;

	if (complete == true)
		switchDiv(this_div, next_div);
	else
		alert('Please complete the form before adding a new worry');
	}//end of switchIfDone


function switchIfDone2(this_div, next_div, num)
	{
	var complete = true;

	if (eval ("hiddenformz2.ult_life" + num + ".value") == "")
		complete = false;

	if (complete == true)
		switchDiv(this_div, next_div);
	else
		alert('Please complete the form before adding a new ultimate life goal');
	}//end of switchIfDone2


function switchIfDone3(num)
	{
	var complete = true;

	for (count = 1; count < num; count++)
		{
		if (eval ("hiddenformz.hidefieldsz" + count + ".checked == false"))
			{
			if (eval ("hiddenformz.cometrue" + count + ".value") == "")
				complete = false;
			}//end of if
		}//end of for

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert('Please complete the form before moving on to the next page');
	}//end of switchIfDone3


function switchIfDone4(num)
	{
	var complete = true;

	for (count = 1; count < num; count++)
		{
		if (eval ("hiddenformz.todo" + count + ".value") == "")
			complete = false;
		}//end of for

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert('Please complete the form before submitting storing the data');
	}//end of switchIfDone4


function switchIfDone5(this_div, next_div)
	{
	var complete = true;

	if (hiddenformz.todo1_x1.value != "" && hiddenformz.todo1_1.value == "")
		complete = false;
	if (hiddenformz.todo1_x2.value != "" && hiddenformz.todo1_2.value == "")
		complete = false;

	if (complete == true)
		{
		document.getElementById(this_div.id).style.display="none"
		document.getElementById(next_div.id).style.display="block"
		}//end of if
	else
		alert('Please enter a value on the First text box if you entered a value on the one beside it');
	}//end of switchIfDone5


function switchDiv(this_div, next_div)
	{
	document.getElementById(next_div.id).style.display="block"
	document.getElementById(this_div.id).style.display="none"
	}//end of switchDiv


function submitFormx()
	{
	var complete = true;

	if (hiddenformz.worry1_1.value == "" && hiddenformz.worry2_1.value == "" && hiddenformz.worry3_1.value == "")
		complete = false;

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert('Please add at least one worry before submitting this form');
	}//end of submitFormx


function submitFormx2(num, num2, num3)
	{
	//check if all the values are completed

	var complete = true;

	if (hiddenformz2.longterm_target.value == "")
		complete = false;
	else if (hiddenformz2.mediumterm_target.value == "")
		complete = false;
	else if (hiddenformz2.shortterm_target.value == "")
		complete = false;
	else if (hiddenformz2.longterm_desc.value == "")
		complete = false;
	else if (hiddenformz2.mediumterm_desc.value == "")
		complete = false;
	else if (hiddenformz2.shortterm_desc.value == "")
		complete = false;
	else if (hiddenformz2.longterm_impt.value == "")
		complete = false;
	else if (hiddenformz2.mediumterm_impt.value == "")
		complete = false;
	else if (hiddenformz2.shortterm_impt.value == "")
		complete = false;

	if (num == 1)
		{
		if (hiddenformz2.situation.value == "")
			complete = false;
		}//end of if

	if (num2 == 1)
		{
		if (hiddenformz2.ult_life1.value == "")
			complete = false;
		}//end of if

	if (complete == true)
		document.hiddenformz2.submit();
	else
		{
		if (num2 != 22)
			alert('Please answer all the fields before submitting your goals');
		else
			alert('Please answer all the fields before updating your goals');
		}//end of else
	}//end of submitFormx2


function submitFormx3(num)
	{
	var complete = true;

	for (count = 1; count < num + 1; count++)
		{
		if (eval("hiddenformz.todo" + count + ".value") == "")
			complete = false;
		}//end of for

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert('Please complete this form before submitting');
	}//end of submitFormx3


function submitFormx4(num)
	{
	var complete = true;

	for (count = 1; count < num; count++)
		{
		if (eval("hiddenformz.resolve" + count + ".checked") == false)
			{
			if (eval("hiddenformz.ifithappen1_" + count + ".value") == "")
				complete = false;
			else if (eval("hiddenformz.reduce_likely1_" + count + ".value") == "")
				complete = false;
			else if (eval("hiddenformz.reduce_risk1_" + count + ".value") == "")
				complete = false;
			else if (eval("hiddenformz.todo2_1_" + count + ".value") == "")
				complete = false;
			}//end of if
		}//end of for

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert("Please complete this form before submitting it.");
	}//end of submitFormx4


function submitFormx5(num)
	{
	var complete = true;

	for (count = 1; count < num; count++)
		{
		//if the textfield has a value, there should be a corresponding value for the checkbox
		//but not vice versa
		if (eval("hiddenformz.textfield" + count + ".value") != "")
			{
			counter = 0;
			for (count2 = 1; count2 < 13; count2++)
				{
				if (eval("hiddenformz.checkbox" + count2 + "_" + count + ".checked") == true)
					counter = 1;
				}//end of for

			if (counter == 0)
				complete = false;
			}//end of if
		}//end of for

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert("Please select at least one Unhelpful Thinking Style if you entered something on the balancing thoughts text area.");
	}//end of submitFormx5


function submitFormZ()
	{
	var complete = true;

	if (hiddenformz.name.value == "" || hiddenformz.email.value == "" || hiddenformz.subject.value == "" || hiddenformz.message.value == "")
		complete = false;

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert('Please answer all fields before submitting this form');
	}//end of submitFormZ


function showdate(num)
	{
	eval("var obj1 = document.getElementById('schedulez" + num + "')");

	if (obj1.checked == true)
		 eval("document.getElementById('hiddendate" + num + "').style.display='block'");
	else
		eval("document.getElementById('hiddendate" + num + "').style.display='none'");
	}//end of showdate


function showgoal(num)
	{
	document.getElementById('life').style.display="none";
	document.getElementById('longterm').style.display="none";
	document.getElementById('mediumterm').style.display="none";
	document.getElementById('shortterm').style.display="none";

	if (num == 1)
		document.getElementById('life').style.display="block";
	else if (num == 2)
		document.getElementById('longterm').style.display="block";
	else if (num == 3)
		document.getElementById('mediumterm').style.display="block";
	else if (num == 4)
		document.getElementById('shortterm').style.display="block";

	highlight();
	window.scrollTo(0,0);
	}//end of showgoal


function showworrylist(num)
	{
	document.getElementById('div1').style.display="none";
	document.getElementById('div2').style.display="none";
	document.getElementById('div3').style.display="none";

	eval("document.getElementById('div" + num + "').style.display='block';")

	highlight3();
	}//end of showworrylist


function showtodo(num)
	{
	document.getElementById('div1').style.display="none";
	document.getElementById('div2').style.display="none";
	document.getElementById('div3').style.display="none";
	//document.getElementById('div4').style.display="none";

	eval("document.getElementById('div" + num + "').style.display='block';")

	highlight4();
	}//end of showtodo


function highlight()
	{
	tabmenu1w.style.backgroundColor='#efefef';
	tabmenu2w.style.backgroundColor='#efefef';
	tabmenu3w.style.backgroundColor='#efefef';
	tabmenu4w.style.backgroundColor='#efefef';
	tabmenu1w.style.color='#363636';
	tabmenu2w.style.color='#363636';
	tabmenu3w.style.color='#363636';
	tabmenu4w.style.color='#363636';

	if (document.getElementById('life').style.display != 'none')
		{
		tabmenu1w.style.backgroundColor='#27aac1';
		tabmenu1w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('longterm').style.display != 'none')
		{
		tabmenu2w.style.backgroundColor='#27aac1';
		tabmenu2w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('mediumterm').style.display != 'none')
		{
		tabmenu3w.style.backgroundColor='#27aac1';
		tabmenu3w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('shortterm').style.display != 'none')
		{
		tabmenu4w.style.backgroundColor='#27aac1';
		tabmenu4w.style.color='#ffffff';
		}//end of if
	}//end of highlight


function highlight2()
	{
	tabmenu1w.style.backgroundColor='#efefef';
	tabmenu2w.style.backgroundColor='#efefef';
	tabmenu3w.style.backgroundColor='#efefef';
	tabmenu4w.style.backgroundColor='#efefef';
	tabmenu1w.style.color='#363636';
	tabmenu2w.style.color='#363636';
	tabmenu3w.style.color='#363636';
	tabmenu4w.style.color='#363636';

	if (document.getElementById('shorttermz').style.display != 'none')
		{
		tabmenu1w.style.backgroundColor='#27aac1';
		tabmenu1w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('mediumtermz').style.display != 'none')
		{
		tabmenu2w.style.backgroundColor='#27aac1';
		tabmenu2w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('longtermz').style.display != 'none')
		{
		tabmenu3w.style.backgroundColor='#27aac1';
		tabmenu3w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('contentz').style.display != 'none')
		{
		tabmenu4w.style.backgroundColor='#27aac1';
		tabmenu4w.style.color='#ffffff';
		}//end of if
	}//end of highlight2


function highlight3()
	{
	tabmenu1w.style.backgroundColor='#efefef';
	tabmenu2w.style.backgroundColor='#efefef';
	tabmenu3w.style.backgroundColor='#efefef';
	tabmenu1w.style.color='#363636';
	tabmenu2w.style.color='#363636';
	tabmenu3w.style.color='#363636';

	if (document.getElementById('div1').style.display != 'none')
		{
		tabmenu1w.style.backgroundColor='#27aac1';
		tabmenu1w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('div2').style.display != 'none')
		{
		tabmenu2w.style.backgroundColor='#27aac1';
		tabmenu2w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('div3').style.display != 'none')
		{
		tabmenu3w.style.backgroundColor='#27aac1';
		tabmenu3w.style.color='#ffffff';
		}//end of if
	}//end of highlight3



function highlight4()
	{
	tabmenu1w.style.backgroundColor='#efefef';
	tabmenu2w.style.backgroundColor='#efefef';
	tabmenu3w.style.backgroundColor='#efefef';
//	tabmenu4w.style.backgroundColor='#efefef';
	tabmenu1w.style.color='#363636';
	tabmenu2w.style.color='#363636';
	tabmenu3w.style.color='#363636';
//	tabmenu4w.style.color='#363636';

	if (document.getElementById('div1').style.display != 'none')
		{
		tabmenu1w.style.backgroundColor='#27aac1';
		tabmenu1w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('div2').style.display != 'none')
		{
		tabmenu2w.style.backgroundColor='#27aac1';
		tabmenu2w.style.color='#ffffff';
		}//end of if
	else if (document.getElementById('div3').style.display != 'none')
		{
		tabmenu3w.style.backgroundColor='#27aac1';
		tabmenu3w.style.color='#ffffff';
		}//end of if
//	else if (document.getElementById('div4').style.display != 'none')
//		{
//		tabmenu4w.style.backgroundColor='#27aac1';
//		tabmenu4w.style.color='#ffffff';
//		}//end of if
	}//end of highlight4


function showdaily(num)
	{
	document.getElementById('contentz').style.display="none";
	document.getElementById('longtermz').style.display="none";
	document.getElementById('mediumtermz').style.display="none";
	document.getElementById('shorttermz').style.display="none";

	if (num == 1)
		{
		document.getElementById('shorttermz').style.display="block";
		}//end of if
	else if (num == 2)
		{
		document.getElementById('mediumtermz').style.display="block";
		}//end of else if
	else if (num == 3)
		{
		document.getElementById('longtermz').style.display="block";
		}//end of else if
	else if (num == 4)
		{
		document.getElementById('contentz').style.display="block";
		}//end of else if
	}//end of showdaily


function popmeup(urlx, heightx, widthx)
	{
	var newWin = null;
	if (newWin != null && !newWin.closed)
		newWin.close();

	strOptions="scrollbars," + " resizable, height=" + heightx + ", width=" + widthx;

	newWin = window.open(urlx, 'newWin', strOptions);
	newWin.focus();
	}//enf of popmeup


function popmeup2(urlx, heightx, widthx)
	{
	var newWin = null;
	if (newWin != null && !newWin.closed)
		newWin.close();

	strOptions="resizable, height=" + heightx + ", width=" + widthx;

	newWin = window.open(urlx, 'newWin', strOptions);
	newWin.focus();
	}//enf of popmeup2


function hidefields(num)
	{
	eval("var obj1 = document.getElementById('hidefieldsz" + num + "')");

	if (obj1.checked == true)
		 eval("document.getElementById('riskfields" + num + "').style.display='none'");
	else
		eval("document.getElementById('riskfields" + num + "').style.display='block'");
	}//end of hidefields


function en_disable(num)
	{
	if (eval("hiddenformz.resolvez" + num + ".checked") == true)
		{
		eval("hiddenformz.ifithappen1_" + num + ".disabled = true;")
		eval("hiddenformz.ifithappen2_" + num + ".disabled = true;")
		eval("hiddenformz.reduce_likely1_" + num + ".disabled = true;")
		eval("hiddenformz.reduce_likely2_" + num + ".disabled = true;")
		eval("hiddenformz.reduce_risk1_" + num + ".disabled = true;")
		eval("hiddenformz.reduce_risk2_" + num + ".disabled = true;")
		eval("hiddenformz.todo2_1_" + num + ".disabled = true;")
		eval("hiddenformz.todo2_2_" + num + ".disabled = true;")
		}//end of if
	else
		{
		eval("hiddenformz.ifithappen1_" + num + ".disabled = false;")
		eval("hiddenformz.ifithappen2_" + num + ".disabled = false;")
		eval("hiddenformz.reduce_likely1_" + num + ".disabled = false;")
		eval("hiddenformz.reduce_likely2_" + num + ".disabled = false;")
		eval("hiddenformz.reduce_risk1_" + num + ".disabled = false;")
		eval("hiddenformz.reduce_risk2_" + num + ".disabled = false;")
		eval("hiddenformz.todo2_1_" + num + ".disabled = false;")
		eval("hiddenformz.todo2_2_" + num + ".disabled = false;")
		}//end of else
	}//end of en_disable


function uncheckothers(num, num2)
	{
	for (var x = 1; x < 13; x++)
		eval("hiddenformz.checkbox" + x + "_" + num + ".checked = false");

	eval("hiddenformz.checkbox" + num2 + "_" + num + ".checked = true");
	}//end of uncheckothers


function getwidth()
	{
	if (navigator.appName.indexOf("Microsoft")!=-1)
		winW = document.body.offsetWidth-20;
	else
		winW = window.innerWidth-16;
	return winW;
	}//end of getwidth


function getheight()
	{
	if (navigator.appName.indexOf("Microsoft")!=-1)
		winH = document.body.offsetHeight-20;
	else
		winH = window.innerHeight-16;
	return winH;
	}//end of getheight


function getoffsetx(divsize)
	{
	w = (getwidth() / 2) - (divsize / 2);
	return w;
	}//end of getoffsetx


function getoffsetY(divsize, adj, evt)
	{
	h = (getheight() / 2) - (evt.clientY / 2) + adj;

	if (document.all)
		h = h + 40;

	return h;
	}//end of getoffsety


function getoffsetx2(divsize)
	{
	w = (getwidth() / 2) - (divsize / 2) - 15;

	if (document.all)
		w = w + 13;

	return w;
	}//end of getoffsetx2


function getoffsetY2(offy)
	{
	var y, h;

	var top = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);

	if (self.innerHeight) // all except Explorer
		y = self.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight)
		y = document.documentElement.clientHeight;
	else if (document.body) // other Explorers
		y = document.body.clientHeight;

	if (offy == 1)
		h = top;
	else
		{
		if (h > y)
			h = top;
		else
			{
			if (y > 449)
				h = top + Math.round((y - 450) / 2);
			else
				h = top;
			}//end of else
		}//end of else

	return h + 90;
	}//end of getoffsety2



function getoffsetY3(offy)
	{
	var y, h;

	var top = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);

	if (self.innerHeight) // all except Explorer
		y = self.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight)
		y = document.documentElement.clientHeight;
	else if (document.body) // other Explorers
		y = document.body.clientHeight;

	if (offy == 1)
		h = top;
	else
		{
		if (h > y)
			h = top;
		else
			{
			if (y > 449)
				h = top + Math.round((y - 450) / 2);
			else
				h = top;
			}//end of else
		}//end of else

	return h + 200;
	}//end of getoffsety3


function showhelp()
	{
	var xpos = getoffsetx2(300);
	var ypos = getoffsetY2(110) - 40;

	eval("document.getElementById('helpdiv').style.top='" + ypos + "px'");
	eval("document.getElementById('helpdiv').style.left='" + xpos + "px'");
	document.getElementById('helpdiv').style.display='block';
	}//end of showhelp


function hidehelp()
	{
	document.getElementById('helpdiv').style.display='none';
	}//end of hidehelp


function showmailme()
	{
	var xpos = getoffsetx2(300);
	var ypos = getoffsetY2(270) - 40;

	eval("document.getElementById('mailme').style.top='" + ypos + "px'");
	eval("document.getElementById('mailme').style.left='" + xpos + "px'");
	document.getElementById('mailme').style.display='block';
	}//end of showmailme


function hidemailme()
	{
	document.getElementById('mailme').style.display='none';
	}//end of hidemailme


function checkcomplete()
	{
	var complete = true;

	if (hiddensendmsg.memname.value == "")
		complete = false;
	else if (hiddensendmsg.mememail.value == "")
		complete = false;
	else if (hiddensendmsg.memmsg.value == "")
		complete = false;

	if (complete == true)
		document.hiddensendmsg.submit();
	else
		alert('Please complete the form before submitting it');
	}//end of checkcomplete


function submitgoals(num, num2, num3)
	{
	//check if all the values are completed
	var complete = true;
	var addedmsg = "";

	if (num == 1)
		{
		if (hiddenformz2.situation.value == "")
			{
			complete = false;
			addedmsg = addedmsg + "\nUltimate Performance Dreams Current Situation";
			}//end of if
		}//end of if

	if (num2 == 1)
		{
		if (hiddenformz2.ult_life1.value == "")
			{
			complete = false;
			addedmsg = addedmsg + "\nUltimate Performance Dreams Future Dream";
			}//end of if
		}//end of if

	if (hiddenformz2.longterm_target.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nLong Term Goals Question 1";
		}//end of if
	if (hiddenformz2.longterm_desc.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nLong Term Goals Question 2";
		}//end of if
	if (hiddenformz2.longterm_impt.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nLong Term Goals Question 3";
		}//end of if
	if (hiddenformz2.mediumterm_target.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nMedium Term Goals Question 1";
		}//end of if
	if (hiddenformz2.mediumterm_desc.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nMedium Term Goals Question 2";
		}//end of if
	if (hiddenformz2.mediumterm_impt.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nMedium Term Goals Question 3";
		}//end of if
	if (hiddenformz2.shortterm_target.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nShort Term Goals Question 1";
		}//end of if
	if (hiddenformz2.shortterm_desc.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nShort Term Goals Question 2";
		}//end of if
	if (hiddenformz2.shortterm_impt.value == "")
		{
		complete = false;
		addedmsg = addedmsg + "\nShort Term Goals Question 3";
		}//end of if

	if (complete == true)
		document.hiddenformz2.submit();
	else
		{
		if (num2 != 22)
			alert('Please answer all these fields before submitting your goals:\n' + addedmsg);
		else
			alert('Please answer all these fields before updating your goals:\n' + addedmsg);
		}//end of else
	}//end of function


function checkAdd()
	{
	var check = 1;
	var message = "There are errors in your inputs:\n";

	if (formx.fname.value == "")
		{
		check = 2;
		message = message + "\nThe First Name Cannot be Null";
		}//end of if

	if (formx.lname.value == "")
		{
		check = 2;
		message = message + "\nThe Last Name Cannot be Null";
		}//end of if

	if (formx.uname.value == "")
		{
		check = 2;
		message = message + "\nThe Username Cannot be Null";
		}//end of if

	if (formx.pass1.value == "")
		{
		check = 2;
		message = message + "\nThe Password Cannot be Null";
		}//end of if

	if (formx.pass2.value == "")
		{
		check = 2;
		message = message + "\nThe Confirm Password Cannot be Null";
		}//end of if

	if ((formx.pass2.value != "" && formx.pass1.value != "") && (formx.pass2.value != formx.pass1.value))
		{
		check = 2;
		message = message + "\nThe Passwords Did Not Match";
		}//end of if

	if (check == 2)
		alert (message);
	else if (check == 1)
		document.formx.submit();

	}//end of checkadd


function checkEdit()
	{
	var check = 1;
	var message = "There are errors in your inputs:\n";

	if (formx.fname.value == "")
		{
		check = 2;
		message = message + "\nThe First Name Cannot be Null";
		}//end of if

	if (formx.lname.value == "")
		{
		check = 2;
		message = message + "\nThe Last Name Cannot be Null";
		}//end of if

	if (formx.uname.value == "")
		{
		check = 2;
		message = message + "\nThe Username Cannot be Null";
		}//end of if

	if (formx.pass2.value != formx.pass1.value)
		{
		check = 2;
		message = message + "\nThe Passwords Did Not Match";
		}//end of if

	if (check == 2)
		alert (message);
	else if (check == 1)
		document.formx.submit();

	}//end of checkadd



function submitFormx4z(num)
	{
	var complete = true;

	/*
	for (count = 1; count < num; count++)
		{
		if (eval("hiddenformz.resolve" + count + ".checked") == false)
			{
			if (eval("hiddenformz.ifithappen1_" + count + ".value") == "")
				complete = false;
			else if (eval("hiddenformz.reduce_likely1_" + count + ".value") == "")
				complete = false;
			else if (eval("hiddenformz.reduce_risk1_" + count + ".value") == "")
				complete = false;
			else if (eval("hiddenformz.todo2_1_" + count + ".value") == "")
				complete = false;
			}//end of if
		}//end of for
	*/

	if (complete == true)
		document.hiddenformz.submit();
	else
		alert("Please complete this form before submitting it.");
	}//end of submitFormx4z


