// JavaScript Document
function viewPhoto()
{
	with (window.document.frmListPhoto) {
		if (cboAlbum.selectedIndex != 0) {
/*			window.location.href = 'index.php';
		} else {*/
			window.location.href = 'index.php?alb=' + cboAlbum.options[cboAlbum.selectedIndex].value;
		}
	}
}

function checkAddPhotoForm()
{
	with (window.document.frmAddPhoto) {
		if (txtimgalbum.selectedIndex == 0) {
			alert('Choose the photo album');
			txtimgalbum.focus();
			return;
		} else if (isEmpty(txtimgtitle, 'Enter photo title', true)) {
			return;
		} else {
			submit();
		}
	}
}

function addPhoto(albumId, qstr)
{
	qstr = (qstr!="")?"&"+qstr:qstr;
	window.location.href = 'index.php?view=add&alb=' + albumId + qstr;
}

function modifyPhoto(photoId,albumId, qstr)
{
	qstr = (qstr!="")?"&"+qstr:qstr;
	window.location.href = 'index.php?view=add&alb=' + albumId + '&img=' + photoId + '&bck=1'+qstr;
}

function deletePhoto(photoId, albumId, qstr)
{
	qstr = (qstr!="")?"&"+qstr:qstr;
	if (confirm('Delete this photo?')) {
		window.location.href = 'processPhoto.php?action=delete&img=' + photoId + '&alb=' + albumId + qstr;
	}
}

function deleteSelectedPhoto(frm, qstr)
{
	qstr = (qstr!="")?"&"+qstr:qstr;
	if(confirmdelcheckeditems('Photo(s)',frm)){
		frm.action="processPhoto.php?action=delselected" + qstr;
		frm.submit();
	}
}

function publishSelectedPhoto(frm,qstr)
{
	qstr = (qstr!="")?"&"+qstr:qstr;
	if(confirmpubcheckeditems('Photo(s)',frm)){
		frm.action="processPhoto.php?action=pubselected"+qstr;
		frm.submit();
	}
}

function unpublishSelectedPhoto(frm,qstr)
{
	qstr = (qstr!="")?"&"+qstr:qstr;
	if(confirmunpubcheckeditems('Photo(s)',frm)){
		frm.action="processPhoto.php?action=unpubselected"+qstr;
		frm.submit();
	}
}

function deleteImage(photoId,indexId)
{
	if (confirm("Delete this image")) {
		window.location.href = "processPhoto.php?action=deleteImage&img=" + photoId + "&pos=" + indexId;
	}
}

function uploadImage(albumId, photoId, pageNum)
{
	window.location.href='index.php?view=add&page=' + pageNum + '&alb='+ albumId + '&img=' + photoId + '&bck=1';
}