function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
            if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
        if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*************************Accordion********************************/
$(document).ready(function() {	
    $('.acc_container').hide(); 
    $('.acc_trigger:first').addClass('active').next().show(); 


    $('.acc_trigger').click(function(){
        if( $(this).next().is(':hidden') ) { 
            $('.acc_trigger').removeClass('active').next().slideUp(); 
            $(this).toggleClass('active').next().slideDown(); 
        }
        return false; 
    });
});

/*******************222*********************/

$(document).ready(function() {	
    $('.acc_container2').hide(); 
    $('.acc_trigger2:first').addClass('active').next().show();


    $('.acc_trigger2').click(function(){
        if( $(this).next().is(':hidden') ) { 
            $('.acc_trigger2').removeClass('active').next().slideUp(); 
            $(this).toggleClass('active').next().slideDown(); 
        }
        return false;
    });
});

/************************333**********************************/
$(document).ready(function() {	
    $('.acc_container3').hide();
    $('.acc_trigger3:first').addClass('active').next().show();


    $('.acc_trigger3').click(function(){
        if( $(this).next().is(':hidden') ) { 
            $('.acc_trigger3').removeClass('active').next().slideUp();
            $(this).toggleClass('active').next().slideDown();
        }
        return false;
    });
});

/**********************444************************************/
$(document).ready(function() {	
    $('.acc_container4').hide();
    $('.acc_trigger4:first').addClass('active').next().show();


    $('.acc_trigger4').click(function(){
        if( $(this).next().is(':hidden') ) { 
            $('.acc_trigger4').removeClass('active').next().slideUp();
            $(this).toggleClass('active').next().slideDown();
        }
        return false;
    });
});

/*************************************************************/

/****************************Tabs*****************************/

$(document).ready(function() {

    $(".tab_content").hide();
    $(".tabs div:first").addClass("active").show();
    $(".tab_content:first").show();

    $(".tabs div").click(function() {
        $(".tabs div").removeClass("active");
        $(this).addClass("active"); 
        $(".tab_content").hide();
        var activeTab = $(this).find("a").attr("href"); 
        $(activeTab).fadeIn();
        return false;
    });

});

$(document).ready(function() {

    $(".tab_content2").hide();
    $(".tabs2 div:first").addClass("active").show();
    $(".tab_content2:first").show();

    $(".tabs2 div").click(function() {
        $(".tabs2 div").removeClass("active");
        $(this).addClass("active"); 
        $(".tab_content2").hide();
        var activeTab = $(this).find("a").attr("href"); 
        $(activeTab).fadeIn();
        
        var channelId  = $(this).find("a").attr("rel");   
        
        showProgramForChannel(channelId) ;   
        
        return false;
    });

});

function showProgramForChannel(channelId)
{
    $("div.daysTabContent").hide();
    $("div.timesTabContent").hide();  

    var d = new Date().getDay();
    //d = 4 ; //for testing  
    if ( d == 0 ){
        d = 7;
    }
    
    var daysTabBtnId = "#daysTabBtn-ch"+ channelId + "d" + d ; 
    var daysTabId = "#daysTab-ch"+ channelId + "d" + d ;
    $(".daysTabs " + daysTabBtnId).addClass("active").show(); 
    $(daysTabId).show();  
    
    //$(daysTabId + " .timesTabs div:first").addClass("active").show();
    $(daysTabId + " .timesTabContent:first").show();    //timesTab-ch1d4-t0    
}

$(document).ready(function() {

     showProgramForChannel(1) ;

    /********JoeM*********/    

    $(".daysTabs div").click(function() {
        $(".daysTabs div").removeClass("active");
        $(this).addClass("active"); 
        $("div.daysTabContent").hide();
        var activeTab = $(this).find("a").attr("href");
        $(activeTab).fadeIn();

        //reset the floating bar position and width
        $('.box').css({left: 0});
        $('.box .head').css({width: 72});  
        //reset the selected item
        $('.lava1 li').removeClass('selected');  
        var lavaId = $(activeTab).find(".timesHolderTabs").find(".lava1"); 
        //alert(x) ;
        $(lavaId).find("li:eq(0)").addClass('selected');   
        
        // show first tab
        $(activeTab).find(".timesTabContent").hide();
        $(activeTab).find(".timesTabContent:eq(0)").show();

        return false;
    });
});	

$(document).ready(function() {	

    $(".timesTabs div").click(function() {
        $(".timesTabs div").removeClass("active");
        $(this).addClass("active"); 
        $(this).parents("ul").find("li").removeClass("selected");
        $(this).parent().parent().addClass("selected")
        $("div.timesTabContent").hide();
        var activeTab = $(this).find("a").attr("href"); 
        $(activeTab).fadeIn();
        return false;
    });
});

/*****************************************************************/

/*****************************************************************/
$(document).ready(function () {

    //transitions
    //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
    var style = 'easeOutElastic';
  
    //Retrieve the selected item position and width
    var default_left = Math.round($('.lava1 li.selected').offset().left - $('.lava1').offset().left);
    var default_width = $('.lava1 li.selected').width();

    //Set the floating bar position and width
    $('.box').css({left: default_left});
    $('.box .head').css({width: default_width});

    //if mouseover the menu item
    $('.lava1 li').hover(function () {

        //Get the position and width of the menu item
        left = Math.round($(this).offset().left - $(this).parent().parent().offset().left);     //get the parent div that hold this ul -> li, we need to know its absolute left
        width = $(this).width(); 
        
        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
        $('.box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	

        //if user click on the menu
    }).click(function () {

        //reset the selected item
        $('.lava1 li').removeClass('selected');	

        //select the current item
        $(this).addClass('selected');

    });

    //If the mouse leave the menu, reset the floating bar to the selected item
    $('.lava1').mouseleave(function () {
        
        default_left = Math.round($(this).find('li.selected').offset().left - $(this).offset().left);
        default_width = $(this).find('li.selected').width();

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
        $('.box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		

    });

});

/*
$(document).ready(function () {

    //transitions
    //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
    var style = 'easeOutElastic';

    //Retrieve the selected item position and width
    var default_left = Math.round($('.lava2 li.selected').offset().left - $('.lava2').offset().left);
    var default_width = $('.lava2 li.selected').width();

    //Set the floating bar position and width
    $('.box').css({left: default_left});
    $('.box .head').css({width: default_width});

    //if mouseover the menu item
    $('.lava2 li').hover(function () {

        //Get the position and width of the menu item
        left = Math.round($(this).offset().left - $('.lava2').offset().left);
        width = $(this).width(); 

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
        $('.box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	

        //if user click on the menu
    }).click(function () {

        //reset the selected item
        $('.lava2 li').removeClass('selected');	

        //select the current item
        $(this).addClass('selected');

    });

    //If the mouse leave the menu, reset the floating bar to the selected item
    $('.lava2').mouseleave(function () {

        //Retrieve the selected item position and width
        default_left = Math.round($('.lava2 li.selected').offset().left - $('.lava2').offset().left);
        default_width = $('.lava2 li.selected').width();

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
        $('.box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		

    });

});

$(document).ready(function () {

    //transitions
    //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
    var style = 'easeOutElastic';

    //Retrieve the selected item position and width
    var default_left = Math.round($('.lava3 li.selected').offset().left - $('.lava3').offset().left);
    var default_width = $('.lava3 li.selected').width();

    //Set the floating bar position and width
    $('.box').css({left: default_left});
    $('.box .head').css({width: default_width});

    //if mouseover the menu item
    $('.lava3 li').hover(function () {

        //Get the position and width of the menu item
        left = Math.round($(this).offset().left - $('.lava3').offset().left);
        width = $(this).width(); 

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
        $('.box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	

        //if user click on the menu
    }).click(function () {

        //reset the selected item
        $('.lava3 li').removeClass('selected');	

        //select the current item
        $(this).addClass('selected');

    });

    //If the mouse leave the menu, reset the floating bar to the selected item
    $('.lava3').mouseleave(function () {

        //Retrieve the selected item position and width
        default_left = Math.round($('.lava3 li.selected').offset().left - $('.lava3').offset().left);
        default_width = $('.lava3 li.selected').width();

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
        $('.box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		

    });

});

$(document).ready(function () {

    //transitions
    //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
    var style = 'easeOutElastic';

    //Retrieve the selected item position and width
    var default_left = Math.round($('.lava4 li.selected').offset().left - $('.lava4').offset().left);
    var default_width = $('.lava4 li.selected').width();

    //Set the floating bar position and width
    $('.box').css({left: default_left});
    $('.box .head').css({width: default_width});

    //if mouseover the menu item
    $('.lava4 li').hover(function () {

        //Get the position and width of the menu item
        left = Math.round($(this).offset().left - $('.lava4').offset().left);
        width = $(this).width(); 

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
        $('.box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	

        //if user click on the menu
    }).click(function () {

        //reset the selected item
        $('.lava4 li').removeClass('selected');	

        //select the current item
        $(this).addClass('selected');

    });

    //If the mouse leave the menu, reset the floating bar to the selected item
    $('.lava4').mouseleave(function () {

        //Retrieve the selected item position and width
        default_left = Math.round($('.lava4 li.selected').offset().left - $('.lava4').offset().left);
        default_width = $('.lava4 li.selected').width();

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
        $('.box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		

    });

});

$(document).ready(function () {

    //transitions
    //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
    var style = 'easeOutElastic';

    //Retrieve the selected item position and width
    var default_left = Math.round($('.lava5 li.selected').offset().left - $('.lava5').offset().left);
    var default_width = $('.lava5 li.selected').width();

    //Set the floating bar position and width
    $('.box').css({left: default_left});
    $('.box .head').css({width: default_width});

    //if mouseover the menu item
    $('.lava5 li').hover(function () {

        //Get the position and width of the menu item
        left = Math.round($(this).offset().left - $('.lava5').offset().left);
        width = $(this).width(); 

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
        $('.box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	

        //if user click on the menu
    }).click(function () {

        //reset the selected item
        $('.lava5 li').removeClass('selected');	

        //select the current item
        $(this).addClass('selected');

    });

    //If the mouse leave the menu, reset the floating bar to the selected item
    $('.lava5').mouseleave(function () {

        //Retrieve the selected item position and width
        default_left = Math.round($('.lava5 li.selected').offset().left - $('.lava5').offset().left);
        default_width = $('.lava5 li.selected').width();

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
        $('.box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		

    });

});

$(document).ready(function () {

    //transitions
    //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
    var style = 'easeOutElastic';

    //Retrieve the selected item position and width
    var default_left = Math.round($('.lava6 li.selected').offset().left - $('.lava6').offset().left);
    var default_width = $('.lava6 li.selected').width();

    //Set the floating bar position and width
    $('.box').css({left: default_left});
    $('.box .head').css({width: default_width});

    //if mouseover the menu item
    $('.lava6 li').hover(function () {

        //Get the position and width of the menu item
        left = Math.round($(this).offset().left - $('.lava6').offset().left);
        width = $(this).width(); 

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
        $('.box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	

        //if user click on the menu
    }).click(function () {

        //reset the selected item
        $('.lava6 li').removeClass('selected');	

        //select the current item
        $(this).addClass('selected');

    });

    //If the mouse leave the menu, reset the floating bar to the selected item
    $('.lava6').mouseleave(function () {

        //Retrieve the selected item position and width
        default_left = Math.round($('.lava6 li.selected').offset().left - $('.lava6').offset().left);
        default_width = $('.lava6 li.selected').width();

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
        $('.box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		

    });

});

$(document).ready(function () {

    //transitions
    //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
    var style = 'easeOutElastic';

    //Retrieve the selected item position and width
    var default_left = Math.round($('.lava7 li.selected').offset().left - $('.lava7').offset().left);
    var default_width = $('.lava7 li.selected').width();

    //Set the floating bar position and width
    $('.box').css({left: default_left});
    $('.box .head').css({width: default_width});

    //if mouseover the menu item
    $('.lava7 li').hover(function () {

        //Get the position and width of the menu item
        left = Math.round($(this).offset().left - $('.lava7').offset().left);
        width = $(this).width(); 

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
        $('.box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	

        //if user click on the menu
    }).click(function () {

        //reset the selected item
        $('.lava7 li').removeClass('selected');	

        //select the current item
        $(this).addClass('selected');

    });

    //If the mouse leave the menu, reset the floating bar to the selected item
    $('.lava7').mouseleave(function () {

        //Retrieve the selected item position and width
        default_left = Math.round($('.lava7 li.selected').offset().left - $('.lava7').offset().left);
        default_width = $('.lava7 li.selected').width();

        //Set the floating bar position, width and transition
        $('.box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
        $('.box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		

    });

});

 */

$(document).ready(function(){
    $('.gridTable tr:odd').addClass('rowBg')
})

//function secondMenuClass(){
/*$(document).ready(function(){
$('ul.secondNav li a').hover(function(){
$(this).addClass('navArrow');
})
})*/	
//}
/*setTimeout(secondMenuClass(), 1000);*/

