(function() {
	$(document).ready(function() {
		prepareOnLoad();
		$('#tabs').tabs("select",2);  
		
		$(".result img.icona").each(function() {
				
				var status=false;			
				$(this).bind("click",function() {
				  var self=($(this)); 
				  var tr=$(self.parents("tr:first")[0]);
				  var sub=tr.nextAll("tr.sub").map(function() {
				     var trPrev=$(this).prevAll("tr.master")[0];
				     return ( tr[0].rowIndex==trPrev.rowIndex ) ? this:null;
				  });

					if(status==false) {
						$(sub).show();
						status=true;
						self[0].src=self[0].src.replace("open","close");
					} else {
					  $(sub).hide();
					  status=false;	
						self[0].src=self[0].src.replace("close","open");
					}

				});
		});
		
		
	});
})()
