// JavaScript Document
function submitAlbum(){
	document.edit_album.submit();
}
function moveImage(){
	document.edit_image.submit();
}
function delImage(pid){
	var pid;
	var album = document.edit_image.from_album.value;
	if (confirm('Are you sure want to delete this picture?'))
		document.location.href='admin/edit_image.php?del=' + pid + '&aid=' + album;
}
function backToHome(){
	document.location.href='index.php';
}
function backToAlbum(album){
	document.location.href='index.php?ref=portfolio&aid=' + album;
}

function showNav(){
	document.getElementById('link_next').style.display = 'block';
	document.getElementById('link_prev').style.display = 'block';
}
function hideNav(){
	document.getElementById('link_next').style.display = 'none';
	document.getElementById('link_prev').style.display = 'none';
}

var Lst;

function CngClass(obj){
	if (Lst) Lst.className='';
		obj.className='selected_image';
		Lst=obj;
}

function getOrderImage() {
  var orderList = '';
  orderedNodes = document.getElementById("adminPhotoList").getElementsByTagName("li");
  for (var i=0;i < orderedNodes.length;i++) {
    orderList += orderedNodes[i].getAttribute('idgambar') + ',';
    }
  document.getElementById("sort_id").value = orderList;
}
function getOrderAlbum() {
  var orderList = '';
  orderedNodes = document.getElementById("album_list").getElementsByTagName("li");
  for (var i=0;i < orderedNodes.length;i++) {
    orderList += orderedNodes[i].getAttribute('idalbum') + ',';
    }
  document.getElementById("sort_id").value = orderList;
}

function check_image(obj){
	var panjang;
	gambar = obj.value
	panjang=gambar.length
	ext=gambar.substr(panjang-3,panjang).toUpperCase();
	if(ext!="JPG"){
		obj.value="";
		alert("Image must be in .jpg format");
	}
}

function delImages(aid){
	var aid;
	if (confirm('Are you sure want to delete all pictures in this album?'))
		document.location.href='admin/add_image.php?aid=' + aid + '&delall';
}