/* Author: mg12 Update: 2008/07/01 Author URI: http://www.fighton.cn/ */ function setStyleDisplay(id, status) { document.getElementById(id).style.display = status; } function setStyleBackgroundImage(id, imageURL) { document.getElementById(id).style.backgroundImage = "url('imageURL')"; } function setCookie(name, value, days) { if (!days) { days = 365; } var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie = name+"="+value+expires+"; path=/"; } function goTop(acceleration, time) { acceleration = acceleration || 0.1; time = time || 16; var dx = 0; var dy = 0; var bx = 0; var by = 0; var wx = 0; var wy = 0; if (document.documentElement) { dx = document.documentElement.scrollLeft || 0; dy = document.documentElement.scrollTop || 0; } if (document.body) { bx = document.body.scrollLeft || 0; by = document.body.scrollTop || 0; } var wx = window.scrollX || 0; var wy = window.scrollY || 0; var x = Math.max(wx, Math.max(bx, dx)); var y = Math.max(wy, Math.max(by, dy)); var speed = 1 + acceleration; window.scrollTo(Math.floor(x / speed), Math.floor(y / speed)); if(x > 0 || y > 0) { var invokeFunction = "goTop(" + acceleration + ", " + time + ")" window.setTimeout(invokeFunction, time); } } function switchImage(imageId, imageUrl, linkId, linkUrl, preview, title, alt) { if(imageId && imageUrl) { var image = document.getElementById(imageId); image.src = imageUrl; if(title) { image.title = title; } if(alt) { image.alt = alt; } } if(linkId && linkUrl) { var link = document.getElementById(linkId); link.href = linkUrl; } }