pp.components.SiteSelect = function(spec, my) {
	spec = spec || {};
	my = my || {};
	
	my.$selector = $(spec.selector);
	if(!spec.selector || !my.$selector){
		throw "'selector' was not specified in spec, or do not yield any results";
	}
	
	my.handleClick = function() {
		
		var href = window.location.href;
		
		//we want to send the user to the site-specific version of this url if possible
		var regex = /(site(?:id)?[\/=])(\d+)/;
		if(href.match(regex)) {
			window.location.href = href.replace(regex, '$1' + $(this).val());
		} else {
			window.location.href = "/report/wind/data/site/" + $(this).val();
		}
	};
	
	var that = {};
	
	that.init = function() {
		my.$selector.change(my.handleClick);
	};
	
	// public functions go here
	
	that.init();
	
	return that;
};

