SK.Comments={View:{hideForms:function(){$("#reply-comment").hide().appendTo($("#invisible_section"))},showForm:function(b){SK.Comments.View.hideError();if(b=="comment-0"){}else{$("#reply-comment").show().appendTo($("#"+b+" > .comment_form_target"));if($("#reply-comment").attr("action")==""){var a=$("#reply-comment").attr("rel")}else{var a=$("#reply-comment").attr("action")}$("#reply-comment").attr("action",a.replace(/\/\//,"/"+b.split("-")[1]+"/"));$("#reply-comment").removeAttr("rel")}},showSpinner:function(a){SK.Comments.spinner.prependTo($("#"+a)).show()},hideSpinner:function(){SK.Comments.spinner.appendTo($("#invisible_section")).hide()},displayError:function(b,a){$("#"+b+" > .comment_form_target .error").html(a).show()},hideError:function(){$(".comment_form_target .error").hide()},addChild:function(b,a){if($("#"+b+" > ol.comments").length==0){$("#"+b).append('<ol class="comments"></ol>')}$("#"+b+" > ol.comments").prepend(a);$("#"+b+" > ol.comments > .comment:first > .footer .reply_comment_link").click(stopAnd(SK.Comments.Controller.handleReplyClick))},getElements:function(){SK.Comments.spinner=$("#comment_spinner");SK.Comments.newCommentForm=$("#new-comment");SK.Comments.newCommentLink=$("#new-comment_link")},form:function(a){if(a=="comment-0"){return $("#new-comment")}else{return $("#reply-comment")}}},Controller:{handleReplyClick:function(a){a.preventDefault();var b=$(a.target).parents(".comment").attr("id");SK.Comments.View.showForm(b);$("#reply_comment_content").val("")},handleSuccessFor:function(a){return function(b){if(b.status=="ok"){SK.Comments.View.addChild(a,b.body);SK.Comments.View.hideSpinner();SK.Comments.View.hideError()}else{SK.Comments.View.displayError(a,b.message);SK.Comments.View.hideSpinner()}}},handleErrorFor:function(a){return function(b){SK.Comments.View.displayError(a,"Sorry, there was an unknown error.");SK.Comments.View.hideSpinner()}},handleSubmitForm:function(a){var b;if(a.target.id=="new-comment"){b="comment-0"}else{b=a.target.parentNode.parentNode.id}SK.Comments.Controller.submitForm(b);if(b="comment-0"){$("#new_comment_content").val("");$("#rating").val("");if(SK.rating!=undefined){SK.rating.setRating(null)}}},submitForm:function(b){SK.Comments.View.hideForms();SK.Comments.View.showSpinner(b);var a=SK.Comments.View.form(b);$.ajax({type:"POST",url:a.attr("action"),data:a.serialize(),success:(SK.Comments.Controller.handleSuccessFor(b)),error:(SK.Comments.Controller.handleErrorFor(b)),dataType:"json"})}},init:function(){$(document).ready(function(){SK.Comments.View.hideForms();SK.Comments.View.getElements();$(".reply_comment_link").click(handleLoggedInLink(SK.Comments.Controller.handleReplyClick));$("#cancel_reply_comment_link").click(stopAnd(SK.Comments.View.hideForms));$("#new-comment").submit(stopAnd(SK.Comments.Controller.handleSubmitForm));$("#reply-comment").submit(stopAnd(SK.Comments.Controller.handleSubmitForm))})}};SK.Comments.init();SK.GMapAdaptor={mapContainerSelector:"#google-map",load_google_map:function(c,a){if(GBrowserIsCompatible()){var b=new GMap2($(this.mapContainerSelector)[0]);b.addControl(new GSmallMapControl());b.setCenter(new GLatLng(c,a),13);b.addOverlay(new GMarker(new GLatLng(c,a)))}},load_google_map_for_city:function(b){var c;var d;if(GBrowserIsCompatible()){d=new GMap2($(this.mapContainerSelector)[0]);d.addControl(new GSmallMapControl());d.setCenter(new GLatLng(b[0][0],b[0][1]),13);for(var a in b){c=new GMarker(new GLatLng(b[a][0],b[a][1]));GEvent.addListener(c,"click",function(e,f){return function(){e.openInfoWindowHtml('<p style="color:#000">'+f+"</p>")}}(c,b[a][2]));d.addOverlay(c)}}}};SK.rating={ratingSelector:"#rating",ratingController:false,currentRatingHandle:false,ratingLabel:false,currentSelectionLabel:false,setRatingLabel:function(a){if(a){var b=$(document.createElement("a"));b.attr("href","");b.text("(cancel)");b.click(function(){SK.rating.setRating(null);return false});this.ratingLabel.text(a+" ");this.ratingLabel.append(b)}else{$(this.ratingLabel).html("&nbsp;")}},setRating:function(a){this.currentSelectionLabel=$(this.ratingController).children(".star"+a).attr("title");$(this.currentRatingHandle).show().css("width",a*$(this.ratingController).children(".star1").width());this.setRatingLabel(this.currentSelectionLabel);$(this.ratingSelector).children().attr("selected",false);$(this.ratingSelector).children("[value="+a+"]").attr("selected",true)},createRatingController:function(){this.ratingController=$(document.createElement("ol"));this.ratingController.attr("class","max-rating");$(this.ratingSelector).after(this.ratingController);this.currentRatingHandle=$(document.createElement("li"));this.currentRatingHandle.attr("class","rating current-rating");this.ratingController.append(this.currentRatingHandle);$.each($(SK.rating.ratingSelector).children("[value]"),function(){var b=$(this).val();var a=$(document.createElement("li"));a.attr("class","rating star"+b);a.attr("title","Rate "+b+" stars");a.hover(function(){$(this).addClass("active");SK.rating.ratingLabel.text($(this).attr("title"));SK.rating.currentRatingHandle.hide()},function(){$(this).removeClass("active");SK.rating.setRatingLabel(SK.rating.currentSelectionLabel);SK.rating.currentRatingHandle.show()});a.click(function(){SK.rating.setRating(b)});SK.rating.ratingController.append(a)});this.ratingLabel=$(document.createElement("span"));this.ratingLabel.attr("class","ratingLabel").html("&nbsp;");this.ratingLabel.insertAfter(this.ratingController)},init:function(){if($("body").hasClass("not-logged-in")==false){SK.rating.createRatingController();$(SK.rating.ratingSelector).hide();SK.rating.setRating($(SK.rating.ratingSelector+" option:selected").val())}}};$(document).ready(function(){SK.rating.init()});