$(document).ready(function() { $(".add-tooltip").each(function() { var id = $(this).attr("id"); var addid = ".add #add-"+id; var bizid = "#"+id; var close = "#close-"+id; $(addid).click(function() { $(bizid).show(); //$(bizid).fadeIn('normal'); }); $(close).click(function() { $(bizid).hide(); //$(bizid).fadeOut('normal'); }); }); $(".hover-menu").click(function() { $(".icon").toggle(); }); $(".box-bg #toggle").click(function() { $(".box-bg #hidden-cats").slideToggle("fast"); if($(".box-bg #toggle").text().substr(0, 4) == "More") { $(".box-bg #toggle").text("Close Categories \u00AB"); $(".box-bg #toggle").attr("title","Rehide the category list"); } else { $(".box-bg #toggle").text("More Categories \u00BB"); $(".box-bg #toggle").attr("title","List more categories"); } }); $("#toggle-experience-form").click(function() { if($("#toggle-experience-form").text().substr(0, 3) == "Add") { $("#toggle-experience-form").text('Hide add Review'); $("#toggle-experience-form").attr("title","Hide the add review form"); } else { $("#toggle-experience-form").text('Add your Review'); $("#toggle-experience-form").attr("title","Show the add review form"); } $("#add-experience").slideToggle("fast"); }); $("#toggle-experience-form-top").click(function() { if($("#toggle-experience-form-top").text().substr(0, 3) == "Add" || $("#toggle-experience-form-top").text().substr(0, 3) == "Edi") { $("#toggle-experience-form-top").text('Hide add Review'); $("#toggle-experience-form-top").attr("title","Hide the add review form"); } else { $("#toggle-experience-form-top").text('Add your Review'); $("#toggle-experience-form-top").attr("title","Show the add review form"); } $("#add-experience").slideToggle("fast"); }); $("#toggle-tag-form").click(function() { if($("#toggle-tag-form").text().substr(0, 3) == "add") { $("#toggle-tag-form").text("\u00AB hide add tags"); $("#toggle-tag-form").attr("title","Hide the add tag form"); $(".tag-toggle").text('\u00AB hide more tags'); $("#tag-container").slideDown(50); } else { $("#toggle-tag-form").text("add tags\u00BB"); $("#toggle-tag-form").attr("title","Show the add tag form"); } $("#add-tags").slideToggle(50); return false; }); $(".ratings .allstar a").each(function() { var allstar = "."+this.className; var allstar_parent = "#"+this.className; $(allstar).click(function() { var id = this.id; $.ajax({ type: "GET", url: "/business/allstar/"+id, dataType: "html", success: function(data) { $(allstar_parent).html(data); } }); }); }); $("a.delete-tag").click(function() { var tagID = $(this).attr("id"); var bizID = $(this).attr("biz"); $.ajax({ type: "GET", url: "/business/delete/tag/"+bizID+"/"+tagID, dataType: "html", success: function(data) { $("#"+tagID).hide(); } }); }); $("a[fn^='video-toggle']").click(function(){ var videoID = $(this).attr("video"); $('div[id='+videoID+']').toggle(0); }); $("a.flag").click(function() { var rID = $(this).attr("rid"); var uID = $(this).attr("uid"); $("#review-"+rID).text("Flagging..."); $.ajax({ type: "GET", url: "/business/flag/review/"+rID+"-"+uID, dataType: "html", success: function(data) { $("#review-"+rID).hide(); } }); return false; }); $("a[class='show-version']").click(function(){ var version = $(this).attr("version"); $('#version-'+version).toggle("fast"); return false; }); $(".tag-toggle").click(function() { if($(".tag-toggle").text().substr(0, 4) == "view") { $(".tag-toggle").text('\u00AB hide more tags'); } else { $(".tag-toggle").text('view more tags \u00BB'); } $("#tag-container").slideToggle(50); return false; }); }); function ajaxFileUpload() { $("#loading") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload ( { url:'/file/upload', secureuri:false, fileElementId:'edit-image', dataType: 'json', success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { alert(data.msg); } } }, error: function (data, status, e) { alert(e); } } ) return false; }