
var ie6 = function(){
    $(".splash.featured").show();
    var mybodyWidth = $(window).width();
    var mybodyHeight = $(window).height();
    var containerHeight = $('#main-container').height();
    var mw = 1110;
    if(containerHeight > mybodyHeight){
        mybodyHeight = containerHeight;
    }
    if(mybodyWidth < mw){
        mybodyWidth = mw;
    }
    var galw = (mybodyWidth - 528) / 2;
    $(".gallery").css("left", galw);

    $("#mesh").height(mybodyHeight);
    $("#mesh").width(mybodyWidth);
    $("#flash").height(mybodyHeight);
    $("#flash").width(mybodyWidth);
    $("#mask").height(mybodyHeight);
    $("#mask").width(mybodyWidth);

    $(window).resize(function(){
        var h = $(window).height();
        var w = $(window).width();

        if(containerHeight > h){
            h = containerHeight;
        }
        if(w < mw){
            w = mw;
        }
        $("#flash").height(h);
        $("#flash").width(w);
        $("#mesh").height(h);
        $("#mesh").width(w);
        $("#mask").height(h);
        $("#mask").width(w);

    });

    var myFlowplayer = flowplayer("video_player_container", {src: "/sites/all/themes/wassersite/fp/flowplayer.swf", wmode: "opaque"} ,{
        clip: {
            autoPlay: false,
            url: '/sites/all/themes/wassersite/video/ryh.flv'
        },
        logo: {
            url: '/sites/all/themes/wassersite/images/lfp.png',
            fullscreenOnly: false,
            displayTime: 10
        },

        canvas: {backgroundColor: "#282828"},


        plugins: {
            controls: {
                url: '/sites/all/themes/wassersite/fp/controls.swf',
                buttonColor: '#df9f22',
                      tooltipColor: '#df9f22',
                      timeBgColor: '#555555',
                      timeColor: '#df9f22',
                      volumeSliderGradient: 'none',
                      volumeSliderColor: '#000000',
                      sliderColor: '#606060',
                      borderRadius: '0px',
                      backgroundGradient: 'none',
                      sliderGradient: 'none',
                      durationColor: '#303030',
                      backgroundColor: '#282828',
                      tooltipTextColor: '#ffffff',
                      bufferGradient: 'none',
                      progressGradient: 'none',
                      buttonOverColor: '#787878 ',
                      progressColor: '#df9f22',
                      bufferColor: '#666666',
                      height: 24,
                      opacity: 1.0

            }

        },
        key: '#$89c3deb8dcb9c734e8e'
    });



    var prevGalNum = 1;
    $("#prev_next").click(function(){
        if(prevGalNum < 8){
            prevGalNum += 1;
        }

            $(".gallery_image").hide();
            $("#prev_"+prevGalNum).show();
        if(prevGalNum == 8){
            prevGalNum = 0;
        }
    });
    $("#prev_previous").click(function(){
        if(prevGalNum > 1){
            prevGalNum -=1;
        }
        $(".gallery_image").hide();
            $("#prev_"+prevGalNum).show();
    });
    $("#prev_close").click(function(){
        $("#mask").hide();
        $(".gallery").hide();
        $(".gallery_image").hide();
        prevGalNum = 1;
    });

    $("#prev_link_1").click(function(){
        $(".gallery_image").hide();
        $("#prev_1").show();
        prevGalNum = 1;
    });
   $("#prev_link_2").click(function(){
        $(".gallery_image").hide();
        $("#prev_2").show();
        prevGalNum = 2;
    });
    $("#prev_link_3").click(function(){
        $(".gallery_image").hide();
        $("#prev_3").show();
        prevGalNum = 3;
    });
    $("#prev_link_4").click(function(){
        $(".gallery_image").hide();
        $("#prev_4").show();
        prevGalNum = 4;
    });
    $("#prev_link_5").click(function(){
        $(".gallery_image").hide();
        $("#prev_5").show();
        prevGalNum = 5;
    });
    $("#prev_link_6").click(function(){
        $(".gallery_image").hide();
        $("#prev_6").show();
        prevGalNum = 6;
    });
    $("#prev_link_7").click(function(){
        $(".gallery_image").hide();
        $("#prev_7").show();
        prevGalNum = 7;
    });
    $("#prev_link_8").click(function(){
        $(".gallery_image").hide();
        $("#prev_8").show();
        prevGalNum = 8;
    });

};



var general = function(){
    $(".splash.featured").show();
    var mybodyWidth = $(window).width();
    var mybodyHeight = $(window).height();
    var containerHeight = $('#main-container').height();
    var mw = 1110;
    if(containerHeight > mybodyHeight){
        mybodyHeight = containerHeight;
    }
    if(mybodyWidth < mw){
        mybodyWidth = mw;
    }
    var galw = (mybodyWidth - 528) / 2;
    $(".gallery").css("left", galw);
   
    $("#mesh").height(mybodyHeight);
    $("#mesh").width(mybodyWidth);
    $("#flash").height(mybodyHeight);
    $("#flash").width(mybodyWidth);
    $("#mask").height(mybodyHeight);
    $("#mask").width(mybodyWidth);

    $(window).resize(function(){
        var h = $(window).height();
        var w = $(window).width();

        if(containerHeight > h){
            h = containerHeight;
        }
        if(w < mw){
            w = mw;
        }
        $("#flash").height(h);
        $("#flash").width(w);
        $("#mesh").height(h);
        $("#mesh").width(w);
        $("#mask").height(h);
        $("#mask").width(w);

    });
    
    var myFlowplayer = flowplayer("video_player_container", {src: "/sites/all/themes/wassersite/fp/flowplayer.swf", wmode: "opaque"} ,{
        clip: {
            autoPlay: false,
            url: '/sites/all/themes/wassersite/video/ryh.flv'
        },
        logo: {
            url: '/sites/all/themes/wassersite/images/lfp.png',
            fullscreenOnly: false,
            displayTime: 10
        },

        canvas: {backgroundColor: "#282828"},


        plugins: {
            controls: {
                url: '/sites/all/themes/wassersite/fp/controls.swf',
                buttonColor: '#df9f22',
                      tooltipColor: '#df9f22',
                      timeBgColor: '#555555',
                      timeColor: '#df9f22',
                      volumeSliderGradient: 'none',
                      volumeSliderColor: '#000000',
                      sliderColor: '#606060',
                      borderRadius: '0px',
                      backgroundGradient: 'none',
                      sliderGradient: 'none',
                      durationColor: '#303030',
                      backgroundColor: '#282828',
                      tooltipTextColor: '#ffffff',
                      bufferGradient: 'none',
                      progressGradient: 'none',
                      buttonOverColor: '#787878 ',
                      progressColor: '#df9f22',
                      bufferColor: '#666666',
                      height: 24,
                      opacity: 1.0

            }
            
        },
        key: '#$89c3deb8dcb9c734e8e'
    });

    // Here the event handling stuff for featured content starts.
    
    // Thumbnail hover state

    $("#ryh_li").mouseenter(function(){$("#ryh").fadeIn(200)});
    $("#ryh_li").mouseleave(function(){$("#ryh").fadeOut(200)});
    $("#encorp_karma_li").mouseenter(function(){$("#encorp_karma").fadeIn(200)});
    $("#encorp_karma_li").mouseleave(function(){$("#encorp_karma").fadeOut(200)});
    $("#ryh_game_li").mouseenter(function(){$("#ryh_game").fadeIn(200)});
    $("#ryh_game_li").mouseleave(function(){$("#ryh_game").fadeOut(200)});
    $("#vc_mgm_li").mouseenter(function(){$("#vc_mgm").fadeIn(200)});
    $("#vc_mgm_li").mouseleave(function(){$("#vc_mgm").fadeOut(200)});
    $("#ryh_hi5_li").mouseenter(function(){$("#ryh_hi5").fadeIn(200)});
    $("#ryh_hi5_li").mouseleave(function(){$("#ryh_hi5").fadeOut(200)});
    
    $("#gib_gal_li").mouseenter(function(){$("#gib_gal").fadeIn(200)});
    $("#gib_gal_li").mouseleave(function(){$("#gib_gal").fadeOut(200)});
    
    $("#ryh_internal_li").mouseenter(function(){$("#ryh_internal").fadeIn(200)});
    $("#ryh_internal_li").mouseleave(function(){$("#ryh_internal").fadeOut(200)});
    
    // 

    $("#ryh").click(function(){
        myFlowplayer.stop();
        $(".splash").fadeOut(800);
       $("#ryh_splash").fadeIn(300);
    });
    
    $("#ryh_hi5").click(function(){
        myFlowplayer.stop();
        $(".splash").fadeOut(800);
       $("#ryh_hi5_splash").fadeIn(300);
    });
   
    $("#vc_mgm").click(function(){
        myFlowplayer.stop();
        $(".splash").fadeOut(800);
       $("#vc_mgm_splash").fadeIn(300);
    });
    
     $("#ryh_game").click(function(){
        myFlowplayer.stop();
        $(".splash").fadeOut(800);
       $("#ryh_game_splash").fadeIn(300);
    });
    
    $("#encorp_karma").click(function(){
       myFlowplayer.stop();
       $(".splash").fadeOut(800);
       $("#encorp_karma_splash").fadeIn(300);
    });
    $("#icbc_gal").click(function(){
       myFlowplayer.stop();
       $(".splash").fadeOut(800);
       $("#icbc_gal_splash").fadeIn(300);
    });
    
    $("#gib_gal").click(function(){
       myFlowplayer.stop();
       $(".splash").fadeOut(800);
       $("#GIB_gal_splash").fadeIn(300);
    });
     $("#ryh_internal").click(function(){
       myFlowplayer.stop();
       $(".splash").fadeOut(800);
       $("#ryh_internal_splash").fadeIn(300);
    });
    
     $("#ryh_internal").click(function(){
       myFlowplayer.stop();
       $(".splash").fadeOut(800);
       $("#ryh_internal_splash").fadeIn(300);
    });

    $("#ryh_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/GIB_website_WasserSite.flv");
    });
    $("#vc_mgm_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/vc-mgm-splash.flv");
    });
    $("#encorp_karma_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/encorp_karma.flv");
    });
     $("#ryh_hi5_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/RYHguinessHi5_WasserSite_dec2010.flv");
    });    
    $("#ryh_internal_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/RYH_Internal_Video_WasserSite_dec2010.flv");
    });
    
    $("#prev_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/RYH_game_WasserSite.flv");
    });
    
    $("#ryh_game_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/RYH_game_WasserSite.flv");
    });
    
    $("#GIB_gal_play").click(function(){
        $(".splash").hide();
        myFlowplayer.play("/sites/all/themes/wassersite/video/vc-65.flv");
    });
    
//     $("#prev_play").click(function(){
//         $("#mask").fadeIn(200);
//         $("#prev_gallery").fadeIn(1000);
//         $("#prev_1").fadeIn(1200);
//     });

    $("#icbc_gal_play").click(function(){
        $("#mask").fadeIn(200);
        $("#icbc_gallery").fadeIn(1000);
        $("#icbc_1").fadeIn(1200);
    });

//        $("#GIB_gal_play").click(function(){
//        $("#mask").fadeIn(200);
//        $("#GIB_gallery").fadeIn(1000);
//        $("#GIB_1").fadeIn(1200);
//    });
    

    $("#mask").click(function(){
        $("#mask").hide();
        $(".gallery").hide();
        $(".gallery_image").hide();
        prevGalNum = 1;
    });
    var prevGalNum = 1;
    $("#prev_next").click(function(){
        if(prevGalNum < 8){
            prevGalNum += 1;
        }
        
            $(".gallery_image").fadeOut(1000);
            $("#prev_"+prevGalNum).fadeIn(1000);
        if(prevGalNum == 8){
            prevGalNum = 0;
        }
    });
    $("#prev_previous").click(function(){
        if(prevGalNum > 1){
            prevGalNum -=1;
        }
        $(".gallery_image").fadeOut(1000);
            $("#prev_"+prevGalNum).fadeIn(1000);
    });
    $("#prev_close").click(function(){
        $("#mask").hide();
        $(".gallery").hide();
        $(".gallery_image").hide();
        prevGalNum = 1;
    });
    
    $("#prev_link_1").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_1").fadeIn(1000);
        prevGalNum = 1;
    });
   $("#prev_link_2").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_2").fadeIn(1000);
        prevGalNum = 2;
    });
    $("#prev_link_3").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_3").fadeIn(1000);
        prevGalNum = 3;
    });
    $("#prev_link_4").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_4").fadeIn(1000);
        prevGalNum = 4;
    });
    $("#prev_link_5").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_5").fadeIn(1000);
        prevGalNum = 5;
    });
    $("#prev_link_6").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_6").fadeIn(1000);
        prevGalNum = 6;
    });
    $("#prev_link_7").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_7").fadeIn(1000);
        prevGalNum = 7;
    });
    $("#prev_link_8").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#prev_8").fadeIn(1000);
        prevGalNum = 8;
    });
    

// ICBC gallery starts here.
    
    var icbcGalNum = 1;
    $("#icbc_next").click(function(){
        if(icbcGalNum < 5){
            icbcGalNum += 1;
        }
            $(".gallery_image").fadeOut(1000);
            $("#icbc_"+icbcGalNum).fadeIn(1000);
        if(icbcGalNum == 5){
            icbcGalNum = 0;
        }

    });
    $("#icbc_previous").click(function(){
        if(icbcGalNum > 1){
            icbcGalNum -=1;
        }
        $(".gallery_image").fadeOut(1000);
            $("#prev_"+icbcGalNum).fadeIn(1000);
    });
    $("#icbc_close").click(function(){
        $("#mask").hide();
        $(".gallery").hide();
        $(".gallery_image").hide();
        icbcGalNum = 1;
    });

    $("#icbc_link_1").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#icbc_1").fadeIn(1000);
        icbcGalNum = 1;
    });
   $("#icbc_link_2").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#icbc_2").fadeIn(1000);
        icbcGalNum = 2;
    });
    $("#icbc_link_3").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#icbc_3").fadeIn(1000);
        icbcGalNum = 3;
    });
    $("#icbc_link_4").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#icbc_4").fadeIn(1000);
        icbcGalNum = 4;
    });
    $("#icbc_link_5").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#icbc_5").fadeIn(1000);
        icbcGalNum = 5;
    });

// GIB gallery starts here.

    var gibGalNum = 1;
    $("#GIB_next").click(function(){
        if(gibGalNum < 5){
            gibGalNum += 1;
        }
            $(".gallery_image").fadeOut(1000);
            $("#GIB_"+gibGalNum).fadeIn(1000);
var widthE = $("#GIB_"+gibGalNum).width();
$(".gallery").width(widthE);
$("#GIB_body").width(widthE);
        if(gibGalNum == 5){
            gibGalNum = 0;
        }

    });
    $("#GIB_previous").click(function(){
        if(gibGalNum > 1){
            gibGalNum -=1;
        }
        $(".gallery_image").fadeOut(1000);
            $("#GIB_"+gibGalNum).fadeIn(1000);
var widthE = $("#GIB_"+gibGalNum).width();
$(".gallery").width(widthE);
$("#GIB_body").width(widthE);
    });
    $("#GIB_close").click(function(){
        $("#mask").hide();
        $(".gallery").hide();
        $(".gallery_image").hide();
        gibGalNum = 1;
    });

    $("#GIB_link_1").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#GIB_1").fadeIn(1000);
        gibGalNum = 1;
var widthE = $("#GIB_1").width();
$(".gallery").width(widthE);
$("#GIB_body").width(widthE);
    });
   $("#GIB_link_2").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#GIB_2").fadeIn(1000);
        gibGalNum = 2;
var widthE = $("#GIB_2").width();
$(".gallery").width(widthE);
$("#GIB_body").width(widthE);
    });
    $("#GIB_link_3").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#GIB_3").fadeIn(1000);
        gibGalNum = 3;
var widthE = $("#GIB_3").width();
$(".gallery").width(widthE);
$("#GIB_body").width(widthE);
    });
    $("#GIB_link_4").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#GIB_4").fadeIn(1000);
        gibGalNum = 4;
var widthE = $("#GIB_4").width();
$(".gallery").width(widthE);
$("#GIB_body").width(widthE);
    });
    $("#GIB_link_5").click(function(){
        $(".gallery_image").fadeOut(1000);
        $("#GIB_5").fadeIn(1000);
        gibGalNum = 5;
var widthE = $("#GIB_5").width();
$(".gallery").width(widthE);
$("#GIB_body").width(widthE);
    });


// Full screen part starts here.
    $("#fullScreen").click(function(){
        $("#container").hide();
        $("#footer").hide();
        $("#on_webcams").hide();
        $("#webcam_controls").fadeIn(1000);
    });
    $("#webcamExit").click(function(){
        $("#webcam_controls").hide();
        $("#container").fadeIn(200);
        $("#footer").show();
        $("#on_webcams").show();

    });
    var direction = 'north';
    $("#north").click(function(){
        if(direction == 'north'){
            return;
        }
        flowplayer("flash", {src: "/sites/all/themes/wassersite/fp/flowplayer.swf", wmode: "opaque", bgcolor: "#ffffff"} ,{
            clip: {
                //autoPlay: true,
                live: true,
                provider: 'maxcdn',
                url: 'myStream'
            },
            logo: {
                url: '/sites/all/themes/wassersite/images/lfp.png',
                fullscreenOnly: false,
                displayTime: 10
            },
            plugins: {
                controls: null,
                maxcdn: {
                    url: "/sites/all/themes/wassersite/fp/flowplayer.rtmp.swf",
                    netConnectionUrl: 'rtmp://96.49.128.31/oflaDemo'
                }
            },
            key: '#$89c3deb8dcb9c734e8e'
        });
    });
    $("#south").click(function(){
        direction = 'south';
        flowplayer("flash", {src: "/sites/all/themes/wassersite/fp/flowplayer.swf", wmode: "opaque", bgcolor: "#ffffff"} ,{
            clip: {
                //autoPlay: true,
                live: true,
                provider: 'maxcdn',
                url: 'south'
            },
            logo: {
                url: '/sites/all/themes/wassersite/images/lfp.png',
                fullscreenOnly: false,
                displayTime: 10
            },
            plugins: {
                controls: null,
                maxcdn: {
                    url: "/sites/all/themes/wassersite/fp/flowplayer.rtmp.swf",
                    netConnectionUrl: 'rtmp://96.49.128.31/oflaDemo'
                }
            },
            key: '#$89c3deb8dcb9c734e8e'
        });
    });


};


if ( $.browser.msie && $.browser.version != 8.0 ) { 
    ie6();

}else{ 
    general();

}


