var getNewHost = function(hostName){
	var fpl = [/^(http:\/\/)?(www\.)?[fplnews]+\.(com)$/, 									'http://www.fplnews.com/Login.aspx?accountID=277'];
	var dukeNewsline = [/^(http:\/\/)?(www\.)?[duke]+(\-energy|power)+[newsline]+\.(com)$/, 'http://www.duke-energynewsline.com/Login.aspx?accountID=170000' ];
	var dukeEnergy = [/^(http:\/\/)?(www\.)?[duke\-energynews]+\.(com)$/, 					'http://www.duke-energy.com/'];
	var progress = [/^(http:\/\/)?(www\.)?[progress\-energycl]+\.(com)$/, 					'http://www.progress-energycl.com/Login.aspx?accountID=190'];
	var psn = [/^(http:\/\/)?(www\.)?[psncenergybusiness]+\.(com)$/, 						'http://www.psncenergy.com/'];
	var sce = [/^(http:\/\/)?(www\.)?[scegbusiness]+\.(com)$/, 								'http://www.sceg.com/'];

	var hosts = [fpl, dukeNewsline, dukeEnergy, progress, psn, sce];
	var newHost = null;

	var getCLID = function(){
		var clid = window.location.search.substring(1);
		var allDigits = /^\d+$/;
		if(allDigits.test(clid)){return 'http://members.questline.com/Login.aspx?accountID=' + clid;}
		else {return null;}
	};

	for(var i=0; i<hosts.length; i+=1){
		if(hosts[i][0].test(hostName)){newHost = hosts[i][1];}
	}

	if(newHost === null){newHost = getCLID();}
	return newHost;
};


var tryRedirect = function(){
	var newHost = getNewHost(window.location.hostname);
	if(newHost !== null){window.location = newHost;}
	else {return false;}
}();