	var CANNEDSEARCH;
	if (!CANNEDSEARCH) CANNEDSEARCH = {};
	if (!CANNEDSEARCH.Application) CANNEDSEARCH.Application = {};
	jQuery(document).ready(function(){

		CANNEDSEARCH.Application = {
			WEB_SERVICE: "/index.php/downloads/cannedsearch/",
			runRequest: function() {
				jQuery('#subcontent').html('<p>request is being made</p>');
				jQuery.ajax({
											url: CANNEDSEARCH.Application.WEB_SERVICE + jQuery('#subcontent').attr('rel'), 
											type: "GET", 
											dataType: "json", 
											success: function(payload, status, rqobject){
					output = '<ul>';
					for (resultCursor = 0 ; resultCursor < payload.body.data.count; resultCursor++ ){
							output += "<li><a href='" + payload.body.data.results[resultCursor].http_loc + '/' + payload.body.data.results[resultCursor].hash + '.' + payload.body.data.results[resultCursor].ext +"' title=''>" + payload.body.data.results[resultCursor].name + "</a></li>";
					}
					if (payload.body.data.count == 0) {
						output += "<li>no downloads available</li>";
					}
					output += '</ul>';
					jQuery('#subcontent').html(output);
																
																			}, 
											error: function(request, status , thrown){
																				jQuery('#subcontent').html('<p>unable to get download list: ' + thrown + '</p>');
																				
																			}
				})
				
			}
			
		};
		
		CANNEDSEARCH.Application.runRequest();
			
	});
