function moveElement(elementID,final_x,final_y,interval){
if(!document.getElementById) return false; if(!document.getElementById(elementID)) return false; var elem = document.getElementById(elementID); if(elem.movement){ clearTimeout(elem.movement); } var xpos = parseInt(elem.offsetLeft); var ypos = parseInt(elem.offsetTop); if(xpos == final_x && ypos == final_y){ return true; } if(xpos<final_x){ var dist = Math.ceil((final_x - xpos)/10); xpos = xpos + dist; } if(xpos>final_x){ var dist = Math.ceil((xpos - final_x)/10); } if(ypos<final_y){ var dist = Math.ceil((final_y - ypos)/10); ypos = ypos + dist; } if(ypos>final_y){ var dist = Math.ceil((ypos - final_y)/10); ypos = ypos - dist; } elem.style.left = xpos + "px"; elem.style.top = ypos + "px"; var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")"; elem.movement = setTimeout(repeat,interval);}function prepareSlideshow(){ if(!document.getElementsByTagName) return false; if(!document.getElementById) return false; if(!document.getElementById("intro")) return false; var intro = document.getElementById("intro"); var slideshow = document.createrElement("div"); slideshow.setAttribute("id","slideshow"); var frame = document.createElement("img"); frame.setAttribute("src","images/frame.gif"); frame.setAttribute("alt",""); frame.setAttribute("id","frame"); slideshow.appendChild(frame); var preview = document.createElement("img"); preview.setAttribute("src","images/slideshow.gif"); preview.setAttribute("alt","a glimpse of what awaits you"); preview.setAttribute("id","preview"); slideshow.appendChild(preview); insertAfter(slideshow,intro); var links = document.getElementsByTagName("a"); var destination; for(var i=0; i
//表格隔行变色function stripetables(){ if(!document.getElementsByTagName) return false; var tables = document.getElementsByTagName("table"); for(var i=0; i
//为不支持placeholder的浏览器添加这个功能function resetfields(whichform){ if(Modernizr.input.placeholder) return ; for(var i=0; i
//ajaxfunction getHTTPObject(){ if(typeof XMLHttpRequest == "undefined"){ XMLHttpRequest = function(){ try{ return new ActiveXObject("Msxml2.XMLHTTP.6.0");} catch(e){} try{ return new ActiveXObject("Msxml2.XMLHTTP.3.0");} catch(e){} try{ return new ActiveXObject("Msxml2.XMLHTTP");} catch(e){} return false; } } return new XMLHttpRequest();}function displayAjaxLoading(element){ while(element.hasChildNodes()){ element.removeChild(element.lastChild); } var content = document.createElement("img"); content.setAttribute("src","images/loading.gif"); content.setAttribute("alt","Loading..."); element.appendChild(content);}function submitFormWidthAjax(whichform,thetarget){ var request = getHTTPObject(); if(!request){ return false;} displayAjaxLoading(thetarget); var dataParts = []; var element; for(var i=0; i([\s\S]+)<\/article>/); if(matches.length>0){ thetarget.innerHTML = matches[1]; }else{ thetarget.innerHTML = ' Oops,there was an error. Sorry.
'; } }else{ thetarget.innerHTML = '' + request.statusText + '
'; } } }; request.send(data); return true;}function prepareForms(){ for(var i=0; i