// Anti-Claus javascript

//alert('JavaScript Loaded');

function goHome ()
{
  window.location.href='http://www.anti-claus.com';
}

function refresh ()
{
  history.go(0);
}

function reload ()
{
  history.go(0);
}

function closeWindowTimed (t)
{
  setTimeout('self.close();',t);
}

function closeWindowOnEnter () // close window on enter key
{
  if (event.keyCode == 13) { self.close(); }
} 

function resizeWindow(w, h) // for single image
{
  if ( document.images[0] )
  {
    window.resizeTo(document.images[0].width+w,document.images[0].height+h);
  }
  self.focus();
}

function popupWindow (url,name,opt) // correct order
{
  // alert ('in popupWindow');
  if (opt == '' || opt == 'default')
  {
    opt = 'height=300,width=300,resizable=1,scrollbars=1,toolbar=0,menubar=0,titlebar=0';
  }
  var newwin = window.open(url,name,opt);
  newwin.focus();
}

function confirmLogout ()
{
  if ( confirm ('Are you sure you want to logout?') == true )
  {
    window.location.href='../logout.cfm?dc=yes';
  }
}
function confirmExit ()
{
  if ( confirm ('Are you sure you want to exit?') == true )
  {
    window.location.href='../logout.cfm?dc=no';
  }
}
function confirmCloseWindow ()
{
  if ( confirm ('Are you sure you want to close this window?') == true )
  {
    window.close();
  }
}

function confirmDelete (id)
{
  if ( confirm ('Are you sure you want to delete this record?') == true )
  {
    document.mainform.id.value = id;
    document.mainform.action.value = 'delete';
    document.mainform.submit();
  }
}

function confirmUpdate (id)
{
  if ( confirm ('Are you sure you want to update this record?') == true )
  {
    document.mainform.id.value = id;
    document.mainform.action.value = 'update';
    document.mainform.submit();
  }
}

function unconfirmedUpdate (id)
{
    document.mainform.id.value = id;
    document.mainform.action.value = 'update';
    document.mainform.submit();
}

// Anti Claus only

  function contactOrder (m)
  {
    var m;
    document.menuform.mode.value = m;
    document.menuform.submit();
  }
  function confirmCancel ()
  {
    if (confirm('Are you sure you want to cancel?\nYou will lose all the info typed in on this page!') == true)
    {
      window.location.href='http://www.anti-claus.com/cancelled.cfm?mode=mail';
    }
  }
  function confirmViewAnswers (url)
  {
    if ( confirm("Are you SURE you want to see the answers?") == true )
    {
      popupWindow (url,'QuizAnswers','height=500,width=600,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,titlebar=no');
    }
  }

// end of utilities

