/**
 * Class TextHint
 * Places a gray text statement in a text box, then erases it unpon first character pressed
 * 
 * TextHint 
 * @param - box - dom pointer to a boxc
 * @param  text - string - string to place in box
 * **/
function TextHint (box,text){
  	this.typeFlag = false;
	this.box = box;
	this.text = text;
	this.size = box.style.fontSize;
	box.style.height = '15px';
	this.color = box.style.color;
	this.gray = '#555555';
	box.value = text;
	box.style.color = this.gray;
	box.style.fontSize = '8pt';
	
	if(box.setSelectionRange){
		//box.focus();
		//box.setSelectionRange(0,0);
	}
	else if (box.createTextRange) {
		var range = box.createTextRange();
		range.collapse(true);
		range.moveEnd('character', 0);
		range.moveStart('character', 0);
		range.select();
	}	
	var me = this;
	
	
	box.onfocus = function (){
	  	if (!me.typeFlag){
			me.box.value = '';
			me.box.style.color = me.color;
			me.box.style.fontSize = me.size;
		}
	}
	
	box.onblur = function(){
	  	
	  	if (me.box.value == ''){
		  	me.box.value = me.text;
			me.box.style.color = me.gray;
			me.typeFlag = false;
			me.box.style.fontSize = '8pt';
		}
	}
	
	box.onkeypress = function(){
	  	if (me.typeFlag == false){
		  	me.box.value = '';
			me.box.style.color = me.color;
			me.box.style.fontSize = me.size;
		}
	  	me.typeFlag = true;
	}
	
}

