window.addEvent('domready', function() {
	var picker = $('toll-picker');
	var injected = $('toll-picker-result');
 	if(picker) {
 		var totalHeight = 20;
 		var transform = new Fx.Styles(injected);
 		transform.options.duration = 200;
 		picker.setStyle("display","");
		injected.setStyle("height","0px");
		injected.setStyle("opacity",0);
		injected.setStyle("display","block");
		//picker.addEvent('keypress',function(){			
			//picker.fireEvent('change', picker);
		//});
 		picker.addEvent('change',function() {
 			if(picker.value != "") {
	 			if(injected.style.height > '0px') {
	 				transform.chain(function(){
	 					transform.start({
		 					'padding-top':[15,0],
		 					'padding-bottom':[15,0],
		 					'opacity':[1,0],
		 					'height':[totalHeight,0]
	 					});
	 				});
	 			}
	 			transform.chain(function(){
	 				//Break values
	 				var values = picker.value;
	 				values = values.split("::");
	 				var string = "Call <strong> " + values[0] + " </strong> for as little as <strong> " + values[1] + "</strong> cents per minute!";
	 				injected.innerHTML = string;
	 				transform.start({
	 					'padding-top':[0,15],
	 					'padding-bottom':[0,15],
	 					'opacity':[0,1],
	 					'height':[0,totalHeight]
	 				});
	 			});
	 			transform.start();
	 		} else {
	 			if(injected.style.height > '0px') {
 					transform.start({
	 					'padding-top':[15,0],
	 					'padding-bottom':[15,0],
	 					'opacity':[1,0],
	 					'height':[totalHeight,0]
 					});
	 			}
	 		}
 		});
 		
 			picker.addEvent('keyup',function() {
 			if(picker.value != "") {
	 			if(injected.style.height > '0px') {
	 				transform.chain(function(){
	 					transform.start({
		 					'padding-top':[15,0],
		 					'padding-bottom':[15,0],
		 					'opacity':[1,0],
		 					'height':[totalHeight,0]
	 					});
	 				});
	 			}
	 			transform.chain(function(){
	 				//Break values
	 				var values = picker.value;
	 				values = values.split("::");
	 				var string = "Call <strong> " + values[0] + " </strong> for as little as <strong> " + values[1] + "</strong> cents per minute!";
	 				injected.innerHTML = string;
	 				transform.start({
	 					'padding-top':[0,15],
	 					'padding-bottom':[0,15],
	 					'opacity':[0,1],
	 					'height':[0,totalHeight]
	 				});
	 			});
	 			transform.start();
	 		} else {
	 			if(injected.style.height > '0px') {
 					transform.start({
	 					'padding-top':[15,0],
	 					'padding-bottom':[15,0],
	 					'opacity':[1,0],
	 					'height':[totalHeight,0]
 					});
	 			}
	 		}
 		});
 		
 	}
});		
