jQuery.noConflict();
var $j = jQuery;
$j(function(){
	valueReplace.init();
});
valueReplace = function(){
	var o = {};
	function init(){
		o.fields = $j('.value-replace');
		o.values = {};
		o.fields.each(function(){
			if($j(this).is("INPUT")) { $j(this).attr("title",$j(this)[0].value); textinputReplace($j(this)); }
			if($j(this).is("TEXTAREA")) { $j(this).attr("title",$j(this).html()); textareaReplace($j(this)); }
		});
	}
	function textinputReplace($e){
		$e.focus(function(){
			if($e[0].value == $e.attr("title") ){ 
				$e[0].value = "";
			}
		});
		$e.blur(function(){
			if($e[0].value == "" || $e[0].value === undefined) {
				$e[0].value = $e.attr("title");
			}
		});
	}
	function textareaReplace($e){
		$e.focus(function(){
			if($e.html() == $e.attr("title") ){ 
				$e.html("");
			}
		});
		$e.blur(function(){
			if($e.html() == "" || $e.html() === undefined) {
				$e.html($e.attr("title"));
			}
		});
	}
	return { init:init }
}();
