// opens a new window
function Popup(theURL, w, h) {
   window.open(theURL,'Popup','toolbar=no,menubar=no,resizable=yes,scrollbars=yes,height='+ h + ',width=' + w);
   //Popup.focus();
   return false;
}

$(document).ready(function(){
    /*********************** JQUERY FORM ********************/
    $("form {input[type=text], input[type=password]}").focus(function(){
        $( this ).parent().find(".info").css("display", "block");
        $( this ).addClass("highlighted");
    }).blur(function(){
        $(this).parent().find(".info").css("display", "none");
        $( this ).removeClass("highlighted");
    });

    /*********************** JQUERY RECENTLY RELEASED ********************/
    $("#recentlyReleasedHeader").click(function() {
		$(".comingSoon").hide();
		$("#upcomingHeader").parent().removeClass("active");
		$(this).parent().addClass("active");
		$(".recentlyReleased").show();
		return false;
    });

    $("#upcomingHeader").click(function() {
		$(".recentlyReleased").hide();
		$("#recentlyReleasedHeader").parent().removeClass("active");
		$(this).parent().addClass("active");
		$(".comingSoon").show();
		return false;
    });

    /*********************** JQUERY TOOLTIP ********************/
	$('.tooltip').click(function(){
		return false;
	}).mouseover(function(e) {
		var toolTipWidth = $( '#' + this.id + '_tooltip').width();
		/* check if there is enough space to show bubble on left */
		var left = e.pageX + 10; var top = e.pageY + 10;
		if ( e.pageX + toolTipWidth >= $(window).width() ) {
			left = e.pageX - toolTipWidth - 25; /* additional 25px for mouse width */
		}
		$( '#' + this.id + '_tooltip').css({position:"absolute", top: top, left: left}).fadeIn('fast');
	}).mouseout(function() {
		$( '#' + this.id + '_tooltip').fadeOut('fast');
	});
});