// JavaScript Document
var imgCount = 0;
var imgId = 0;
function getImage(dir,cnt){
	imgCount = cnt;
	if(dir == "prv"){
		//Decrement imgID
		imgId--;
		if(imgId < 0){imgId = (imgCount-1);}
	}else{
		imgId++;
		if(imgId > (imgCount-1)){imgId = 0;}
	}
	//Open an AJAX request
	$('#featuredPhoto').html("<center><img style='border:none' src='/images/ajax-loader.gif' alt='Loading' /></center>");
	$.get("/ajax/widgetHandler.ajax.php","w=fphoto&id="+imgId,function(data){
		if(data.error == 0){
			$('#featuredPhoto').html(data.message);
			var pItem = imgId+1;
			$('#photoOrder').html(pItem + " of " + imgCount);
			$("a[rel='colorbox']").colorbox();
		}
	},'json');
}
