
 function confirmdelete(form) {
  if(confirm("Are you sure you want to delete ?")) {
   return true;
  } else {
   return false;
  }
 }

 function setimage(image){ //Sets highlight border and image number on buttons when manually selected by user.
  var imgplc = 'img' +(image) +'plc'; 
   
  //Div place holder colour.
  document.getElementById('img1plc').style.borderColor = '#999999'; //Reset image 1.
  document.getElementById('img2plc').style.borderColor = '#999999'; //Reset image 2.
  document.getElementById('img3plc').style.borderColor = '#999999'; //Reset image 3.
  document.getElementById('img4plc').style.borderColor = '#999999'; //Reset image 4.
  document.getElementById(imgplc).style.borderColor = '#FF0000'; //Set requested image to red.

  //Change Button Label to detail image working with.
  document.getElementById('imgno').value = (image); //Sets button image number.
  document.getElementById('deleteimage').value = 'Delete Image ' +(image); //Update button text.
  document.getElementById('uploadimage').value = 'Upload Image ' +(image); //Update button text.
  document.getElementById('uploadimage').focus(); //Focus on Update button.
 }
  
 function showloading(image) {
  var loading = 'loading' +(image);
  var element = document.getElementById(loading);
   
  if (element != undefined) {
   element.style.display = 'inline';
   element.style.visibility = 'visible';
   
   if(image == '5') {
	element.innerHTML = "Uploading image, may take some time, please wait... <img src='images/loader.gif' border='0'>";
   } else {
	element.innerHTML = "<img src='images/loader.gif' border='0'>";
   }
  }
 }
 
 function upload_progress() {
  var image = document.getElementById('imgno').value;
  var file = document.getElementById('file').value;
  
  if(file != '') {
   showloading(5);
   showloading(image);
  }
  
  return true;
 }
