var submitted = false;      // to avoid double-click

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function bookmark(url) {
//  var url = this.location;
  var description = document.title;
  netscape="Netscape User's hit CTRL+D to add a bookmark to this site."
  if (navigator.appName=='Microsoft Internet Explorer')
    window.external.AddFavorite(url, description);
  else if (navigator.appName=='Netscape')
    alert(netscape);
}//end-func-bookmark

function validateSearch(inputObj, errMsg) {
  var valid = false;
  with (inputObj) {
    if (value.length>2) valid = true;
  }
  if (!valid) alert(errMsg);
  return valid;
}

function validatePoll(errMsg) {
  var valid = false;
  if (document.pollAction.n_2_3_poll_option_id) {
    with (document.pollAction) {
      for (var i=0; i<n_2_3_poll_option_id.length; i++) {
        if (n_2_3_poll_option_id[i].checked) {
          valid = true;
          break;
        }
      }
    }
  }
  if (!valid) alert(errMsg);
  return valid;
}//end-func-validatePoll

function votePoll() {
  with (document.pollAction) {
    var url = action;
    url = url + '?act_type=' + act_type.value;
    url = url + '&n_1_3_poll_id=' + n_1_3_poll_id.value;
    for (var i=0; i<n_2_3_poll_option_id.length; i++) {
      if (n_2_3_poll_option_id[i].checked) {
        url = url + '&n_2_3_poll_option_id=' + n_2_3_poll_option_id[i].value;
        break;
      }//end-if
    }//end-for
  }//end-with
  var features = 'width=280,height=440,toolbar=no,location=no,status=no,menubar=no,resizable=no';
  popWin = window.open(url, 'Poll', features);
  popWin.focus();
  document.pollAction.reset();
}//end-func-votePoll

function fit(w, h) {
  if(navigator.appName.indexOf('Microsoft')>=0)
    window.resizeBy(w-document.body.clientWidth, h-document.body.clientHeight);
  else window.resizeBy(w-window.innerWidth, h-window.innerHeight);
}

function addToFavorites(url, desc) {
  if (window.external) {
    external.AddFavorite(url, desc);
  }
}

//-------------------------------------------------------------------
// Disable buttons, it can be used right after submit button is
// clicked to avoid double-click
// form buttons object reference
//-------------------------------------------------------------------
function allowSubmit() {
  if (submitted) return false;
  submitted = true;
  return true;
}


