﻿function rate_page(url) {
    open_window(url, "Rate Page", 0, 0, 245, 170, 0);
}

function contact_page(url) {
    open_window(url, "Contact", 0, 0, 270, 340, 0);
}

function tip_page(url) {
    open_window(url, "Send tip", 0, 0, 500, 450, 0);
}

function open_window(url, name, left, top, width, height, menubar) {
    // if IE then use modal window (it's a bit quicker)
    left = (screen.width / 2) - (width / 2);
    top = (screen.height / 2) - (height / 2);
    rp = window.open(url, "_blank", "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width + ",menubar=" + menubar + ",scrollbars=0,resizable=0,status=0");
    rp.focus();
    return (true);
}
function refreshParent() {
    if (window.opener.location) {
        window.opener.location.reload();
    }
    self.close();
}

function rating(id) {
    rate = parseInt(id.charAt(4));
    document.getElementById("review_rate").value = rate;
    for (i = 1; i <= rate; i++) {
        document.getElementById("rate" + i).className = "scoreSelected";
    }
    for (i = rate + 1; i <= 5; i++) {
        document.getElementById("rate" + i).className = "score";
    }
}                 
function qtip_page(url) {

    $(this).qtip(
    {
        content:
        {
            title: {
                text: 'Tips en venn',
                button: 'Lukk'
            },
            url: url
        }//,
//        position: {
//            target: $(document.body), // Position it via the document body...
//            corner: 'center' // ...at the center of the viewport
//        },
//        show: {
//            when: 'click', // Show it on click
//            solo: true // And hide all other tooltips
//        },
//        hide: false,
//        style: {
//            width: 500,
//            height: 600,
//            padding: '14px',
//            border: {
//                width: 9,
//                radius: 9,
//                color: '#666666'
//            },
//            name: 'light'
//        },
//        api: {
//            beforeShow: function() {
//                // Fade in the modal "blanket" using the defined show speed
//                $('#qtip-blanket').fadeIn(this.options.show.effect.length);
//            },
//            beforeHide: function() {
//                // Fade out the modal "blanket" using the defined hide speed
//                $('#qtip-blanket').fadeOut(this.options.hide.effect.length);
//            }
//        }
    });
}