$(function(){ 
    
    // find all the input elements with title attributes
	$('input[title!=""]').hint();
/*
	$('textarea[title!=""]').hint();
*/
	$("td[id^=rating]").click(function(){
        var id = $(this).attr('id');
        var rating = ($("input[@name='" + id + "']:checked")).val();
        $('input[name="data[Review]['+id+']"]').val(rating);
        },function(){}
    ); 
	$("input[@type='text'], textarea").focus(function(){
        var obj = '.hint_'+ $(this).attr('id');
        $(obj).fadeIn('fast');
        $(obj).css('position', 'absolute');
        $(obj).css('top', $(this).offset().top+'px');
        $(obj).css('left', $(this).offset().left+$(this).width()+20+'px');
        $(obj).css('display', 'block');
    });        
	$("input[@type='text'], textarea").blur(function(){
        var obj = '.hint_'+ $(this).attr('id');
        $(obj).css('display', 'none');
    });
   
   
    // jqueryオブジェクトの中身をダンプする関数
    function jquery_dump($obj) {
    	var dumphtml = [];
    	if($.browser.msie) {
    		for(var i = 0; i < $obj.length; i++) {
    			dumphtml.push('[' + i + '] ');
    			dumphtml.push($obj[i].outerHTML.replace(/^[\r\n\t]+/, ''));
    			dumphtml.push("\n");
    		}
    	} else {
    		for(var i = 0; i < $obj.length; i++) {
    			dumphtml.push('[' + i + '] '
    				+ '<' + $obj[i].nodeName.toLowerCase());
    			for(var j = 0; j < $obj[i].attributes.length; j++) {
    				dumphtml.push(' ' + $obj[i].attributes[j].nodeName + '="' 
    					+ $obj[i].attributes[j].nodeValue + '"');
    			}
    			dumphtml.push('>' + $obj[i].innerHTML);
    			dumphtml.push('<\/' + $obj[i].nodeName.toLowerCase() + '>');
    			dumphtml.push("\n");
    		}
    	}
    	alert(dumphtml.join(''));
    }
    
});
