var site={links:["home/home.php","about/about.php","journal.php","serverside/serverside.php","clientside/clientside.php","playground/playground.php","forge/forge.php","contact/contact.php"],labels:["Home Page","About Me","My Blog","Server-Side Coding","Client-Side Coding","Playground Coding","Moo Plugins","Contact Me"],a:["a0","a1","a2","a3","a4","a5","a6","a7"],currentTab:null,init:function(){if(!document.getElementById&&!document.getElementsByTagName){return;}site.makeRequest(site.links[0],"main",site.a[0]);site.nav=document.getElementById("nav");if(!site.nav){return;}site.LIs=site.nav.getElementsByTagName("li");for(var i=0;i<site.LIs.length;i++){var link=site.LIs[i].firstChild;link.onclick=(function(i){link.href=site.labels[i];return function(){site.makeRequest(site.links[i],"main",site.a[i]);return false;};})(i);}if($("topofpage")){site.topOfPage();}},makeRequest:function(serverpage,objID,object){if(site.currentTab==object){return;}var url=serverpage+"?sid="+Math.random();var objid=objID;for(i=0;i<=7;i++){var ob="a"+i;if(ob==object){document.getElementById(object).className="active";}else{document.getElementById(ob).className="";}}$(objid).innerHTML="<div id='load'>Loading...</>";new Ajax.Updater(objid,url,{method:"get",evalScripts:true});site.currentTab=object;},addEvent:function(elem,evType,fn,useCapture){if(elem.addEventListener){elem.addEventListener(evType,fn,useCapture);}else{if(elem.attachEvent){var r=elem.attachEvent("on"+evType,fn);return r;}else{elem["on"+evType]=fn;}}},getXMLHttpRequestObject:function(){var xmlhttp;if(window.ActiveXObject){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){xmlhttp=false;}}}else{if(window.XMLHttpRequest){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false;}}}if(!xmlhttp){alert("The browser does not support Ajax. Consider upgradding the browser!");}else{return xmlhttp;}},topOfPage:function(){$("topofpage").hide();Event.observe($("topofpage"),"click",function(event){event.stop();new Effect.ScrollTo("header",{duration:0.4});});new ScrollSpy({container:window,min:100,onEnter:function(c){$("topofpage").show();},onLeave:function(c){$("topofpage").hide();}});},getVote:function(value){var xmlhttp=site.getXMLHttpRequestObject();var URL="vote/processVote.php?";URL+="vote="+value+"&sid="+Math.random();xmlhttp.open("GET",URL,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("poll").innerHTML=xmlhttp.responseText;}Effect.Appear("poll");}};xmlhttp.send(null);},handleQuickSearch:function(value){var URL="livesearch.php?query="+value+"&sid="+Math.random();var objid="main";new Ajax.Updater(objid,URL,{method:"get",evalScripts:true});}};site.addEvent(window,"load",site.init,false);
