webserver_path = location.hostname;
kanserver_path = "";

//webserver_path = "www.cweb.com.hk";
//kanserver_path = "www.cweb.com.hk";

div_path = "/";
cv_sc_base_path = "http:" + "//" + kanserver_path + "/" + webserver_path;
cv_nonsc_base_path = "http:" + "//" + webserver_path;

sc_path = cv_sc_base_path + div_path;
tc_path = cv_nonsc_base_path + div_path;

if ((location.href.toString().search('/sc/') != -1)||(location.href.toString().search('/sc_txt/') != -1)) {
	atgb = 1
} else {
	atgb = 0;
}

function switchLang(lang)
{

 if (parent.frames.length > 0)
  {
	for (i=0; i<parent.frames.length; i++)
	{
		org_path=parent.frames[i].location.pathname;
		org_path = org_path.replace("/en/", "/"+lang+"/");
		org_path = org_path.replace("/tc/", "/"+lang+"/");
		org_path = org_path.replace("/sc/", "/"+lang+"/");
		org_path = org_path.replace("/en_txt/", "/"+lang+"/");
		org_path = org_path.replace("/tc_txt/", "/"+lang+"/");
		org_path = org_path.replace("/sc_txt/", "/"+lang+"/");
	
		parent.frames[i].location.href = org_path;

	}
  }
  else
  {
	  	org_path=parent.location.pathname;
		org_path = org_path.replace("/en/", "/"+lang+"/");
		org_path = org_path.replace("/tc/", "/"+lang+"/");
		org_path = org_path.replace("/sc/", "/"+lang+"/");
		org_path = org_path.replace("/en_txt/", "/"+lang+"/");
		org_path = org_path.replace("/tc_txt/", "/"+lang+"/");
		org_path = org_path.replace("/sc_txt/", "/"+lang+"/");
	  	parent.location.href = org_path + "?num=" + getVar('num');
  }

}

function show_link() {

	if (atgb) 
	{
		document.write("<A onmouseover=\"MM_swapImage('mainbar3','','../clf/sc/mainbar3b_f2.gif',1)\"  onmouseout=MM_swapImgRestore() href=\"javascript:changelang('tc')\"    target=_top><IMG src=\"../clf/sc/mainbar3b.gif\" alt=\"ÁcÅéª©\" name=mainbar3 width=49 height=19       border=0 id=\"mainbar3\"></A>");

	} else 
	{
	document.write ("<A  onmouseover=\"MM_swapImage('mainbar3','','../clf/b5/mainbar3b_f2.gif',1)\"    onmouseout=MM_swapImgRestore()     href=\"javascript:changelang('sc')\"       target=_top><IMG src=\"../clf/b5/mainbar3b.gif\" alt=\"Â²Ê^ª©\" name=mainbar3 width=49 height=19       border=0 id=\"mainbar3\"></A>");
	}
}

function getVar(name)
         {
         get_string = document.location.search;         
         return_value = '';
         
         do { //This loop is made to catch all instances of any get variable.
            name_index = get_string.indexOf(name + '=');
            
            if(name_index != -1)
              {
              get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);
              
              end_of_value = get_string.indexOf('&');
              if(end_of_value != -1)                
                value = get_string.substr(0, end_of_value);                
              else                
                value = get_string;                
                
              if(return_value == '' || value == '')
                 return_value += value;
              else
                 return_value += ', ' + value;
              }
            } while(name_index != -1)
            
         //Restores all the blank spaces.
         space = return_value.indexOf('+');
         while(space != -1)
              { 
              return_value = return_value.substr(0, space) + ' ' + 
              return_value.substr(space + 1, return_value.length);
							 
              space = return_value.indexOf('+');
              }
          
         return(return_value);        
}
