//Site version 2
var pathToImage = "/images/spinner.gif"; $(document).ready(function() { imgLoading = new Image(); imgLoading.src = pathToImage; imgHtml = "<p class=\"center\"><br/><img src=\"" + imgLoading.src + "\"></p><p class=\"center\">Loading...</p></p>"; $("a[rel=external]").each(function() { this.target = "_blank" }); $("a.fancybox").fancybox({ autoDimensions: false, width: 564 }); $("a.thickbox").fancybox(); if ($("form").hasClass("jsValidation")) $.getScript("/scripts/formvalidation.js"); $("body").AjaxPost(); $("a.jsAutoHide").click(function() { $(this).hide() }); $("body").ScrollToAnchor(); $("#photocollist").change(function() { $("#photocoldata").html(imgHtml); var b = $("#frmPhotos").attr("action").replace("#photocollist", "") + "?ajaxPost=true"; $.ajax({ type: "post", url: b, data: { photocollist: $(this).val() }, error: function() { $("#frmPhotos").submit() }, success: function(a) { $("#photocoldata").hide().html(a).fadeIn(); $("#photocoldata a.thickbox").fancybox() } }) }) }); $.fn.ScrollToAnchor = function() { ahrefInit = function(a) { a.anchor = "#" + a.href.split("#")[1]; $(a).click(function() { $.scrollTo(a.anchor, 800); return false }) }; if (this.find("a").hasClass("jsScrollTo")) $.getScript("/scripts/scrollTo.js"); this.find("a.jsScrollTo").each(function() { ahrefInit(this) }) }; $.fn.AjaxPost = function() { var c; ahrefInit = function(a) { a.postId = "#" + a.href.split("#")[1]; a.url = a.href.replace(a.postId, ""); $(a).click(function() { if ($(a.postId).size()) { $(a.postId).html(imgHtml); doPost(a); $(c).find("span").removeClass('highlight'); $(a).find("span").addClass('highlight'); c = a; return false } }) }; selectInit = function(s) { $(s).change(function() { s.url = $(this).val().split("#")[0]; s.postId = "#" + $(this).val().split("#")[1]; $(s.postId).html(imgHtml); doPost(s) }) }; doPost = function(a) { $.ajax({ type: "get", url: a.url + "&ajaxPost=true", error: function() { location.href = a.url }, success: function(b) { $(a.postId).hide().html(b).fadeIn().AjaxPost(); $(a.postId).ScrollToAnchor() } }) }; this.find("a.jsAjaxPost").each(function() { ahrefInit(this) }); this.find("select.jsAjaxPost").each(function() { selectInit(this) }) };