// wait until document is fully scriptable
$(document).ready(function() {

    // select #flowplanes and make it scrollable. use circular and navigator plugins
    $("#flowpanes").scrollable({ size: 1, clickable: false }).circular().navigator({

        // select #flowtabs to be used as navigator
        navi: "#flowtabs",

        // select A tags inside the navigator to work as items (not direct children)
        naviItem: 'a',

        // assign "current" class name for the active A tag inside navigator
        activeClass: 'active'

    });

    var api = $("#flowpanes").scrollable();
	
	

    if (typeof (seekTo) != "undefined" && seekTo > 0) {
        api.seekTo(seekTo, 0);
    }

    $(".popImage").overlay({
        expose: {
            color: '#333',
            loadSpeed: 200,
            opacity: 0.5
        }
    });

    $("#bottomTop").click(function() {
        $('html').animate({ scrollTop: 0 }, 'slow');
        return false;
    });

    $(".land_two").click(function() {
        api.seekTo(2);
        return false;
    });

    $(".land_three").click(function() {
        api.seekTo(3);
        return false;
    });

    $(".land_four").click(function() {
        api.seekTo(4);
        return false;
    });

});

$(function() {

	// setup overlay actions to buttons
	$(".popVideo").overlay({

		expose: '#333',				
		loadSpeed: 200, 
		opacity: 0.5,
		
		onLoad: function(content) {
			// find the player contained inside this overlay and load it
			this.getOverlay().find("a.player").flowplayer(0).load();
		},
		
		onClose: function(content) {
			$f().unload();
		}
	});				
	
	$("div.flash").each(
 
		function(intIndex){
		
			var ref = this.id;
			var obj = $("a[rel=" + ref + "]");
			var href = obj.attr("href");
			
			$("div#" + ref).flashembed(href)				 
		}
	);
	
	/* Tabs */
    $("ul.tabs").tabs("div.panes > div");
	
}); 
