var favoritesListObj=null;$(document).ready(function(){if(/event=view.mynyc/.test(window.location)||/event=view.publicprofile/.test(window.location.href.toLowerCase())){var b=$(".myLists").children("li").size();var a=$("#ul_sortable").children("li").size();if((b<=2)&&(a==0)){$("#virgin_lister").show();$(".myLists").show()}else{showTabEtc()}}favoritesListObj=new FavoritesList();$("#profileTabs li a").css("cursor","pointer");$("#profileTabs li a").click(function(){clickMyNycTab(false);loadReviews("1")})});function loadReviews(pg){var id=getQueryVariable("gid");var params={event:"ajax.getreviews",page:pg};if(id!=0){params={event:"ajax.getreviews",gid:id,page:pg}}try{$.get("/",params,function(data){retval=eval("("+$.trim(data)+")");$("div.colABoxRight2 div.pagination").remove();$("div.colABoxRight2 ul#ul_sortable").remove();$("div.colABoxRight2 p#ratingdesc").after(retval.html);$("div.paginationNew a.previous").click(function(){var pg=Number($("div.paginationNew span.current").html());pg--;loadReviews(pg)});$("div.paginationNew a.notcurrent").click(function(){loadReviews($(this).text())});$("div.paginationNew a.next").click(function(){var pg=Number($("div.paginationNew span.current").html());pg++;loadReviews(pg)})})}catch(err){}}function getQueryVariable(a){var c=window.location.search.substring(1);var d=c.split("&");for(var b=0;b<d.length;b++){var e=d[b].split("=");if(e[0]==a){return e[1]}}return 0}function FavoritesList(){$("#close_create_list").click(function(){$("#createList").hide();$("input[@name=new_list_title]").val("");$("textarea[@name=new_list_desc]").val("")})}FavoritesList.prototype={create:function(){var f=$("#create_list_form");var action=f.attr("action");var serializedForm=f.serialize();$.post(action,serializedForm,function(data){var retval=eval("("+$.trim(data)+")");var liTitle="favTitle-"+retval.title;var divTitle="favTitleEdit-"+retval.title;var formTitle="favTitleEdit-form-"+retval.title;var inputTitle="favInput-"+retval.title;var appendStr='<li id="'+liTitle+'"><a href="index.cfm?event=view.mynyc&id='+retval.msg+'">';appendStr=appendStr+retval.title;appendStr=appendStr+'</a><div id="'+divTitle+'" style="display: none;"><form action="/" method="post" name="'+formTitle+'"><input id="'+inputTitle+'" class="inputText" type="text" value="" name="'+inputTitle+'"/></form></div></li>';if($(".myLists > li").size()>=2){var prevLi=$(".myLists li:last-child").prev();var prevLiAText=$(prevLi).find("a").text();$(prevLi).find("a").text(prevLiAText+",")}$(".myLists li:last-child").before(appendStr);appendStr='<div id="'+divTitle+'" style="padding-left: 20px;" ><input id="add_list_name" type="checkbox" checked="" style="width: 5px;" title="add/delete" value="keep" name=""/><a style="padding-right: 305px;" href="index.cfm?event=view.mynyc&id=150">'+retval.title+"</a></div>";$("#edit_list_form input[@name=submit]").before(appendStr);$("#createList").hide();$("input[@name=new_list_title]").val("");$("textarea[@name=new_list_desc]").val("")})},rename:function(a){$(a).prev().show();$(a).prev().find("#favEdit_close").click(function(){$(this).parent().hide()})},update:function(el,action,id,newTitle,description){$.post(action,{id:id,newtitle:newTitle,desc:description},function(data){retval=eval("("+$.trim(data)+")");$(el).parent().parent().parent().parent().hide();$(el).parent().parent().parent().parent().prev().text(retval.text)})},remove:function(a){$.get("/",{event:"ajax.deletelist",id:a},function(c){try{$("#delete-"+a).next().next().remove();$("#delete-"+a).next().remove();$("#delete-"+a).remove();$("#ed-seperator-"+a).remove();$("#edit-"+a).remove();$("#favEditWrapper-"+a).remove();$("#title-"+a).remove();$("#checkbox-"+a).remove()}catch(b){}})}};function onCreateList(){$("#createList").show();return false}function create_list(){sTest="li#favTitle-"+$("input[@name=new_list_title]").val();if($(sTest).length!=0){self.parent.tb_open_new("/index.cfm?event=view.updatelistconfirm&amp;func=create&amp;exists=1&amp;empty=0&amp;KeepThis=true&amp;TB_iframe=true&amp;height=235&amp;width=484&amp;modal=true")}else{if($("input[@name=new_list_title]").val()==""){self.parent.tb_open_new("/index.cfm?event=view.updatelistconfirm&amp;func=create&amp;exists=0&amp;empty=1&amp;KeepThis=true&amp;TB_iframe=true&amp;height=235&amp;width=484&amp;modal=true")}else{favoritesListObj.create();showTabEtc();var a=$(".myLists").children("li").size();$("div.colABoxRight1 ul#profileTabs li:first-child").find("a").text("My Lists ("+a+")");$("div.colABoxRight2 ul#profileTabs li:first-child").find("a").text("My Lists ("+a+")")}}return false}function showTabEtc(){$(".myLists").show();$("#profileTabs").show();$("#virgin_lister").hide();$("div.colABoxRight > h2").show();$("#listdesc").show();$("div.colABoxRight > input").show()}function close_tb(){return tb_remove(null,false)}function Isdelete(a,b){var a=a;document.accountInfo.action=b+a;document.accountInfo.submit()}function cleanCommas(e){var d="&#44;";var c=e.getElementsByTagName("INPUT");for(var b=0;b<c.length;b++){if(c[b].type=="text"){c[b].value=c[b].value.replace(/,/g,d)}}var a=e.getElementsByTagName("TEXTAREA");for(var b=0;b<a.length;b++){a[b].value=a[b].value.replace(/,/g,d)}}function onSubmit(a){cleanCommas(a)}function saveFlare(g,e){var a='<div style="background: transparent url('+g+") no-repeat scroll 0% 50%; _background: none; _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+g+'\', sizingMethod=\'crop\');" class="profileButton"><input type="hidden" id="flare" value="'+g+'"name="flare"/></div>';$(".profileButton").remove();$(".profilePic").append(a);var d=$("#accountInfo");var c=e+"ajax.UpdateProfile";var b=d.serialize();$.post(c,b,function(f){});tb_remove(null,false)}function delete_list(a){favoritesListObj.remove(a);tb_remove(null,false)}function onDelete(a,b){title=$(a).prev().prev().prev().prev().text();self.parent.tb_open_new("/index.cfm?event=view.deletelistconfirm&amp;title="+title+"&amp;link="+b+"&amp;KeepThis=true&amp;TB_iframe=true&amp;height=175&amp;width=484&amp;modal=true");return false}function update_list(a,c,e){var d=$(a).parent().parent().prev().find("input[@name=favInput]").val();var b=$(a).parent().parent().prev().find("textarea[@name=edit_list_desc]").val();if($(a).parent().parent().parent().parent().parent().find("input[@value="+d+"]").size()>1){self.parent.tb_open_new("/index.cfm?event=view.updatelistconfirm&amp;func=rename&amp;exists=1&amp;empty=0&amp;KeepThis=true&amp;TB_iframe=true&amp;height=235&amp;width=484&amp;modal=true")}else{if(d==""){}else{favoritesListObj.update(a,c,e,d,b);tb_remove(null,false)}}return false}function close_tb(){return tb_remove(null,false)}function clickMyNycTab(a){if(a==undefined||a==true){$("div.colABoxRight1").show();$("#review_section").show();$("div.colABoxRight2").hide()}else{$("#review_section").hide();$("div.colABoxRight2").show();$("div.colABoxRight1").hide()}return false}function removeListItem(idx,usr,type,listid,content_id,title){$.get("/",{event:"ajax.deletelistitem",usr:usr,listid:listid,id:content_id,type:type,title:title},function(data){retval=eval("("+$.trim(data)+")");selectr="#ul_sortable:nth-child("+idx+")";$("#ul_sortable li:nth-child("+idx+")").find(".listing").remove()});tb_remove(null,false);return false}function deleteListItem(e,h,d,a,c,g,f){var b=$(e).parent().parent().parent().parent().parent().prevAll().size()+1;self.parent.tb_open_new("/index.cfm?event=view.deletelistitemconfirm&amp;idx="+b+"&amp;usr="+h+"&amp;type="+d+"&amp;listid="+a+"&amp;listtitle="+g+"&amp;itemtitle="+f+"&amp;id="+c+"&amp;KeepThis=true&amp;TB_iframe=true&amp;height=175&amp;width=484&amp;modal=true");return false}function updateProfile(d){var c=$("#accountInfo");var b=d+"ajax.UpdateProfile";var a=c.serialize();$.post(b,a,function(e){})}function updatePhoto(d,b,c){updateProfile(d);var a='<img height="153" width="153" alt="" src="/cms/uploadedimages/devnycvisitcom/users/'+b+c+'"/>';$(".profilePic img").remove();$(".profileButton").before(a)}function textCounter(b,a){if(b.value.length>a){b.value=b.value.substring(0,a)}};