jQuery.fn.popupready = function(onready, url, name, features, replace) {
    var popup = window.open(url, name, features, replace);
    if (onready) {
        setTimeout(poll, 10);
    }
    function poll() {
        if (jQuery("body *", popup.document).length == 0) {
            setTimeout(poll, 10);
        }
        else {
            onready(popup);
        }
    }
    return popup;
};
jQuery.popupready = jQuery.fn.popupready;

jQuery(document).ready(function() {
	order_newsletter();
    jQuery("a.myPopup").click(function(e) {
    e.preventDefault();
    jQuery.popupready(
        function(popup) {
        jQuery("a", popup.document).click(function(e) {
                e.preventDefault();
                popup.close();
            });
        },
        "/beatport/", "newwindow", "location=0,status=0,scrollbars=0,width=462,height=336");
    });
});

/* NEWSLETTER */
function order_newsletter(){
	$('#newsletter form').submit(function(){
		$(this).callRemote();
		return false;
	})
}

/* FORM - DEFAULT TEXT */
$(function(){ 
	 // find all the input elements with title attributes
	$('input[title!=""]').hint();
	});
