if(typeof(MVJS)=="undefined")
{
	MVJS={};
}
MVJS.WaterMarkText = function(ControlID,Message,WaterMarkClass,MessageText){
	return new MVJS._WaterMarkText(ControlID,Message,WaterMarkClass,MessageText);
};
MVJS._WaterMarkText = function(ControlID,Message,WaterMarkClass,MessageText){
	
	this.Control=null;
	this.Message="";
	this.WaterMarkClass = "WaterMarkClass";
	this.ControlClass='';
	this.ControlMaxLength='';
	this.DefaultControlClass="InputWaterMarkClass";
	
	if(MessageText)Message = MessageText;	
	if(typeof(ControlID) == 'string')
	{
		this.Control = document.getElementById(ControlID);
	}
	else
	{
		this.Control = ControlID;	
	}
	
	if(Message)
	{
		this.Message =  Message;
	}
	else if(this.Control.lang !=null)
	{
		this.Message = this.Control.lang;
	}
	else
	{
		return;
	}
	
	if(this.Control.maxLength)
	this.ControlMaxLength = this.Control.maxLength;
	
	if(WaterMarkClass!='' && WaterMarkClass!=null)
	this.WaterMarkClass = WaterMarkClass;
	if(this.Control.className)
	this.ControlClass = this.Control.className;
	
	if(this.ControlClass== this.WaterMarkClass)
	{
		this.ControlClass = this.DefaultControlClass;
	}
	
	if(this.ControlMaxLength && this.Message.length > this.ControlMaxLength)
	this.Control.maxLength = this.Message.length;
	
	this.Control.className = this.WaterMarkClass;
	this.Control.value = this.Message;
	this.Control.style.color="";
	var _this = this;
	
	MVJS.EventHandler().AttachEvent(this.Control,"focus",function (){_this.FocusHandler();});
	MVJS.EventHandler().AttachEvent(this.Control,"blur",function (e){_this.BlurHandler();});
	
	/*this.Control.onfocus = function ()
	{
		if(_this.Control.className == _this.WaterMarkClass)
		{
			_this.Control.value='';
			_this.Control.className= _this.ControlClass;			
			_this.Control.maxLength = _this.ControlMaxLength;
		}
	};
	
	
	this.Control.onblur = function ()
	{
		if(_this.Control.value =='')
		{
			_this.Control.className = _this.WaterMarkClass;
			_this.Control.maxLength = _this.Message.length;
			_this.Control.style.color="";
			_this.Control.value = _this.Message;
			
		}
	};*/
	
	 
};
MVJS._WaterMarkText.prototype.FocusHandler = function()
{
	if(this.Control.className == this.WaterMarkClass)
	{
		this.Control.value='';
		this.Control.className= this.ControlClass;			
		this.Control.maxLength = this.ControlMaxLength;
	}
};
MVJS._WaterMarkText.prototype.BlurHandler = function()
{
	if(this.Control.value =='')
	{
		this.Control.className = this.WaterMarkClass;
		this.Control.maxLength = this.Message.length;
		this.Control.style.color="";
		this.Control.value = this.Message;
				
	}
};
MVJS._WaterMarkText.prototype.RemoveWatermark = function()
{
	MVJS.SetValue(this.Control,'');
	this.Control.className = this.ControlClass;
	this.Control.onfocus = function (){};
	this.Control.onblur = function (){};	
};
