function showLogin(isTop) {
	hideWizard();
	Bw = document.getElementsByTagName("body")[0].offsetWidth;
	Bh = document.getElementsByTagName("body")[0].offsetHeight + document.getElementsByTagName("body")[0].scrollTop;
	if (isTop) {
		L = (Bw - 250) / 2;
		gEl("loginFrm").style.left = L;
		gEl("loginFrm").style.top = 15;
		gEl("loginFrm").style.backgroundColor = "transparent";
		gEl("loginFrm").style.border = "none";
		gEl("loginHD").style.display = "none";
	}
	else {
		L = (Bw - 310);
		gEl("loginFrm").style.left = L;
		gEl("loginFrm").style.top = Bh - 220;
		gEl("loginFrm").style.backgroundColor = "#CECECE";
		gEl("loginFrm").style.border = "#215a7b 1px solid";
		gEl("loginHD").style.display = "inline";
	}
	gEl("loginFrm").style.visibility = "visible"; 
	//gEl("loginFrmBack").style.left = L + 5;
	//gEl("loginFrmBack").style.height = (gEl("loginFrm").offsetHeight);
	//gEl("loginFrmBack").style.visibility = "visible";
	document.loginForm.uname.focus();
}
function hideLogin() {
	gEl("loginFrmBack").style.visibility = "hidden";
	gEl("loginFrm").style.visibility = "hidden"; 
}
var selTR = null;
function checkOption(id) {
	if (selTR && gEl("tr_" + selTR).className == "selTD") {
		gEl("tr_" + selTR).className = "mout";
	}
	selTR = id;
	gEl("ptID_" + id).checked = true;
	gEl("tr_" + id).className = "selTD";
	showSelected(id);
}
function showSelected(id) {
	document.pckgForm.packageTypeID.value = id;
	tbl = gEl("tblOptions");
	ri = gEl("tr_" + id).rowIndex;
	selPckg = tbl.rows[ri].cells[0].innerHTML + " - " + tbl.rows[ri].cells[7].innerHTML;
	while (tbl.rows[ri].cells[0].colSpan < 9) {
		ri -= 1;
	}
	gEl("selPackageTD").innerHTML = tbl.rows[ri].cells[0].innerHTML + " - " + selPckg;
}
function showWizard() {
	hideLogin();
	if (isIE) {
		document.innerFrame.src = "about:blank";
	}
	else {
		frames["innerFrame"].src = "about:blank";
	}
	Bw = (isIE)? document.body.offsetWidth:window.innerWidth;
	L = (Bw - 610) / 2;
	gEl("innerFrmBack").style.left = L + 5;
	gEl("innerFrmBack").style.top = document.body.scrollTop + 105;
	gEl("innerFrmBack").style.visibility = "visible";
	gEl("innerFrame").style.left = L;
	gEl("innerFrame").style.top = document.body.scrollTop + 100;
	gEl("innerFrame").style.visibility = "visible";
}
function hideWizard() {
	gEl("innerFrmBack").style.visibility = "hidden";
	gEl("innerFrame").style.visibility = "hidden";
}
function showPackages(ari) {
	if (tbl.rows.length-1 < ari || tbl.rows[ari].cells[0].colSpan == 10) {
		currOpt = newOpt;
		return true;
	}
	else {
		tbl.rows[ari].className = "trShow";
		if (tbl.rows[ari].id == "tr_" + selTR) {
			tbl.rows[ari].className = "selTD";
		}
		ari++;
		setTimeout("showPackages(" + ari + ")",10);
	}
}
function hidePackages(rri) {
	if (tbl.rows.length-1 < rri || tbl.rows[rri].cells[0].colSpan == 10) {
		ari = newOpt[PN][PN].rowIndex + 2;
		setTimeout("showPackages(" + ari + ")",10);
	}
	else {
		tbl.rows[rri].className = "trHdn";
		rri++;
		setTimeout("hidePackages(" + rri + ")",10);
	}
}
var frms = "This is the maximum number of Request Forms you are permitted.";
var ufrms = "This is the maximum number of Update Forms you are permitted.";
var rprts = "This is the maximum number of Reports you can define";
var usrs = "This is the maximum number of users you can set-up";
var rqsts = "This is the maximum number of requests (ie. how many times your form can be completed by your users).";
var inpts = "This is the maximum number of inputs (questions) allowed on your form";
var NA = "Not Applicable - This limitation does not apply";
var Unlim = "This package is not limited for ";
var Calc = "The total cost of this package is calculated based on the number of forms, reports and users you create.";
function showInfo(obj, lnk, txt) {
	gEl("helper").innerHTML = obj;
	if (txt) {
		gEl("helper").innerHTML += txt;
	}
	T = event.clientY - event.offsetY - gEl("helper").offsetHeight;
	L = (event.clientX - event.offsetX) - 120;
	gEl("helper").style.top = T;
	gEl("helper").style.left = L;
	gEl("helper").style.visibility = "visible";
}
function hideInfo() {
	gEl("helper").style.visibility = "hidden";
}
function checkChangePwd(frm) {
	if (frm.upwd_old.value.length == 0) {
		alert("Please enter your old password");
		frm.upwd_old.focus();
		return false;
	}
	if (frm.upwd_new1.value.length == 0) {
		alert("Please enter your new password");
		frm.upwd_new1.focus();
		return false;
	}
	if (frm.upwd_new2.value.length == 0) {
		alert("Please enter your new confirmation password");
		frm.upwd_new2.focus();
		return false;
	}
	if (frm.upwd_new2.value != frm.upwd_new1.value) {
		alert("Please enter your new password and confirmation password do not match.\nPlease ensure they are the same.");
		frm.upwd_new2.focus();
		frm.upwd_new2.select();
		return false;
	}
	return true;
}
function checkUname(frm) {
	if (frm.uname.value.length == 0) {
		alert("Please enter your email address");
		frm.uname.focus();
		return false;
	}
	frm.act.value = "forgotPwd";
	return true;
}
function checkHomeFrom(btnVal) {
	frm = document.forms[0];
	if (btnVal == "Sign Me Up!" || btnVal == "Open an Account") {
		return checkRegisterForm(frm);
	}
	else {
		return checkEmailForm(frm);
	}
}
function checkRegisterForm(frm) {
	frm.target = "_top";
	frm.action = "/owf/register.asp";
	return checkFormFields(["orgContactName","orgContactEmail","packageTypeID","entryCode"],frm,true);
}
function checkEmailForm(frm) {
	frm.target = "innerFrame";
	frm.action = "emailContact.asp";
	return checkFormFields(["yrName","yrEmail","sbjct","msg"],frm,false);
}
function checkFormFields(flds, frm, isRegister) {
	var msg = "Please provide details for the following fields:\n\n";
	var canSave = true;
	for (var i=0; i<flds.length; i++) {
		if (frm[flds[i]].value.length == 0) {
			msg += ("\t" + document.getElementById("lbl" + frm[flds[i]].name).innerHTML + "\n");
			canSave = false;
		}
	}
	if (isRegister) {
		if (frm.entryCode.value.length > 0 && frm.entryCode.value != frm.srvrEntryCode.value) {
			msg += ("\nThe letters/numbers presented in the image do not match your input.\n");
			canSave = false;
		}
		/*
		if (frm.voucher.value.length > 0) {
			if (frm.voucherVerified.value == "") {
				msg += ("\nPlease Verify your Voucher Code.\n");
				canSave = false;
			}
			else if (frm.voucherVerified.value == "0") {
				msg += ("\nYour Voucher Code is not valid.\n");
				canSave = false;
			}
		}
		*/
		if (!frm.tandc.checked) {
			msg += ("\nPlease indicate that you have read the Terms and Conditions");
			canSave = false;
		}
	}
	if (!canSave) {
		alert(msg);
	}
	return canSave;
}
var currPckgID = null;
function moutPackage(td) {
	ci = td.cellIndex;
	ri = td[PN].rowIndex;
	tbl = gEl("prodTbl");
	tbl.rows[ri].cells[0].className = "thHead";
	for (o=1; o<=ri; o++) {
		if (tbl.rows[o].cells[ci]) {
			if (tbl.rows[o].cells[ci] != currPckgID) {
				tbl.rows[o].cells[ci].className = "homeTDc";
			}
		}
	}
	for (o=1; o<ci; o++) {
		if (tbl.rows[ri].cells[o] != currPckgID) {
			tbl.rows[ri].cells[o].className = "homeTDc";
		}
	}
}
function moverPackage(td) {
	ci = td.cellIndex;
	ri = td[PN].rowIndex;
	tbl = gEl("prodTbl");
	tbl.rows[ri].cells[0].className = "thHeadHome";
	for (o=1; o<=ri; o++) {
		if (tbl.rows[o].cells[ci]) {
			if (tbl.rows[o].cells[ci] != currPckgID) {
				tbl.rows[o].cells[ci].className = (o == ri)? "moverHome":"moverHomeLft";
			}
		}
	}
	for (o=1; o<ci; o++) {
		if (tbl.rows[ri].cells[o] != currPckgID) {
			tbl.rows[ri].cells[o].className = "moverHomeLft";
		}
	}
}
function moverPackageLimit(td) {
	ci = td.cellIndex;
	ri = td[PN].rowIndex;
	tbl = gEl("prodTbl");
	tbl.rows[ri].cells[0].className = "thHeadHome";
	for (o=2; o<=ri; o++) {
		if (tbl.rows[o].cells[ci]) {
			if (tbl.rows[o].cells[ci] != currPckgID) {
				tbl.rows[o].cells[ci].className = "moverHomeLft";
			}
		}
	}
	for (o=1; o<ci; o++) {
		if (tbl.rows[ri].cells[o] != currPckgID) {
			tbl.rows[ri].cells[o].className = "moverHomeLft";
		}
	}
}
function highlightPackage(th) {
	moverTRHome(th[PN]);
}
function lowlightPackage(th) {
	moutTRHome(th[PN]);
}
function moverTRHome(tr) {
	tr.className = "mover";
}
function moutTRHome(tr) {
	tr.className = "mout";
}
function resizeHomeDiv() {
}
function showReg(evnt) {
	if (gEl("regRow").style.display == "none") {
		gEl("regRow").style.display = "block";
		gEl("registerDivBack").style.left = gEl("regDiv").offsetLeft;
		gEl("registerDivBack").style.height = gEl("regDiv").offsetHeight - 90;
		gEl("registerDivBack").style.width = gEl("regDiv").offsetWidth - 20;
		gEl("registerDivBack").style.display = "block";
	}
	else {
		gEl("regRow").style.display = "none";
		gEl("registerDivBack").style.display = "none";
	}
}
var imgB = null;
var arrowI = null;
var flowBox = null;
function showLC(txtObj, x1, y1, x2, y2, img) {
	if (!imgB) {
		imgB = gEl("imgBox");
		arrowI = gEl("arrowImage");
		flowBox = gEl("LCDiv");
	}
	flowBox.innerHTML = gEl(txtObj).innerHTML;
	flowBox.style.textAlign = "left";
	flowBox.style.width = "200";
	BL = gEl(img).offsetLeft + 5;
	BT = gEl(img).offsetTop + 5;
	if (isIE) {
		imgB.style.left = x1 + BL; 
		imgB.style.top = y1 + BT;
		imgB.style.width = x2 - x1;
		imgB.style.height = y2 - y1;
		imgB.style.display = "block";
	}
	arrowI.style.left = x1 + ((x2-x1) / 2) + BL;
	arrowI.style.top = y1 + ((y2-y1) / 2) + BT - 20;
	arrowI.style.display = "block";
	flowBox.style.display = "block";
	flowBox.style.left = x1 + ((x2-x1) / 2) + BL + 20;
	flowBox.style.top = y1 + ((y2-y1) / 2) + BT - 20 - flowBox.offsetHeight;
	//if (document.getElementsByTagName("body")[0].offsetWidth - flowBox.offsetLeft < 180) {
	//	flowBox.style.width = document.getElementsByTagName("body")[0].offsetWidth - flowBox.offsetLeft - 50;
	//}
	//else {
	//	flowBox.style.width = "200";
	//}
}
function hideLC() {
	//imgB.style.display = "none";
	//arrowI.style.display = "none";
	//flowBox.style.display = "none";
}
function getCodeValue() {
	/*
	var head = document.getElementsByTagName("head")[0];
	script = document.createElement("script");
	script.type = "text/javascript";
	script.src = dynamicImageURL + "netComp.aspx";
	head.appendChild(script);
	*/
	makeRequest("/owf/netComp.aspx?c=" + Math.random(),"cookieLoaded");
}
function cookieLoaded(entryCode) {
	document.forms[0].srvrEntryCode.value = entryCode;
}
function checkKeyForm(frm) {
	if (frm.orgKey.value.length == 0) {
		alert("Please enter your registration key");
		frm.orgKey.focus();
		return false;
	}
	return true;

}
function showPayMsg(sel) {
	prod = sel.options[sel.selectedIndex].text;
	prod = (prod.indexOf("(") > -1)? prod.substring(0, prod.indexOf("(")):prod;
	msg = (sel.selectedIndex == 0)? "The Gatherer FREE product allows<br>90 days FREE access.":"The " + prod + " product allows<br>30 days FREE, no obligation, access";
	gEl("payMsg").innerHTML = msg;
}
var faqWin = null;
function showFaqPop(url) {
	if (faqWin && !faqWin.closed) {
		faqWin.close();
	}
	faqWin = window.open(url,'faqWin','target=faqWin,width=500,height=400,scrollbars=1'); 
	return false;
}
function moverImg(img) {
	img.src = img.src.toString().replace("Off","Mo");
}
function moutImg(img) {
	img.src = img.src.toString().replace("Mo","Off");
}
function showInnerFrame(lnk) {
	hrf = lnk.href;
	bdy = document.getElementsByTagName("body")[0];
	W = (hrf.indexOf("contact.asp") > -1)? 510:(hrf.indexOf("flow.asp") > -1)? 830:800;
	H = (600 > bdy.offsetHeight - 70)? bdy.offsetHeight - 70:600;
	St = bdy.scrollTop;
	gEl("innerFrame").style.width = W;
	gEl("innerFrame").style.height = H;
	gEl("innerFrame").style.top = St + 10;
	gEl("innerFrame").style.left = (bdy.offsetWidth - W) / 2;
	gEl("innerFrame").style.visibility = "visible";
}
function moverHomeBtn(img) {
	fle = img.src.substring(0, img.src.indexOf(".gif"));
	img.src = fle + "_mo.gif";
}
function moutHomeBtn(img) {
	fle = img.src.substring(0, img.src.indexOf("_mo.gif"));
	img.src = fle + ".gif";
}
function showStep(sNo) {
	bdy = document.getElementsByTagName("body")[0];
	Bw = bdy.offsetWidth - 280;
	Bh = bdy.offsetHeight;
	if (!isIE) {
		Bh = window.innerHeight;
	}
	sT = bdy.scrollTop;
	if (sNo > 0 && sNo < 9) {
		gEl("stepTxt").innerHTML = "Step " + sNo;
		gEl("stepFrame").style.height = 450;
	}
	else if (sNo == 0) {
		gEl("stepFrame").style.height = 70;
		gEl("stepTxt").innerHTML = "Oops, Sorry!";
	}
	else {
		gEl("stepFrame").style.height = 480;
		gEl("stepTxt").innerHTML = "Welcome to QuickForm <sup>&copy;</sup>";
	}
	gEl("stepBack").style.display = (isIE)? "inline":"block";
	gEl("stepBox").style.display = (isIE)? "inline":"block";
	gEl("stepBack").style.height = document.getElementsByTagName("body")[0].scrollHeight;
	gEl("stepBox").style.top = ((Bh - gEl("stepBox").offsetHeight) / 2) + sT;
	gEl("stepBox").style.left = ((Bw - gEl("stepBox").offsetWidth) / 2 > 0)? (Bw - gEl("stepBox").offsetWidth) / 2:10;
	lnks = "";
	if (sNo > 0 && sNo < 9) {
		if (sNo > 1) {
			lnks += "<a href=\"javascript:void(0)\" onclick=\"showStep(" + (sNo - 1) + ")\">Previous Step</a> | ";	
		}
		if (sNo < 6) {
			lnks += "<a href=\"javascript:void(0)\" onclick=\"showStep(" + (sNo + 1) + ")\">Next Step</a> | ";	
		}
	}
	gEl("lnkTD").innerHTML = lnks + "<a href=\"javascript:void(0)\" onclick=\"hideStep()\">Close</a>";	
	window.open("/owf/showStep.asp?step=" + sNo, "stepFrame", "target=stepFrame");
	return false;
}
function hideStep() {
	gEl("stepBox").style.display = "none";
	gEl("stepBack").style.display = "none";
}