Function.prototype.method = function (name, func) { this.prototype[name] = func; return this; }; if (!String.prototype.trim) { String.method('trim', function () { return this.replace(/^\s+|\s+$/g, ''); }); String.method('ltrim', function () { return this.replace(/^\s+/g, ''); }); String.method('rtrim', function () { return this.replace(/\s+$/g, ''); }); } var initial_fontsize = 12; var initial_lineheight = 28; function setFontsize(type, objname) { var whichEl = document.getElementById(objname); if (whichEl != null) { var oP = document.getElementById(objname).getElementsByTagName("p"); if (type == 1) { if (initial_fontsize < 42) { whichEl.style.fontSize = ++initial_fontsize + "px"; whichEl.style.lineHeight = ++initial_lineheight + "px"; if (oP != null) { for (var i = 0; i < oP.length; i++) { oP[i].style.fontSize = whichEl.style.fontSize; oP[i].style.lineHeight = whichEl.style.lineHeight; } } } } else { if (initial_fontsize > 8) { whichEl.style.fontSize = --initial_fontsize + "px"; whichEl.style.lineHeight = --initial_lineheight + "px"; if (oP != null) { for (var i = 0; i < oP.length; i++) { oP[i].style.fontSize = whichEl.style.fontSize; oP[i].style.lineHeight = whichEl.style.lineHeight; } } } } } } function trresizeimg(maxw, maxh, objimg) { var img = new Image(); img.src = objimg.src; var hratio; var wratio; var ratio = 1; var w = img.width; var h = img.height; wratio = maxw / w; hratio = maxh / h; if (maxw == 0 && maxh == 0) { ratio = 1; } else if (maxw == 0) { // if (hratio < 1) ratio = hratio; } else if (maxh == 0) { if (wratio < 1) ratio = wratio; } else if (wratio < 1 || hratio < 1) { ratio = wratio <= hratio ? wratio : hratio; } if (ratio < 1) { w = w * ratio; h = h * ratio; } objimg.height = h; objimg.width = w; } function _baidu_com(callid){ switch(callid){ //悬浮客服 case "tr11": document.writeln("