function getEvents( url ) {
    var ajaxObj = new RDAjax( 'GET' );

    // Get the events from google 
    try { 
    	ajaxObj.submitRequest( url, false );
    } catch( e ) { 
        alert( e.message );
        exit();
    }
    
    var listElem = RDJ.$( 'prUpcomingEventsList' );
    while( listElem.hasChildNodes() ) { listElem.removeChild( listElem.lastChild ); }
    var node = ajaxObj.response().documentElement;
    var items = node.getElementsByTagName( 'entry' );
    if( items.length == 0 ) {
        //alert( 'no events found' );
    } else
    	for( var i = 0; ( i < items.length && i < 4 ); i++ )
        	addItem( listElem, items[ i ] );
        
}

function addItem( list, entry ) {
    var ajaxObj = new RDAjax( 'GET' );
    var gd = 'http://schemas.google.com/g/2005';
    
    var item = RDJ.createElement( 'li' );
    
    // Set up the information link
    var link = RDJ.createElement( 'a' );
    link.setAttribute( 'href', entry.getElementsByTagName( 'link' ).item( 0 ).attributes.getNamedItem( 'href' ).value );
    link.setAttribute( 'target', '_blank' );

    var content = entry.getElementsByTagName( 'content' ).item( 0 ).firstChild.data;
    content = content.match( /When: (.*!?)/ )
    content = content[ 0 ].split( /\s/g );

    var title = RDJ.createElement( 'strong' );
    title.appendChild( document.createTextNode( entry.getElementsByTagName( 'title' ).item( 0 ).firstChild.data ) );
    link.appendChild( title );

    var p = RDJ.createElement( 'p' );
    p.appendChild( link );
    p.appendChild( RDJ.createElement( 'br' ) );
    p.appendChild( document.createTextNode( content[ 1 ] + ' ' + content[ 2 ] + ' ' + content[ 3 ] + ' ' + content[ 4 ] + ' ' + content[ 5 ] + '-' + content[ 7 ]  ) );
    item.appendChild( p );
   
    list.appendChild( item );
}

function moviePlay( mov, div ) {
    if( div == 'undefined' || div == '' ) div = 'moviePlayer';

    // Remove anything that may currently be in the moviePlayer frame
    var moviePlayer = RDJ.$( div );
    RDRemoveElementChildren( div );

    var url = 'http://peakrewards.bgesmartenergy.com/media/pr/MoviePlayer.swf';

    var vars = {'src':mov};
    var params =  { loop:'false', quality:'high', wmode:'transparent', allowScriptAccess:'sameDomain', swliveconnect:'true', play:'true', scale:'showall', menu:'true', base:'http://peakrewards.bgesmartenergy.com/media/pr/' }; //
    var attr = { id:div, name:div}; // , style:'display:block;' , type:'application/x-shockwave-flash'

    swfobject.embedSWF( url, div, 210, 162, '9.0.0', 'http://www.bgesmartenergy.com/media/expressInstall.swf', vars, params, attr );
}

function swfPlay( mov, div, width, height ) {
    if( div == 'undefined' || div == '' ) div = 'moviePlayer';
    if( width == 'undefined' || width == '' ) width = '100%';
    if( height == 'undefined' || height == '' ) height = '100%';

    // Remove anything that may currently be in the moviePlayer frame
    var moviePlayer = RDJ.$( div );
    RDRemoveElementChildren( div );

    var url = 'http://peakrewards.bgesmartenergy.com/media/pr/' + mov;
    var vars = {};
    var params =  { loop:'false', quality:'high', wmode:'transparent', allowScriptAccess:'sameDomain', swliveconnect:'true', play:'true', scale:'showall', menu:'true', base:'http://peakrewards.bgesmartenergy.com/media/pr/' };
    var attr = { id:div, name:div };

    swfobject.embedSWF( url, div, width, height, '9.0.0', 'http://www.bgesmartenergy.com/media/expressInstall.swf', vars, params, attr );
}

function openWindow( url, fullscreen, w, h ) {
var opts = '';

if( w != undefined ) opts += 'width=' + w;
if( h != undefined ) opts += ',height=' + h;


if( fullscreen == true ) opts += ',fullscreen=true';
window.open( url, '', opts );
}

<!-- BUBBLES -->
function openBubble( divId ) { RDJ.$( divId + 'One' ).style.display = 'none'; RDJ.$( divId + 'Two' ).style.display = 'block'; }
function closeBubble( divId ) { RDJ.$( divId + 'Two' ).style.display = 'none'; RDJ.$( divId + 'One' ).style.display = 'block';  }
//function openBubble( divId ) { RDJ.$( divId + 'One' ).style.display = 'none'; RDJ.$( divId + 'Two' ).style.display = 'block';  RDCorrectPNG();}
//function closeBubble( divId ) { RDJ.$( divId + 'Two' ).style.display = 'none'; RDJ.$( divId + 'One' ).style.display = 'block'; RDCorrectPNG(); }

function toggleBubble( divId ) {
RDJ.toggleDisplay( divId + '-0' );
RDJ.toggleDisplay( divId + '-1' );
}

var idx = 0;
function rotateBubbles() {
	var bubbles = new Array( 'bubble-enrollment-chart','bubble-heatpump', 'bubble-educational-video', 'bubble-online-access' );	
	var div = RDJ.$( bubbles[ idx % bubbles.length ] );
	div.style.display = 'none';
	
	idx = idx + 1;
	
	var div = RDJ.$( bubbles[ idx % bubbles.length ] );
	div.style.display = 'block';
		
	setTimeout( "rotateBubbles()", 5000 );
}

<!-- Calendar -->
var cal = 0;
function calendarBubble() {
	cal = new RDCalendar( 'creditCalendar', 'cal', false );
	
	cal.selectorFunction = function() {
		RDJ.$( 'creditCalendarText' ).style.display = 'block';
		
		var sd = new Date(); sd.setFullYear( cal.selectorForm.chooseYear.options[ cal.selectorForm.chooseYear.selectedIndex ].text, cal.selectorForm.chooseMonth.selectedIndex, cal.selectedDate );
		RDJ.$( 'creditCalendarDate0' ).innerHTML = cal.selectorForm.chooseMonth.options[ sd.getMonth() ].text + ' ' + sd.getDate() + ', ' + sd.getFullYear();
		sd = RDIncrementDate( sd, -3, 'day' );
		if( sd.getDay() == 0 ) sd = RDIncrementDate( sd, -1, 'day' );
		RDJ.$( 'creditCalendarDate1' ).innerHTML = cal.selectorForm.chooseMonth.options[ sd.getMonth() ].text + ' ' + sd.getDate() + ', ' + sd.getFullYear();
		
		if( sd.getMonth() < 5 )
			sd.setFullYear( sd.getFullYear(), 5, sd.getDate() );
		else if( sd.getMonth() > 7 )
			sd.setFullYear( sd.getFullYear() + 1, 5, sd.getDate() );
		else
			sd.setFullYear( sd.getFullYear(), sd.getMonth() + 1, sd.getDate() );
			
		RDJ.$( 'creditCalendarDate2' ).innerHTML = cal.selectorForm.chooseMonth.options[ sd.getMonth() ].text + ' ' + sd.getFullYear();
	}

	cal.selectorForm.chooseMonth.onchange = function() {cal.selectMonth();}
}

<!-- Thermo -->

		function features( key ) {
			var txt = '';
			
			switch( key ) {
				case 1:
					txt = '<strong>Energy Savings</strong><br />Programmable thermostats can help you save up to 15% on annual heating and cooling costs.';
					break;
				case 2:
					txt = '<strong>#1 Choice of Homeowners</strong><br />Honeywell is the leading brand in temperature control.';
					break;
				case 3:
					txt = '<strong>Cycling Event Notification</strong><br />The word &ldquo;SAVINGS&rdquo; is displayed on the thermostat when a cycling event is occurring.';
                                        RDJ.$( 'thermo-demo-img' ).src = 'http://peakrewards.bgesmartenergy.com/img/pr/thermo-dots-savings.png';
					break;
				case 4:
					txt = '<strong>Precise Comfort Control (+/-1 F)</strong><br />Maintains consistent comfort to the highest level of accuracy.';
					break;
				case 6:
					txt = '<strong>Real-Time Clock</strong><br />Keeps time during power failures and automatically updates for daylight savings.';
					break;
				case 7:
					txt = '<strong>Simple Programming</strong><br />Functional design makes programming the thermostat easy. Online thermostat programming will be available summer 2009.';
					break;
				case 8:
					txt = '<strong>Large, Clear Backlit Digital Display with Touchscreen Interaction</strong><br />Easy to read in any lighting condition.';
					break;
				case 9:
					txt = '<strong>Programmable Fan</strong><br />Separate indoor fan control ensures comfort in your home.';
					break;
				case 10:
					txt = '<strong>One Touch Temperature Control</strong><br />Allows you to override the program schedule at any time.';
					break;
				case 11:
					txt = "<strong>PeakRewards<span class=\"smark\">&#x2120;</span></strong> is one more way the BGE Smart Energy Savers Program<span class=\"smark\">&#x2120;</span> is helping you conserve energy, save money, and help the environment.";
					break;
				default:
					txt = "<img src=\"http://peakrewards.bgesmartenergy.com/img/pr/dot.png\" alt=\"\" />&nbsp;Move your mouse over the red areas to the left to learn more about product features.";
                                        RDJ.$( 'thermo-demo-img' ).src = 'http://peakrewards.bgesmartenergy.com/img/pr/thermo-dots.png';
					break;
			}
			
			RDJ.$( 'therminfo' ).innerHTML = txt;
		}
<!-- ENROLLMENT MAP -->
// Create a default RDAjax Object

	var ajaxObj = new RDAjax( 'GET' );
	
	// For some reason in IE6, there's already a DOM element called
	// map. So we have to nullify it, so we can use it again.
	var map = null;
	
	// Get the total number of customers
	var prTotalCust = 0;
	
	// Here's an empty array to store the polygons
	var counties = [];
	
	// These are the colors or the map legend
	var	prLegendColors = [ '#FF823A', '#F2F26F', '#FFF7BD', '#95CFB7',  '#75b66a' ];    //site colors
	
	// Set the default border style
	var borderWidth = 4;
	var borderOverWidth = 6;
	var borderColor = '#FFFFFF';
	var borderOverColor = '#AAAAAA';    // blue

function prLoad( key ) {
    switch( key ) {
    	case 'calendar-bubble':
    		calendarBubble();
    		break;
        case 'thermo-map':
                break;
    	case 'enrollment-map': 
    	default:
    		enrollmentMap();
    		break;
    	}
}

// Get a color from the colors array
function getColorForValue( val ) {
	if( val < 5000 ) {
		return prLegendColors[ 0 ];
	} else if(  val < 10000 ) {
		return prLegendColors[ 1 ];
	} else if(  val < 25000 ) {
		return prLegendColors[ 2 ];
	} else if( val < 50000 ) {
		return prLegendColors[ 3 ];
       } else {
		return prLegendColors[ 4 ];
	}
}

// Set the colors in the legend 
function setColorLegend() {
	for( var i = 0; i < prLegendColors.length; i++ ) {
		var item = RDJ.$( 'level' + i );
		item.style.backgroundColor = prLegendColors[ prLegendColors.length - ( i + 1) ];
	}
}

// Mouse over a polygon
var mouseOverCounty = function( overlay ) {
	this.setStrokeStyle( {color:borderOverColor, weight:borderOverWidth } );
}

// Mouse leaves a polygon
var mouseOutCounty = function( overlay ) {
	this.setStrokeStyle( {color:borderColor, weight:borderWidth }  );
}

// Draw the County boundaries   
var drawCounties = function( data, map ) {
// Extend the polygon to store zipcode information
GPolygon.prototype.cust = 0;

	// Initialize the map boundaries
	var bounds = new GLatLngBounds();
    	
	// Get the xml file, and parse it
	var xml = GXml.parse( data );
    	
	// Get the boundaries
	var boundaries = xml.documentElement.getElementsByTagName( "boundary" );
	
        for( var i = 0; i < boundaries.length; i++ ) {
		var boundary = boundaries[ i ];
		
		// Only draw counties with installs
		if( boundary.getAttribute( 'cust' ) == 0 ) continue;
    		
		// Get the points
    	        var points = new Array();
    	        for( var j = 1; j < boundary.childNodes.length - 1; j += 2 ) {
    		     var vertex = boundary.childNodes[ j ];
    		     points.push( new GLatLng( vertex.getAttribute( 'lat' ), vertex.getAttribute( 'lng' ) ) );
   	        }

                    vertex = boundary.childNodes[ boundary.childNodes.length - 1 ];
    		     points.push( new GLatLng( vertex.getAttribute( 'lat' ), vertex.getAttribute( 'lng' ) ) );
   	        
   	    // Grab a color
   		var clr = getColorForValue( boundary.getAttribute( 'cust' ) );
   		
   		// Add up the total customers
   		prTotalCust += parseInt( boundary.getAttribute( 'cust' ) );
    	
    	// Create a polygon
   		var gon = new GPolygon( points, borderColor, borderWidth, 1, clr, 1 );
   		
   		// Add the polygon to an array so we can access it later
   		gon.county = boundary.getAttribute( 'county' );
   		gon.name = boundary.getAttribute( 'name' );
   		gon.cust = boundary.getAttribute( 'cust' );
		counties[ gon.county ] = gon;
   		
   		// Add the polygon to the map
   		map.addOverlay( gon );
   		
   		// Add the label to the map
   		var label = new RDTextMarker();
   		label.position = gon.getBounds().getCenter();
   		label.content = '<div class="countyName"><p>' +  gon.name + "</p><p>" + gon.cust + "</p></div>";
        if( gon.county == 16 ) // Prince George's County
        	label.offset = new GSize( -24, 0 );   
   		map.addRDTextMarker( label );
   		RDJ.$( label.id ).style.zIndex = 100002;
		
		bounds.extend( gon.getBounds().getCenter() );
   	
   		//GEvent.addListener( gon, 'mouseover', mouseOverCounty );
		//GEvent.addListener( gon, 'mouseout', mouseOutCounty );
		
		map.setCenter( bounds.getCenter(), map.getBoundsZoomLevel( bounds ) );
    }

	var text = RDJ.$( 'legendCust' );
	text.innerHTML = prTotalCust;
}

function enrollmentMap() {
	if( GBrowserIsCompatible() ) {
		// We're going to center the map here
	var baltimore = new GLatLng( 39.290555,-76.609604 );
		// Set the legend's color
		setColorLegend();
	
		map = new GMap2( document.getElementById( "map" ) );
		map.addMapType( G_PHYSICAL_MAP );
		map.removeMapType( G_NORMAL_MAP );
		map.removeMapType( G_SATELLITE_MAP );
		map.removeMapType( G_HYBRID_MAP );
		map.disableDragging();
		map.disableDoubleClickZoom();
		map.disableContinuousZoom();
		map.disableGoogleBar();
		map.disableScrollWheelZoom();
				
		//map.addControl( new GSmallMapControl() );
		//map.addControl( new GMapTypeControl() );
		map.setCenter( baltimore, 9 );
		map.clearOverlays();
			
		GDownloadUrl( "google-maps/county", function( data ) { drawCounties( data, map ) } );
  	} else {
  		map = RDJ.$( 'map' );
  		map.innerHTML = "<p>Unfortunately, your browser is incompatible with Google Maps.</p>";
  	}
}

// BEGIN LOAD FUNCTIONS
RDJ.attachEvent( window, 'load', function() {

var source = RDJ.getURLValueForKey( 'utm_source' );
var campaign = RDJ.getURLValueForKey( 'utm_campaign' );
var content = RDJ.getURLValueForKey( 'utm_content' );
if( source != '' ) {
	RDJ.writeCookie( 'entrypoint', campaign + '-' + source + '-' + content, 7 );
}

if( RDJ.$( 'feedback-button' ) != undefined ) {
	function placeFeedbackButton( event ) {
		var button = RDJ.$( 'feedback-button' );
		var win = RDJ.getWindowSize();
		var size = RDJ.getSize( button );
		
		if( RDJ.isIE6() ) {
window.scrollBarSize = RDJ.getScrollBarSize();
			button.style.top = win[ 'h' ] + document.documentElement.scrollTop - 24 + window.scrollBarSize[ 'h' ] + 'px';
			button.style.left = win[ 'w' ] + document.documentElement.scrollLeft - size[ 'w' ] - window.scrollBarSize[ 'w' ] + 'px';
		} else {
			button.style.top = win[ 'h' ] + ( ( window.pageYOffset != undefined ) ? window.pageYOffset : document.body.offsetTop ) - 24 + window.scrollBarSize[ 'h' ] + 'px';
			button.style.left = win[ 'w' ] + ( ( window.pageYOffset != undefined ) ? window.pageXOffset : document.body.offsetLeft ) - size[ 'w' ] - window.scrollBarSize[ 'w' ] + 'px';
		}
	}

	RDJ.attachEvent( window, 'load', placeFeedbackButton );
	RDJ.attachEvent( window, 'resize', placeFeedbackButton );
	RDJ.attachEvent( window, 'scroll', placeFeedbackButton );
}
	
if( RDJ.$('share') ) {
	// SHARE A LINK
	var sel = RDJ.$( 'share-email-link' );
	var stp = RDJ.$( 'share-this-page' );
	var ses = RDJ.$( 'share-email-submit' );
	RDJ.attachEvent( sel, 'click', function() { RDJ.toggleDisplay( stp ); return false; } );
	RDJ.attachEvent( ses, 'click', function() { RDJ.toggleDisplay( stp ); } );
}


// Bubble Rotator for homepage
if( RDJ.$('bubbleRotator') ) {
new RDJ.Crossfader( new Array( 'bubble-savings', 'bubble-referralrewards', 'bubble-online-access' ), 500, 5000 );
}

if( RDJ.$('contact_form') ) {
RDJ.attachEvent( RDJ.$('contact_form'), 'submit', function() {
RDJ.$('subject').value = RDJ.$('subject').value.replace( /foo/, RDJ.$('name').value );
});
}

if( RDJ.$('email-signup-form') )
RDJ.attachEvent( RDJ.$( 'email-signup-form'), 'submit', function() { 
	if( !RDJ.isValidEmail( RDJ.$('idijdu-idijdu').value ) ) {
		alert( 'You must enter a valid email address to continue' );
		return false;
	}
	
	if( RDJ.$('agree').checked == true ) { 
		this.submit();
		return true; 
	} else { 
		alert( 'You must agree to receive emails from BGE to signup for the mailing list.');
		return false; 
	} 
} );

if( RDJ.isIE6() ) {RDJ.fixPNG();}

// END LOAD FUNCTIONS
});
