﻿var $c = jQuery.noConflict()
$c.noConflict($)
$c(document).ready(function() {

    $c('a[name=modal]').click(function(e) {
        e.preventDefault();

        var id = $c(this).attr('href');

        var maskHeight = $c(document).height();
        var maskWidth = $c(window).width();

        $c('#mask').css({ 'width': maskWidth, 'height': maskHeight });

        $c('#mask').fadeIn(0);
        $c('#mask').fadeTo("slow", 0.6);

        //Get the window height and width
        var winH = $c(window).height();
        var winW = $c(window).width();

        $c(id).css('top', winH / 2 - $c(id).height() / 2);
        $c(id).css('left', winW / 2 - $c(id).width() / 2);

        $c(id).fadeIn(100);

    });

    $c('.window .close').click(function(e) {
        e.preventDefault();

        $c('#mask').hide();
        $c('.window').hide();
    });

    $c('#mask').click(function() {
        $c(this).hide();
        $c('.window').hide();
    });

});

