function scrollTips(id, interval) { var tips = document.getElementById(id); removeWithoutElement(tips); var height = getPixcelValue(tips.style["height"]); var beforeLast = tips.childNodes.length - 1; var orgScrollTop = tips.scrollTop; if (orgScrollTop == (height * beforeLast)) { while (--beforeLast >= 0) { tips.appendChild(tips.removeChild(tips.firstChild)); } orgScrollTop = 0; tips.scrollTop = 0; } var i = 1; var scrollDelay = window.setInterval( function() { tips.scrollTop = orgScrollTop + i; if (++i > height) { clearInterval(scrollDelay); scrollDelay = 0; } } , interval); } function getPixcelValue(pixcel) { var px = pixcel.indexOf("px"); return (px == -1) ? pixcel: pixcel.substring(0, px); } function getElementById(id) { return $(id); } function removeWithoutElement(node) { var child = node.firstChild; while (child) { var nextSibling = child.nextSibling; if (child.nodeType != 1) { node.removeChild(child); } child = nextSibling; } } function loadCssChage() { var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); } function unLoadCssChange() { var title = getActiveStyleSheet(); createCookie("style", title, 365); } function setActiveStyleSheet(title) { var i, a, main; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) { a.disabled = false; } } } } function getActiveStyleSheet() { var i, a; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title"); } return null; } function getPreferredStyleSheet() { var i, a; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; } 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; }