
function loadNewPhotos(path,username,numpics) {
		if ((document.getElementById('flickrLoadIndicator'+username)) && (document.getElementById('photos'+username)))
		{
			$('afp_startInd'+username).value=0;
			var ajax;
			var loadingDiv = document.getElementById('flickrLoadIndicator'+username);
			var photoDiv = document.getElementById('photos'+username);
			show('flickrLoadIndicator'+username);
			if (document.getElementById('dropPhotoset'+username))
				var photoset = document.getElementById('dropPhotoset'+username).options[document.getElementById('dropPhotoset'+username).selectedIndex].value;
			else
				var photoset = '';
			if (document.getElementById('dropSort'))
				var sort = document.getElementById('dropSort').options[document.getElementById('dropSort').selectedIndex].value;
			else
				var sort = '';
			 ajax =  new Ajax.Updater(
			 'photos'+username,        // DIV id must be declared before the method was called
			 path + '/photoUpdateHandler.php?loadNew=1&ps='+photoset+'&sort='+sort+'&userName=' + username + '&numPics=' + numpics,        // URL
			 {                // options
			   method:'get',
			   onComplete:function(){initLightbox(); hide('flickrLoadIndicator'+username);}            
			 });
		}

}


function movePhotos(direction,username,path,numpics,photosets) {

		if ((document.getElementById('flickrLoadIndicator'+username)) && (document.getElementById('photos'+username)))
		{
						show('flickrLoadIndicator'+username);

			 //direction = 0 - previous group
			 //direction = 1 - previous picture
			 //direction = 2 - next picture
			 //direction = 3 - next group
			var ajax;
			var afp_startInd = $('afp_startInd'+username).value;
			if(direction==1 )
			$('afp_startInd'+username).value=parseInt(afp_startInd)-1;
			else if(direction==2)
			$('afp_startInd'+username).value=parseInt(afp_startInd)+1;
			

			var loadingDiv = document.getElementById('flickrLoadIndicator'+username);
			var photoDiv = document.getElementById('photos'+username);     
			var dat = new Date();
			 ajax =  new Ajax.Updater(
			 'photos'+ username,        // DIV id must be declared before the method was called
			 path + '/photoUpdateHandler.php?afp_startInd='+afp_startInd+'&ps='+photosets+'&userName=' + username +'&move=' + direction + '&numPics=' + numpics+'&date='+dat.getTime(),        // URL
			 {                // options
			   method:'get',
			   onComplete:function(){ initLightbox(); hide('flickrLoadIndicator'+username);}            
			 });
		 }
}

function show(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		obj.style.display = "";
	}
} 
function hide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
			obj.style.display = "none";
		}
	
}

