﻿function nuc_textCounter(field, countfield, maxlimit)
 {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

function submit_on_change(theform){
document.getElementById(theform).submit();
}


function submitform(pressbutton){
	document.adminForm.func.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}



function submitform_dir(pressbutton){
	document.adminForm.directory.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}

function checkBox(id){

var element=document.getElementById(id);

element.checked=true;

//document.adminForm.checked;
}

//public form validations
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{alert(alerttxt);return false}
else {return true}
}
}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}
}
}



function printpage() {
window.print();  
}


//http://www.alistapart.com/articles/imagegallery
/*
function showPic (pic, caption) {


 if (document.getElementById) {
  document.getElementById('placeholder') .src = pic;
  if (caption) {
   document.getElementById('desc') .childNodes[0].nodeValue = caption;
  }

  if (!caption) {
  {
   document.getElementById('desc') .childNodes[0].nodeValue = null;
  }
 
  if (summary) {
   document.getElementById('summ') .childNodes[0].nodeValue = summary;
  } 
   if (!summary)
  {
   document.getElementById('summ') .childNodes[0].nodeValue =null;
  }

  return false;
 } 
 
 else {
 return true;
 }
}
*/

function showPic (pic, caption,summary) {
 if (document.getElementById) {
  document.getElementById('placeholder') .src = pic;
  if (caption) {
   document.getElementById('desc') .childNodes[0].nodeValue = caption;
  }
    if (!caption) {
   document.getElementById('desc') .childNodes[0].nodeValue = "";
  }

    if (summary !="none") {
   document.getElementById('gallery_summary') .childNodes[0].nodeValue = summary;
  }

  return false;
 } else {
  return true;
 }
}


