//------------------------------------------------------------------------------    
//  Worldlingo.com Standard Java Scripts
//
//  Copyright (c) 1999, 2000, 2001 Worldlingo Inc
//------------------------------------------------------------------------------    
function checkEncoding(form) {
  var encoding = document.charset;
  var srclang = form["wl_srclang"];			if (srclang.options[srclang.options.selectedIndex].value == "ZH_CN" &&
			    new String(encoding).toUpperCase() != new String("GB2312").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "GB2312.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "ZH_TW" &&
			    new String(encoding).toUpperCase() != new String("Big5").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "Big5.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "NL" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-1").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-1.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "FR" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-1").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-1.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "DE" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-1").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-1.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "EL" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-7").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-7.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "IT" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-1").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-1.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "JA" &&
			    new String(encoding).toUpperCase() != new String("Shift_JIS").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "Shift_JIS.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "KO" &&
			    new String(encoding).toUpperCase() != new String("euc-kr").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "euc-kr.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "PT" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-1").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-1.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "RU" &&
			    new String(encoding).toUpperCase() != new String("UTF-8").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "UTF-8.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "ES" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-1").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-1.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
  			if (srclang.options[srclang.options.selectedIndex].value == "EN" &&
			    new String(encoding).toUpperCase() != new String("iso-8859-1").toUpperCase()) {
			  alert("Your document is encoded in: " + encoding + " it should encoded be in: " + "iso-8859-1.  Our Translation Engine will try to translate your text.");
			  form["wl_srclang"].focus();
			  //return;
			}
    // if we are still here then submit the form
  form.submit();
}

function listLangPairs() {    document.write('<OPTION value="ZH_CN-EN">Chinese (Simplified) to English</OPTION>');
      document.write('<OPTION value="ZH_CN-DE">Chinese (Simplified) to German</OPTION>');
      document.write('<OPTION value="ZH_CN-ES">Chinese (Simplified) to Spanish</OPTION>');
      document.write('<OPTION value="ZH_CN-FR">Chinese (Simplified) to French</OPTION>');
      document.write('<OPTION value="ZH_CN-IT">Chinese (Simplified) to Italian</OPTION>');
      document.write('<OPTION value="ZH_CN-JA">Chinese (Simplified) to Japanese</OPTION>');
      document.write('<OPTION value="ZH_CN-KO">Chinese (Simplified) to Korean</OPTION>');
      document.write('<OPTION value="ZH_CN-PT">Chinese (Simplified) to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="ZH_CN-NL">Chinese (Simplified) to Dutch</OPTION>');
      document.write('<OPTION value="ZH_CN-EL">Chinese (Simplified) to Greek</OPTION>');
      document.write('<OPTION value="ZH_CN-RU">Chinese (Simplified) to Russian</OPTION>');
      document.write('<OPTION value="ZH_TW-DE">Chinese (Traditional) to German</OPTION>');
      document.write('<OPTION value="ZH_TW-ES">Chinese (Traditional) to Spanish</OPTION>');
      document.write('<OPTION value="ZH_TW-FR">Chinese (Traditional) to French</OPTION>');
      document.write('<OPTION value="ZH_TW-IT">Chinese (Traditional) to Italian</OPTION>');
      document.write('<OPTION value="ZH_TW-JA">Chinese (Traditional) to Japanese</OPTION>');
      document.write('<OPTION value="ZH_TW-KO">Chinese (Traditional) to Korean</OPTION>');
      document.write('<OPTION value="ZH_TW-PT">Chinese (Traditional) to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="ZH_TW-NL">Chinese (Traditional) to Dutch</OPTION>');
      document.write('<OPTION value="ZH_TW-EL">Chinese (Traditional) to Greek</OPTION>');
      document.write('<OPTION value="ZH_TW-EN">Chinese (Traditional) to English</OPTION>');
      document.write('<OPTION value="ZH_TW-RU">Chinese (Traditional) to Russian</OPTION>');
      document.write('<OPTION value="NL-FR">Dutch to French</OPTION>');
      document.write('<OPTION value="NL-IT">Dutch to Italian</OPTION>');
      document.write('<OPTION value="NL-PT">Dutch to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="NL-JA">Dutch to Japanese</OPTION>');
      document.write('<OPTION value="NL-KO">Dutch to Korean</OPTION>');
      document.write('<OPTION value="NL-ZH_CN">Dutch to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="NL-EN">Dutch to English</OPTION>');
      document.write('<OPTION value="NL-ZH_TW">Dutch to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="NL-EL">Dutch to Greek</OPTION>');
      document.write('<OPTION value="NL-DE">Dutch to German</OPTION>');
      document.write('<OPTION value="NL-ES">Dutch to Spanish</OPTION>');
      document.write('<OPTION value="NL-RU">Dutch to Russian</OPTION>');
      document.write('<OPTION value="FR-EN">French to English</OPTION>');
      document.write('<OPTION value="FR-DE">French to German</OPTION>');
      document.write('<OPTION value="FR-EL">French to Greek</OPTION>');
      document.write('<OPTION value="FR-ES">French to Spanish</OPTION>');
      document.write('<OPTION value="FR-IT">French to Italian</OPTION>');
      document.write('<OPTION value="FR-JA">French to Japanese</OPTION>');
      document.write('<OPTION value="FR-KO">French to Korean</OPTION>');
      document.write('<OPTION value="FR-ZH_TW">French to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="FR-PT">French to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="FR-ZH_CN">French to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="FR-NL">French to Dutch</OPTION>');
      document.write('<OPTION value="FR-RU">French to Russian</OPTION>');
      document.write('<OPTION value="DE-FR">German to French</OPTION>');
      document.write('<OPTION value="DE-IT">German to Italian</OPTION>');
      document.write('<OPTION value="DE-JA">German to Japanese</OPTION>');
      document.write('<OPTION value="DE-KO">German to Korean</OPTION>');
      document.write('<OPTION value="DE-PT">German to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="DE-ZH_TW">German to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="DE-NL">German to Dutch</OPTION>');
      document.write('<OPTION value="DE-ZH_CN">German to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="DE-EN">German to English</OPTION>');
      document.write('<OPTION value="DE-ES">German to Spanish</OPTION>');
      document.write('<OPTION value="DE-EL">German to Greek</OPTION>');
      document.write('<OPTION value="DE-RU">German to Russian</OPTION>');
      document.write('<OPTION value="EL-EN">Greek to English</OPTION>');
      document.write('<OPTION value="EL-DE">Greek to German</OPTION>');
      document.write('<OPTION value="EL-ES">Greek to Spanish</OPTION>');
      document.write('<OPTION value="EL-FR">Greek to French</OPTION>');
      document.write('<OPTION value="EL-ZH_TW">Greek to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="EL-IT">Greek to Italian</OPTION>');
      document.write('<OPTION value="EL-PT">Greek to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="EL-JA">Greek to Japanese</OPTION>');
      document.write('<OPTION value="EL-KO">Greek to Korean</OPTION>');
      document.write('<OPTION value="EL-ZH_CN">Greek to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="EL-NL">Greek to Dutch</OPTION>');
      document.write('<OPTION value="EL-RU">Greek to Russian</OPTION>');
      document.write('<OPTION value="IT-DE">Italian to German</OPTION>');
      document.write('<OPTION value="IT-NL">Italian to Dutch</OPTION>');
      document.write('<OPTION value="IT-ES">Italian to Spanish</OPTION>');
      document.write('<OPTION value="IT-ZH_TW">Italian to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="IT-FR">Italian to French</OPTION>');
      document.write('<OPTION value="IT-JA">Italian to Japanese</OPTION>');
      document.write('<OPTION value="IT-KO">Italian to Korean</OPTION>');
      document.write('<OPTION value="IT-EL">Italian to Greek</OPTION>');
      document.write('<OPTION value="IT-PT">Italian to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="IT-ZH_CN">Italian to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="IT-EN">Italian to English</OPTION>');
      document.write('<OPTION value="IT-RU">Italian to Russian</OPTION>');
      document.write('<OPTION value="JA-IT">Japanese to Italian</OPTION>');
      document.write('<OPTION value="JA-KO">Japanese to Korean</OPTION>');
      document.write('<OPTION value="JA-ZH_TW">Japanese to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="JA-PT">Japanese to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="JA-ZH_CN">Japanese to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="JA-EL">Japanese to Greek</OPTION>');
      document.write('<OPTION value="JA-EN">Japanese to English</OPTION>');
      document.write('<OPTION value="JA-DE">Japanese to German</OPTION>');
      document.write('<OPTION value="JA-ES">Japanese to Spanish</OPTION>');
      document.write('<OPTION value="JA-NL">Japanese to Dutch</OPTION>');
      document.write('<OPTION value="JA-FR">Japanese to French</OPTION>');
      document.write('<OPTION value="JA-RU">Japanese to Russian</OPTION>');
      document.write('<OPTION value="KO-EN">Korean to English</OPTION>');
      document.write('<OPTION value="KO-ZH_TW">Korean to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="KO-DE">Korean to German</OPTION>');
      document.write('<OPTION value="KO-EL">Korean to Greek</OPTION>');
      document.write('<OPTION value="KO-ES">Korean to Spanish</OPTION>');
      document.write('<OPTION value="KO-FR">Korean to French</OPTION>');
      document.write('<OPTION value="KO-NL">Korean to Dutch</OPTION>');
      document.write('<OPTION value="KO-IT">Korean to Italian</OPTION>');
      document.write('<OPTION value="KO-JA">Korean to Japanese</OPTION>');
      document.write('<OPTION value="KO-PT">Korean to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="KO-ZH_CN">Korean to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="KO-RU">Korean to Russian</OPTION>');
      document.write('<OPTION value="PT-ZH_TW">Portuguese (Brazil) to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="PT-NL">Portuguese (Brazil) to Dutch</OPTION>');
      document.write('<OPTION value="PT-FR">Portuguese (Brazil) to French</OPTION>');
      document.write('<OPTION value="PT-IT">Portuguese (Brazil) to Italian</OPTION>');
      document.write('<OPTION value="PT-JA">Portuguese (Brazil) to Japanese</OPTION>');
      document.write('<OPTION value="PT-KO">Portuguese (Brazil) to Korean</OPTION>');
      document.write('<OPTION value="PT-ZH_CN">Portuguese (Brazil) to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="PT-EN">Portuguese (Brazil) to English</OPTION>');
      document.write('<OPTION value="PT-DE">Portuguese (Brazil) to German</OPTION>');
      document.write('<OPTION value="PT-EL">Portuguese (Brazil) to Greek</OPTION>');
      document.write('<OPTION value="PT-ES">Portuguese (Brazil) to Spanish</OPTION>');
      document.write('<OPTION value="PT-RU">Portuguese (Brazil) to Russian</OPTION>');
      document.write('<OPTION value="RU-JA">Russian to Japanese</OPTION>');
      document.write('<OPTION value="RU-ZH_TW">Russian to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="RU-KO">Russian to Korean</OPTION>');
      document.write('<OPTION value="RU-NL">Russian to Dutch</OPTION>');
      document.write('<OPTION value="RU-EL">Russian to Greek</OPTION>');
      document.write('<OPTION value="RU-PT">Russian to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="RU-ZH_CN">Russian to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="RU-EN">Russian to English</OPTION>');
      document.write('<OPTION value="RU-DE">Russian to German</OPTION>');
      document.write('<OPTION value="RU-ES">Russian to Spanish</OPTION>');
      document.write('<OPTION value="RU-FR">Russian to French</OPTION>');
      document.write('<OPTION value="RU-IT">Russian to Italian</OPTION>');
      document.write('<OPTION value="ES-IT">Spanish to Italian</OPTION>');
      document.write('<OPTION value="ES-EL">Spanish to Greek</OPTION>');
      document.write('<OPTION value="ES-NL">Spanish to Dutch</OPTION>');
      document.write('<OPTION value="ES-JA">Spanish to Japanese</OPTION>');
      document.write('<OPTION value="ES-ZH_TW">Spanish to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="ES-KO">Spanish to Korean</OPTION>');
      document.write('<OPTION value="ES-PT">Spanish to Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="ES-ZH_CN">Spanish to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="ES-EN">Spanish to English</OPTION>');
      document.write('<OPTION value="ES-DE">Spanish to German</OPTION>');
      document.write('<OPTION value="ES-FR">Spanish to French</OPTION>');
      document.write('<OPTION value="ES-RU">Spanish to Russian</OPTION>');
      document.write('<OPTION value="EN-DE">English to German</OPTION>');
      document.write('<OPTION value="EN-ZH_CN">English to Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="EN-NL">English to Dutch</OPTION>');
      document.write('<OPTION value="EN-KO">English to Korean</OPTION>');
      document.write('<OPTION value="EN-EL">English to Greek</OPTION>');
      document.write('<OPTION value="EN-ES">English to Spanish</OPTION>');
      document.write('<OPTION value="EN-FR">English to French</OPTION>');
      document.write('<OPTION value="EN-IT">English to Italian</OPTION>');
      document.write('<OPTION value="EN-RU">English to Russian</OPTION>');
      document.write('<OPTION value="EN-ZH_TW">English to Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="EN-JA">English to Japanese</OPTION>');
      document.write('<OPTION value="EN-PT">English to Portuguese (Brazil)</OPTION>');
  
}

function listSrcLangs() {    document.write('<OPTION value="EN">English</OPTION>');
      document.write('<OPTION value="ZH_CN">Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="ZH_TW">Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="NL">Dutch</OPTION>');
      document.write('<OPTION value="FR">French</OPTION>');
      document.write('<OPTION value="DE">German</OPTION>');
      document.write('<OPTION value="EL">Greek</OPTION>');
      document.write('<OPTION value="IT">Italian</OPTION>');
      document.write('<OPTION value="JA">Japanese</OPTION>');
      document.write('<OPTION value="KO">Korean</OPTION>');
      document.write('<OPTION value="PT">Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="RU">Russian</OPTION>');
      document.write('<OPTION value="ES">Spanish</OPTION>');
  
}

function listTrgLangs() {    document.write('<OPTION value="EN">English</OPTION>');
      document.write('<OPTION value="ZH_CN">Chinese (Simplified)</OPTION>');
      document.write('<OPTION value="ZH_TW">Chinese (Traditional)</OPTION>');
      document.write('<OPTION value="NL">Dutch</OPTION>');
      document.write('<OPTION value="FR">French</OPTION>');
      document.write('<OPTION value="DE">German</OPTION>');
      document.write('<OPTION value="EL">Greek</OPTION>');
      document.write('<OPTION value="IT">Italian</OPTION>');
      document.write('<OPTION value="JA">Japanese</OPTION>');
      document.write('<OPTION value="KO">Korean</OPTION>');
      document.write('<OPTION value="PT">Portuguese (Brazil)</OPTION>');
      document.write('<OPTION value="RU">Russian</OPTION>');
      document.write('<OPTION value="ES">Spanish</OPTION>');
  
}

// Purpose: Validate the form relating to Worldlingo Translator
function ValidateTranslatorForm(form) {
  // Make sure that a source language has been entered
  selIndex = form["wl_srclang"].selectedIndex;
  if (form["wl_srclang"].options[selIndex].value == "none") {
    alert("Please select source language.");
    form["wl_srclang"].focus();
    return;
  }
  // Make sure that a target language has been entered
  selIndex = form["wl_trglang"].selectedIndex;
  if (form["wl_trglang"].options[selIndex].value == "none") {
    alert("Please select target language.");
    form["wl_trglang"].focus();
    return;
  }
  // Make sure that a target language has been entered
  selIndex1 = form["wl_srclang"].selectedIndex;
  selIndex2 = form["wl_trglang"].selectedIndex;
  if (form["wl_srclang"].options[selIndex1].value == form["wl_trglang"].options[selIndex2].value) {
    alert("Please select two different languages.");
    form["wl_trglang"].focus();
    return;
  }
  // if we are still here then submit the form
  // checkEncoding(form);
  form.submit();
}


//=============================================================================
//Function inputs special characters from the select boxes to the specified form field 

function handleListChange(theList) {
  var numSelected = theList.selectedIndex ;

  if (numSelected != 0) {
    textValue = window.opener.document.textform.wl_text.value ;
    textValue = textValue + theList.options[numSelected].value ;
    window.opener.document.textform.wl_text.value = textValue ;
    theList.selectedIndex = 0 ;
   // window.opener.document.textform.wl_text.focus() ;
  }
}

//==============================================================================
//end hide for older browsers -->