function filterChr(str, id, redo) {
	if (document.getElementById(id).value.length == 0 || redo) {
		re = /\$|,|@|#|~|`|\%|\\|\*|\^|\&|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\/|\!|\$|\./g;
		str = str.replace(re, "");
		str = str.replace(/\s+/g, "_");
		document.getElementById(id).value = str;
	}
}

function countDown(control, maxLen, counter, typeName) {
	var len = control.value.length;
	var txt = control.value;
	var span = document.getElementById(counter);
	span.style.display = '';
	span.innerHTML = (maxLen - len) + ' characters remaining';
	if (len >= (maxLen - 10)) {
		span.style.color = 'red';
		if (len > maxLen) {
			//alert(txt.substring(0, maxLen));
			control.innerHTML = txt.substring(0, maxLen);
			span.innerHTML = (maxLen - control.value.length) + ' characters remaining';
			alert(typeName + ' text exceeds the maximum allowed!');
		}
	} else {
		span.style.color = '';
	}
}
function setAction(id) {
	SetTarget();
	document.getElementById('UcLiveForm1_hdnType').value = 'selectionChanged';
	document.getElementById('UcLiveForm1_hdnPid').value = id;
}

function SetTarget(id) {
	document.getElementById(id).value = document.body.scrollTop;
}
function GoToTarget(id) {
	if (document.getElementById(id).value != '') {
		document.body.scrollTop = document.getElementById(id).value;
		document.getElementById(id).value = '';
	}
}
function ShowImage(url, w, h){
	//var w = 350;
	//var h = 150;
	var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var sFeatures = "height=" + h + ",width=" + w + ",left=" + LeftPosition + ",top=" + TopPosition + ",status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes"
	var win = window.open(url, "_form", sFeatures);
	if (win != null) { win.focus() }
	return false
}