// JavaScript Document
/*************************************************************/
if(window.ie6){
// because ie6 is rubbish and can't handle li:hover - here is a little fix - HMS 10/06/2008
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("navigation");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;
}

/**************************************************************

	Script		: Text Resize Detector
	Version		: 1.0
	Authors		: Samuel birch
	Desc		: Captures when the text is resized.

**************************************************************/

var TextResizeDetector = new Class({
	getOptions: function(){
		return {
			delay: 200,
			onChange: Class.empty
		};
	},
	
	initialize: function(options){
		this.setOptions(this.getOptions(), options);
		
		this.element = new Element('span').setProperty('id','textResizeControl').setStyles({position: 'absolute', left: '-9999px'}).setHTML('&nbsp;').injectInside(document.body);
		this.oldSize = this.element.getStyle('height').toInt();
		this.start();
	},
	
	check: function(){
		if(this.oldSize != this.element.getStyle('height').toInt()){
			this.oldSize = this.element.getStyle('height').toInt();
			this.options.onChange();
		}
	},
	
	start: function(){
		this.timer = this.check.periodical(this.options.delay, this);
	},
	
	stop: function(){
		$clear(this.timer);
	}
});
TextResizeDetector.implement(new Events);
TextResizeDetector.implement(new Options);

/*************************************************************/

window.addEvent('domready', function() {
    if ($('amount'))
    {
      $('amount').addEvent('focus', function(){
          if ($('amount').value == "Loan Amount")
          {
            $('amount').value = "";
          }
      }
      )
      $('amount').addEvent('blur', function(){
          if ($('amount').value == "")
          {
            $('amount').value = "Loan Amount";
          }
      }
      )
      $('term').addEvent('focus', function(){
          if ($('term').value == "Term (years)")
          {
            $('term').value = "";
          }
      }
      )
      $('term').addEvent('blur', function(){
          if ($('term').value == "")
          {
            $('term').value = "Term (years)";
          }
      }
      )
      $('rate').addEvent('focus', function(){
          if ($('rate').value == "Interest rate")
          {
            $('rate').value = "";
          }
      }
      )
      $('rate').addEvent('blur', function(){
          if ($('rate').value == "")
          {
            $('rate').value = "Interest rate";
          }
      }
      )          
}
}
);

