/*
Author: mg12
Update: 2008/05/05
Author URI: http://www.neoease.com/
base.js
*/
(function(){function e(a){return document.getElementById(a)}function h(a,c){e(a).style.display=c}window.MGJS={};window.MGJS.$=e;window.MGJS.setStyleDisplay=h;window.MGJS.goTop=function(a,c){a=a||0.1;c=c||16;var b=0,d=0,f=0,g=0,i=0,j=0;if(document.documentElement){b=document.documentElement.scrollLeft||0;d=document.documentElement.scrollTop||0}if(document.body){f=document.body.scrollLeft||0;g=document.body.scrollTop||0}i=window.scrollX||0;j=window.scrollY||0;b=Math.max(b,Math.max(f,i));d=Math.max(d, Math.max(g,j));g=1+a;window.scrollTo(Math.floor(b/g),Math.floor(d/g));if(b>0||d>0)window.setTimeout("MGJS.goTop("+a+", "+c+")",c)};window.MGJS.switchTab=function(a,c,b,d,f,g){e(b).className=d;e(f).className=g;b=a.split(",");for(d=0;d<b.length;d++){a=b[d];e(a)&&h(a,"block")}b=c.split(",");for(d=0;d<b.length;d++){a=b[d];e(a)&&h(a,"none")}};window.MGJS.loadCommentShortcut=function(){e("comment").onkeydown=function(a){var c=null;c=window.event?window.event:a;c!=null&&c.ctrlKey&&c.keyCode==13&&e("submit").click()}; e("submit").value+=" (Ctrl+Enter)"};window.MGJS.getElementsByClassName=function(a,c,b){b=b||document;c=c=="*"&&b.all?b.all:b.getElementsByTagName(c);b=[];a=a.replace(/\-/g,"\\-");a=RegExp("(^|\\s)"+a+"(\\s|$)");for(var d,f=0;f<c.length;f++){d=c[f];a.test(d.className)&&b.push(d)}return b}})();

/*
Author: mg12
Update: 2008/05/05
Author URI: http://www.neoease.com/
comment.js
*/
(function(){window.MGJS_CMT={};window.MGJS_CMT.reply=function(c,b,a){c=MGJS.$(c).innerHTML;b='<a href="#'+b+'">@'+c.replace(/\t|\n|\r\n/g,"")+" </a> \n";if(MGJS.$(a)&&MGJS.$(a).type=="textarea"){field=MGJS.$(a);if(field.value.indexOf(b)>-1)alert("You've already appended this reply!");else{field.value=field.value.replace(/\s|\t|\n/g,"")==""?b:field.value.replace(/[\n]*$/g,"")+"\n\n"+b;field.focus()}}else alert("The comment box does not exist!")};window.MGJS_CMT.quote=function(c,b,a,d){c=MGJS.$(c).innerHTML; var e=MGJS.$(a).innerHTML;a='<blockquote cite="#'+a+'">';a+='\n<strong><a href="#'+b+'">'+c.replace(/\t|\n|\r\n/g,"")+"</a> :</strong>";a+=e.replace(/\t/g,"");a+="</blockquote>\n";b=a;if(MGJS.$(d)&&MGJS.$(d).type=="textarea"){field=MGJS.$(d);if(document.selection){field.focus();sel=document.selection.createRange();sel.text=b;field.focus()}else if(field.selectionStart||field.selectionStart=="0"){d=field.selectionStart;a=field.selectionEnd;c=d;field.value=field.value.substring(0,d)+b+field.value.substring(a, field.value.length);c+=b.length;field.focus();field.selectionStart=c;field.selectionEnd=c}else{field.value+=b;field.focus()}}else alert("The comment box does not exist!")}})();
