


$(document).ready(function() {
    $('#menuContent .tabContent:not(:first)').css('display', 'none');
    $('#menu2Content .mainTab:not(:first)').css('display', 'none');
    $('.videos.tabContentWidget').css('display', 'none');
    $('#menu2Content .tabContent:not(:first)').css('display', 'none');
    $('#menu3Content .tabContent:not(:first)').css('display', 'none');
});


function changeTab(me, toTab) {

    belongsTo = $(me).parent().attr('id');

    $('#' + belongsTo + 'Content .tabContent').css('display', 'none')
    $('#' + toTab).css('display', 'block');

    $('#' + belongsTo + ' .on').removeClass('on');
    $(me).addClass('on');
}

function changeTabWidget(me, toTab) {

    belongsTo = $(me).parent().attr('id');
   // alert(belongsTo);
    $('#' + belongsTo + 'Content .tabContentWidget').css('display', 'none')
    $('#' + belongsTo + 'Content .' + toTab).css('display', 'block');

    $('#' + belongsTo + ' .on').removeClass('on');
    $(me).addClass('on');
}


$(document).ready(function() {
    //To switch directions up/down and left/right just place a "-" in front of the top/left attribute
    //Vertical Sliding
    $('.boxgrid.slidedown').hover(function() {
        $(".cover", this).stop().animate({ top: '260px' }, { queue: false, duration: 300 });
    }, function() {
        $(".cover", this).stop().animate({ top: '0px' }, { queue: false, duration: 300 });
    });
    $('.boxgrid.slidedown2').hover(function() {
        $(".cover", this).stop().animate({ top: '260px' }, { queue: false, duration: 300 });
    }, function() {
        $(".cover", this).stop().animate({ top: '0px' }, { queue: false, duration: 300 });
    });
});

Cufon.replace('li#TheGames a');
Cufon.replace('li#AboutUs a');
Cufon.replace('li#Gallery a');
Cufon.replace('li#Blog a');
Cufon.replace('h1');
Cufon.replace('h2');
Cufon.replace('.boxgrid h3');
Cufon.replace('.boxgrid h2');
Cufon.replace('#homecontentleftcolumn #lower2column_left_tabnav a');
Cufon.replace('#homecontentleftcolumn #lower2column_left_tabnav a.on');
Cufon.replace('#lowerwidecontent .content .maintitle');
Cufon.replace('#lowerwidecontent .content h3');
Cufon.replace('#lowerwidecontent .contentsmall h3');
Cufon.replace('#lowerwidecontent .contentsmall .maintitle');
Cufon.replace('.cufonbranding1');
Cufon.replace('.cufonbranding2');
Cufon.replace('.cufonbranding3');
Cufon.replace('#banner h1');
Cufon.replace('#videolisting h3');
Cufon.replace('.videorepeat h4');
Cufon.replace('.videorepeat h5');
Cufon.replace('#tvheadcaption h2');
Cufon.replace('#tvheadcaption h3');
Cufon.replace('#banner h2');
Cufon.replace('.puffareareg h3');
Cufon.replace('.headertitle h3');
Cufon.replace('.controls label');
Cufon.replace('.walllabel p');


Cufon.replace('.itemOverlay h3');


$("#menu a").click(function() {
    $("#menuContent").slideUp(200, function() {
        $("#menuContent").slideDown(500, function() {
        });
    });
});

var cfgBannerSlideTime = 1500;
var cfgBannerSlideDistance = '140px';
var cfgBannerSlideInitialSize = '356px';




function resizeOverview() {
    if ($("#menuContent").css('height') == '140px') {
        $("#menuContent").animate({ height: cfgBannerSlideInitialSize }, cfgBannerSlideTime);
        $("#imageclosebutt").text('Close')
    } else {
        $("#menuContent").animate({ height: cfgBannerSlideDistance }, cfgBannerSlideTime);
        $("#imageclosebutt").text('Open')

    }
}




/* venues */

function filterCategory(ddl) {
    var cluster = ddl[ddl.selectedIndex].value;
    if (cluster == "east") {
        $(document).find('.categorylist_Westend, .categorylist_Southside, .categorylist_Satellite').fadeOut(500);
        $(document).find('.categorylist_Eastend').fadeIn(500);
    }
    else if (cluster == "west") {
    $(document).find('.categorylist_Eastend, .categorylist_Southside, .categorylist_Satellite').fadeOut(500);
    $(document).find('.categorylist_Westend').fadeIn(500);
    }
    else if (cluster == "south") {
    $(document).find('.categorylist_Eastend, .categorylist_Westend, .categorylist_Satellite').fadeOut(500);
    $(document).find('.categorylist_Southside').fadeIn(500);
    }
    else if (cluster == "satellite") {
        $(document).find('.categorylist_Eastend, .categorylist_Southside, .categorylist_Westend').fadeOut(500);
        $(document).find('.categorylist_Satellite').fadeIn(500);
    }
    else
        $(document).find('.categorylist_Eastend, .categorylist_Southside, .categorylist_Satellite, .categorylist_Westend').fadeIn(500);
}

function changePageSize(ddl) {
    var theUrl = window.location.href.split('?')[0] + "?pageSize=" + ddl[ddl.selectedIndex].value;
    window.location = theUrl;

}


$(document).ready(function() {
    //To switch directions up/down and left/right just place a "-" in front of the top/left attribute
    //Vertical Sliding
    $('.boxgrid.slidedown').hover(function() {
        $(".cover", this).stop().animate({ top: '260px' }, { queue: false, duration: 1 });
    }, function() {
        $(".cover", this).stop().animate({ top: '0px' }, { queue: false, duration: 1 });
    });
    $('.boxgrid.slidedown2').hover(function() {
        $(".cover", this).stop().animate({ top: '260px' }, { queue: false, duration: 1 });
    }, function() {
        $(".cover", this).stop().animate({ top: '0px' }, { queue: false, duration: 1 });
    });
});


// This is the name of the class that contains the rollover state
openClass = "open"
function closeall() {

    if ($("#gamesscroll").css("display") == "block") {
        $("#gamesscroll").slideUp("slow");
        document['gamesscrollclick'].src = 'images/navarrow1.gif';

    }
    if ($("#aboutscroll").css("display") == "block") {
        $("#aboutscroll").slideUp("slow");
        document['aboutscrollclick'].src = 'images/navarrow1.gif';

    }
    if ($("#mediascroll").css("display") == "block") {
        $("#mediascroll").slideUp("slow");
        document['mediascrollclick'].src = 'images/navarrow1.gif';

    }
}


$(document).ready(function() {
$('#Template_StaticTopNav1_gamesscrollclick').click(function() {
        if ($("#gamesscroll").css("display") == "none") {
            $("#gamesscroll").slideDown("slow");
            document['gamesscrollclick'].src = '/images/navarrow1_up.gif';
        } else {
            $("#gamesscroll").slideUp("slow");
            document['gamesscrollclick'].src = '/images/navarrow1.gif';

        }

    });
});

$(document).ready(function() {
$('#Template_StaticTopNav1_aboutscrollclick').click(function() {

        if ($("#aboutscroll").css("display") == "none") {
            $("#aboutscroll").slideDown("slow");
            document['aboutscrollclick'].src = '/images/navarrow1_up.gif';

        } else {
            $("#aboutscroll").slideUp("slow");
            document['aboutscrollclick'].src = '/images/navarrow1.gif';

        }

    });
});

$(document).ready(function() {
$('#Template_StaticTopNav1_mediascrollclick').click(function() {
        if ($("#mediascroll").css("display") == "none") {
            $("#mediascroll").slideDown("slow");
            document['mediascrollclick'].src = '/images/navarrow1_up.gif';

        } else {
            $("#mediascroll").slideUp("slow");
            document['mediascrollclick'].src = '/images/navarrow1.gif';

        }

    });
});

$(function() {

    $('.scroll-pane').jScrollPane({
        scrollbarWidth: 12
    }); 
	$('.scroll-pane2').jScrollPane({
        scrollbarWidth: 12
    });
    $('#East End').jScrollPane({
        scrollbarWidth: 12
    });
    $('#SouthSide').jScrollPane({
        scrollbarWidth: 12
    });
    $('#West End').jScrollPane({
        scrollbarWidth: 12
    });
    $('#Satellite').jScrollPane({
        scrollbarWidth: 12
    });
    

});


$(document).ready(function() {
    $("#news-marquee").marquee({ yScroll: "bottom" });
});


var use_debug = false;

function debug() {
    if (use_debug && window.console && window.console.log) console.log(arguments);
}


function WebForm_FireDefaultButton(event, target) {
    //event.srcElement doesn't work in FF so we check whether
    //it or event.target exists, using whichever is returned
    var element = event.target || event.srcElement;
    if (event.keyCode == 13 &&
    !(element &&
    element.tagName.toLowerCase() == "textarea")) {
        var defaultButton;
        if (__nonMSDOMBrowser) {
            defaultButton = document.getElementById(target);
        }
        else {
            defaultButton = document.all[target];
        }
        if (defaultButton && typeof defaultButton.click != "undefined") {
            defaultButton.click();
            event.cancelBubble = true;
            if (event.stopPropagation) {
                event.stopPropagation();
            }
            return false;
        }
    }
    return true;
}


var childWidth = 0;
var sliderWidth = 0;
var childLength = 0;
var moving = false;

$(document).ready(function() {
childLength = $('.slideContainer .slideHolder .slider ul').children().length
childWidth = $('.slideContainer .slideHolder .slider ul li:eq(0)').css('width');
    sliderWidth = (childLength * parseInt(childWidth));
    $('.slideContainer .slider').css('width', sliderWidth + 'px');
});

function move(dir) {
    if (!moving) {
        moving = true;
        if (dir == 'next') {
            $('.slideContainer .slider').animate(
					{ left: '-' + childWidth },
					400, 'linear',
					function() { swapPositions(dir); }
				)
        } else {
            swapPositions(dir);
            $('.slideContainer .slider').css('left', '-' + childWidth);
            $('.slideContainer .slider').animate(
					{ left: '0px' },
					400, 'linear',
					function() { moving = false; }
				)
        }
    }
}

function swapPositions(dir) {
    if (dir == 'back') {
        $('.slideContainer .slideHolder .slider ul').prepend($('.slideContainer .slideHolder .slider ul li:eq(' + (childLength - 1) + ')'));
        $('.slideContainer .slider').css('left', 0);
    } else {
    $('.slideContainer .slideHolder .slider ul').append($('.slideContainer .slideHolder .slider ul li:eq(0)'));
    $('.slideContainer .slider').css('left', 0);
        moving = false;
    }
}

var childWidth_small = 0;
var sliderWidth_small = 0;
var childLength_small = 0;
var moving_small = false;

$(document).ready(function() {
    childLength_small = $('.slideContainer-small .slideHolder .slider ul').children().length
    childWidth_small = $('.slideContainer-small .slideHolder .slider ul li:eq(0)').css('width');
    sliderWidth_small = (childLength_small * parseInt(childWidth_small));
    $('.slideContainer-small .slider').css('width', sliderWidth_small + 'px');
});

function move_small(dir) {
    if (!moving_small) {
        moving_small = true;
        if (dir == 'next') {
            $('.slideContainer-small .slider').animate(
					{ left: '-' + childWidth_small },
					400, 'linear',
					function() { swapPositions_small(dir); }
				)
        } else {
         swapPositions_small(dir);
            $('.slideContainer-small .slider').css('left', '-' + childWidth_small);
            $('.slideContainer-small .slider').animate(
					{ left: '0px' },
					400, 'linear',
					function() { moving_small = false; }
				)
        }
    }
}

function swapPositions_small(dir) {
    if (dir == 'back') {
        $('.slideContainer-small .slideHolder .slider ul').prepend($('.slideContainer-small .slideHolder .slider ul li:eq(' + (childLength_small - 1) + ')'));
        $('.slideContainer-small .slider').css('left', 0);
    } else {
        $('.slideContainer-small .slideHolder .slider ul').append($('.slideContainer-small .slideHolder .slider ul li:eq(0)'));
        $('.slideContainer-small .slider').css('left', 0);
        moving_small = false;
    }
}



/*
 * 2014 TV slider
 *
 */
var childWidth1 = 0;
var sliderWidth1 = 0;
var childLength1 = 0;
var moving1 = false;

$(document).ready(function () {
    childLength1 = $('#videoscroller .videoSlideHolder .videoSlider ul').children().length;
    //childLength1 = (childLength1 < 4) ? 4 : childLength;
    childWidth1 = $('#videoscroller .videoSlideHolder .videoSlider ul li:eq(0)').css('width');
    childWidth1 = parseInt(childWidth1) + 20;
    sliderWidth1 = (childLength1 * parseInt(childWidth1));
    //alert(childLength1+' - '+childWidth1+' - '+sliderWidth1);
    $('#videoscroller .videoSlideHolder .videoSlider').css('width', sliderWidth1 + 'px');
});

function move1(dir) {
    if (!moving1) {
        moving1 = true;
        if (dir == 'next') {
            $('#videoscroller .videoSlideHolder .videoSlider').animate(
					{ left: '-' + childWidth1 },
					400, 'linear',
					function () { swapPositions1(dir); }
				)
        } else {
            swapPositions1(dir);
            $('#videoscroller .videoSlideHolder .videoSlider').css('left', '-' + childWidth1);
            $('#videoscroller .videoSlideHolder .videoSlider').animate(
					{ left: '0px' },
					400, 'linear',
					function () { moving1 = false; }
				)
        }
    }
}

function swapPositions1(dir) {
    if (dir == 'back') {
        $('#videoscroller .videoSlideHolder .videoSlider ul').prepend($('#videoscroller .videoSlideHolder .videoSlider ul li:eq(' + (childLength1 - 1) + ')'));
        $('#videoscroller .videoSlideHolder .videoSlider').css('left', 0);
    } else {
        $('#videoscroller .videoSlideHolder .videoSlider ul').append($('#videoscroller .videoSlideHolder .videoSlider ul li:eq(0)'));
        $('#videoscroller .videoSlideHolder .videoSlider').css('left', 0);
        moving1 = false;
    }
}

/*********/




/*
* Function: clickOnEnter(event, button)
*
* This file should be suitable for script inclusion in a jsp or html file.
*/

// Determine the browser style
var NS = (document.layers) ? true : false;
var IE = (document.all) ? true : false;

// Needed to capture Netscape keypress events
if (NS) document.captureEvents(Event.KEYPRESS);

// Set flag to false initially
var clickedEnter = false;

/*
* clickOnEnter
* ------------
* Simulates a click on a button when the user presses the Enter key.  This
* function can be used to direct the submission of a form when Enter is pressed
* in a text field.  To do so, put:
*
*   onKeyPress="clickOnEnter(event, this.form.<button_name>)"
*
* as an attribute of the text field in question, where <button_name> is the
* name of the button that should trigger a submission.  Some browsers may
* receive two submissions with this code, especially Netscape 6.x for Mac OS X,
* so you may want to use this function in combination with hasClickedButton.
* Another option is to set up the form action to ignore multiple submissions.
*/
function clickOnEnter(event, button) {
    // Get IE event
    if (IE) event = window.event;

    // Get key code
    var code = 0;
    if (NS) code = event.which
    else code = event.keyCode; // choose IE style as default

    // If key code is return key, click the button
    if (code == 13) {
        // It seems that in IE 5 for PC the button name/value pair doesn't get
        // submitted when click is called, so add it to the query by hand
        if (IE) {
            button.form.action = button.form.action + "?" + button.name + "=" + button.value;
        }
        clickedEnter = true;
        button.click();
    } else clickedEnter = false;
}
$(document).ready(function() {
    $('a[title*=partial]').hide();
});

