﻿$(document).ready(function() {
    $('.buttonBuy').click(function(ev) { 
        // var url = $(this).attr("href");
        // url = document.getElementById("hdnloginurl").value;

        var url = "/register/user_login.aspx?fromUrl=" + document.getElementById("hdnbuyurl").value + "&origin=BN";
       
        $.modal('<iframe src="' + url + '" height="400" width="785" scrolling="no" style="border:0"></iframe>', {
            closeHTML: "",
            containerCss: {
                backgroundColor: "#fff",
                height: 400,
                padding: 0,
                width: 785
            },
            overlayClose: true
        });

        ev.preventDefault();
    });

    $('.buttonBid').click(function(ev) { 
        // var url = $(this).attr("href");
        // url = document.getElementById("hdnloginurl").value;

        var url = "/register/user_login.aspx?fromUrl=" + document.getElementById("hdnbidurl").value + "&origin=BID";
       
        $.modal('<iframe src="' + url + '" height="400" width="785" scrolling="no" style="border:0"></iframe>', {
            closeHTML: "",
            containerCss: {
                backgroundColor: "#fff",
                height: 400,
                padding: 0,
                width: 785
            },
            overlayClose: true
        });

        ev.preventDefault();
    });


    $('.buttonMao').click(function(ev) { 
        // var url = $(this).attr("href");
        // url = document.getElementById("hdnloginurl").value;

        var url = "/register/user_login.aspx?fromUrl=" + document.getElementById("hdnmaourl").value + "&origin=MAO";
       
        $.modal('<iframe src="' + url + '" height="400" width="785" scrolling="no" style="border:0"></iframe>', {
            closeHTML: "",
            containerCss: {
                backgroundColor: "#fff",
                height: 400,
                padding: 0,
                width: 785
            },
            overlayClose: true
        });

        ev.preventDefault();
    });
/*Auctions.aspx (listing page)*/
    $('.buttonLogin').click(function(ev) { /* pull out into seperate js file */
        var url = $(this).attr("href");
        $.modal('<iframe src="' + url + '" height="400" width="785" scrolling="no" style="border:0"></iframe>', {
            closeHTML: "",
            containerCss: {
                backgroundColor: "#fff",
                height: 400,
                padding: 0,
                width: 785
            },
            overlayClose: true
        });
        ev.preventDefault();
    });


/*header.ascx*/
$('.link-signin .button').click(function(ev) { /* pull out into seperate js file */
    var url = $(this).attr("href");
    $.modal('<iframe src="' + url + '" height="400" width="785" scrolling="no" style="border:0"></iframe>', {
        closeHTML: "",
        containerCss: {
            backgroundColor: "#fff",
            height: 400,
            padding: 0,
            width: 785
        },
        overlayClose: true
    });
    ev.preventDefault();
});

$('.link-join .button').click(function(ev) { /* pull out into seperate js file */
    var url = $(this).attr("href");
    $.modal('<iframe src="' + url + '" height="400" width="785" scrolling="no" style="border:0"></iframe>', {
        closeHTML: "",
        containerCss: {
            backgroundColor: "#fff",
            height: 400,
            padding: 0,
            width: 785
        },
        overlayClose: true
    });
    ev.preventDefault();
});

    $('.listings-listview .cta-btn').click(function(ev) {
        var href = $(this).attr('rel');
        if($(this).hasClass('login-redirect')) {
            $.modal('<iframe src="' + href + '" height="400" width="785" scrolling="no" style="border:0"></iframe>', {
                closeHTML: "",
                containerCss: {
                    backgroundColor: "#fff",
                    height: 400,
                    padding: 0,
                    width: 785
                },
                overlayClose: true
            });
        } else {
            window.location=href;
        }
        ev.preventDefault();
    });


});      
