﻿$(document).ready(function () {
    //Setting container overflow as hidden
    $('.welcomeTheatre').css('overflow', 'hidden');

    //Hide ALL Splash Content panels
    //$('.splashContent').css('display', 'none');

    //load animation 1
    //$('.flashPanel').flash({ swf: 'Assets/Specific/HomeSplash/section1.swf', height: 401, width: 968, wmode: 'window' });

    //set tab 1 to current
    $('#splashScene1').css('display', 'block').addClass('current');

    //Set FIRST List item to current
    $('ul#TheatreController li:first-child').addClass('current');

    //Set current scene value
    currentscene = 1
    incomingscene = 1

    var SplashItem = $('ul#TheatreController li');

    //Setting "current" class to selected list items

    $(SplashItem).click(function () {
        //Set Incoming Scene ID		
        $(SplashItem).removeClass('current');
        $(this).addClass('current');
        incomingscene = $(this).index() + 1


        $('.splashScene').css('display', 'none').removeClass('current');
        $('#splashScene' + incomingscene).css('display', 'block').addClass('current');
        //Amend SELECTED NAV as 1
        //alert(currentscene)
        //FADE out CURRENT tab CONTENT
        //$('.current .splashContent').fadeOut(2000, function () {
            //Outgoing Animation of CURRENT Tab
            //alert(currentscene)
            //$('.current .flashPanel').flash({ swf: 'Assets/Specific/HomeSplash/section' + currentscene + 'out.swf', height: 401, width: 968, wmode: 'window' });
        //});
    });
});

function flashOut(a) {
    //Play selected tab INCOMING animation
    $('.current .flashPanel').flash().remove();
    //$('.current .flashPanel').flash({ swf: 'Assets/Specific/HomeSplash/section' + incomingscene + '.swf', height: 401, width: 968, wmode: 'window' });
}

function flashReady(b) {
    //REMOVE FLASH OBJECT
    $('.flashPanel').flash().remove();
    //FADE in ALL tab CONTENT
    $('.splashContent').fadeIn(2000);

    //Sorting tab
    $('.splashScene').css('display', 'none').removeClass('current');
    $('#splashScene' + incomingscene).css('display', 'block').addClass('current');

    currentscene = b

}

function browserCheck() {

    if (navigator.userAgent.match(/iPhone/i) ||
		navigator.userAgent.match(/Android/i) ||
		navigator.userAgent.match(/Blackberry/i) ||
		navigator.userAgent.match(/BlackBerry/i) ||
		navigator.userAgent.match(/OperaMobi/i) ||
		navigator.userAgent.match(/Opera Mini/i) ||
		navigator.userAgent.match(/IEMobile/i) ||
		navigator.userAgent.match(/Jasmine/i) ||
		navigator.userAgent.match(/Fennec/i) ||
		navigator.userAgent.match(/Blazer/i) ||
		navigator.userAgent.match(/Minimo/i) ||
		navigator.userAgent.match(/MOT-/i) ||
		navigator.userAgent.match(/Nokia/i) ||
		navigator.userAgent.match(/SAMSUNG/i) ||
		navigator.userAgent.match(/Polaris/i) ||
		navigator.userAgent.match(/LG-/i) ||
		navigator.userAgent.match(/SonyEricsson/i) ||
		navigator.userAgent.match(/hiptop/i) ||
		navigator.userAgent.match(/avantgo/i) ||
		navigator.userAgent.match(/plucker/i) ||
		navigator.userAgent.match(/SIE-/i) ||
		navigator.userAgent.match(/xiino/i) ||
		navigator.userAgent.match(/elaine/i) ||
		navigator.userAgent.match(/AUDIOVOX/i) ||
		navigator.userAgent.match(/mobile/i) ||
		navigator.userAgent.match(/webOSi/i)
	 ) {
        window.location.replace("http://m.o2priority.co.uk/moments");
    }

}
