
function disableSubmit(s)
{
  // When we disable the submit button we lose its value so copy to hidden field instead
  var r = document.getElementById("submit-temp");
  r.name = s.name; 
  r.value = s.value; 
	
  s.name = "null";
  s.disabled = true; //'disabled';
  s.className = s.className + ' submit-disabled';
  s.value = 'Please wait...';
  return true;
}

function disableSubmitButtons(f)
{
  for (i = 0; i < f.length; i++) 
    {
      var s = f.elements[i];
      if(s.type == 'submit')
	{
	  disableSubmit(s);
	}
    }
}

function initialise()
{
  checkFooter();
  document.getElementById("Main").onscroll = checkFooter;
}

function checkFooter()
{
  if(document.getElementById('Main').clientHeight + document.getElementById('Main').scrollTop + 50 >= document.getElementById('Main').scrollHeight)
    {
      if(document.getElementById('Footer').style.display == "none")
	{
	  document.getElementById('Footer').className = "footer-light";
	  document.getElementById('Footer').style.display = "block";
	  setTimeout("document.getElementById('Footer').className = 'footer'",50);
	}
    }
  else
    {
      document.getElementById('Footer').style.display = "none";
    }
}

function popup()
{
  var w = 600;
  var h = 500;
  var t = window.screen.availHeight/2 - 250;
  var l = window.screen.availWidth/2 - 300;
  var popup = window.open("about:blank","popup", "height="+h+", width="+w+", top="+t+", left="+l+", status=yes ,toolbar=no ,menubar=no, location=no, resizable=yes, scrollbars=no");
  popup.focus();
}

function galleryImage(obj,galNum)
{
  for(i=1;i<=galNum;i++)
    {
      document.getElementById("GalleryLargeImage" + i).className = "gallery-large-image";
    }
  document.getElementById("GalleryLargeImage" + obj).className = "gallery-show";
  document.getElementById("Main").className = "main gallery";
}

function galleryReset(galNum)
{
  for(i=1;i<=galNum;i++)
    {
      document.getElementById("GalleryLargeImage" + i).className = "gallery-large-image";
    }
  document.getElementById("Main").className = "main";
}

window.onload = initialise;
window.onresize=checkFooter;

