﻿function revealModal(divID) {
	window.onscroll = function() { document.getElementById(divID).style.top = document.body.scrollTop; };
	document.getElementById(divID).style.display = "block";
	document.getElementById(divID).style.top = document.body.scrollTop;
}

function hideModal(divID) {
	document.getElementById(divID).style.display = "none";
}

function OnKeyPress(args) {
	if (args.keyCode == Sys.UI.Key.esc) {
		$find("ModalPopupExtender1").hide();
	}
}

function textCounter(field, countfield, maxlimit) {
/*
* The input parameters are: the field name;
* field that holds the number of characters remaining;
* the max. numb. of characters.
*/
if (field.value.length > maxlimit) // if the current length is more than allowed
field.value =field.value.substring(0, maxlimit); // don't allow further input
else
countfield.InnerHTML = maxlimit - field.value.length;} // set the display field to remaining number
