function skim_album(e, id)
{
	if (e == 0)
		xpos = 0;
	else
	{
		var width =  80;
		var count = 5;
		var x1 = e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft));
    	var x2 = findPosX($(id));
    	x = Math.abs(x1-x2);
    	xpos = -((Math.round(x / ((width / count) + 1))) * width);
    }
    
    $(id).style.backgroundPosition = xpos + 'px 0px';
    $(id).style.backgroundPositionX = xpos + 'px';
}

function ajax_album_cover_photo(album, id)
{
	new Ajax.Request('ajax.php?mode=album&f=cover&album=' + encodeURIComponent(album) + '&id=' + encodeURIComponent(id), {asynchronous:true, onSuccess: function(xmlhttp) { 
		alert('Album cover has been successfully changed.');
	 }});
}

function ajax_album_remove(id)
{
	confirm_album_remove = confirmed(undefined, "Da li sigurno želite da obrišete izabrani album?");
	if (confirm_album_remove == false)
		return false;
	
	new Ajax.Request('ajax.php?mode=album&f=remove&id=' + encodeURIComponent(id), {asynchronous:true, onSuccess: function(xmlhttp) { 
		window.location.reload();
	 }});
}

function ajax_album_foto_remove(id)
{
	confirm_album_remove = confirmed(undefined, "Da li sigurno želite da obrišete izabranu sliku?");
	if (confirm_album_remove == false)
		return false;
	
	new Ajax.Request('ajax.php?mode=album&f=foto_remove&id=' + encodeURIComponent(id), {asynchronous:true, onSuccess: function(xmlhttp) { 
		window.location.reload();
	 }});
}