
var htmlRoot = 'http://www.ammtec.com.au/';
var xhr;
var NWS_request = '';
var callback = '';

function ALB_getImgRight(alb, id) {
	document.gallery_params.scrolldir.value = 'RIGHT';
	ALB_getImg(alb, id);
}
function ALB_getImgLeft(alb, id) {
	document.gallery_params.scrolldir.value = 'LEFT'
	ALB_getImg(alb, id);
}
function ALB_getImg(alb, id) {
	// get HTML
	var callback =
	{
		success : function(obj)
					{
						document.getElementById('photocontent').innerHTML = obj.responseText;
						document.getElementById('thumb_'+id).style.border = "1px solid red";

						selThumb = document.gallery_params.selected_thumb.value;


						var cellIndex = document.getElementById('thumb_'+id).parentNode.parentNode.cellIndex;
						var cellsTotal = document.getElementById('thumb_'+id).parentNode.parentNode.parentNode.cells.length;

						if (selThumb > 0) {
							document.getElementById('thumb_'+selThumb).style.border = "0";
							scrollCursor = (cellsTotal *  900) / 5;


							if (cellIndex == cellsTotal-1) {
								scrollCursor *= cellIndex;
								div_scroll1.setScrollCursor(scrollCursor);
							}

							if (cellIndex % 5 == 0) {

								if (document.gallery_params.scrolldir.value == 'RIGHT') {
									scrollCursor *= cellIndex;
								}
								else {
									scrollCursor *= -cellIndex;
								}

								div_scroll1.setScrollCursor(scrollCursor);
							}

						}


						document.gallery_params.selected_thumb.value = id;


					},
		failure : function(obj){
			document.getElementById('photocontent').innerHTML = '<h4>There is was a problem retreving the news under this category, if this problem continues to occur, please contact the website administrator</h4>';
		}
	}

	document.getElementById('photocontent').innerHTML = '<img src="'+htmlRoot+'uploaded_files/document_uploads/ajax-loading.gif"'

	var obj = WBM_XHR.asyncRequest('GET', htmlRoot+'public_panel/ajax/gallery.php?task=getImage&albID='+alb+'&picId='+id, callback, null);
}
