﻿$(function() {
    $(".print").click(function() {
        window.print();
    });
    $(".enlarge").click(function() {
        
        
        var href = $(this).attr("href");
        var params = (href.substr(href.indexOf('#') + 1).split("&") != -1) ? href.substr(href.indexOf('#') + 1).split("&") : href.substr(href.indexOf('#') + 1);
        var properties = {
            url: null,
            width: 400,
            height: 600
        };
        $.each(params, function() {
            fields = this.split("=");
            properties[fields[0]] = fields[1];

        });
        window.open(properties.url, "enlarge", "location=0,status=0,height=" + properties.height + ",width=" + properties.width);
        return false;
    });
    $("#views>li>a").bind('click mouseover', function() {
        var href = $(this).attr("href");
        var src = href;

        $(".enlarge-img").attr({
            src: src
        });
        $(".enlarge").attr({
            href: "#url=" + href.replace(/thumb/, "large")
        });
        return false;
    });
    $(".download").click(function() {
        var prefix = $(this).attr("rel") + "images/download.aspx?src=";

        return false;
    });
});
