//定义StringBuffer对象开始
function StringBuffer(){
	this.data=[];
} 
StringBuffer.prototype.append=function(){
	this.data.push(arguments[0]);
	return this;
} 
StringBuffer.prototype.tostring=function(){
	return this.data.join("");
} 
//StringBuffer对象结束

String.prototype.Trim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

function $(id)
{
   return document.getElementById(id);
}
//S

//获得元素的位置
function getposition(element,offset){
    var c=0;
    while(element){
        c+=element[offset];
        element=element.offsetParent
    }
    return c;
}