(function() {
	function __wjs__null_text_(){
		if (!document.getElementById) return false;
		var objAll = document.getElementsByTagName("input");
		var base_class = 'wjsnulltext';
		var reg = new RegExp(base_class, 'i');
		for(var i = 0; i < objAll.length; i++) {
			if(!objAll[i].className.match(reg)){ continue; }
			objAll[i].setAttribute('wjsnulltext_color', objAll[i].style.color);
			__wjs__null_text__blur_(objAll[i]);
			objAll[i].onblur = function() { __wjs__null_text__blur_(this); }
			objAll[i].onfocus = function() { __wjs__null_text__focus_(this); }
		}
	}
	function __wjs__null_text__blur_(obj){
		var nullvalue = obj.getAttribute('nullvalue');
		if (obj.value == '' || obj.value == nullvalue) {
			obj.value = nullvalue;
			if(obj.getAttribute('nullcolor') != null){
				obj.style.color = obj.getAttribute('nullcolor');
			}
		}
	}
	function __wjs__null_text__focus_(obj){
		var nullvalue = obj.getAttribute('nullvalue');
		if (obj.value == nullvalue) { obj.value = ''; }
		obj.style.color = obj.getAttribute('wjsnulltext_color');
	}
	function __wjs__add_event_(obj,event_name,func){
		try{
			obj.addEventListener(event_name,func,false);
		}catch(e){
			obj.attachEvent('on'+event_name,func);
		}
	}
	__wjs__add_event_(window, 'load', __wjs__null_text_);
})();
