					
function tooltipHTML(STATE_NAME,STATE_ABBR,PROJECT_COUNT,DOLLARS_SUM, VIS_PROJECT_COUNT){

// Select photo based on agency
if(currentDept!='0'){
	if(deptArray[currentDept][5] == filterFields[0]){ // if the dept over this project recognizes agencies...
		if(vfCat!='0'){ // an agency is selected. use that image
			if(agImgName!='*'){
			   var photo = '<td class="iwin_1_img" width="'+agImgWidth+'"><img src="./logos/'+agImgName+'" width="'+agImgWidth+'" height="'+agImgHeight+'" border="0"/></td>';	
			}else{ // no image available for that agency. use the dept. logo
				var photo = '<td class="iwin_1_img" width="'+deptArray[currentDept][3]+'"><img src="./logos/'+deptArray[currentDept][2]+'" width="'+deptArray[currentDept][3]+'" height="'+deptArray[currentDept][4]+'" border="0" alt="['+(deptArray[currentDept][1]!=''?deptArray[currentDept][1]:"Dept.")+' logo]" /></td>';	
			}	
		}else{ // no agency selected. use the department image
			var photo = '<td class="iwin_1_img" width="'+deptArray[currentDept][3]+'"><img src="./logos/'+deptArray[currentDept][2]+'" width="'+deptArray[currentDept][3]+'" height="'+deptArray[currentDept][4]+'" border="0" alt="['+(deptArray[currentDept][1]!=''?deptArray[currentDept][1]:"Dept.")+' logo]" /></td>';	
		}
	}else if(deptArray[currentDept][2]!=''){
		var photo = '<td class="iwin_1_img" width="'+deptArray[currentDept][3]+'"><img src="./logos/'+deptArray[currentDept][2]+'" width="'+deptArray[currentDept][3]+'" height="'+deptArray[currentDept][4]+'" border="0" alt="['+(deptArray[currentDept][1]!=''?deptArray[currentDept][1]:"Dept.")+' logo]" /></td>';	
	}else{ // not an agency filtered dept. and no department logo available.
		var photo = '<td class="iwin_1_img" width="51"><img src="./logos/ARRA.gif" width="51" height="50" border="0" alt="[ARRA logo]" title="ARRA" /></td>';	
	}
}else{
	var photo = '<td class="iwin_1_img" width="51"><img src="./logos/ARRA.gif" width="51" height="50" border="0" alt="[ARRA logo]" title="ARRA" /></td>';	
}



// format the currencies for funding amount
var currency = "";
if(DOLLARS_SUM !=''){
	currency = formatCurrency(DOLLARS_SUM);
	currency = remove(currency,".00");
}

var stateTitle = toTitleCase(STATE_NAME);

var project_count_noVis = PROJECT_COUNT - VIS_PROJECT_COUNT;

return '<table class="iwin iwin_state" cellpadding="2" cellspacing="0" border="0">'+
'<tbody>'+
/*'<tr><th colspan="2">'+STATE_NAME+' State</th></tr>'+ */
'<tr>'+
	photo+
	'<td class="iwin_1_title">'+(PROJECT_COUNT!=0?stateTitle+'<span>Summary of Spending</span>':'No assistance or contracts awarded')+'</td>'+
'</tr>'+
(currentDept!=0?'<tr><td colspan="2" class="stateSummary">'+deptArray[currentDept][0]+"<br/>":'<tr><td colspan="2" class="stateSummary">')+
(PROJECT_COUNT!=0?'<tr><td colspan="2" class="stateSummary">':'Currently <b>no</b> recorded data here.<br/>')+

(vfCat!=0||fundCat!=0?"(Filters applied in the map header)</td></tr>":"</td></tr>")+

(PROJECT_COUNT!=0?'<tr><td colspan="2" style="border-top: 1px solid #BBBBBB;">'+
		'<table class="iwin_1_items" width="100%" cellspacing="0" cellpadding="0" border="0">'+
		'<tbody>'+
			/*'<tr class="iwin_2_pline"><td class="iwin_2_label">Recipients or Vendors</td><td class="iwin_2_value" valign="middle" align="right">'+RECIPIENT_COUNT+'</td></tr>'+*/
			'<tr class="iwin_2_pline"><td class="iwin_2_label" colspan="2"><strong>'+PROJECT_COUNT+'</strong> Projects or Programs'+(!isNaN(project_count_noVis)&&project_count_noVis>0?'<br/><span style="font-size:10px;">('+project_count_noVis+' '+(project_count_noVis > 1?'projects':'project')+' not displayed on map *)</span>':'')+'</td></tr>'+	
			
			'<tr class="iwin_2_pline"><td class="iwin_2_label">Total funding</td><td class="iwin_2_value" valign="middle" align="right"><strong>'+currency+'</strong></td></tr>'+
		'</tbody>'+
		'</table>'+
'</td></tr>':'')+
/*(STATE_ABBR!=''?'<tr><td colspan="2" class="iwin_1_footer" style="padding-bottom: 4px;"><a href="javascript:void(0);" ><span>Zoom to state</span> >>></a>&nbsp;&nbsp;<a href="http://preprod.usda.gov/blog/'+STATE_ABBR.toUpperCase()+'" target="_blank"><span>Share your comments</span> >>></a></td></tr>':'')+*/

'</tbody>'+
'</table>';
}




