var ServiceTypeUpdater = new Class({

	initialize: function() {
		$each($$('input.service-type'), function(el) {
			el.onclick = this.updateServiceType.pass(el, this);
		}, this);
	},
	
	updateServiceType: function(el) {
	this.serviceType = el.className.replace(/service-type /,'');
		$each($$('label.service-type-label'), function(el) {
			if (el.className.match(this.serviceType)) {
				if (!(el.className.match('service-type-hilight'))) {
					el.className += " service-type-hilight";
				}
			} else {
				el.className = el.className.replace(/service-type-hilight/,'');
			}
			switch (this.serviceType) {
				case "on":
					action = "Turn On";
					newClass = "addr-box-title-on";
					newColor = "login-fields-on";
					ctaTitle = "Turn On Your SCE Power";
					newCta = "Do you need Southern California Edison electricity at your address? Connecting your electricity online is quick and easy. Simply enter your address to order your service.";
					newSckey = "electricity";
					newAction = "http://www.whitefence.com/scripts/server/marketcheck.php";
					break;
				case "off":
					action = "Turn Off";
					newClass = "addr-box-title-off";
					newColor = "login-fields-off";
					ctaTitle = "Turn Off Your SCE Power";
					newCta = "Do you need to turn off your Southern California Edison electricity at your address? Turning off your electricity online is quick and easy. Simply enter your address to turn off your service.";
					newSckey = "turnOffNevadaPower";
					newAction = "https://www.whitefence.com/WebObjects/WhiteFenceService.woa/wa/processAddress";
					break;
				case "transfer":
					action = "New Transfer";
					newClass = "addr-box-title-transfer";
					newColor = "login-fields-transfer";
					ctaTitle = "Transfer Your SCE Power";
					newCta = "If you are a current SCE customer and wish to transfer your power with SCE to your new address, you can start here. Simply enter your address to transfer your service today.";
					newSckey = "electricity";
					newAction = "http://www.whitefence.com/scripts/server/marketcheck.php";
					break;
			}
			addrTitle = $('addr-box-title-action');
			addrTitle.innerHTML = action;
			addrTitle.className = newClass;
			addrColor = $('login-fields');
			addrColor.className = newColor;
			addrCta = $('cta-copy');
			addrCta.innerHTML = newCta;
			addrCtaTitle = $('cta-title');
			addrCtaTitle.innerHTML = ctaTitle;
			addrSckey = $('scKey');
			addrSckey.value = newSckey;
			addrAction = $('selfReg');
			addrAction.action = newAction;
			
			}, this);
	}




});

