(function() {
	var fontFamily = 'Arial,sans-serif', fontSize = '16', fontUnits = 'px';
	function e( id ) { 
		return document.getElementById('Poll411'+id); }
	var label = e('Label'), input = e('Input'), button = e('Button'), frame = e('Frame'), select = e('SelectState');
	var example = "Ex: 1600 Pennsylvania Ave 20500";
	input.value = example;
	Poll411 = {
		focus: function() {
			if( input.value == example ) {
				input.className = '';
				input.value = '';
			}
		},
		blur: function() {
			if( input.value ==  ''  ||  input.value == example ) {
				input.className = 'example';
				input.value = example;
			}
		},
		select: function() {
			var state = select.value;
			var popURL = ['http://www.gmodules.com/ig/ifr?url=http://election-gadgets.appspot.com/voter-info-gadget.xml&amp;synd=open&amp;up_sidebar=true&amp;up_state=', encodeURIComponent(state), '&amp;up_fontFamily=', encodeURIComponent(fontFamily), '&amp;up_fontSize=', fontSize, '&amp;up_fontUnits=', fontUnits, '&amp;up_submit=0'].join('');
			$.prettyPhoto.open(popURL+'&iframe=true&width=750&height=500');
			//$.prettyPhoto.open("http://"+state+".electionland.com");
			return false;
		},
		submit: function() {
			var addr = input.value;
			if( addr == example ) addr = addr.replace( /^.*: /, '' );
			var popURL = ['http://www.gmodules.com/ig/ifr?url=http://election-gadgets.appspot.com/voter-info-gadget.xml&amp;synd=open&amp;up_sidebar=true&amp;up_address=', encodeURIComponent(addr), '&amp;up_fontFamily=', encodeURIComponent(fontFamily), '&amp;up_fontSize=', fontSize, '&amp;up_fontUnits=', fontUnits, '&amp;up_submit=1'].join('');
			$.prettyPhoto.open(popURL+'&iframe=true&width=750&height=500');
			return false;
		}
	};
})();
