function swapGalImage(anchor)
{
	var url_array = $(anchor).attr('href').split("/");
	//If dest_url is NULL, remove the anchor tag if it exists
	//no harm if it doesn't exist
	if(typeof $(anchor).attr('dest_url') == "undefined" || $(anchor).attr('dest_url') == "") {
		$("div.preview a, div.preview img").remove();
		$("div.preview").append("<img src='"+$(anchor).attr('href')+"' />");
	}

	//Dest_url does exist, so we need an anchor tag	
	else {
		//if there is an anchor within preview
		if($("div.preview a").length > 0)
			$("div.preview a").attr('href', $(anchor).attr('dest_url'));
		else
			$("div.preview img").wrap("<a href='"+$(anchor).attr('dest_url')+"'></a>");
	}	
	$("div.preview img").attr('src', $(anchor).attr('href'));

}
function findLoc(locationname) {
	//jQuery to load a remote page using HTTP POST, arguments are
	// 1: page to load
	// 2: key/value pair to send to server
	// 3: callback function to execute when data loads successfully
	$.post(
		"/inc/findLoc.php",
		{'LOCATION': locationname}, 
		function(data) {

			$('#locationResults').html(data); 
			
			$('.preview').innerfade({
				speed: 'slow',
				timeout: 6000,
				type: 'sequence',
				containerheight: '435px'
			});
		}
	);
}

