$(function () {
    // load the modal window
    $('.modal-register').click(function () {
        // scroll to top
        $('html, body').animate({ scrollTop: 0 }, 'slow');
        // before showing the modal window, reset the form incase of previous use.
        $('.success, .error').hide();
        $('div#modal-register').show();
        //show the mask and contact divs
        $('.mask').show().fadeTo('', 0.7);
        $('div#modal-register').fadeIn();
        // stop the modal link from doing its default action
        return false;

    });

    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-register, div.mask').stop().fadeOut('slow');

    });

    // load the modal window
    $('.modal-login').click(function () {
        // scroll to top
        $('html, body').animate({ scrollTop: 0 }, 'slow');
        // before showing the modal window, reset the form incase of previous use.
        $('.success, .error').hide();
        $('div#modal-login').show();
        //show the mask and contact divs
        $('.mask').show().fadeTo('', 0.7);
        $('div#modal-login').fadeIn();
        // stop the modal link from doing its default action
        return false;
    });

    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-login, div.mask').stop().fadeOut('slow');

    });

    // load the modal window
    $('.modal-mydetails').click(function () {
        // scroll to top
        $('html, body').animate({ scrollTop: 0 }, 'slow');
        // before showing the modal window, reset the form incase of previous use.
        $('.success, .error').hide();
        $('div#modal-mydetails').show();
        //show the mask and contact divs
        $('.mask').show().fadeTo('', 0.7);
        $('div#modal-mydetails').fadeIn();
        // stop the modal link from doing its default action
        return false;

    });

    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-mydetails, div.mask').stop().fadeOut('slow');

    });

    //close modal login and show modal register
    $('div#modal-login a#RegisterButton').click(function () {
        $('div#modal-login').hide();
        $('div#modal-register').show();
        return false;
    }); 

    // load the modal window
    $('.modal-warning').click(function () {
        // scroll to top
        $('html, body').animate({ scrollTop: 0 }, 'slow');
        // before showing the modal window, reset the form incase of previous use.
        $('.success, .error').hide();
        $('div#modal-warning').show();
        //show the mask and contact divs
        $('.mask').show().fadeTo('', 0.7);
        $('div#modal-warning').fadeIn();
        // stop the modal link from doing its default action
        return false;
    });


    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-warning, div.mask').stop().fadeOut('slow');


    });

    // load the modal window
    $('.modal-language').click(function () {
        // scroll to top
        $('html, body').animate({ scrollTop: 0 }, 'slow');
        // before showing the modal window, reset the form incase of previous use.
        $('.success, .error').hide();
        $('div#modal-language').show();
        //show the mask and contact divs
        $('.mask').show().fadeTo('', 0.7);
        $('div#modal-language').fadeIn();
        // stop the modal link from doing its default action
        return false;
    });


    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-language, div.mask').stop().fadeOut('slow');

    });
    

    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-standardpopup, div.mask').stop().fadeOut('slow');

    });


    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-abuse, div.mask').stop().fadeOut('slow');


    });

    // close the modal window is close div or mask div are clicked.
    $('div.close, div.mask').click(function () {
        $('div#modal-commentspopup, div.mask').stop().fadeOut('slow');


    });



});


// load the modal window
function DisplayPopUp() {
    // scroll to top
    $('html, body').animate({ scrollTop: 0 }, 'slow');
    // before showing the modal window, reset the form incase of previous use.
    $('.success, .error').hide();
    $('div#modal-standardpopup').show();
    //show the mask and contact divs
    $('.mask').show().fadeTo('', 0.7);
    $('div#modal-standardpopup').fadeIn();
    // stop the modal link from doing its default action
    return true;
};

function DisplayCommentsPopUp() {
    // scroll to top
    $('html, body').animate({ scrollTop: 0 }, 'slow');
    // before showing the modal window, reset the form incase of previous use.
    $('.success, .error').hide();
    $('div#modal-commentspopup').show();
    //show the mask and contact divs
    $('.mask').show().fadeTo('', 0.7);
    $('div#modal-commentspopup').fadeIn();
    // stop the modal link from doing its default action
    return true;
};


// load the modal window
function DisplayReportAbusePopUp() {
    // scroll to top
    $('html, body').animate({ scrollTop: 0 }, 'slow');
    // before showing the modal window, reset the form incase of previous use.
    $('.success, .error').hide();
    $('div#modal-abuse').show();
    //show the mask and contact divs
    $('.mask').show().fadeTo('', 0.7);
    $('div#modal-abuse').fadeIn();
    // stop the modal link from doing its default action
    return true;
};

function CloseReportAbusePopUp() {
    $('div#modal-abuse, div.mask').stop().fadeOut('slow');
}

function CloseStandardPopUp() {
    $('div#modal-standardpopup, div.mask').stop().fadeOut('slow');
}

function CloseCommentsPopUp() {
    $('div#modal-commentspopup, div.mask').stop().fadeOut('slow');
}
