if(location.href.toString().search('www0.logisticshk.gov.hk') != -1){
test_arg = "test=y&";

path = "http:" + "//" + "www0.logisticshk.gov.hk/";

tc_path = "http:" + "//" + "www0.logisticshk.gov.hk/";

front_path = "http:" + "//" + "www0.logisticshk.gov.hk/";

cv_sc_base_path = "http:" + "//" + "www0.logisticshk.gov.hk";

cv_nonsc_base_path = "http:" + "//" + "www0.logisticshk.gov.hk";}
else if(location.href.toString().search('logisticshk_ogcio.devprj.com') != -1){
test_arg = "";

path = "http:" + "//" + "logisticshk_ogcio.devprj.com/";

tc_path = "http:" + "//" + "logisticshk_ogcio.devprj.com/";

front_path = "http:" + "//" + "logisticshk_ogcio.devprj.com/";

cv_sc_base_path = "http:" + "//" + "logisticshk_ogcio.devprj.com";

cv_nonsc_base_path = "http:" + "//" + "logisticshk_ogcio.devprj.com";}
else{
test_arg = "";

//path = "http:" + "//" + "sc.info.gov.hk/gb/www.logisticshk.gov.hk/";
path = "http:" + "//" + "www.logisticshk.gov.hk/";

tc_path = "http:" + "//" + "www.logisticshk.gov.hk/";

front_path = "http:" + "//" + "www.logisticshk.gov.hk/";

//cv_sc_base_path = "http:" + "//" + "sc.info.gov.hk/gb/www.logisticshk.gov.hk";
cv_sc_base_path = "http:" + "//" + "www.logisticshk.gov.hk";

cv_nonsc_base_path = "http:" + "//" + "www.logisticshk.gov.hk";}

function pop1() {
myWin= open("ht" + "tp://hkctl.hknve.org/logscouncil/member.htm", "login",
      "width=700,height=500,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes");
}

function changeVer(lang) {
	search_str = "/";
	prog_file = "/cgi-bin/logisticshk/frame.cgi";
	
	org_path=parent.content.location.pathname;
	org_path_start=org_path.indexOf(search_str);
	org_path_end=org_path.length;
	org_path=org_path.substring(org_path_start, org_path_end);

	org_path_end=org_path.length;
	org_path_start=org_path.indexOf(search_str);
	basic_path =org_path.substring(0, org_path_start);
	tmp_str=org_path.substring(org_path_start + search_str.length, org_path_end);
	org_path_start2=tmp_str.indexOf("/");
	section =tmp_str.substring(0, org_path_start2);

	if (section) {
		org_path_start=org_path.indexOf(section);
		org_path_end=org_path.length;
		content=org_path.substring(org_path_start + section.length+1, org_path_end);
	}
	
	if (lang == 'e') {
		lang_arg = "";
	}
	if (lang == 'c') {
		lang_arg = "lang=c&";
	}
	if (lang == 's') {
		lang_arg = "lang=s&";
	}
	
	//prog_arg = "?" + test_arg + "lang=c&section=" + section + "&content=" + content;
	prog_arg = "?" + test_arg + lang_arg + "section=" + section + "&content=" + content;

	if (lang == 's') {
		base_path = cv_sc_base_path;
	} else {
		base_path = cv_nonsc_base_path;
	}
	
	parent.location = base_path + prog_file + prog_arg;
}

function switchLang(currLang, tarLang){

  var currPath = document.URL.toString();
  var lang = window.location.hostname;
	
  var head, toPath;
  toPath = "";

  if (currLang==0)
  {
    if (tarLang==1)
    {
      currPath = currPath.replace("/eng/", "/text/eng/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==2)
    {
      currPath = currPath.replace("/chi/", "/text/chi/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==3)
    {
      currPath = currPath.replace("/chi/", "/text/chi/");
      if(document.URL.toString().search('sc.info.gov.hk/gb/') == -1){ 
        if(document.URL.toString().search('common.westcomzivo.com/gb/') == -1){ 
          currPath = currPath.replace(lang, "common.westcomzivo.com/gb/" + lang);
        }
      }
      toPath = currPath;
      location = toPath;
    }
  }
  else if (currLang==1)
  {
    if (tarLang==2)
    {
      currPath = currPath.replace("/eng/", "/chi/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==0)
    {
      currPath = currPath.replace("/text/eng/", "/eng/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==3)
    {
      currPath = currPath.replace("/eng/", "/chs/");
      toPath = currPath;
      location = toPath;
    }
  }
  else if (currLang==2)
  {		
    if (tarLang==1)
    {
      currPath = currPath.replace("/chi/", "/eng/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==0)
    {
      currPath = currPath.replace("/text/chi/", "/chi/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==3)
    {
      currPath = currPath.replace("/chi/", "/chs/");
      toPath = currPath;
      location = toPath;
    }
  }
  else if (currLang==3)
  {
    if (tarLang==1)
    {
      currPath = currPath.replace("/chs/", "/eng/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==0)
    {
      currPath = currPath.replace("/text/chi/", "/chi/");
      toPath = currPath;
      location = toPath;
    }
    else if (tarLang==2)
    {
      currPath = currPath.replace("/chs/", "/chi/");
      toPath = currPath;
      location = toPath;
    }
  }
	
	//location = toPath;	
}

function PopWin(url,x,y){
    eval("nw = window.open(url,'content1','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,pageXOffset=100,pageYOffset=100,top=0,left=0,width=" + x + ",height=" + y + "')");
        if ( nw.focus != null){
        nw.focus();
    }
} 
 
 
