var Base=function(){if(arguments.length){if(this==window){Base.prototype.extend.call(arguments[0],arguments.callee.prototype);}else{this.extend(arguments[0]);}}};Base.version="1.0.2";Base.prototype={extend:function(source,value){var extend=Base.prototype.extend;if(arguments.length==2){var ancestor=this[source];if((ancestor instanceof Function)&&(value instanceof Function)&&ancestor.valueOf()!=value.valueOf()&&/\bbase\b/.test(value)){var method=value;value=function(){var previous=this.base;this.base=ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue;};value.valueOf=function(){return method;};value.toString=function(){return String(method);};}return this[source]=value;}else if(source){var _prototype={toSource:null};var _protected=["toString","valueOf"];if(Base._prototyping)_protected[2]="constructor";for(var i=0;(name=_protected[i]);i++){if(source[name]!=_prototype[name]){extend.call(this,name,source[name]);}}for(var name in source){if(!_prototype[name]){extend.call(this,name,source[name]);}}}return this;},base:function(){}};Base.extend=function(_instance,_static){var extend=Base.prototype.extend;if(!_instance)_instance={};Base._prototyping=true;var _prototype=new this;extend.call(_prototype,_instance);var constructor=_prototype.constructor;_prototype.constructor=this;delete Base._prototyping;var klass=function(){if(!Base._prototyping)constructor.apply(this,arguments);this.constructor=klass;};klass.prototype=_prototype;klass.extend=this.extend;klass.implement=this.implement;klass.toString=function(){return String(constructor);};extend.call(klass,_static);var object=constructor?klass:_prototype;if(object.init instanceof Function)object.init();return object;};Base.implement=function(_interface){if(_interface instanceof Function)_interface=_interface.prototype;this.prototype.extend(_interface);};function sack(file){this.AjaxFailedAlert="Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";this.requestFile=file;this.method="POST";this.URLString="";this.encodeURIString=true;this.execute=false;this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(err){this.xmlhttp=null;}}if(!this.xmlhttp&&typeof XMLHttpRequest!="undefined")this.xmlhttp=new XMLHttpRequest();if(!this.xmlhttp){this.failed=true;}};this.setVar=function(name,value){if(this.URLString.length<3){this.URLString=name+"="+value;}else{this.URLString+="&"+name+"="+value;}};this.encVar=function(name,value){var varString=encodeURIComponent(name)+"="+encodeURIComponent(value);return varString;};this.encodeURLString=function(string){varArray=string.split('&');for(i=0;i<varArray.length;i++){urlVars=varArray[i].split('=');if(urlVars[0].indexOf('amp;')!=-1){urlVars[0]=urlVars[0].substring(4);}varArray[i]=this.encVar(urlVars[0],urlVars[1]);}return varArray.join('&');};this.runResponse=function(){eval(this.response);};this.runAJAX=function(urlstring){this.responseStatus=new Array(2);if(this.failed&&this.AjaxFailedAlert){alert(this.AjaxFailedAlert);}else{if(urlstring){if(this.URLString.length){this.URLString=this.URLString+"&"+urlstring;}else{this.URLString=urlstring;}}if(this.encodeURIString){var timeval=new Date().getTime();this.URLString=this.encodeURLString(this.URLString);this.setVar("rndval",timeval);}if(this.element){this.elementObj=document.getElementById(this.element);}if(this.xmlhttp){var self=this;if(this.method=="GET"){var totalurlstring=this.requestFile+"?"+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true);}else{this.xmlhttp.open(this.method,this.requestFile,true);}if(this.method=="POST"){try{this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')}catch(e){}}this.xmlhttp.send(this.URLString);this.xmlhttp.onreadystatechange=function(){switch(self.xmlhttp.readyState){case 1:self.onLoading();break;case 2:self.onLoaded();break;case 3:self.onInteractive();break;case 4:self.response=self.xmlhttp.responseText;self.responseXML=self.xmlhttp.responseXML;self.responseStatus[0]=self.xmlhttp.status;self.responseStatus[1]=self.xmlhttp.statusText;self.onCompletion();if(self.execute){self.runResponse();}if(self.elementObj){var elemNodeName=self.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){self.elementObj.value=self.response;}else{self.elementObj.innerHTML=self.response;}}self.URLString="";break;}};}}};this.createAJAX();};Clusterer=function(map){this.map=map;this.markers=[];this.clusters=[];this.timeout=null;this.currentZoomLevel=map.getZoom();this.maxVisibleMarkers=Clusterer.defaultMaxVisibleMarkers;this.gridSize=Clusterer.defaultGridSize;this.minMarkersPerCluster=Clusterer.defaultMinMarkersPerCluster;this.maxLinesPerInfoBox=Clusterer.defaultMaxLinesPerInfoBox;this.icon=Clusterer.defaultIcon;GEvent.addListener(map,'zoomend',Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(map,'moveend',Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(map,'infowindowclose',Clusterer.MakeCaller(Clusterer.PopDown,this));};Clusterer.defaultMaxVisibleMarkers=50;Clusterer.defaultGridSize=5;Clusterer.defaultMinMarkersPerCluster=5;Clusterer.defaultMaxLinesPerInfoBox=10;Clusterer.defaultIcon=new GIcon();Clusterer.defaultIcon.image="style/img/aggregate_house.png";Clusterer.defaultIcon.shadow="style/img/shadow-aggregate_house.png";Clusterer.defaultIcon.iconSize=new GSize(48.0,48.0);Clusterer.defaultIcon.shadowSize=new GSize(73.0,48.0);Clusterer.defaultIcon.iconAnchor=new GPoint(24.0,24.0);Clusterer.defaultIcon.infoWindowAnchor=new GPoint(24.0,24.0);Clusterer.prototype.SetIcon=function(icon){this.icon=icon;};Clusterer.prototype.SetMaxVisibleMarkers=function(n){this.maxVisibleMarkers=n;};Clusterer.prototype.SetMinMarkersPerCluster=function(n){this.minMarkersPerCluster=n;};Clusterer.prototype.SetMaxLinesPerInfoBox=function(n){this.maxLinesPerInfoBox=n;};Clusterer.prototype.AddMarker=function(marker,ad){if(marker.setMap!=null)marker.setMap(this.map);marker.myAd=ad;marker.onMap=false;this.markers.push(marker);this.DisplayLater();};Clusterer.prototype.ClearOverlays=function(){for(var i=0;i<this.markers.length;++i){if(this.markers[i]!=null)this.RemoveMarker(this.markers[i]);}this.markers=[];};Clusterer.prototype.RemoveMarker=function(marker){for(var i=0;i<this.markers.length;++i)if(this.markers[i]==marker){if(marker.onMap)this.map.removeOverlay(marker);for(var j=0;j<this.clusters.length;++j){var cluster=this.clusters[j];if(cluster!=null){for(var k=0;k<cluster.markers.length;++k)if(cluster.markers[k]==marker){cluster.markers[k]=null;--cluster.markerCount;break;}if(cluster.markerCount==0){this.ClearCluster(cluster);this.clusters[j]=null;}else if(cluster==this.poppedUpCluster)Clusterer.RePop(this);}}this.markers[i]=null;break;}this.DisplayLater();};Clusterer.prototype.DisplayLater=function(){if(this.timeout!=null)clearTimeout(this.timeout);this.timeout=setTimeout(Clusterer.MakeCaller(Clusterer.Display,this),50);};Clusterer.Display=function(clusterer){var i,j,marker,cluster;clearTimeout(clusterer.timeout);var newZoomLevel=clusterer.map.getZoom();if(newZoomLevel!=clusterer.currentZoomLevel){for(i=0;i<clusterer.clusters.length;++i)if(clusterer.clusters[i]!=null){clusterer.ClearCluster(clusterer.clusters[i]);clusterer.clusters[i]=null;}clusterer.clusters.length=0;clusterer.currentZoomLevel=newZoomLevel;}var bounds=clusterer.map.getBounds();var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();var dx=ne.lng()-sw.lng();var dy=ne.lat()-sw.lat();dx*=0.10;dy*=0.10;bounds=new GLatLngBounds(new GLatLng(sw.lat()-dy,sw.lng()-dx),new GLatLng(ne.lat()+dy,ne.lng()+dx));var visibleMarkers=[];var nonvisibleMarkers=[];for(i=0;i<clusterer.markers.length;++i){marker=clusterer.markers[i];if(marker!=null)if(bounds.contains(marker.getPoint())||clusterer.currentZoomLevel<=2)visibleMarkers.push(marker);else nonvisibleMarkers.push(marker);}for(i=0;i<nonvisibleMarkers.length;++i){marker=nonvisibleMarkers[i];if(marker.onMap){clusterer.map.removeOverlay(marker);marker.onMap=false;}}for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null&&!bounds.contains(cluster.marker.getPoint())&&cluster.onMap){clusterer.map.removeOverlay(cluster.marker);cluster.onMap=false;}}if(visibleMarkers.length>clusterer.maxVisibleMarkers){var latRange=bounds.getNorthEast().lat()-bounds.getSouthWest().lat();var latInc=latRange/clusterer.gridSize;var lngInc=latInc/Math.cos((bounds.getNorthEast().lat()+bounds.getSouthWest().lat())/2.0*Math.PI/180.0);for(var lat=bounds.getSouthWest().lat();lat<=bounds.getNorthEast().lat();lat+=latInc)for(var lng=bounds.getSouthWest().lng();lng<=bounds.getNorthEast().lng();lng+=lngInc){cluster=new Object();cluster.clusterer=clusterer;cluster.bounds=new GLatLngBounds(new GLatLng(lat,lng),new GLatLng(lat+latInc,lng+lngInc));cluster.markers=[];cluster.markerCount=0;cluster.onMap=false;cluster.marker=null;clusterer.clusters.push(cluster);}for(i=0;i<visibleMarkers.length;++i){marker=visibleMarkers[i];if(marker!=null&&!marker.inCluster){for(j=0;j<clusterer.clusters.length;++j){cluster=clusterer.clusters[j];if(cluster!=null&&cluster.bounds.contains(marker.getPoint())){cluster.markers.push(marker);++cluster.markerCount;marker.inCluster=true;}}}}for(i=0;i<clusterer.clusters.length;++i)if(clusterer.clusters[i]!=null&&clusterer.clusters[i].markerCount<clusterer.minMarkersPerCluster){clusterer.ClearCluster(clusterer.clusters[i]);clusterer.clusters[i]=null;}for(i=clusterer.clusters.length-1;i>=0;--i)if(clusterer.clusters[i]!=null)break;else--clusterer.clusters.length;for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null){for(j=0;j<cluster.markers.length;++j){marker=cluster.markers[j];if(marker!=null&&marker.onMap){clusterer.map.removeOverlay(marker);marker.onMap=false;}}}}for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null&&cluster.marker==null){var xTotal=0.0,yTotal=0.0;for(j=0;j<cluster.markers.length;++j){marker=cluster.markers[j];if(marker!=null){xTotal+=(+marker.getPoint().lng());yTotal+=(+marker.getPoint().lat());}}var location=new GLatLng(yTotal/cluster.markerCount,xTotal/cluster.markerCount);marker=new GMarker(location,{icon:clusterer.icon});cluster.marker=marker;GEvent.addListener(marker,'click',Clusterer.MakeCaller(Clusterer.PopUp,cluster));}}}for(i=0;i<visibleMarkers.length;++i){marker=visibleMarkers[i];if(marker!=null&&!marker.onMap&&!marker.inCluster){clusterer.map.addOverlay(marker);if(marker.myAddedToMap!=null)marker.myAddedToMap();marker.onMap=true;}}for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null&&!cluster.onMap&&bounds.contains(cluster.marker.getPoint())){clusterer.map.addOverlay(cluster.marker);cluster.onMap=true;}}Clusterer.RePop(clusterer);};Clusterer.PopUp=function(cluster){var clusterer=cluster.clusterer;var html='<table width="300">';var n=0;html+='<tr><td align="center">';html+=' <b>'+clusterer.markers.length+' An�ncios Aqui:</b>';html+='</td></tr>';for(var i=0;i<clusterer.markers.length;++i){var marker=clusterer.markers[i];if(marker!=null){++n;if(marker.myAd.photosUrls!=null)html+='<td><img src="fotoP/'+marker.myAd.photosUrls[0]+'" width="24px" height="24px">';else html+='<td><img src="style/img/house.png" width="24px" height="24px">';html+='</td><td><a href="JavaScript:ctrl.openAd('+marker.myAd.idAd+');">'+marker.myAd.info.substr(0,25)+'...</a></td></tr>';if(n==clusterer.maxLinesPerInfoBox-1&&cluster.markerCount>clusterer.maxLinesPerInfoBox){html+='<tr><td colspan="2">... e ainda mais '+(clusterer.markers.length-n)+'</td></tr>';break;}}}html+='</table>';clusterer.map.closeInfoWindow();cluster.marker.openInfoWindowHtml(html);};Clusterer.RePop=function(clusterer){if(clusterer.poppedUpCluster!=null)Clusterer.PopUp(poppedUpCluster);};Clusterer.PopDown=function(clusterer){clusterer.poppedUpCluster=null;};Clusterer.prototype.ClearCluster=function(cluster){var i,marker;for(i=0;i<cluster.markers.length;++i)if(cluster.markers[i]!=null){cluster.markers[i].inCluster=false;cluster.markers[i]=null;}cluster.markers.length=0;cluster.markerCount=0;if(cluster==this.poppedUpCluster)this.map.closeInfoWindow();if(cluster.onMap){this.map.removeOverlay(cluster.marker);cluster.onMap=false;}};Clusterer.MakeCaller=function(func,arg){return function(){func(arg);};};GMarker.prototype.setMap=function(map){this.map=map;};GMarker.prototype.addedToMap=function(){this.map=null;};GMarker.prototype.origOpenInfoWindow=GMarker.prototype.openInfoWindow;GMarker.prototype.openInfoWindow=function(node,opts){if(this.map!=null)return this.map.openInfoWindow(this.getPoint(),node,opts);else return this.origOpenInfoWindow(node,opts);};GMarker.prototype.origOpenInfoWindowHtml=GMarker.prototype.openInfoWindowHtml;GMarker.prototype.openInfoWindowHtml=function(html,opts){if(this.map!=null)return this.map.openInfoWindowHtml(this.getPoint(),html,opts);else return this.origOpenInfoWindowHtml(html,opts);};GMarker.prototype.origOpenInfoWindowTabs=GMarker.prototype.openInfoWindowTabs;GMarker.prototype.openInfoWindowTabs=function(tabNodes,opts){if(this.map!=null)return this.map.openInfoWindowTabs(this.getPoint(),tabNodes,opts);else return this.origOpenInfoWindowTabs(tabNodes,opts);};GMarker.prototype.origOpenInfoWindowTabsHtml=GMarker.prototype.openInfoWindowTabsHtml;GMarker.prototype.openInfoWindowTabsHtml=function(tabHtmls,opts){if(this.map!=null)return this.map.openInfoWindowTabsHtml(this.getPoint(),tabHtmls,opts);else return this.origOpenInfoWindowTabsHtml(tabHtmls,opts);};GMarker.prototype.origShowMapBlowup=GMarker.prototype.showMapBlowup;GMarker.prototype.showMapBlowup=function(opts){if(this.map!=null)return this.map.showMapBlowup(this.getPoint(),opts);else return this.origShowMapBlowup(opts);};var thumbnailviewer={enableTitle:true,enableAnimation:false,definefooter:'<div class="footerbar" onClick="thumbnailviewer.closeit();">fechar</div>',defineLoading:'<img src="style/img/loader5.gif" /> A carregar imagem...',activeImage:0,scrollbarwidth:16,opacitystring:'filter:progid:DXImageTransform.Microsoft.alpha(opacity=10); -moz-opacity: 0.1; opacity: 0.1',targetlinks:[],createthumbBox:function(){document.write('<div id="thumbBox"><div id="thumbImage"></div>'+this.definefooter+'</div>');document.write('<div id="thumbLoading">'+this.defineLoading+'</div>');this.thumbBox=document.getElementById("thumbBox");this.thumbImage=document.getElementById("thumbImage");this.thumbLoading=document.getElementById("thumbLoading");this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;this.thumbBox.style.maxHeight="500px";this.objNav=document.createElement("div");this.objNav.setAttribute('id','hoverNav');this.thumbBox.appendChild(this.objNav);this.objPrevLink=document.createElement("a");this.objPrevLink.setAttribute('id','prevLink');this.objPrevLink.setAttribute('href','#');this.objNav.appendChild(this.objPrevLink);this.objNextLink=document.createElement("a");this.objNextLink.setAttribute('id','nextLink');this.objNextLink.setAttribute('href','#');this.objNav.appendChild(this.objNextLink);},centerDiv:function(divobj){var ie=document.all&&!window.opera;var dom=document.getElementById;var scroll_top=(ie)?this.standardbody.scrollTop:window.pageYOffset;var scroll_left=(ie)?this.standardbody.scrollLeft:window.pageXOffset;var docwidth=(ie)?this.standardbody.clientWidth:window.innerWidth-this.scrollbarwidth;var docheight=(ie)?this.standardbody.clientHeight:window.innerHeight;var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)?this.standardbody.offsetHeight:this.standardbody.scrollHeight;var objwidth=divobj.offsetWidth;var objheight=divobj.offsetHeight;var topposition=(docheight>objheight)?scroll_top+docheight/2-objheight/2+"px":scroll_top+10+"px";divobj.style.left=docwidth/2-objwidth/2+"px";divobj.style.top=Math.floor(parseInt(topposition))+"px";divobj.style.visibility="visible";},showthumbBox:function(){this.centerDiv(this.thumbBox);if(this.enableAnimation){this.currentopacity=0.1;this.opacitytimer=setInterval("thumbnailviewer.opacityanimation()",20);}},loadimage:function(index,photos){this.objPrevLink.style.display='none';this.objNextLink.style.display='none';this.activeImage=index;if(photos!=undefined)this.images=photos;var link=document.createElement('img');link.src='fotoG/'+this.images[index];var imageHTML='<img style="max-height:400px" src="'+link.getAttribute("src")+'" style="'+this.opacitystring+'" />';this.centerDiv(this.thumbLoading);this.thumbImage.innerHTML=imageHTML;this.featureImage=this.thumbImage.getElementsByTagName("img")[0];this.featureImage.onload=function(){thumbnailviewer.thumbLoading.style.visibility="hidden";thumbnailviewer.showthumbBox();thumbnailviewer.updateNav();};if(document.all&&!window.createPopup){this.featureImage.src=link.getAttribute("href");};this.featureImage.onerror=function(){thumbnailviewer.thumbLoading.style.visibility="hidden";};},setimgopacity:function(value){var targetobject=this.featureImage;if(targetobject.filters&&targetobject.filters[0]){if(typeof targetobject.filters[0].opacity=="number"){targetobject.filters[0].opacity=value*100;}else{targetobject.style.filter="alpha(opacity="+value*100+")";}}else if(typeof targetobject.style.MozOpacity!="undefined"){targetobject.style.MozOpacity=value;}else if(typeof targetobject.style.opacity!="undefined"){targetobject.style.opacity=value;}else{this.stopanimation();}},opacityanimation:function(){this.setimgopacity(this.currentopacity);this.currentopacity+=0.1;if(this.currentopacity>1){this.stopanimation();}},stopanimation:function(){if(typeof this.opacitytimer!="undefined"){clearInterval(this.opacitytimer);}},closeit:function(){this.stopanimation();this.thumbBox.style.visibility="hidden";this.thumbImage.innerHTML="";this.thumbBox.style.left="-2000px";this.thumbBox.style.top="-2000px";},cleanup:function(){this.thumbLoading=null;if(this.featureImage){this.featureImage.onload=null;};this.featureImage=null;this.thumbImage=null;for(var i=0;i<this.targetlinks.length;i++){this.targetlinks[i].onclick=null;};this.thumbBox=null;},dotask:function(target,functionref,tasktype){var task=(window.addEventListener)?tasktype:"on"+tasktype;if(target.addEventListener){target.addEventListener(task,functionref,false);}else if(target.attachEvent){target.attachEvent(task,functionref);}},updateNav:function(){this.objNav.style.display='Block';this.objNav.style.top=(this.thumbBox.offsetHeight/2)-16+'px';this.objNav.style.width=(this.thumbBox.offsetWidth-20)+'px';var self=this;if(this.activeImage!=0){this.objPrevLink.style.display='block';this.objPrevLink.style.height='32px';this.objPrevLink.onclick=function(){self.loadimage(self.activeImage-1);return false;}};if(this.activeImage!=(this.images.length-1)){this.objNextLink.style.display='block';this.objNextLink.style.height='32px';this.objNextLink.onclick=function(){self.loadimage(self.activeImage+1);return false;}}},init:function(){if(!this.enableAnimation){this.opacitystring="";};var pagelinks=document.getElementsByTagName("a");for(var i=0;i<pagelinks.length;i++){if(pagelinks[i].getAttribute("rel")&&pagelinks[i].getAttribute("rel")=="thumbnail"){pagelinks[i].onclick=function(){thumbnailviewer.stopanimation();thumbnailviewer.loadimage(this);return false;};this.targetlinks[this.targetlinks.length]=pagelinks[i];}};this.dotask(window,function(){if(thumbnailviewer.thumbBox.style.visibility=="visible"){thumbnailviewer.centerDiv(thumbnailviewer.thumbBox);}},"resize");}};thumbnailviewer.createthumbBox();thumbnailviewer.dotask(window,function(){thumbnailviewer.init();},"load");thumbnailviewer.dotask(window,function(){thumbnailviewer.cleanup();},"unload");var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));}function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));}function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));}function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));}function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));}function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));}function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";}function core_md5(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}return Array(a,b,c,d);}function md5_cmn(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);}function md5_ff(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);}function md5_gg(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);}function md5_hh(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t);}function md5_ii(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t);}function core_hmac_md5(key,data){var bkey=str2binl(key);if(bkey.length>16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);}function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);}function bit_rol(num,cnt){return(num<<cnt)|(num>>>(32-cnt));}function str2binl(str){var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;}function binl2str(bin){var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);return str;}function binl2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}return str;}function binl2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3){var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}return str;};
