﻿

/* Helper wrappers */
$.postJSON = function(urlIn, dataIn, callbackIn) {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: urlIn,
        dataType: "json",
        data: dataIn,
        success: callbackIn
    });
};


this.initImagePreview = function() {
    xOffset = 0;
    yOffset = 0;

    var aLargeImage = $("a[id$='_aLargeImage']")
    aLargeImage.click(function(e) {

        // Dont follow the link
        e.preventDefault();

        var originalLink = this.href;
        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("body").append("<p id='pShowLargeImage'><img src='" + this.href + "' alt='Image preview' />" + c + "</p>");
        $("#pShowLargeImage")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast", function() {
                $("body").one("click", function() {
                    $("#pShowLargeImage").remove();
                });
			});
    });
};



function GetAspNetID(aspNetId) {
    return "[id$='_" + aspNetId + "']";
}


