var english = "/english/";
var chinese = "/chinese/";
var sc = "/sc/";
var textonly = "/text";

// For Interactive Glossary of Chemical Terms search result page
var e_glossary = "http://www.govtlab.gov.hk/english/glossary.htm";
var c_glossary = "http://www.govtlab.gov.hk/chinese/glossary.htm";
var s_glossary = "http://www.govtlab.gov.hk/sc/glossary.htm";

function tran_gb() {
  var lk = top.location.href;

  if (lk.indexOf(english) != -1) lk = lk.replace(english,sc);
  if (lk.indexOf(chinese) != -1) lk = lk.replace(chinese,sc);

  // For Interactive Glossary of Chemical Terms search result page
  if (lk.indexOf("e_result") != -1 || lk.indexOf("c_result") != -1) lk = s_glossary;

  top.location.href = lk;
}

function tran_b5() {
  var lk = top.location.href;

  if (lk.indexOf(english) != -1) lk = lk.replace(english,chinese);
  if (lk.indexOf(sc) != -1) lk = lk.replace(sc,chinese);

  // For Interactive Glossary of Chemical Terms search result page
  if (lk.indexOf("e_result") != -1 || lk.indexOf("s_result") != -1) lk = c_glossary;

  top.location.href = lk;
}

function tran_en() {
  var lk = top.location.href;

  if (lk.indexOf(chinese) != -1) lk = lk.replace(chinese,english);
  if (lk.indexOf(sc) != -1) lk = lk.replace(sc,english); 	

  // For Interactive Glossary of Chemical Terms search result page
  if (lk.indexOf("c_result") != -1 || lk.indexOf("s_result") != -1) lk = e_glossary;

  top.location.href = lk;
}

function tran_text() {
  var lk = top.location.href;

  if (lk.indexOf(english) != -1) lk = lk.replace(english,textonly+english); 	
  if (lk.indexOf(chinese) != -1) lk = lk.replace(chinese,textonly+chinese); 	
  if (lk.indexOf(sc) != -1) lk = lk.replace(sc,textonly+sc); 	

  // For Interactive Glossary of Chemical Terms search result page
  if (lk.indexOf("e_result") != -1) lk = e_glossary.replace(english,textonly+english); 	
  if (lk.indexOf("c_result") != -1) lk = c_glossary.replace(chinese,textonly+chinese); 	
  if (lk.indexOf("s_result") != -1) lk = s_glossary.replace(sc,textonly+sc); 	

  top.location.href = lk;
}

function openar(year) {
  switch (year) {
    case 2008:
      window.open("../ar2008/index.html",null,"height=600,width=800,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
      break;
    case 2007:
      window.open("../ar2007/index.html",null,"height=600,width=800,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
  }
}

function openkeyind(pg) {
  window.open(pg,null,"height=500,width=600,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
}

function openwin(pg) {
  window.open(pg,null,"height=500,width=600,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
}
