var port="";function DoLoginByClient(){try{DoDummyLogin()}catch(a){}}var arrayReplaceStringFrom=["'","\\\\",'"',"/"];var arrayReplaceStringTo=["{RS_1}","{RS_2}","{RS_3}","{RS_4}"];function HtmlEntities(b){var a=b;$.each(arrayReplaceStringFrom,function(d,c){a=a.replace(new RegExp(c,"g"),arrayReplaceStringTo[d])});return a}function FBInit(){window.fbAsyncInit=function(){FB.init({appId:"218215744921439",status:true,cookie:true,xfbml:true});FBConnect()};(function(a){var c,b="facebook-jssdk";if(a.getElementById(b)){return}c=a.createElement("script");c.id=b;c.async=true;c.src="//connect.facebook.net/en_US/all.js";a.getElementsByTagName("head")[0].appendChild(c)}(document))}function FBConnect(){FB.login(function(a){if(a.authResponse){if(a.status=="connected"){FBGetData()}else{var b=new Dialog();oDialog.Show("Você não concedeu permissão para o Milevo acessar sua conta, por favor tente novamente e autorize.",2,null)}}else{var b=new Dialog();oDialog.Show("Não foi possivel entrar no Facebook.",2,null)}},{scope:"email,user_birthday,user_relationships"})}function FBGetData(){FB.api("/me",function(a){fbData=a;var c=document.getElementById("hfJsonFB");c.value=JSON.stringify(a);var b=document.getElementById("btnDummyFB");b.click()})}var popUpSocialNetWork;function ReturnLoginBySocialNetwork(b){var a=new Dialog();if(b!=undefined&&b!=""){CallGA(b)}a.Show("Entrando no Milevo.",11,null);window.location=window.location}function ReturnLoginBySocialNetworkError(a){var b=new Dialog();b.Show(a,10,null)}function DoLoginBySocialNetwork(b){var d="location=no, scrollbars=yes, resizable=yes, toolbar=no, left=10, top=10, menubar=no, width=500, height=530";var e=window.location.protocol+"//"+window.location.hostname;var a=window.location.port;if(a!=null){e=e+":"+a}var c=e;if(b=="g"){c=c+"/GoogleAccount";CallGA("novo-acesso-login-gmail")}else{CallGA("novo-acesso-login-facebook");FBInit();return false}popUpSocialNetWork=window.open(c,"SocialNetworkAccount",d);return false}function CallGA(a){var b=document.getElementById("idGAux");if(b!=null){b.src="/ga/"+a}}function Dialog(){var a=this;this.Hide=function(){$("#dialog").dialog("destroy")};this.Show=function(f,k,m){if($("#dialog").dialog("isOpen")){this.Hide()}var e;var b;var o;var g;var h;var c;var r;var n;var d;var l=new StringBuilder();var q=$.template("Dialog.htm");switch(k){case 1:e=false;b="Aguarde...";o=true;g="icon_waiting.png";h=120;c=421;r=false;f="Aguarde, atualizando seus resultados...";e=n=a.Hide;break;case 2:e=true;b="Informação";o=false;g="information.png";h=160;c=421;r={OK:m!=undefined?m.ok:a.Hide};e=n=m!=undefined&&m.close!=undefined?m.close:a.Hide;break;case 3:e=false;b="Confirmação";o=false;g="question.png";h=160;c=421;d="teste";r={NÃO:m.nao!=undefined?m.nao:a.Hide,SIM:{method:m.sim!=undefined?m.sim:a.Hide,buttonClass:"btverde",hoverClass:"btverdeHover",hoverClass:"btverdeFocus"}};e=n=m!=undefined&&m.close!=undefined?m.close:a.Hide;break;case 4:e=true;b="Atenção!";o=false;g="warning.png";h=160;c=421;r={OK:m!=undefined?m.ok:a.Hide};e=n=m!=undefined&&m.close!=undefined?m.close:a.Hide;break;case 5:e=false;b="Erro!";o=false;g="error.png";h=160;c=421;r={OK:m!=undefined?m.ok:a.Hide};e=n=m!=undefined&&m.close!=undefined?m.close:a.Hide;break;case 6:e=true;b="Sucesso.";o=false;g="sucess.png";h=160;c=421;r={OK:m!=undefined?m.ok:a.Hide};e=n=m!=undefined&&m.close!=undefined?m.close:a.Hide;break;case 7:e=true;b="Login.";o=false;g="user.png";h=160;c=421;r={Login:m!=undefined?m.login:a.Hide};e=n=m.close!=undefined?m.close:a.Hide;break;case 8:e=true;b="Informação";o=false;g="information.png";h=160;c=421;r={OK:m!=undefined?m.ok:a.Hide};e=n=m!=undefined&&m.close!=undefined?m.close:a.Hide;break;case 9:e=false;b="Aguarde...";o=true;g="icon_waiting.png";h=120;c=421;r=false;e=n=a.Hide;break;case 10:e=false;b="Atenção";o=true;g="warning.png";h=150;c=421;r={OK:m!=undefined?m.ok:a.Hide};e=n=a.Hide;break;case 11:e=false;b="Aguarde...";o=true;g="icon_waiting.png";h=120;c=421;r=false;f="Entrando no Milevo.";e=n=a.Hide;break;case 12:if($("#sl2")!=null){$("#sl2").attr("style","width:0; height:0;")}e=true;b="Informação";o=false;g="information.png";h=180;c=421;r={OK:function(){$(this).dialog("close");if($("#sl2")!=null){$("#sl2").attr("style","width:720; height:500;")}}};n:n!=undefined?n:function(s){$("#dialog").dialog("destroy");if($("#sl2")!=null){$("#sl2").attr("style","width:720; height:500;")}};e=n;break;case 13:e=false;b="Aguarde...";o=true;g="icon_waiting.png";h=120;c=421;r=false;e=n=a.Hide;break}l.append(q.apply({Ico:g,Msg:f}));$("#dialog").html(l.toString());$("#dialog").dialog({closeOnEscape:e!=undefined?e:function(s){$("#dialog").dialog("destroy");if($("#sl2")!=null){$("#sl2").attr("style","width:720; height:500;")}},modal:true,height:h,width:c,minHeight:h,maxHeight:h,title:b,resizable:false,noClose:o,autoOpen:false,buttons:r,close:n!=undefined?n:function(s){$("#dialog").dialog("destroy");if($("#sl2")!=null){$("#sl2").attr("style","width:720; height:500;")}}});$("#dialog").dialog("open")};this.ShowMessageDialogOK=function(b){var c={ok:function(){oDialog.Hide()}};oDialog.Show(b,2,c)}}function Utilities(){var me=this;this.Url={Encode:function(string){return escape(this._utf8_encode(string))},Decode:function(string){return this._utf8_decode(unescape(string))},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c)}else{if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128)}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128)}}}return utftext},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++}else{if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}}return string}};this.IntersectByName=function(left,rigth){var result=[];var z=0;for(var i=0;i<left.length;i++){for(var j=0;j<rigth.length;j++){if(left[i].Name==rigth[j].Name){result[z]=left[i];z++;break}}}return result};this.Sort=function(vetor,criterio,ordem){var tmp;for(j=1;j<vetor.length;++j){tmp=vetor[j];i=j-1;while((eval("vetor[i]."+criterio)<eval("tmp."+criterio)&&eval("tmp."+criterio)!=null&&ordem=="DESC")||((eval("vetor[i]."+criterio)==null?Infinity:eval("vetor[i]."+criterio))>(eval("tmp."+criterio)==null?Infinity:eval("tmp."+criterio))&&ordem=="ASC")&&i>=0){vetor[i+1]=vetor[i];--i;if(i<0){break}}vetor[i+1]=tmp}return vetor};this.Dialog=new Dialog();this.CheckMail=function(mail){var er=new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);if(typeof(mail)=="string"){if(er.test(mail)){return true}}else{if(typeof(mail)=="object"){if(er.test(mail.value)){return true}}else{return false}}};this.DateForExtensiveWithOutDay=function(date){if(date==null||date==""){return""}var aux=date.split("/");if(aux.length==0){return""}var dateAux=new Date(Number(aux[1]),Number(aux[0])-1,1);var month=dateAux.getMonth();var year=dateAux.getFullYear();var extensive="";switch(month){case 0:extensive="janeiro de "+year;break;case 1:extensive="fevereiro de "+year;break;case 2:extensive="março de "+year;break;case 3:extensive="abril de "+year;break;case 4:extensive="maio de "+year;break;case 5:extensive="junho de "+year;break;case 6:extensive="julho de "+year;break;case 7:extensive="agosto de "+year;break;case 8:extensive="setembro de "+year;break;case 9:extensive="outubro de "+year;break;case 10:extensive="novembro de "+year;break;case 11:extensive="dezembro de "+year;break}return extensive};this.DateForExtensive=function(date){var month=date.getMonth();var year=date.getFullYear();var extensive="";switch(month){case 0:extensive="janeiro de "+year;break;case 1:extensive="fevereiro de "+year;break;case 2:extensive="março de "+year;break;case 3:extensive="abril de "+year;break;case 4:extensive="maio de "+year;break;case 5:extensive="junho de "+year;break;case 6:extensive="julho de "+year;break;case 7:extensive="agosto de "+year;break;case 8:extensive="setembro de "+year;break;case 9:extensive="outubro de "+year;break;case 10:extensive="novembro de "+year;break;case 11:extensive="dezembro de "+year;break}return extensive};this.Redirect=function(page){var url="/"+page;var host=window.location.protocol+"//"+window.location.hostname;var Myport=window.location.port;if(Myport!=null){host=host+":"+Myport}endereco=host+"/";if(page!=null&&page.length>1){if(page.substring(0,1)=="/"){url=host+page}else{url=host+"/"+page}}else{url=host+"/"+page}var encodeUrl=function(url){if(url.indexOf("?")>0){encodedParams="?";parts=url.split("?");params=parts[1].split("&");for(i=0;i<params.length;i++){if(i>0){encodedParams+="&"}if(params[i].indexOf("=")>0){p=params[i].split("=");encodedParams+=(p[0]+"="+escape(encodeURI(p[1])))}else{encodedParams+=params[i]}}url=parts[0]+encodedParams}return url};window.location.href=encodeUrl(url);this.ReturnUrl=function(page){var url="/"+page;var host=window.location.protocol+"//"+window.location.hostname;var Myport=window.location.port;if(Myport!=null){host=host+":"+Myport}url=host+"/"+page;return encodeUrl(url)}}}function Cookies(){this.Response=function(a,c,b){if(b==null||b==undefined){b={expires:1800000}}$.cookie(a,c,b)};this.Request=function(a){return $.cookie(a)};this.Remove=function(a){$.cookie(a,null)}}function getFriendlyLink(b){var a="";switch(b){case"cities":a="Cidade";break;case"attractions":a="Atracao";break;case"hotels":a="Hotel";break;case"restaurants":a="Restaurante";break}return a}function getFriendlyLinkByPlaceTypeId(b){var a="";switch(b){case 4:a="Cidade";break;case 3:a="Atracao";break;case 1:a="Hotel";break;case 2:a="Restaurante";break}return a}function GetPrepositionArticle(b,c){var a="";switch(b){case 1:switch(c){case 1:a="";break;case 2:a="em";break;case 3:a="de";break;case 4:a="";break}break;case 2:switch(c){case 1:a="o";break;case 2:a="no";break;case 3:a="do";break;case 4:a="ao";break}break;case 3:switch(c){case 1:a="a";break;case 2:a="na";break;case 3:a="da";break;case 4:a="à";break}break}return a}function StatusAguarde(){var a=new Utilities();a.Dialog.Show("wait",1);return true}function PopUp(){var a="";var c=this;var b=function(d){if(d.indexOf("?")>0){encodedParams="?";parts=d.split("?");params=parts[1].split("&");for(i=0;i<params.length;i++){if(i>0){encodedParams+="&"}if(params[i].indexOf("=")>0){p=params[i].split("=");encodedParams+=(p[0]+"="+escape(encodeURI(p[1])))}else{encodedParams+=params[i]}}d=parts[0]+encodedParams}return d};this.openPopupWindow=function(g,d,e,f,k){if(k==undefined){k="location=no, scrollbars=yes, resizable=yes, toolbar=no, left=10, top=10, menubar=no, width="+e+", height="+f}newUrl="PopUp/"+g;d=d.replace(/\/|\-|\./gi,"");var l=new RegExp("\\s","g");d=d.replace(l,"");var h="width: "+e+"px; height: "+f+"px;";myLytebox.start(document.getElementById("hfLinkLB"),false,true,newUrl,h);return;if(!a.closed&&a.location){a.location.href=b(g)}else{a=window.open(b(g),d,k);if(!a.opener){a.opener=self}}if(window.focus){a.focus()}};this.Close=function(){if(parent!=null&&parent!=undefined&&parent!="undefined"&&parent.myLyteBox!=null){parent.myLytebox.end()}else{window.close()}};this.OpenLogin=function(){c.openPopupWindow("newLogin.aspx","Login",700,344);return false};this.OpenLogin2=function(){c.openPopupWindow("newLogin.aspx?redirectUrlOpener=close","Login",700,344);return false};this.OpenPhotoGallery=function(e,d,g,f){c.openPopupWindow("PhotoGallery.aspx?place="+e+"&placeid="+d+"&photoid="+g+"&professional="+f,"PhotoGallery",800,700);return false};this.OpenMap=function(d,e){c.openPopupWindow("Map.aspx?placeType="+d+"&placeid="+e,"Map",670,460);return false};this.OpenMapCountry=function(e,d){c.openPopupWindow("MapCountry.aspx?countryId="+e+"&countryName="+d,"Map",670,460,"resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no,width=650,height=450");return false};this.OpenAddPhoto=function(e,d){c.openPopupWindow("AddPhotos.aspx?place="+e+"&placeid="+d,"AddPhoto",800,650);return false};this.OpenAddVideo=function(e,d){c.openPopupWindow("AddVideo.aspx?place="+e+"&placeid="+d,"AddVideos",800,650);return false}}function fncLogonUnlogonButton(){var a=new PopUp();a.openPopupWindow("newLogin.aspx?redirectUrlOpener=reload","Milevo",700,344);return false}function Fechar(){var a=document.getElementById("fechar");parent.myLytebox.end();return false}function SetFocusToClose(){var a=document.getElementById("auxWClose");if(a!=null){if($("#Pop")!=null&&$("#Pop")[0]!=null){$("#Pop")[0].style.display="inline"}a.style.display="inline";a.focus()}}var callbacksAlert={ok:function(){SetFocusToClose();$("#dialog").dialog("destroy");Fechar()},close:function(){SetFocusToClose();$("#dialog").dialog("destroy");Fechar()}};var callbacksAlertUploadImage={ok:function(){SetFocusToClose();$("#dialog").dialog("destroy");Fechar();DivUploadHtmlVisible(true)},close:function(){SetFocusToClose();$("#dialog").dialog("destroy");Fechar();DivUploadHtmlVisible(true)}};var callbacksAlertAndGo={ok:function(){$("#dialog").dialog("destroy");window.location=GetDomainUrl()},close:function(){$("#dialog").dialog("destroy");window.location=GetDomainUrl()}};function GetDomainUrl(){var b=window.location.protocol+"//"+window.location.hostname;var a=window.location.port;if(a!=null){b=b+":"+a}b=b+"/";return b}function ShowAlert(a){var b=new Utilities();b.Dialog.Show(a,8,callbacksAlert)}function AlertAndGo(a){var b=new Utilities();b.Dialog.Show(a,8,callbacksAlertAndGo)}function ShowAndScrollToQuickLogin(){if($("[id$=divQuickLogin]")!=null){if($("[id$=divQuickLogin]")[0]!=null){$("[id$=divQuickLogin]").show();ScrollToQuickLogin($("[id$=divQuickLogin]")[0]);try{InProcessChange(false)}catch(a){}}}}function ScrollToQuickLogin(a){if(a!=null){a.scrollIntoView()}else{if($("[id$=divQuickLogin]")!=null){if($("[id$=divQuickLogin]")[0]!=null){$("[id$=divQuickLogin]")[0].scrollIntoView()}}}}function ShowAlertWithCloseUploadImage(a){var b=new Utilities();b.Dialog.Show(a,2,callbacksAlertUploadImage)}function ShowAlertWithClose(a){var b=new Utilities();b.Dialog.Show(a,2,callbacksAlert)}function ShowAlertWithOutClose(a){var b=new Utilities();b.Dialog.Show(a,8)};

