/* this defines a numaReports object that can be used by creating it as a new object as in 
 * 
 * myObjInstantiation = new numaRptObj();
 * 
 */
numaRptObj = function(){

	this.reportUrl = reportsRequest;

	this.getCallURL = function(layer){
		return this.reportUrl + 'request=numagetreportitems&format=json&layer=' + layer;
	}

	this.getHTMLReport = function(json,x,y,div){
		var outHTML = "<div align='center'>";
		for (var i=0;i<json.length;i++){
			outHTML = outHTML + "<br/><img src='" + json[i].URL + "&x=" + x + "&y=" + y + "' vspace='10' border='0'><br/>";
		}
		$(div).innerHTML = outHTML + "</div>"; 
	}
	
	/*this.getHTMLReportList = function(json,x,y,div){
		var outHTML = "<div align='center'>";
		for (var i=0;i<json.length;i++){
			outHTML = outHTML + "<a HREF='" + json[i].URL +  "&x=" + x + "&y=" + y + "'>" + json[i].CHARTNAME + "</a><BR/>";
		}
		$(div).innerHTML = outHTML + "</div>"; 
	}*/	


	this.getHTMLReportList = function(json,x,y,div){
		var outHTML = "<div class='accordianWrapper'><div class='mochaAccordian'>";
		var secHTML = "";
		if(! json.length){
			outHTML = "<p style='margin:5px;text-align:center'>There is currently no summary graph for this poligon</p>";
		}
		else{
			for (var i=0;i<json.length;i++){
				if (i == 0){ 
					outHTML = outHTML + "<h3 class='accordianToggler topToggler'>" + json[i].CHARTNAME + "</h3>";
				}
				else{
					outHTML = outHTML + "<h3 class='accordianToggler'>" + json[i].CHARTNAME + "</h3>";
				}
				outHTML = outHTML + "<div class='accordianElement'>";
				outHTML = outHTML + "	<div class='accordianContent'>";
				outHTML = outHTML + "		<img src='" + json[i].URL + "&x=" + x + "&y=" + y + "' vspace='0' border='0'>";
				outHTML = outHTML + "	</div>";
				outHTML = outHTML + "</div>";
			}
		}
		outHTML = outHTML + "</div></div>";
		//$(div).innerHTML =  outHTML;
		MochaUI.updateContent({'element': $(div),'content': outHTML});
	}
}


