/**************************** Variable Declaration Section *************************************************/ var selectedSection; var selectedSubSection; var selectedSecondSubSection; var subPath; var locationPath; var langID; var titleID; var langNum; var langPath; var langCode = 'en'; var menu; var txtHome; var txtContact; var txtSitemap; var txtSearch; var txtGo; var mode; var searchLink; var screenWidth = screen.width; var sitePath = 'https://www.hkreform.gov.hk/'; //var sitePath = 'http://lrcwww.ai-sol.com/'; //var sitePath = 'http://localhost/~tonylaw/lrc/'; var imagePath = sitePath + 'common/images/'; var langCodeEN = 'en'; var langCodeTC = 'tc'; var langCodeGB = 'gb'; var langCodeCHS = 'chs'; var searchDate; var revisionDate; var reviewDate; // variables with values stored in cookies var cookie = readCookie("textsize"); var textsize = cookie ? cookie : 1; // 1=normal 2=larger 3=largest var mobileMode; cookie = readCookie("mobileMode"); if (cookie != null){ mobileMode = cookie; }else if(screenWidth<800){ //switch to mobile mode if screen width is less than 800px; mobileMode = 1; }else{ mobileMode = 0; } /**************************** Variable Declaration Section FINISH ******************************************/ /**************************** Language / Server Path declaration ******************************************/ isText=false; if(document.URL.toString().search('/' + langCodeEN + '/')!=-1 || location.search.toString().indexOf('lang=' + langCodeEN)!=-1 || location.search.toString().indexOf('mode=257')!=-1){ langPath = langCodeEN + '/'; langID=1; titleID=1; txtPageTitle = 'The Law Reform Commission of Hong Kong'; txtHome = 'HOME'; txtContact = 'CONTACT'; txtSitemap = 'SITE MAP'; txtSearch = 'SEARCH'; txtGo = 'GO'; txtRevisionDate = "Last revision date"; txtGoToTop = "Go to Top"; txtSearchFieldLabel = "Input Search"; mode = 257; searchLink = "https://www.search.gov.hk/search.html"; }else if ((document.URL.toString().search('/' + langCodeTC + '/')!=-1 || location.search.toString().indexOf('lang=' + langCodeTC)!=-1 || location.search.toString().indexOf('mode=258')!=-1) &&!(document.URL.toString().search('/gb/')!=-1)){ langPath = langCodeTC + '/'; langID=2; titleID=2; txtPageTitle = "香港法律改革委員會"; txtHome = '主頁'; txtContact = '聯絡我們'; txtSitemap = '網頁指南'; txtSearch = '搜尋'; txtGo = '去'; txtRevisionDate = "修訂日期"; txtGoToTop = "頁首"; txtSearchFieldLabel = "搜尋輸入"; mode = 258; searchLink = "https://www.search.gov.hk/search.html"; }else{ langPath = langCodeCHS + '/'; langID=3; titleID=3; txtPageTitle = '香港法律改革委员会'; txtHome = '主页'; txtContact = '联络我们'; txtSearch = '搜寻'; txtSitemap = '网页指南'; txtGo = '去'; txtRevisionDate = "修订日期"; txtGoToTop = "页首"; txtSearchFieldLabel = "搜寻输入"; mode = 258; searchLink = "https://www.search.gov.hk/search.html"; } var gicSearchForm; var ui_langs = new Array("en", "zh-hk", "zh-cn"); var ui_charsets = new Array("utf-8", "utf-8", "utf-8"); gicSearchForm='
\n'; gicSearchForm+='\n'; gicSearchForm+='\n'; gicSearchForm+='\n'; gicSearchForm+='\n'; gicSearchForm+='\n'; gicSearchForm+='\n'; /* if (isText) gicSearchForm+='\n'; */ if(location.href.toString().search('dev01.westcomzivo.com/lrc')!=-1){ if(location.href.toString().search('/gb/')!=-1){ subPath="http://common.westcomzivo.com/gb/dev01.westcomzivo.com/lrc/" } else{ subPath="http://dev01.westcomzivo.com/lrc/" } } if(location.href.toString().search('www0.hkreform.gov.hk')!=-1){ if(location.href.toString().search('/gb/')!=-1){ subPath="http://sc.info.gov.hk/gb/www0.hkreform.gov.hk/" } else{ subPath="http://www0.hkreform.gov.hk/" } } if(location.href.toString().search('www.hkreform.gov.hk')!=-1){ if(location.href.toString().search('/gb/')!=-1){ subPath="http://sc.info.gov.hk/gb/www.hkreform.gov.hk/" } else{ subPath="https://www.hkreform.gov.hk/" } } if(location.href.toString().search('ogciohkreform.arcotect.com')!=-1){ if(location.href.toString().search('/gb/')!=-1){ subPath="http://sc.info.gov.hk/gb/www.hkreform.gov.hk/" } else{ subPath="http://ogciohkreform.arcotect.com/" } } if(location.href.toString().search('se.cgi')!=-1){ subPath="https://www.hkreform.gov.hk/" } /* if(location.href.toString().search('TextOnly.pl')!=-1){ subPath="TextOnly.pl?search="; } */ if(subPath=='' || subPath==null){ //var lastSlash=location.href.toString().lastIndexOf('/'); //subPath=location.href.toString().substring(0, lastSlash); subPath = sitePath; } locationPath = subPath + langPath; if(location.href.toString().search('westcomzivo')!=-1){ //Setting kanhan Server gb_urlPath='common.westcomzivo.com/gb/'; }else{ gb_urlPath='sc.info.gov.hk/gb/'; } // return the current language code function getLangCode(){ if(document.URL.toString().search('/' + langCodeEN + '/')!=-1 || location.search.toString().indexOf('lang=' + langCodeEN)!=-1){ langCode = langCodeEN; }else if(document.URL.toString().search('/' + langCodeTC + '/')!=-1 || location.search.toString().indexOf('lang=' + langCodeTC)!=-1){ langCode = langCodeTC; }else if(document.URL.toString().search('/' + langCodeCHS + '/')!=-1 || location.search.toString().indexOf('lang=' + langCodeCHS)!=-1){ langCode = langCodeCHS; } return langCode; } // get URL paramenter function getURLParam(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ){ return ""; }else{ return results[1]; } } // Cookie functions to store user session info such as fontsize function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } // Get stylesheet based on selected font size function getFontsizeStyle(){ var outText = ""; document.writeln(outText); } // Get stylesheet based on selected mobile selection function getMobileStyle(){ if(mobileMode == 1){ document.writeln(""); } } // Switch Textsize function textsizeSwitch(inSize){ textsize = inSize; createCookie("textsize", inSize, 365); location.reload(); } // Switch Mobile Version function mobileModeSwitch(inValue){ mobileMode = inValue; createCookie("mobileMode", inValue, 365); if (inValue == 1){ // text default to "normal" for mobile textsize = 1; createCookie("textsize", 1, 365); }else{ // text default to "normal" textsize = 1; createCookie("textsize", 1, 365); } location.reload(); } // Switch Language function langSwitch(lang) { var currentPath = location.href.toString(); var tempPath = location.href.toString(); var currLang = '/' + getLangCode() + '/'; var switchTc = '/tc/'; var switchEn = '/en/'; var switchChs = '/chs/'; var switchText = '/text'; var switchGraphics = '/text'; var urlVars = document.location.search; if (location.href.toString().search('se.cgi')!=-1){ switch (lang){ case '/text/': if (langID==1){ tempPath=tempPath.replace("mode=257", "mode=394"); } if (langID==2){ tempPath=tempPath.replace("mode=258", "mode=395"); } if (langID==3){ tempPath=tempPath.replace("mode=258", "mode=395"); tempPath=tempPath.replace('https://', 'https://'+gb_urlPath); } goPath=tempPath; break; case '/graphics/': if (langID==4){ tempPath=tempPath.replace("mode=394", "mode=257"); } if (langID==5){ tempPath=tempPath.replace("mode=395", "mode=258"); } if (langID==6){ tempPath=tempPath.replace("mode=395", "mode=258"); tempPath = tempPath.replace(gb_urlPath, ''); } goPath=tempPath; break; case '/gb/': if (langID==1){ tempPath=tempPath.replace('https://', 'https://'+gb_urlPath); tempPath=tempPath.replace("mode=257", "mode=258"); tempPath=tempPath.replace("search", "search2"); } if (langID==2){ tempPath=tempPath.replace('https://', 'https://'+gb_urlPath); // tempPath=tempPath.replace("mode=258", "mode=396"); } if (langID==6){ tempPath = tempPath.replace(gb_urlPath, ''); tempPath=tempPath.replace("mode=258", "mode=395"); } if (langID==4){ tempPath=tempPath.replace('https://', 'https://'+gb_urlPath); tempPath=tempPath.replace("mode=394", "mode=395"); tempPath=tempPath.replace("search", "search2"); } if (langID==5){ tempPath=tempPath.replace('http://', 'http://'+gb_urlPath); // tempPath=tempPath.replace("mode=395", "mode=397"); } goPath=tempPath; break; case '/en/': if (langID==2){ tempPath=tempPath.replace("mode=258", "mode=257"); tempPath=tempPath.replace("search2", "search"); } if (langID==3){ tempPath=tempPath.replace("mode=258", "mode=257"); tempPath=tempPath.replace("search2", "search"); tempPath = tempPath.replace(gb_urlPath, ''); } if (langID==4){ tempPath=tempPath.replace("mode=394", "mode=257"); } if (langID==5){ tempPath=tempPath.replace("mode=395", "mode=394"); tempPath=tempPath.replace("search2", "search"); } if (langID==6){ tempPath=tempPath.replace("mode=395", "mode=394"); tempPath=tempPath.replace("search2", "search"); tempPath = tempPath.replace(gb_urlPath, ''); } goPath=tempPath; break; case '/tc/': if (langID==3){ tempPath = tempPath.replace(gb_urlPath, ''); // tempPath=tempPath.replace("mode=396", "mode=258"); } if (langID==2){ // tempPath=tempPath.replace("mode=257", "mode=258"); tempPath = tempPath.replace(gb_urlPath, ''); } if (langID==1){ tempPath=tempPath.replace("mode=257", "mode=258"); tempPath=tempPath.replace("search", "search2"); } if (langID==5){ // tempPath=tempPath.replace("mode=395", "mode=258"); tempPath = tempPath.replace(gb_urlPath, ''); } if (langID==4){ tempPath=tempPath.replace("mode=394", "mode=395"); tempPath=tempPath.replace("search", "search2"); } if (langID==6){ tempPath = tempPath.replace(gb_urlPath, ''); // tempPath=tempPath.replace("mode=397", "mode=395"); } goPath=tempPath; break; default: } document.location=goPath; }else{ switch (lang){ case 'en': currentPath = currentPath.replace(currLang, switchEn); break; case 'tc': currentPath = currentPath.replace(currLang, switchTc); break; case 'chs': currentPath = currentPath.replace(currLang, switchChs); break; default: } document.location = currentPath; } } /**************************** Language / Server Path declaration Finish ***********************************/ function getTitle(){ title = '' + txtPageTitle; if (selectedSection == 99){ if (langID == 1 || langID == 4){ title += ' - ' + MainTitle[1][selectedSection]; } else { title += ' - ' + MainTitle[2][selectedSection]; } }else{ if (selectedSection !='' && selectedSection !='-'){ title += ' - ' + MainTitle[titleID][selectedSection]; if (selectedSubSection !='' && selectedSection !='-'){ title += ' - ' + SubSectionTitle[titleID][selectedSection][selectedSubSection]; if (selectedSecondSubSection != '' && selectedSection !='-'){ title += ' - ' + SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][selectedSecondSubSection]; } } } } title += ''; document.writeln(title); } function getHTMLHeader(){ // Header document.writeln('
'); document.writeln('
'); //document.writeln(' '); if (langID == 1){ document.writeln(' '); } else if (langID == 2){ document.writeln(' '); } else if (langID == 3){ document.writeln(' '); } // Text Resize Buttons document.writeln('
'); document.writeln('
    '); if (langID == 1){ document.writeln('
  • '); if (textsize == 1){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); document.writeln('
  • '); if (textsize == 2){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); document.writeln('
  • '); if (textsize == 3){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); } else if (langID == 2){ document.writeln('
  • '); if (textsize == 1){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); document.writeln('
  • '); if (textsize == 2){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); document.writeln('
  • '); if (textsize == 3){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); } else if (langID == 3){ document.writeln('
  • '); if (textsize == 1){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); document.writeln('
  • '); if (textsize == 2){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); document.writeln('
  • '); if (textsize == 3){ document.writeln('A'); } else { document.writeln('A'); } document.writeln('
  • '); } document.writeln('
'); document.writeln('
'); // Language Switch Buttons document.writeln('
'); document.writeln('
    '); document.writeln('
  • '); if (mobileMode == 1){ document.writeln('DESKTOP'); } else { document.writeln('MOBILE'); } document.writeln('
  • '); document.writeln('
  • '); if (langID == 1){ document.writeln('ENGLISH'); } else { document.writeln('ENGLISH'); } document.writeln('
  • '); document.writeln('
  • '); if (langID == 2 && location.href.toString().search('sc.info.gov.hk/gb')==-1){ document.writeln('繁體'); } else { document.writeln('繁體'); } document.writeln('
  • '); document.writeln('
  • '); if (langID == 3 || location.href.toString().search('sc.info.gov.hk/gb')!=-1){ document.writeln('简体'); } else { document.writeln('简体'); } document.writeln('
  • '); // Print Button document.writeln('
  • '); if (langID == 1){ document.writeln('Print'); } else if (langID == 2){ document.writeln('打印'); } else if (langID == 3){ document.writeln('打印'); } document.writeln('
  • '); document.writeln('
'); document.writeln('
'); document.writeln('
'); // Header Menu document.writeln('
'); document.writeln(' '); document.writeln('
'); document.writeln('
'); if (menu != 'N'){ document.writeln('
'); getLeftMenuList(); document.writeln('





      W3C'); document.writeln('
'); } } function getLeftMenuList(){ document.writeln(''); } function getfooterHTML(){ var noticeText='Important notices (en)'; var reviewText='Last review date:'; if (revisionDate==''||revisionDate=='MM/DD/YYYY') revisionDate='02/15/2022'; if (reviewDate==''||reviewDate=='MM/DD/YYYY') reviewDate='02/15/2022'; if (titleID==2){ noticeText='­«­n§i¥Ü (tc)'; reviewText='ÂÐÀˤé´Á¡G (tc)'; } var monthArray=new Array(); monthArray[0]='January'; monthArray[1]='February'; monthArray[2]='March'; monthArray[3]='April'; monthArray[4]='May'; monthArray[5]='June'; monthArray[6]='July'; monthArray[7]='August'; monthArray[8]='September'; monthArray[9]='October'; monthArray[10]='November'; monthArray[11]='December'; var reDate=new Date(Date.parse(revisionDate)) var showDate=reDate.getDate()+' '+monthArray[reDate.getMonth()]+' '+reDate.getFullYear(); if (titleID==2 || titleID==3) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日'; var reDate2=new Date(Date.parse(reviewDate)) var showDate2=reDate2.getDate()+' '+monthArray[reDate2.getMonth()]+' '+reDate2.getFullYear(); if (titleID==2 || titleID==3) showDate2=reDate2.getFullYear()+'年'+(reDate2.getMonth()+1)+'月'+reDate2.getDate()+'日'; document.writeln('
'); document.writeln('
' + txtGoToTop + '
'); document.writeln('
'); if (selectedSection == 6){ document.writeln(' '+MainTitle[titleID][10]+''); } else { document.writeln(' '+MainTitle[titleID][10]+''); } if (selectedSection == 99){ if (titleID == 1) { searchDate = '15 February 2022'; } else { searchDate = '2022¦~02¤ë15¤é' } document.writeln(' '+txtRevisionDate+': '+searchDate+''); }else{ document.writeln(' '+txtRevisionDate+': '+showDate+''); } document.writeln('
'); document.writeln('
'); } function PopWin(url,x,y) { eval("nw = window.open(url,'content1','toolbar=yes,location=yes,directories=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,pageXOffset=100,pageYOffset=100,top=0,left=0,width=" + x + ",height=" + y + "')"); if ( nw.focus != null){ nw.focus(); } } function getNavLink(){ var navLink = ''; if (selectedSection == 99){ navLink = ''+txtHome+''; } else { if (selectedSection !='' && selectedSection !='-'){ navLink = ''+txtHome+''; navLink += '>'; if (selectedSubSection == ''){ navLink += MainTitle[titleID][selectedSection]; } else { navLink += ''+MainTitle[titleID][selectedSection]+''; } if (selectedSubSection !=''){ navLink += '>'; if (selectedSecondSubSection == ''){ if (selectedSection == 4){ // get news title from XML; navLink += ""; }else{ navLink += SubSectionTitle[titleID][selectedSection][selectedSubSection]; } } else{ navLink += ''+SubSectionTitle[titleID][selectedSection][selectedSubSection]+''; } if (selectedSecondSubSection != ''){ navLink += '>'; navLink += SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][selectedSecondSubSection]; } } } } document.writeln(navLink); } function getSecondLevel(){ if (SubSection[1][selectedSection].length>0){ var secondLevel = ""; if (selectedSection == 4){ // In News section, the most updated one needed to be on top, so it need to use reverse function secondLevel += ''; for (var i=SubSection[1][selectedSection].length-1; i>0; i--){ if (selectedSubSection == i){ secondLevel += SubSectionTitle[titleID][selectedSection][i]; }else{ secondLevel += ''+SubSectionTitle[titleID][selectedSection][i]+''; } if ((i-1)>0){ secondLevel += '|'; } } secondLevel += ''; } else { secondLevel += ''; for (var i=1; i'; }else{ secondLevel += ''+SubSectionTitle[titleID][selectedSection][i]+''; } if ((i+1)0){ var thirdLevel = ''; thirdLevel += ''; for (var i=1; i'; }else{ thirdLevel += ''+SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][i]+''; } if ((i+1)'); if (selectedSection !=99){ if (selectedSection != 6){ document.writeln(''); if (MainTitle[titleID][selectedSection] != null){ document.writeln('

'+MainTitle[titleID][selectedSection]+'

'); } } if (selectedSubSection != '' && selectedSubSection != '-'){ if (selectedSection != 4){ getSecondLevel(); } else { getSectionList(4, '') document.writeln(''); } // Skip this for News page because Title will be generated from XML if (selectedSection != 4){ document.writeln('

'); getHeader() document.writeln('

'); } } if (selectedSecondSubSection != '' && selectedSecondSubSection != '-'){ getThirdLevel(); document.writeln('

'+SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][selectedSecondSubSection]+'

'); } } document.writeln(''); } function getSectionList(section, subSection){ if (subSection == ''){ if (section == 4){ // In News section, the index is generated using XML document.writeln('
'); } else { document.writeln(''); } } else { if (SecondSubSection[1][section][subSection].length>0){ document.writeln(''); } } } // Generate Sitemap function getSitemap(){ if (MainSection[1].length >0){ document.writeln(''); } } function getAcrobat(){ if (titleID == 1){ document.writeln('

Note: Some of the files are in PDF format. Please download Adobe Reader Get Adobe Reader for viewing and printing.

'); } else if (titleID == 2){ document.writeln('

注意部份檔案為PDF格式,請下載 Adobe ReaderGet Adobe Reader以便瀏覽。

'); } else if (titleID == 3){ document.writeln('

注意部份档案为PDF格式,请下载 Adobe ReaderGet Adobe Reader以便浏览。

'); } } function mainWinLink(url){ window.opener.location.href = url; window.opener.focus(); document.focus(); } // Generate news index list on HOME page (index.htm) // no longer used because the list is generated using XML /* function getNewsIndexList(num){ document.writeln('NEWS'); document.writeln('
    '); if (num == 'all'){ if (SubSection[1][4].length > 0){ for (var news=SubSection[1][4].length-1; news>0; news--){ document.writeln('
  • '+NewsTitle[titleID][news]+'
    '); document.writeln(' '+NewsDate[titleID][news]+'
  • '); } } } else { if (SubSection[1][4].length > 0){ var totalNews = SubSection[1][4].length for (var news=SubSection[1][4].length-1; news>totalNews-num-1; news--){ document.writeln('
  • '+NewsTitle[titleID][news]+'
    '); document.writeln(' '+NewsDate[titleID][news]+'
  • '); } document.writeln('
  • more news...

  • '); } } document.writeln('
'); } */