﻿function doRegisterPopup(){window.open('popup-SignUpForUpdates.aspx','signup','height=550,width=550,resizable=1,status=1');}
function go(ddlThis) {if (ddlThis.selectedIndex > 0) {location = ddlThis.options[ddlThis.selectedIndex].value;}}

String.prototype.capitalize = function(){
	var s = this.replace(/\S+/g, function(a){return a.charAt(0).toUpperCase() + a.slice(1).toLowerCase();});
	if (s.indexOf("'") > 0) {var i = s.indexOf("'")+1;s = s.slice(0,i) + s.charAt(i++).toUpperCase() + s.slice(i);}
	if (s.match(/[ ]?Mc\w|^Mc\w/)) {var i = s.indexOf('Mc')+2;s = s.slice(0,i) + s.charAt(i++).toUpperCase() + s.slice(i);}
	return s;
};
	
var bCheckedFName = false;
var bCheckedLName = false

// this will only correct casing once per page load cycle
function setProperCase(id,x) {
	if (((x == 0) && (!bCheckedFName)) || ((x == 1) && (!bCheckedLName))) {
	//if (!bChecked) {
		var input = document.getElementById(id);
		var t = input.value;
		if ((t.toUpperCase() == t) || (t.toLowerCase() == t)) {input.value = t.capitalize().replace(/ And /,' and ');}
		
		if (x == 0) {bCheckedFName = true;}
		else {bCheckedLName = true;}
		//bChecked = true;
	}
}

function joinTeleTownHall() {
	window.open('JoinTeleTownHall.aspx','teleTownHall','status=1,resizable=1,width=460,height=320');
}
