
function $(id){return document.getElementById(id);}
var Event={stopClick:function(event){if(event.srcElement){event.cancelBubble=true;event.returnValue=false;}else{event.stopPropagation();event.preventDefault();}}};var Ajax={getObj:function(){try{return new XMLHttpRequest();}catch(e){}
try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){}
try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}
return null;},start:function(url,method,body,callback){var xmlhttp=Ajax.getObj();if(xmlhttp){if(!xmlhttp){return;}
xmlhttp.open(method,url,true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){callback(xmlhttp);};xmlhttp.send(body);}}};var Vote={countVote:function(event){Event.stopClick(event);var target=(event.srcElement)?event.srcElement:event.target;var parentTag=target.parentNode;parentTag.removeChild(target);Ajax.start(target.href+"&ajax=1","get","",Vote.updateCount);},updateCount:function(xmlhttp){if((xmlhttp.readyState==4)&&(xmlhttp.status==200)){var xmlDoc=xmlhttp.responseXML.documentElement;var id=xmlDoc.getElementsByTagName("id")[0].childNodes[0].nodeValue;var message=xmlDoc.getElementsByTagName("message")[0].childNodes[0].nodeValue;var tag=$("msg_"+id);tag.innerHTML='&ndash; '+message;}}};var Scroll={ul_id:"",timeout:0,scrollPosition:function(){return(navigator.appName=="Microsoft Internet Explorer")?document.body.scrollTop:window.pageYOffset;},makeVisible:function(classname,position){if(Scroll.scrollPosition()>position){$(classname).className=classname;}else{$(classname).className="";}},doScroll:function(scroll_pos,inc){var scroll_top,scroll_y,scroll_max;if(document.all){scroll_top=document.documentElement.scrollTop;scroll_y=scroll_top+document.documentElement.clientHeight;}else{scroll_top=document.body.scrollTop||window.pageYOffset;scroll_y=window.scrollY;}
if(window.scrollMaxY){scroll_max=window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){scroll_max=document.body.scrollHeight-window.innerHeight;}else{scroll_max=document.body.offsetHeight;}
if(scroll_pos<0){scroll_pos=0;}
if(scroll_pos>scroll_top){if((scroll_pos-scroll_top)<10){inc=1;}else if((scroll_pos-scroll_top)<100){inc=Math.floor((scroll_pos-scroll_top)/2);}}else{if((scroll_top-scroll_pos)<10){inc=1;}else if((scroll_top-scroll_pos)<100){inc=Math.floor((scroll_top-scroll_pos)/2);}}
if((scroll_top<scroll_pos)&&(scroll_y<scroll_max)){scrollTo(0,scroll_top+inc);this.timeout=setTimeout("Scroll.doScroll("+scroll_pos+", "+inc+")",1);}else if(scroll_top>scroll_pos){scrollTo(0,scroll_top-inc);this.timeout=setTimeout("Scroll.doScroll("+scroll_pos+", "+inc+")",1);}else{clearTimeout(this.timeout);}},scroll:function(event){Event.stopClick(event);var clicked_elem=(event.srcElement)?event.srcElement:event.target;var stop_elem=$(clicked_elem.hash.replace("#",""));var stop_pos=this.getPosition(stop_elem);this.doScroll(stop_pos-10,50);},getPosition:function(obj){var top=0;if(obj.offsetParent){top=obj.offsetTop;while(obj=obj.offsetParent){top+=obj.offsetTop;}}
return top;}};var Links={newWindow:function(event){Event.stopClick(event);var target=(event.srcElement)?event.srcElement:event.target;window.open(target.parentNode.href);}};function setup(){var isIE=document.attachEvent?true:false;if(!isIE){var menu=$('menu');menu.setAttribute('style','text-shadow:0 1px 0 #fff;');var footer=$('footer');footer.setAttribute('style','text-shadow:0 1px 0 #fff;');var wrapper=$('wrapper');wrapper.setAttribute('style','-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px');var message=$('message');if(message!=undefined){message.setAttribute('style','-moz-border-radius:8px;');}
var forms=document.forms;for(var i=0;i<forms.length;i++){var elements=forms[i].elements;for(var j=0;j<elements.length;j++){var tagName=elements[j].tagName.toLowerCase();if((tagName=='select'||tagName=='textarea')||(tagName=='input'&&elements[j].type.toLowerCase()!='image')){elements[j].setAttribute('style','-moz-border-radius:6px');}}}}
var links=document.getElementsByTagName("a");for(var i=0;i<links.length;i++){if(links[i].className=="new-window"){links[i].style.display="inline";links[i].innerHTML='<img src="/images/new-window.png" width="14" height="11" />';if(isIE){links[i].attachEvent("onclick",function(event){Links.newWindow(event);});}else{links[i].addEventListener("click",function(event){Links.newWindow(event);},false);}}}
var links=document.links;for(var i=0;i<links.length;i++){if(links[i].className=="thumbs-up"){var id=links[i].id;var num=id.replace("id_","");links[i].href="/vote/?id="+num;links[i].innerHTML="I like this!";links[i].className="active-thumbs-up";if(isIE){links[i].attachEvent("onclick",function(event){Vote.countVote(event);});}else{links[i].addEventListener("click",function(event){Vote.countVote(event);},false);}}}
var a=$('back-to-top');if(a!=undefined){if(isIE){a.attachEvent("onclick",function(event){Scroll.scroll(event);});}else{a.addEventListener("click",function(event){Scroll.scroll(event);},false);}}
var div=$('always-visible');if(div!=undefined){setInterval("Scroll.makeVisible('always-visible', 633)",10);}}
window.onload=setup;
