var preloaded = false;

// Global defines

function shSteps(b, s)
{
	if (b.src.indexOf('images/showsteps.gif')>-1)
	{
		for (var i=1; i < s+1; i++)
		{
			document.getElementById("step" + i).src = "images/step0" + i + ".gif";
		}
		b.src = "images/hidesteps.gif";
	}
	else
	{
		for (var i=1; i < s+1; i++)
		{
			document.getElementById("step" + i).src = "images/spacer.gif";
		}
		b.src = "images/showsteps.gif";
	}
	return true;
}

function showwindowstatus(text)
{
	text = text.replace("\'", "\\\'")
	window.setTimeout("window.status=\'" + text + "\'", 10);
}

function getURLArgs()
{
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split("&");
	for (var i = 0; i < pairs.length; i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos==-1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
return args;
}

function isblank(s)
{
	for(var i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
	}
	return true;
}

function verify(f, msg)
{
	//var msg;
	var empty_fields = "";
	var errors = "";

	// Loop through the elements of the form, looking for all
	// text and textarea elements that don't have an "optional" property
	// defined. Then, check for fields that are empty and make a list of them.
	// Also, if any of these elements have a "min" or a "max" property defined,
	// then verify that they are numbers and that they are in the right range.
	// Put together error messages for fields that are wrong.
	for(var i = 0; i < f.length; i++)
	{
		var e = f.elements[i];
		if (((e.type == "text") || (e.type == "textarea")) && !e.optional)
		{
			// first check if the field is empty
			if ((e.value == null) || (e.value == "") || isblank(e.value))
			{
				empty_fields += "\n          " + e.name;
				continue;
			}

		// Now check for fields that are supposed to be numeric.
			if (e.numeric || (e.min != null) || (e.max != null))
			{
				var v = parseFloat(e.value);
				if (isNaN(v) || ((e.min != null) && (v < e.min)) || ((e.max != null) && (v > e.max)))
				{
					errors += "- The field " + e.name + " must be a number";
					if (e.min != null)
						errors += " that is greater than " + e.min;
					if (e.max != null && e.min != null)
						errors += " and less than " + e.max;
					else if (e.max != null)
						errors += " that is less than " + e.max;
					errors += ".\n";
				}
			}
		}
	}

	// Now, if there were any errors, display the messages, and
	// return false to prevent the form from being submitted.
	// Otherwise return true.
	if (!empty_fields && !errors) return true;
	alert(msg);
	return false;
}

function reloadPage(init)
{  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function OpenNewWindow(fyle, action)
{
	var wf = "";
	var w = (arguments[2] ? arguments[2] : 610);
	var h = (arguments[3] ? arguments[3] : 400);

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=no";
	wf = wf + ",scrollbars=no";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open(fyle,action,wf);
	return true;
}

function OpenHelper(fyle)
{
	var wf = "";
	var w = (arguments[1] ? arguments[1] : 300);
	var h = (arguments[2] ? arguments[2] : 200);

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open(fyle,'_blank',wf);
	return true;
}
function OpenCoach(cid)
{
	var wf = "";
	var w = 550;
	var h = 330;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ShowCoach.asp?cid=' + cid,'_blank',wf);
	return true;
}

function OpenCoachAdmin(cid)
{
	var coachtext =  escape(document.coachedit.CoachText.value);
	
	var wf = "";
	var w = 550;
	var h = 330;
	
	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	if (coachtext.length <= 2000) {
	
		window.open('../ShowCoachAdmin.asp?coachtext=' + coachtext,'_blank',wf);
		return true;
	}
	alert("Because the text is very long, this preview will display the most recently-saved data from the database.  If you have made any current changes, you will have to save the changes before viewing.");
	window.open('ShowCoach.asp?cid=' + cid,'_blank',wf);
	return true;
}

function OpenTakeaBreak(tbfyle)
{
	var wf = "";
	var w = 675;
	var h = 300;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('TakeaBreak.asp?tb=' + tbfyle,'_blank',wf);
	return true;
}

function OpenExample(expage)
{
	var wf = "";
	var w = 675;
	var h = 700;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ShowExamples.asp?expage=' + expage,'_blank',wf);
	return true;
}

function OpenExampleAdmin(expage)
{
	var extext =  escape(document.exampleedit.ExText.value);
	
	var wf = "";
	var w = 675;
	var h = 620;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	if (extext.length <= 2000) {
		window.open('../ShowExamplesAdmin.asp?extext=' + extext,'_blank',wf);
		return true;
	}
	previewexample();
<!---	alert("Because this text is very large, you must first save your changes before previewing.  If you have not saved your changes, they will not be reflected in this preview."); --->
<!---	window.open('ShowExamples.asp?expage=' + expage,'_blank',wf); --->
	return true;
}


function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function encodeMyHtml() {
    encodedHtml = escape(encodeHtml.htmlToEncode.value);
    encodedHtml = encodedHtml.replace(/\//g,"%2F");
    encodedHtml = encodedHtml.replace(/\?/g,"%3F");
    encodedHtml = encodedHtml.replace(/=/g,"%3D");
    encodedHtml = encodedHtml.replace(/&/g,"%26");
    encodedHtml = encodedHtml.replace(/@/g,"%40");
    encodeHtml.htmlEncoded.value = encodedHtml;
 } 

function ShowVDescription(vtype,vid)
{
	var wf = "";
	var w = 550;
	var h = 200;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ShowVDescription.asp?vtype=' + vtype + '&vid=' + vid,'_blank',wf);
	return true;
}

function OpenActivity(fyle)
{
	var wf = "";
	var w = (arguments[1] ? arguments[1] : 300);
	var h = (arguments[2] ? arguments[2] : 200);

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=yes";
	window.open(fyle,'_blank',wf);
	return true;
}

function OpenPage(PGID)
{
	var wf = "";
	var w = 675;
	var h = 620;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('../ShowPage.asp?PGID=' + PGID,'_blank',wf);
	return true;
}

function OpenPageText(PGID)
{
	var pgtext =  escape(document.pagedit.pageText.value);
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;
	
	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	if (pgtext.length <= 2000) {
		window.open('../ShowPageTextAdmin.asp?PGID=' + PGID + '&pgname=' + pgname + '&pgtype=' + pgtype + '&pgtext=' + pgtext,'_blank',wf);
		return true;
	}
	window.open('../ShowPageTextLarge.asp?PGID=' + PGID,'_blank',wf);
	return true;
}

function OpenPageTextSaved(PGID)
{
	var pgtext =  escape(document.pagedit.pageText.value);
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;
	
	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	window.open('../ShowPageText.asp?PGID=' + PGID,'_blank',wf);
	return true;
}

function OpenWhyText(PGID)
{
	var whyimportant =  escape(document.pagedit.WhyImportant.value);
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;
	
	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	if (whyimportant.length <= 2000) {
		window.open('../ShowWhyTextAdmin.asp?PGID=' + PGID + '&pgname=' + pgname + '&pgtype=' + pgtype + '&whyimportant=' + whyimportant,'_blank',wf);
		return true;
	}
	window.open('../ShowWhyTextLarge.asp?PGID=' + PGID,'_blank',wf);
	return true;
}

function OpenWhyTextSaved(PGID)
{
	var whyimportant =  escape(document.pagedit.WhyImportant.value);
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;
	
	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	window.open('../ShowWhyText.asp?PGID=' + PGID,'_blank',wf);
	return true;
}

function OpenPIText(PGID)
{
	var pageinstructions =  escape(document.pagedit.PageInstructions.value);
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;
	
	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	if (pageinstructions.length <= 2000) {
		window.open('../ShowPITextAdmin.asp?PGID=' + PGID + '&pgname=' + pgname + '&pgtype=' + pgtype + '&pageinstructions=' + pageinstructions,'_blank',wf);
		return true;
	}
	window.open('../ShowPITextLarge.asp?PGID=' + PGID,'_blank',wf);
	return true;
}

function OpenPITextSaved(PGID)
{
	var pageinstructions =  escape(document.pagedit.PageInstructions.value);
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;
	
	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	window.open('../ShowPIText.asp?PGID=' + PGID,'_blank',wf);
	return true;
}

function OpenASText(PGID, countas)
{
	var evalstate = "var hereshowtext = escape(document.pagedit.HeresHowText_" + countas + ".value);";
	eval(evalstate);
	
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	if (hereshowtext.length <= 2000) {

		window.open('../ShowASTextAdmin.asp?PGID=' + PGID + '&pgname=' + pgname + '&pgtype=' + pgtype + '&hereshowtext=' + hereshowtext + '&countas=' + countas,'_blank',wf);
		return true;
	}
	window.open('../ShowASTextLarge.asp?PGID=' + PGID + '&pgname=' + pgname + '&countas=' + countas,'_blank',wf);
	return true;
}

function OpenASTextSaved(PGID, countas)
{
	var evalstate = "var hereshowtext = escape(document.pagedit.HeresHowText_" + countas + ".value);";
	eval(evalstate);
	
	var pgname =  document.pagedit.PageName.value;
	var pgtype =  document.pagedit.PageType.value;
	
	var wf = "";
	var w = 675;
	var h = 620;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";

	window.open('../ShowASText.asp?PGID=' + PGID + '&pgname=' + pgname + '&countas=' + countas,'_blank',wf);
	return true;
}

function PageTurner()
{
	var tl = (arguments[1] ? arguments[1] : 15000);
	var thepage = (arguments[0] ? "location.href='" + arguments[0] + "'" : "history.back()");
	setTimeout(thepage,tl);
	return true;
}

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");

function getthedate()
{
	var mydate=new Date();
	var year=mydate.getYear();
	if (year < 1000) year+=1900;
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	if (daym<10) daym="0"+daym;
	var hours=mydate.getHours();
	var minutes=mydate.getMinutes();
	var seconds=mydate.getSeconds();
	var dn="AM";
	if (hours>=12) dn="PM";
	if (hours>12)
	{
		hours=hours-12;
	}
	if (hours==0) hours=12;
	if (minutes<=9) minutes="0"+minutes;
	if (seconds<=9) seconds="0"+seconds;
	//change font size here
	var cdate="<small><font color='blue' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn+"</b></font></small>";
	if (document.all)
	{
		document.all.clock.innerHTML=cdate;
	}
	else if (document.getElementById)
	{
		document.getElementById("clock").innerHTML=cdate;
	}
	else
	{
		document.write(cdate);
	}
}

if (!document.all&&!document.getElementById) getthedate();

function goforit()
{
	if (document.all||document.getElementById) setInterval("getthedate()",1000);
}

function checkotherbu(f, fld)
{
	var fldval = fld.value;
	switch(fldval){
		case "10" :
			if (fld.checked) {
				f.other.style.visibility = "visible";
				f.other.focus();
			}else{
				//f.other.style.visibility = "hidden";
			}
			break;
		case "16" :
			if (fld.checked) {
				f.other1.style.visibility = "visible";
				f.other1.focus();
			}else{
				//f.other1.style.visibility = "hidden";
			}
			break;
		case "17" :
			if (fld.checked) {
				f.other2.style.visibility = "visible";
				f.other2.focus();
			}else{
				//f.other2.style.visibility = "hidden";
			}
			break;
		case "18" :
			if (fld.checked) {
				f.other3.style.visibility = "visible";
				f.other3.focus();
			}else{
				//f.other3.style.visibility = "hidden";
			}
			break;
	}
}

function checkotherradio(f, grpName)
{
	var grp, rad, r = 0;
	grp = (typeof grpName == 'string') ? f[grpName] : grpName;
	while (rad = grp[r++]) if (rad.checked) {
		if (rad.value == 10){
			f.other.style.visibility = "visible"
		}else{
			//f.other.style.visibility = "hidden"
		}
	}
}

function checkpriorityhh(f)
	{
	var c1 = f.WGStrategy_Priority_1.value;
	var c2 = f.WGStrategy_Priority_2.value;
	var c3 = f.WGStrategy_Priority_3.value;
	var c4 = f.WGStrategy_Priority_4.value;
	var tp = parseInt(c1) + parseInt(c2) + parseInt(c3) + parseInt(c4);
	if ((c1 < 1 || c1 > 4) || (c2 < 1 || c2 > 4) || (c3 < 1 || c3 > 4) || (c4 < 1 || c4 > 4))
	{
			alert ("You must enter a Priority between 1 and 4.");
			return false;
	}
	if (tp==10)
	{
		return true;
	}
	else
	{
		alert("You must priotize each challenge from 1 (most important) to 4 (least important).");
		return false;
	}
	return false;
}
function checkpriorityhh_old(f,formname)
	{
	var msg;
	var priorno = f.value;
	var fname = f.name;
	var lno = fname.length - 1;
	var pno = fname.substr(lno, 1);
	var checkblank = priorno.length;
	if (checkblank > 0) {
		if (priorno < '1' || priorno > '4') {
			alert ("Please enter a Priority between 1 and 4.");
			f.value = "";
			return false;
		}else{
			switch (pno) {
				case "1" :
					if (formname.WGStrategy_Priority_2.value == priorno ||
						formname.WGStrategy_Priority_3.value == priorno ||
						formname.WGStrategy_Priority_4.value == priorno) {
						msg = "Priority " +  priorno + " has already been used.";
						alert (msg);
						f.value = "";
						return false;
					}
				break
				case "2" :
					if (formname.WGStrategy_Priority_1.value == priorno ||
						formname.WGStrategy_Priority_3.value == priorno ||
						formname.WGStrategy_Priority_4.value == priorno) {
						msg = "Priority " +  priorno + " has already been used.";
						alert (msg);
						f.value = "";
						return false;
					}
				break
				case "3" :
					if (formname.WGStrategy_Priority_1.value == priorno ||
						formname.WGStrategy_Priority_2.value == priorno ||
						formname.WGStrategy_Priority_4.value == priorno) {
						msg = "Priority " +  priorno + " has already been used.";
						alert (msg);
						f.value = "";
						return false;
					}
				break
				case "4" :
					if (formname.WGStrategy_Priority_1.value == priorno ||
						formname.WGStrategy_Priority_2.value == priorno ||
						formname.WGStrategy_Priority_3.value == priorno) {
						msg = "Priority " +  priorno + " has already been used.";
						alert (msg);
						f.value = "";
						return false;
					}
				break
				}
			}
		}
	}

function checkothertrend(f, formname, otherfield, e)
{
	e = document.getElementById(e);
	if(f.selectedIndex==10) {
		e.style.visibility='visible';
		eval('formname.' + otherfield + '.style.visibility = "visible";');
		eval('formname.' + otherfield + '.focus();');

	} else {
		e.style.visibility='hidden';
		eval('formname.' + otherfield + '.style.visibility = "hidden";');
	}
}

function checkothercomp(f, formname, otherfield, countcomps)
{
	if(f.selectedIndex==countcomps) {
		eval('formname.' + otherfield + '.style.visibility = "visible";');
		eval('formname.' + otherfield + '.focus();');

	} else {
		eval('formname.' + otherfield + '.style.visibility = "hidden";');
	}
}

function shpchart(b)
{
	//alert(b.value);
	if (b.value=="Hide")
	{
		document.getElementById("pchart").style.display="none";
		b.value = "Show";
	}
	else
	{
		document.getElementById("pchart").style.display="block";
		b.value = "Hide";
	}
}

function shwchart(b)
{
	if (b.value=="Hide")
	{
		document.getElementById("wchart").style.display="none";
		b.value = "Show";
	}
	else
	{
		document.getElementById("wchart").style.display="block";
		b.value = "Hide";
	}
}

function OpenPostingsTrends()
{
	alert('You must save your Industry Trends.  If you have not already done so, click "Save Your Results" when you return to this worksheet.');
	var wf = "";
	var w = 750;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('PostToEmployeesTrends.asp','_blank',wf);
	return true;
}

function ViewPostedTrends()
{
	var wf = "";
	var w = 650;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ViewPostedTrends.asp','_blank',wf);
	return true;
}

function OpenPostingsStrategy()
{
	alert('You must save your Business Strategies.  If you have not already done so, click "Save Your Results" when you return to this worksheet.');
	var wf = "";
	var w = 700;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('PostToEmployeesStrategy.asp','_blank',wf);
	return true;
}

function ViewPostedStrategy()
{
	var wf = "";
	var w = 650;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ViewPostedStrategy.asp','_blank',wf);
	return true;
}

function OpenPostingsBU()
{
	alert('You must save your Business Unit Challenges.  If you have not already done so, click "Save Your Results" when you return to this worksheet.');
	var wf = "";
	var w = 700;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('PostToEmployeesBU.asp','_blank',wf);
	return true;
}

function ViewPostedBU()
{
	var wf = "";
	var w = 650;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ViewPostedBU.asp','_blank',wf);
	return true;
}

function OpenPostingsWG()
{
	alert('You must save your Workgroup Challenges.  If you have not already done so, click "Save Your Results" when you return to this worksheet.');
	var wf = "";
	var w = 700;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('PostToEmployeesWG.asp','_blank',wf);
	return true;
}

function ViewPostedWG()
{
	var wf = "";
	var w = 650;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ViewPostedWG.asp','_blank',wf);
	return true;
}

function OpenPostingsComps()
{
	alert('You must save your Critical Competencies.  If you have not already done so, click "Save Your Results" when you return to this worksheet.');
	var wf = "";
	var w = 700;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('PostToEmployeesComps.asp','_blank',wf);
	return true;
}

function ViewPostedComps()
{
	var wf = "";
	var w = 650;
	var h = 625;

	var lp = (screen.width) ? (screen.width-w)/2 : 0;
	var tp = (screen.height) ? (screen.height-h)/2 : 0;
	wf = wf + "left=" + lp;
	wf = wf + ",top=" + tp;
	wf = wf + ",width=" + w;
	wf = wf + ",height=" + h;
	wf = wf + ",resizable=yes";
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	window.open('ViewPostedComps.asp','_blank',wf);
	return true;
}