
function showHide(){
  var element;
  for (var i=0; i<=showHide.arguments.length; i++) {
    element = document.getElementById(showHide.arguments[i]);
      if(element == null) { continue };
    element.style.display=='' ?  element.style.display='none' : element.style.display='';
  }
}



// enforces maxLength for textareas
// USE: <textarea maxlength="40" onkeyup="return maxLength(this)"></textarea>
// -------------------------------------------------------------------------------------------
function maxLength(obj) {
  var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
  if (obj.getAttribute && obj.value.length>mlength)
  obj.value=obj.value.substring(0,mlength)
}



// popUp simplified -- opens files in popup
// Add these featues | toolbar=0,location=0,menubar=0 | On new version
// This should center win (w) would be with par
// LeftPosition=(screen.width)?(screen.width-w)/2:100;
// TopPosition=(screen.height)?(screen.height-h)/2:100;
function popUpWin(url,name,width,height,scroll,resize,status) {
  var winW = (screen.width - width) / 2;
  var winH = (screen.height - height) / 2 - 35;
  win = window.open(url,name,'width='+width+',height='+height+',top='+winH+',left='+winW+',scrollbars='+scroll+',resizable='+resize+',status='+status+'')
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}



// popUp advanced -- opens subs only with extras parameters
function popUpSub(popThis, popWidth, popHeight, popScroll, popResize, popTitle, popExtra1, popExtra2) {
  var winMidWidth = (screen.width - popWidth) / 2;
  var winMidHeight = (screen.height - popHeight) / 2 - 35;
  window.open('.?popTitle='+popTitle+'&popExtra1='+popExtra1+'&popExtra2='+popExtra2+'&popIt='+popThis, null, 'width='+popWidth+',height='+popHeight+',top='+winMidHeight+',left='+winMidWidth+',history=no,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars='+popScroll+',resizable='+popResize+'');
}



function delPage() {
  if (window.confirm("Are you sure you want to delete this page?                   \n\nProceed only if you are absolutely sure.")){
    return true;
  }
  return false;
}

function delNews() {
  if (window.confirm("Are you sure you want to delete this news?                   \n\nProceed only if you are absolutely sure.")){
    return true;
  }
  return false;
}
