// JS for image page
function moreGenres(site_id, element){
	element.blur();
	if(jQuery("#results_genre").html().length){
		jQuery("#results_genre").slideToggle();
		return;
	}
	
	// AJAX call
	jQuery.ajax({
		type: "POST",
		url: site_url+"locations/similar_genres/",  // MUST HAVE TRAILING SLASH!
		cache: true,
		data: jQuery("#site_id").serialize(),
		success: function(data){
			jQuery("#results_genre").html(data).slideDown("medium");
		}
	});
}

function moreNear(site_id, element){
	element.blur();
	if(jQuery("#results_near").html().length){
		jQuery("#results_near").slideToggle();
		return;
	}
	
	// AJAX call
	jQuery.ajax({
		type: "POST",
		url: site_url+"locations/near/",  // MUST HAVE TRAILING SLASH!
		cache: true,
		data: jQuery("#site_id, #site_lat, #site_long").serialize(),
		success: function(data){
			jQuery("#results_near").html(data).slideDown("medium");
		}
	});
}

function moreGalleries(gallery_id, element){
	element.blur();
	if(jQuery("#results_gallery").html().length){
		jQuery("#results_gallery").slideToggle();
		return;
	}
	
	// AJAX call
	jQuery.ajax({
		type: "POST",
		url: site_url+"gallery/get_next_prev/",  // MUST HAVE TRAILING SLASH!
		cache: true,
		data: jQuery("#gallery_id").serialize(),
		success: function(data){
			jQuery("#results_gallery").html(data).slideDown("medium");
		}
	});
}

function moreSiteGalleries(site_id, gallery_id, element){
	element.blur();
	if(jQuery("#results_site_gallery").html().length){
		jQuery("#results_site_gallery").slideToggle();
		return;
	}
	
	// AJAX call
	jQuery.ajax({
		type: "POST",
		url: site_url+"gallery/get_more_site/"+site_id+"/",  // MUST HAVE TRAILING SLASH!
		cache: true,
		data: jQuery("#gallery_id").serialize(),
		success: function(data){
			jQuery("#results_site_gallery").html(data).slideDown("medium");
		}
	});
}

function centeriFrame(frameName, wPos, hPos){
	window.frames[frameName].scrollBy(wPos, hPos);
}
