<!--
   function changelang(toLang)
   {
   if (toLang=="b5")
   {
     if (top.location.pathname.indexOf("/eng/") != -1)
     {   
	 	var path=top.location.pathname.replace(/\/eng\//,"/b5/");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
      else if (top.location.pathname.indexOf("\\eng\\") != -1)
     {
	 	var path=top.location.pathname.replace(/\\eng\\/,"\\b5\\");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     if (top.location.pathname.indexOf("/gb/") != -1)
     {   
	 	var path=top.location.pathname.replace(/\/gb\//,"/b5/");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     else if (top.location.pathname.indexOf("\\gb\\") != -1)
     {  //top.location.replace(top.location.pathname.replace(/\\gb\\/,"\\b5\\")); 
	 	var path=top.location.pathname.replace(/\\gb\\/,"\\b5\\");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
   }
   
   else if (toLang=="gb")
   {
      if (top.location.pathname.indexOf("/b5/") != -1)
     {   //top.location.replace(top.location.pathname.replace(/\/b5\//,"/gb/"));
	 	var path=top.location.pathname.replace(/\/b5\//,"/gb/");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     else if (top.location.pathname.indexOf("\\b5\\") != -1)
     {  //top.location.replace(top.location.pathname.replace(/\\b5\\/,"\\gb\\"));
	 	var path=top.location.pathname.replace(/\\b5\\/,"\\gb\\");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     if (top.location.pathname.indexOf("/eng/") != -1)
     {  //top.location.replace(top.location.pathname.replace(/\/eng\//,"/gb/"));
	 	var path=top.location.pathname.replace(/\/eng\//,"/gb/");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     else if (top.location.pathname.indexOf("\\eng\\") != -1)
     {	//top.location.replace(top.location.pathname.replace(/\\eng\\/,"\\gb\\")); 
	 	var path=top.location.pathname.replace(/\\eng\\/,"\\gb\\");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
   }
   
   else if (toLang=="eng")
   {
      if (top.location.pathname.indexOf("/b5/") != -1)
     {  //top.location.replace(top.location.pathname.replace(/\/b5\//,"/eng/"));
	 	var path=top.location.pathname.replace(/\/b5\//,"/eng/");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     else if (top.location.pathname.indexOf("\\b5\\") != -1)
     {	//top.location.replace(top.location.pathname.replace(/\\b5\\/,"\\eng\\")); 
	 	var path=top.location.pathname.replace(/\\b5\\/,"\\eng\\");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     if (top.location.pathname.indexOf("/gb/") != -1)
     {   //top.location.replace(top.location.pathname.replace(/\/gb\//,"/eng/"));
	 	var path=top.location.pathname.replace(/\/gb\//,"/eng/");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
     else if (top.location.pathname.indexOf("\\gb\\") != -1)
     {	//top.location.replace(top.location.pathname.replace(/\\gb\\/,"\\eng\\")); 
	 	var path=top.location.pathname.replace(/\\gb\\/,"\\eng\\");
			path=toMainPage(path);
	 		top.location.replace(path);
     }
   }
   else if (toLang=="html_b5")
   {
     if (top.location.pathname.indexOf("/text/b5/") != -1)
     {   
        var path=top.location.pathname.replace("/text/b5/","/b5/");
            path= toMainPage(path);
        	top.location.replace(path);
     }     
   }
   else if (toLang=="html_gb")
   {
     if (top.location.pathname.indexOf("/gb/") != -1)
     {   
        var path=top.location.pathname.replace("/text/gb/","/gb/");
            path= toMainPage(path);
        	top.location.replace(path);
     }     
   }
   else if (toLang=="html_eng")
   {     
     if (top.location.pathname.indexOf("/text/eng/") != -1)
     {   
        var path=top.location.pathname.replace("/text/eng/","/eng/");
            path= toMainPage(path);
        	top.location.replace(path);
     }     
   }

}
function toMainPage(path){
    // text version to HTML version
    // e.g text version page drinking2.aspx redirect to HTML version drinking.aspx
	if(path.indexOf("/calculator/") != -1){
       path= path.replace("2.aspx",".aspx");
       path= path.replace("3.aspx",".aspx");
       path= path.replace("4.aspx",".aspx");
       path= path.replace("_reference.aspx",".aspx");
       path= path.replace("_standard.aspx",".aspx");
       path= path.replace("_formula.aspx",".aspx");
       path= path.replace("_table.aspx",".aspx");
       path= path.replace("_result.aspx",".aspx");
       path= path.replace("_analysis.aspx",".aspx");
       path= path.replace("_formula_asian.aspx","_asian.aspx");
       path= path.replace("_table_asian.aspx","_asian.aspx");
	}
    return path;
}

//-->	
