function sf(inID){try { document.getElementById(inID).focus(); } catch(e) {} }

var winLink;
function displayExternalLink(location) {
  try {
    if (winLink) winLink.close();
    winLink = window.open("/links/jumpto.asp?page=" + location,"AiS_Link")
    if (winLink) try { winLink.focus(); } catch (e) { }
  } catch (e) {
    return (true);
  }
  return (false);
} 

var winPDF;
function PDFWindow(location) {
  try {
    if (winPDF) { winPDF.close(); }
    winPDF = window.open(location,"pdf_window","toolbar=no,location=no,status=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=550,height=550")
    if (winPDF) try { winPDF.focus(); } catch (e) { }
  } catch (e) {
    return (true);
  }
  return (false);
}

var winNew;
function displayInNewWindowWH(location,winname,width,height) {
  if (winNew) winNew.close();
  winNew = window.open(location,winname,"toolbar=no,location=no,status=no,directories=no,menubar=no,scrollbars=auto,resizable=no,width=" + width + ",height=" + height)
  if (winNew) try { winNew.focus(); } catch (e) { return(true); }
  return (false);
} 
function displayInNewWindowWH2(location,winname,width,height) {
  if (winNew) winNew.close();
  winNew = window.open(location,winname,"toolbar=no,location=no,status=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height)
  if (winNew) try { winNew.focus(); } catch (e) { return(true); }
  return (false);
} 
function displayInNewWindow(location,winname) {
  if (winNew) winNew.close();
  winNew = window.open(location,winname)
  if (winNew) try { winNew.focus(); } catch (e) { return(true); }
  return (false);
} 

function checkEmail(theForm) {
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@._-&()'";
  var checkStr = theForm.Email.value;
  var allValid = false;

  if (checkStr.length < 6) {
    alert("Please enter a valid Email address.");
    theForm.Email.focus();
    return (false);
  }

  for (i = 0; i < checkStr.length; i++) {
    ch = checkStr.charAt(i);
    if (ch == ".") {
      allValid = true;
      break;
    }
  }
  
  if (allValid) {
    allValid = false;
    for (i = 0; i < checkStr.length; i++) {
      ch = checkStr.charAt(i);
      if (ch == "@") {
        allValid = true;
        break;
      }
    }
  }
  
  if (!allValid) {
    alert("Please enter a valid Email address.");
    return (false);
  }

  for (i = 0; i < checkStr.length; i++) {
    ch = checkStr.charAt(i);
    for (j = 0; j < checkOK.length; j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length) {
      allValid = false;
      break;
    }
  }
  if (!allValid) {
    alert("Please enter only letter, digit and \"@._-&()\" characters for your email address.");
    theForm.Email.focus();
    return (false);
  }
  return (true);
}

function CreateStandardFlash(elementID,movieName,width,height,movieID,bgColour) {
  var d;
  try {
    d = document.getElementById(elementID);
    d.innerHTML = '<object type="application/x-shockwave-flash" data="' + movieName + '" width="' + width + '" height="' + height + '" id="' + movieID + '" viewastext><param name="movie" value="' + movieName + '" /><param name="quality" value="high" /><param name="bgcolor" value="' + bgColour + '" />';
  } catch(e) {
    return (false);
  }
  return (true);
}