/* 
Town of Hempstead Online (version 3.3)
Website by LaMa Media
Copyright (c) 1997-2008 - All rights reserved
*/


// ****************************************************************
// GLOBALS
// ****************************************************************

var vFormName, vFormPage, vNumFormPages;


// ****************************************************************
// SHOW FORM
// ****************************************************************

function fShowForm(rName, rWidth, rHeight, rAlt, rPages, rPDFSize) {
	var tGIF, tGIFPage;
	vFormName = rName;
	vFormPage = 1;
	vNumFormPages = 1;
	if (rPages != 1) {
		vFormPage = parseInt(fGetItem(rPages, 0, vDelim));
		vNumFormPages = parseInt(fGetItem(rPages, 1, vDelim));
	}
	document.open();
	if (!vOnline || vKiosk) {
		fFormContact();
	} else if (!vPrint) {
		if (typeof(rPDFSize) != 'undefined') {
			var tFile = (vPath + "media/forms/print/" + vArea + "/" + vFormName);
			fPDF("Click here to download a printable version of this form.", tFile, rPDFSize);
		} else {
			fFormContact();
		}
	}
	if (vNumFormPages > 1) fFormMultipage();
	tGIFPage = vFormPage;
	if (tGIFPage == 1) tGIFPage = "";
	tGIF = (vPath + "media/forms/sample/" + vArea + "/" + vFormName + tGIFPage + ".gif");
	document.write('<div align="center"><img src="' + tGIF + '" width="' + rWidth + '" height="' + rHeight + '" alt="' + rAlt + '" border="1"></div>');
	document.close();
}


// ****************************************************************
// FORM CONTACT
// ****************************************************************

function fFormContact() {
	document.write('<div align="center"><table align="center" class="boxtable-' + vArea + '" cellpadding="4" cellspacing="0" border="0">');
	document.write('<tr align="center" valign="middle"><td class="note-' + vArea + '">Contact ');
	if (vArea == "bz") {
		document.write('the <a href="' + vPath + 'content/bz/permits.html">Building Department</a> ');
	} else if (vArea == "rc") {
		document.write('the <a href="' + vPath + 'content/rc/conservation.html">Department of Conservation &amp; Waterways</a><br>');
	} else if (vArea == "tc") {
		document.write('the <a href="' + vPath + 'content/tc/tcoverview.html">Town Clerk\'s Office</a> ');
	} else {
		document.write('<a href="' + vPath + 'content/home/contact.html">Town Hall</a> ');
	}
	document.write('for a copy of this form.</td></tr></table></div><br>');
}


// ****************************************************************
// FORM MULTIPAGE
// ****************************************************************

function fFormMultipage() {
	fButtonPath("all/" + vArea + "_b_");
	fNewButton(91, "Previous", "prev", 15, 26, "javascript:fFormPage(-1)", 1);
	fNewButton(92, "Next", "next", 15, 26, "javascript:fFormPage(1)", 1);
	document.write('<div align="center"><table width="150" align="center" cellpadding="0" cellspacing="0" border="0"><tr valign="middle"><td align="left">');
	fShowButton(91);
	document.write('</td><td class="note-' + vArea + '" align="center">Page ' + vFormPage + ' of ' + vNumFormPages + '</td><td align="right">');
	fShowButton(92);
	document.write('</td></tr></table></div><br>');
}


// ****************************************************************
// FORM PAGE
// ****************************************************************

function fFormPage(rPrevNext) {
	var tPageNum = "";
	vFormPage += rPrevNext;
	if (vFormPage < 1) vFormPage = vNumFormPages;
	if (vFormPage > vNumFormPages) vFormPage = 1;
	if (vFormPage != 1) tPageNum = vFormPage;
	if (vPrint) {
		window.top.pageFrame.location.href = (vFormName + tPageNum + ".html");
	} else {
		window.top.location.href = (vFormName + tPageNum + ".html");
	}
}


