/************************
* SiteMagic 可移植版 for Site MagicSquare (SiteMagic)
* Coding By Ridge Wong @ 2008-2-16
**************************/
//window.onerror = function() { return true; }

function echo(str) {document.write(str);}
function echoln(str) {echo(str+"<br />");}
function G(id){return document.getElementById(id)};
function GN(name){return document.getElementsByName(name)};
function trim(s){return s.replace(/(^\s+)|(\s+$)/g,"")};
function trimPun(str){return str.replace(/(\'+)|(\"+)/g,"")};
function registerNamespace(b){var rootObject=window;var namespaceParts=b.split(".");for(var i=0;i<namespaceParts.length;i++){var currentPart=namespaceParts[i]; if(!rootObject[currentPart]) rootObject[currentPart]=new Object(); rootObject=rootObject[currentPart];}}
registerNamespace("SiteMagic.WebUI");
String.prototype.format=function(){if(arguments.length==0) return this;for(var s=this, i=0; i<arguments.length; i++)s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]);return s;}; 
String.prototype.encodeURI=function(){var returnString;returnString=escape(this);returnString=returnString.replace(/\+/g,"%2B");return returnString;};
Function.prototype.bind=function(){var args=[];for(var i=0,len=arguments.length;i<len;i++)args.push(arguments[i]);var __method=this,object=args[0];return function(){return __method.apply(object,args)}};
Object.extend=function(des,src){for(var property in src){des[property]=src[property]}return des};
function setStyle(a,b) { var c=document.styleSheets[0]; if(c.addRule) { c.addRule(a,b); } else if(c.insertRule) { c.insertRule(a+" { "+b+" }",c.cssRules.length); }}
function getStyle(e,a) { return (e.currentStyle) ? e.currentStyle[a] : document.defaultView.getComputedStyle(e, null)[a]; }
function getScrollXY(e){var objTar=(document.body.scrollTop) ? document.body : document.documentElement;if(e){objTar=document.getElementById(e);} return {X:objTar.scrollLeft,Y:objTar.scrollTop};}
function setScrollXY(objXY) {var objTar = (document.body.scrollTop) ? document.body : document.documentElement;if(objXY.X) objTar.scrollLeft = objXY.X;if(objXY.Y) objTar.scrollTop = objXY.Y;}
function getAbsPoint(e){var x=e.offsetLeft,y = e.offsetTop;while(e = e.offsetParent){x += e.offsetLeft;y += e.offsetTop;}return {X: x, Y: y};}
function CreateBookmark() {var url=document.location.href,title=document.title;if(window.sidebar) {window.sidebar.addPanel(title,url,'');} else {if(window.external) {window.external.AddFavorite(url,title); }else {if(window.opera && window.print) { return true; }}}}
function HiddenAll(showIds){var ObjectColletion=showIds.split(",");for (var i=0,j=ObjectColletion.length; i<j ; i++ ){document.getElementById(ObjectColletion[i]).style.display = "none";}}
