function ajax(type,file,text,func) { var xmlhttp_object; try{xmlhttp_object = new activexobject("msxml2.xmlhttp");} catch(new_ieerror) { try{xmlhttp_object = new activexobject("microsoft.xmlhttp");} catch(ieerror){xmlhttp_object = false;} } if(!xmlhttp_object && typeof xmlhttp_object != "undefiend") { try{xmlhttp_object = new xmlhttprequest();} catch(new_ieerror){xmlhttp_object = false;} } type = type.touppercase(); if(type == "get") file = file + "?" + text; xmlhttp_object.open(type,file,true); if(type == "post") xmlhttp_object.setrequestheader("content-type","application/x-www-form-urlencoded"); xmlhttp_object.onreadystatechange = function responsereq() { if(xmlhttp_object.readystate == 4) func(xmlhttp_object.responsetext); }; if(type == "get") text = null; xmlhttp_object.send(text); } function picresize(obj,maxwidth,maxheight) { if(!window.xmlhttprequest) { obj.onload = null; img = new image(); img.src = obj.src; if (img.width > maxwidth && img.height > maxheight) { if(img.width / img.height > maxwidth / maxheight) { obj.height = maxwidth * img.height / img.width; obj.width = maxwidth; }else{ obj.width = maxheight * img.width / img.height; obj.height = maxheight; } }else if(img.width > maxwidth){ obj.height = maxwidth * img.height / img.width; obj.width = maxwidth; }else if(img.height > maxheight){ obj.width = maxheight * img.width / img.height; obj.height = maxheight; }else{ obj.width = img.width; obj.height = img.height; } } } //新秀