var linkTextLength = 55; var screenWidth = getScreenWidth(); var languages = new Array("zh-CN", "zh-HK", "zh-TW"); var currentLanguage = getCurrentLanguageCode(); var style = getLanguageSpecificStyleSheet(); // // Set screen width // function getScreenWidth() { if (screen.availHeight > screen.availWidth) { width = '240'; } else { width = '400'; } return width; } // // Get the current language // function getCurrentLanguageCode() { return window.navigator.language; } // // Get language specific style sheet // function getLanguageSpecificStyleSheet() { for (var i = 0; i < languages.length; i++) { if (languages[i] == currentLanguage) { return 'style-green-chinese'; } } return 'style-green'; } // // Set stylesheet // function getStyleSheet() { document.write(''); } // // Toggle entertainment // function toogleDropdown(object) { var entertainment = document.getElementById('entertainment'); var history = document.getElementById('history'); var entertainmentIcon = document.getElementById('entertainmenticon'); var historyIcon = document.getElementById('historyicon'); var historyLine = document.getElementById('historyline'); if (object == 'entertainment') { if (screenWidth == '240') { entertainment.className = 'entertainmentVertical'; } else { entertainment.className = 'entertainmentHorizontal'; } if (entertainment.style.display == 'block') { entertainment.style.display = 'none'; entertainmentIcon.src = '../images/Button_Plus.png'; } else { entertainment.style.display = 'block'; entertainmentIcon.src = '../images/Button_Minus.png'; } if (history.style.display == 'block') { history.style.display = 'none'; historyIcon.src = '../images/Button_Plus.png'; historyLine.className = 'line'; } } else if (object == 'history') { if (history.style.display == 'block') { history.style.display = 'none'; historyIcon.src = '../images/Button_Plus.png'; historyLine.className = 'line'; } else { history.style.display = 'block'; historyIcon.src = '../images/Button_Minus.png'; historyLine.className = 'linedot'; } if (entertainment.style.display == 'block') { entertainment.style.display = 'none'; entertainmentIcon.src = '../images/Button_Plus.png'; } } } // // Search // function focusInputSearch(o) { o.style.color = "#000000"; o.value = ""; } function blurInputSearch(o) { o.style.color = "#ababab"; if (o.value == "") o.value = "Search"; } // // Address // function focusInputAddress(o) { o.style.color = "#000000"; o.value = "www."; } function blurInputAddress(o) { o.style.color = "#ababab"; if (o.value == "www.") o.value = "Enter address"; } // // History list // function getHistory() { var t = 0; if (myUsedUrls.length > 1 ) { for (var i = 0 ; i < myUsedUrls.length ; i+=3 ) { if (i >= 3) { document.write('
'); } document.write(''); document.write(''); document.write('
'); if (screenWidth == '240') { document.write('
'); } else { document.write('
'); } document.write(''+ getLinkText(myUsedUrls[i]) +'
'); t++; } } } // // Return the link text used in history // function getLinkText(text) { if (text.length > linkTextLength) { text = text.substring(0, linkTextLength) + "..."; } return text; } // // Set focus on element // function setFocus(id) { document.getElementById(id).focus(); }