﻿var exit = true;


$(function () {
    $('.tooltip').hover(function () {
        $(this).addClass('showTooltip');
    },
    function () {
        $(this).removeClass('showTooltip');
    });


    $(".MPVCompletedTournaments .MPVTournament").click(function () {
        $(".MPVWinners").hide('fast');
        $(this).parent().children(".MPVWinners").show('fast');
    });


    if (location.href.indexOf("Download-Assist.aspx") != -1)
        $("#divDownloadHelper").show("slow");

});


//BTag transfer code
$(function() {
    $.expr[':'].external = function(obj) {
        var h = obj.href.toUpperCase();
        return (obj.hostname.toUpperCase() != location.hostname.toUpperCase()) && (h.indexOf('BTAG=') == -1) && (h.indexOf('HTTP://') != -1);
    };

    $('a:external, area:external').each(function() {
        var btag = $("#btagspan").text();
	var url = this.href;
        var prefix = "&";
        if (this.href.indexOf("?") == -1) prefix = "?";
	if (this.href.indexOf("btag1") == -1)
		url += prefix + "btag1=" + btag;
        url += "&bTag=" + btag;
	
//alert(url);
	$(this).attr("href", url);
    });
});


//Insert btags where btag=# or btag1=# found in an href
$(function(){	
	var bt = $("#btagspan").text();
	$("*[href*='btag=#'],*[href*='btag1=#']").each(function(){
		var href = $(this).attr("href");
		href = href.replace(/btag=#/i,"btag=" + bt);
		href = href.replace(/btag1=#/i,"btag1=" + bt);
		$(this).attr("href",href);
});
});
