function initPopup() {
    //alert('popup')
    
    p = document.getElementById("popup-bg");
    if (p) {
        _h = document.getElementById("main").offsetHeight;
        p.style.height = _h + "px";
    }
    var btn_c = document.getElementById("btn-contact");
    if (btn_c) {
        btn_c.onclick = function() {
            document.body.className += " d-popupc ";
            //alert('sdsds');
            if (window.attachEvent && !window.opera) { hideSelectBoxes(p); }
        }

    }





    var btn_h = document.getElementById("btn-hazmana");
    
    if (btn_h) {
        btn_h.onclick = function() {
            document.body.className += " d-popuph ";
            if (window.attachEvent && !window.opera) { hideSelectBoxes(p); }
        }
    }


    var btn_b = document.getElementById("btn-sendToBuddy");

    if (btn_b) {
        btn_b.onclick = function() {
            document.body.className += " d-popupb ";
            if (window.attachEvent && !window.opera) { hideSelectBoxes(p); }
        }
    }
    
    
    var close = document.getElementById("popup").getElementsByTagName("a");
    var close = $("#popup a.cls");
    for (var i = 0; i < close.length; i++) {

        close[i].onclick = function() {
            document.body.className = document.body.className.replace("d-popupc", "");

            document.body.className = document.body.className.replace("d-popuph", "");

            document.body.className = document.body.className.replace("d-popupb", "");

            if (window.attachEvent && !window.opera) { showSelectBoxes(p); }

        }

    }
    
    /*---*/
    $('.photo-hold .btn-open').click(function() {
        if ($('.photo-popup', $(this).parents('.photo-hold')).get(0)) {
            $('.photo-popup', $(this).parents('.photo-hold')).show();
            if (window.attachEvent && !window.opera) { hideSelectBoxes($('.photo-popup', $(this).parents('.photo-hold')).get(0)); }
        }
    });
    $('.photo-popup .btn-close').click(function() {
        $(this).parents('.photo-popup').hide();
        if (window.attachEvent && !window.opera) { showSelectBoxes($('.photo-popup', $(this).parents('.photo-hold')).get(0)); }
    });
}

$(document).ready(function() { initPopup(); });

function pessengerPricePopUp(e, id) {

    var popup = $("#" + id);
    if (popup.css("display") == "block") {
        popup.css("display", "none");
        return false;
    }

    var elemClicked = getEventTarget(e);
    var elemX = pageX(elemClicked) - 95;
    var elemY = pageY(elemClicked) - 83;
    var left = elemX.toString() + "px"; ;
    var top = elemY.toString() + "px"; ;

    popup.css({ "top": top, "left": left, "display": "block" });

    return false;
}












