//redirect.js

//if this is called, redirect to the appropriate site

function redirect() {
	var newLocation = "";

	//make sure there's an officer object.  If no, redirect to phhmortgage.com
	if (officer != "none")
		// if there is one, get the derault gomain and set the value for the redirect
		redirectSwitch:
		switch (officer.defaultDomain){
			//Amcore
			case "amcore":
				newLocation = "amcoremortgages.com";
				break redirectSwitch;
			//citizensonline
			case "citizensmi":
				newLocation = "mortgage.citizensbanking.com";
				break redirectSwitch;
			//f&m banks
			case "fmbanks":
				newLocation = "mortgage.fmbanks.com";
				break redirectSwitch;
			//Integra
			case "integra":
				newLocation = "mortgage.integrabank.com";
				break redirectSwitch;
			//TD Banknorth
			case "tdbanknorth" :
				newLocation = "mortgage.tdbanknorth.com";
				break redirectSwitch;
			//PHH Mortgage
			case "phhmortgage" :
				newLocation = "www.phhmortgage.com";
				break redirectSwitch;
			//PHH Home Loans
			case "phhhomeloans" :
				newLocation = "www.phhhomeloans.com";
				break redirectSwitch;
			//C21 Mortgage
			case "c21mortgage" :
				newLocation = "www.c21mortgage.com";
				break redirectSwitch;
			//C21 Home Loans
			case "c21homeloans" :
				newLocation = "www.c21homeloans.com";
				break redirectSwitch;
			//CB Mortgage
			case "coldwellbankermortgage" :
				newLocation = "www.coldwellbankermortgage.com";
				break redirectSwitch;
			//CB Home Loans
			case "coldwellbankerhomeloans" :
				newLocation = "www.coldwellbankerhomeloans.com";
				break redirectSwitch;
			//ERA Mortgage
			case "eramortgage" :
				newLocation = "www.eramortgage.com";
				break redirectSwitch;
			//ERA Home Loans
			case "erahomeloans" :
				newLocation = "www.erahomeloans.com";
				break redirectSwitch;
			//First Financial
			case "firstfinancial" :
				newLocation = "mortgage.bankatfirst.com";
				break redirectSwitch;	
			//PremierWest Bank
			case "premierwestbank" :
				newLocation = "mortgage.premierwestbank.com";
				break redirectSwitch;
			//American Momentum
			case "amomentumbank" :
				newLocation = "www.americanmomentum.com";
				break redirectSwitch;	
			//First Tennessee
			case "firsttennessee" :
				newLocation = "www.fthomeloans.com";
				break redirectSwitch;
			//Citizens Business Bank
			case "cbb" :
				newLocation = "www.cbbank.com";
				break redirectSwitch;
			//Keybank Mortgage
			case "KeyBank" :
				newLocation = "www.keybankmortgage.com";
				break redirectSwitch;
			//USE Credit Union
			//5star Mortgage
			case "5star" :
				newLocation = "www.5starmortgage.com";
				break redirectSwitch;
			//USE Credit Union
			case "usecu" :
				newLocation = "www.usecu.org";
				break redirectSwitch;
		}
		
	
	if (newLocation != "") {
		//if there is a location for the next page (because the defaultDomain was found)
		//then redirect
		document.location.href= "http://" + newLocation;
	} else {
		//otherwise, go to phhmortgage.com
		document.location.href= "http://www.phhmortgage.com";
	}
	
}