var DEFAULT_REQUEST_VALUE="example.com";var ERR_TAG="error";var ERR_NO_RESULTS="ERR_NO_RESULTS";var ERR_NO_DOMAIN="ERR_NO_DOMAIN";var ERR_TOO_MANY_REQUEST="ERR_TOO_MANY_REQUEST";var RTYPE_IPV4=1;var RTYPE_IPV6=2;var RTYPE_URL=3;var RTYPE_URL_WWW=4;var RTYPE_ERROR=-1;var map;var mapOverview;var mapMarker;var domTxtRequest;var serverIP;var requests;var requestGroup;var tooManyRequestsRaised;var allFadedOut;var iFrame;window.addEvent("domready",function(){domTxtRequest=$("txtRequest");iFrame=new IFrame("iframe_neighbors");domTxtRequest.value=DEFAULT_REQUEST_VALUE;mapInit();domTxtRequest.addEvent("focus",function(){onFocusRequest(true)});domTxtRequest.addEvent("blur",function(){onFocusRequest(false)});$("searchForm").addEvent("submit",function(a){new Event(a).stop();onValidateRequest()});iFrame.addEvent("mouseover",function(){this.scrolling="yes"});iFrame.addEvent("mouseout",function(){this.scrolling="no"});$("linkTerms").addEvent("click",function(b){new Event(b).stop();var a=new Fx.Scroll(window);a.toTop();var a=new Fx.Scroll(window,{onComplete:function(){new MochaUI.Window({id:"windowTerms",title:"Terms of service",loadMethod:"xhr",contentURL:"terms.htm",resizable:false,minimizable:false,maximizable:false,draggable:false,collapsible:false,width:400,height:380})}}).toTop()});setTooltips();setLoadingMode(false);tooManyRequestsRaised=false;allFadedOut=true});function setTooltips(){setTooltip("ipInfo_siteNameTitle","Name of the site.");setTooltip("ipInfo_siteSummaryTitle","Quick description of the site content.");setTooltip("ipInfo_creationDateTitle","Date when the site has been launched. This is not the date of domain registration.");setTooltip("ipInfo_ipTitle","IP address that identifies the server that hosts the site.");setTooltip("ipInfo_ownerTitle","Name of the person/organization who owns the domain.");setTooltip("ipInfo_registrarTitle","The company where domain is registered.");setTooltip("ipInfo_dailyVisitorsTitle","Unique daily visitors of the site. This is an estimation that gives you an idea about daily traffic on the site.");setTooltip("ipInfo_googlePagerankTitle","Index (0 to 10) used by Google to value a website, mostly based on link popularity.");setTooltip("ipInfo_languageTitle","Language used in the site.");setTooltip("mainPageColorsTitle","List of colors ordered by frequency used in the main page of the site. Palette is constructed finding most used colors in the snapshot, not parsing CSS (this way you also find picture colors). Hold on the color to get the hex code.");setTooltip("mainPageInfo_w3cValidTitle","Tells if the main page is valid according to standards that have been defined by the W3C.");setTooltip("mainPageInfo_charsetTitle","Set of characters used in the site.");setTooltip("mainPageInfo_rssFeedTitle","Web feed format used to publish frequently updated content. RSS feed is mainly used in blogs, news feeds or podcasts.");setTooltip("ipLocation_countryTitle","Country in which the server is located.");setTooltip("ipLocation_regionTitle","Region in which the server is located.");setTooltip("ipLocation_cityTitle","City in which the server is located.");setTooltip("ipInfo_latitudeTitle","Latitude of the city in which the server is located.");setTooltip("ipInfo_longitudeTitle","Longitude of the city in which the server is located.");setTooltip("h2_ip_info","Information about the domain and server that hosts the site.");setTooltip("h2_mainpage_info","Information about the main page of the site (the one you would reach by entering the site address in your browser.)");setTooltip("h2_location","Location of the physical machine that hosts the site.");setTooltip("h2_neighbors","Lists the other websites that are hosted on the same machine.")}function setTooltip(a,c,b){if(c==null){return}if(b==null){b="What is it?"}$(a).setStyle("cursor","default");$(a).store("tip:title",b);$(a).store("tip:text",c);myTip=new Tips($(a),{showDelay:500,hideDelay:100,fixed:true,offsets:{x:50,y:10}})}function onFocusRequest(a){if(a){if(domTxtRequest.value==DEFAULT_REQUEST_VALUE){domTxtRequest.value=""}else{fadeAllDivOut()}}else{if(domTxtRequest.value==""){domTxtRequest.value=DEFAULT_REQUEST_VALUE}}}function initPage(){$$(".alt").each(function(a){a.innerHTML=" ";setTooltip(a,"","")});$("imgPagerank").src="style/img/pr/pr.png";$("imgValid").src="style/img/valid_default.png";$("imgRss").src="style/img/mini_rss_none.png";$("mainPageInfo_imgThumbnail").src="style/img/snapshot_default.jpg";$("imgFlag").src="style/img/flags/default.gif";iFrame.src="";$("mainPageColorBoxContainer").empty();iFrame.empty()}function fadeAllDivOut(){if(allFadedOut){return}fadeDivOut("panel_info");fadeDivOut("panel_mainPageInfo");fadeDivOut("panel_location");fadeDivOut("panel_neighbors");fadeDivOut("panel_adsense")}function onValidateRequest(){tooManyRequestsRaised=false;fadeAllDivOut();domTxtRequest.blur();stopAjaxServices();txtRequest=domTxtRequest.value;var a=getDataType(txtRequest);if(a!=RTYPE_URL){shakeSearchBar()}else{setLoadingMode(true);initPage();setServerIP(txtRequest)}}function setServerIP(a){var b="core/getIP.php";new Request({url:b,method:"get",data:"domain="+a,onSuccess:onSuccessSetServerIP,autoCancel:true}).send()}function onSuccessSetServerIP(){if(this.response.xml==null){return}error=xmlGetError(this.response.xml);if(error!=null){setLoadingMode(false);if(error==ERR_NO_DOMAIN){shakeSearchBar()}return}var a=this.response.xml.getElementsByTagName("ip_lookup").item(0);serverIP=xmlGetChildValue(a,"ip");callAjaxServices();fadeDivIn("panel_adsense")}function stopAjaxServices(){if(requests!=null){requests.each(function(a){a.cancel();delete a});requests=null}}function callAjaxServices(){requests=[getServerInfoRequest(),getMainPageInfoRequest(),getSiteLocationRequest(),getIPNeighborsRequest()];requestGroup=new Group(requests[0],requests[1],requests[2],requests[3]);requestGroup.addEvent("onComplete",function(){setLoadingMode(false)});requests.each(function(a){a.send()})}function getDataType(b){var a=new RegExp("^(([0-9]+.){1,3})+[0-9]+$","i");var e=new RegExp("^(([0-9]|[A-F]){1,4}:){7}([0-9]|[A-F]){1,4}$","i");var d=new RegExp("^(http|https|ftp)://[a-zA-Z0-9-.]+.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9-._?,'/\\+&%$#=~])*[^.,)(s]$","i");var c=new RegExp("^[a-zA-Z0-9-.]+.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9-._?,'/\\+&%$#=~])*[^.,)(s]$","i");if(b.match(a)){return RTYPE_IPV4}else{if(b.match(e)){return RTYPE_IPV6}else{if(b.match(c)){return RTYPE_URL}else{if(b.match(c)){return RTYPE_IPV4}else{return RTYPE_ERROR}}}}}function getServerInfoRequest(){return new Request({url:"core/getServerInfo.php",method:"get",data:"ip="+serverIP+"&domain="+domTxtRequest.value,onSuccess:onServerInfoReceived,autoCancel:true})}function onServerInfoReceived(){if(this.response.xml==null){return}var i=xmlGetError(this.response.xml);if(i!=null){return}var j=this.response.xml.getElementsByTagName("site_info").item(0);var g=xmlGetChildValue(j,"site_name");var a=xmlGetChildValue(j,"site_summary");var e=xmlGetChildValue(j,"creation_date");var c=xmlGetChildValue(j,"ip_address");var k=xmlGetChildValue(j,"owner_name");var b=xmlGetChildValue(j,"registrar");var h=xmlGetChildValue(j,"daily_visitors");var d=xmlGetChildValue(j,"google_pagerank");var f=xmlGetChildValue(j,"language");setInnerText("ipInfo_siteNameValue",g);setInnerText("ipInfo_siteSummaryValue",a,50);setInnerText("ipInfo_creationDateValue",e);setInnerText("ipInfo_ipValue",c);setInnerText("ipInfo_ownerValue",k);setInnerText("ipInfo_registrarValue",b);setInnerText("ipInfo_dailyVisitorsValue",h);setInnerText("ipInfo_googlePagerankValue",d);setInnerText("ipInfo_languageValue",f);$("imgPagerank").src="style/img/pr/pr"+d+".png";fadeDivIn("panel_info")}function getMainPageInfoRequest(){return new Request({url:"core/getMainPageInfo.php",method:"get",data:"domain="+domTxtRequest.value,onSuccess:onMainPageInfoReceived,autoCancel:true})}function onMainPageInfoReceived(){if(this.response.xml==null){return}var m=xmlGetError(this.response.xml);if(m!=null){return}var n=this.response.xml.getElementsByTagName("mainpage_info").item(0);var c=xmlGetChildValue(n,"thumbnail_path");var b=xmlGetChildValue(n,"valid");var e=xmlGetChildValue(n,"nb_errors");var d=xmlGetChildValue(n,"charset");var o=xmlGetChildValue(n,"rss_feed");$("imgValid").src="style/img/valid_"+b+".png";if(b=="false"){m=(e>1)?"errors":"error";setInnerText("mainPageInfo_w3cValidValue"," ("+e+" "+m+")")}setInnerText("mainPageInfo_charsetValue",d);if(o==""){setInnerText("mainPageInfo_rssFeedValue","none");$("imgRss").src="style/img/mini_rss_none.png"}else{$("imgRss").src="style/img/mini_rss.png";$("mainPageInfo_rssFeedValue").innerHTML='Subscribe!'}var j=n.getElementsByTagName("colors").item(0);var a=j.getElementsByTagName("color");for(var g=0;g';for(var c=0;c'+value+""}var f=$$("#list_neighbors li");if(f.length>0){var g=f[0].getStyle("padding-left");var e=f[0].getStyle("color");f.each(function(i){i.setStyle("cursor","pointer");var j=new Fx.Morph(i,{duration:70,wait:false});i.addEvent("mouseenter",function(){j.start({"padding-left":"10px",color:"#F953B5"})});i.addEvent("mouseleave",function(){j.start({"padding-left":g,color:e})});i.addEvent("click",function(){iFrame.src="http://"+this.innerHTML})})}fadeDivIn("panel_neighbors")}function mapInit(){map=new google.maps.Map2(document.getElementById("map"));document.getElementById("map").style.backgroundColor="#FFFFFF";map.setCenter(new google.maps.LatLng(39,-22.5),1);map.enableContinuousZoom();map.addControl(new YSliderControl());mapOverview=new GOverviewMapControl(new GSize(100,84));map.addControl(mapOverview);baseIcon=new GIcon();baseIcon.shadow="style/img/map/shadow.png";baseIcon.iconSize=new GSize(50,42);baseIcon.shadowSize=new GSize(50,42);baseIcon.iconAnchor=new GPoint(19,31);baseIcon.image="style/img/map/marker.png";markerOptions={icon:baseIcon};mapMarker=new GMarker(new GLatLng(72.738003,-40.429687),markerOptions);map.addOverlay(mapMarker)}function xmlGetError(a){error=xmlGetChildValue(a,ERR_TAG);if(error==null||error==""){return null}if(error==ERR_TOO_MANY_REQUEST){if(!tooManyRequestsRaised){tooManyRequestsRaised=true;new MochaUI.Window({id:"windowTooManyRequests",title:"Oops!",loadMethod:"xhr",contentURL:"tooManyRequest.htm",resizable:false,minimizable:false,maximizable:false,draggable:false,headerStartColor:[250,215,236],headerStopColor:[252,169,218],collapsible:false,width:400,height:100})}}return error}function xmlGetChildValue(a,c){if(a==null){return""}var b=a.getElementsByTagName(c);if(b==null||b[0]==null||b[0].firstChild==null||b[0].firstChild.nodeValue==null){return""}else{return b[0].firstChild.nodeValue}}function setInnerText(a,b,c){if(c==null){c=30}displayedText="";if(b.length<=c){displayedText=b;setTooltip(a,"","")}else{displayedText=b.substr(0,c-3)+"...";setTooltip(a,b,"+")}$(a).innerHTML=displayedText}function shakeSearchBar(){var a=15;originalMargin=$("search_line").getStyle("margin-left").toInt();myFx=new Fx.Morph("search_line",{duration:50});myFx.start({"margin-left":[originalMargin,originalMargin+a]}).chain(function(){myFx.start({"margin-left":[originalMargin+a,originalMargin-a]})}).chain(function(){myFx.start({"margin-left":[originalMargin-a,originalMargin+a]})}).chain(function(){myFx.start({"margin-left":[originalMargin+a,originalMargin]})}).chain(function(){domTxtRequest.select()})}function fadeDivIn(a){new Fx.Morph(a,{duration:1000}).start({opacity:1});allFadedOut=false}function fadeDivOut(a){new Fx.Morph(a,{duration:500}).start({opacity:0.3})}function setLoadingMode(a){$("btValidateRequest").removeEvents();if(a){$("loading_icon").setStyle("display","block");$("btValidateRequest").addEvent("click",function(){setLoadingMode(false)});$("btValidateRequest").value="Cancel"}else{stopAjaxServices();$("btValidateRequest").addEvent("click",function(){onValidateRequest()});$("btValidateRequest").value="Go weasel it!";$("loading_icon").setStyle("display","none")}};