var contentDivOffset = 20;
var name = "#intro-video-wrap";  
var menuYloc = null;


if(showVideo==true) {
flowplayer("player",

		{
			src: "/assets/js/flowplayer/flowplayer-3.1.5.swf",
			wmode: 'opaque'
		},
		{
		clip: {
			onFinish: function(){ $(name).fadeOut(); $f().unLoad(); }
		},
		plugins: { 
			controls: {
				// location of the controlbar plugin 
				url: '/assets/js/flowplayer/flowplayer.controls-3.1.5.swf', 
				all: false, 
				play: true, 
				scrubber: true 
			} 
		}
	});
}
else {
	$(name).hide();
}

function unloadVideo() {
	//flowplayer().unLoad();
	$f().stop();
}

$(document).ready(function() {
	if(showVideo == false) {
		$(name).hide();
	}
	$("#close-intro-video").click(function(){
		unloadVideo();
		$(name).fadeOut();
		return false;
	});
	/*
	menuYloc = parseInt($(name).css("bottom").substring(0,$(name).css("bottom").indexOf("px")));
	menuYloc = menuYloc-contentDivOffset;
	
	//winoffset = $(window).height() - 2*(contentDivOffset);
	winoffset = $(window).height();
	
	$(window).scroll(function() {

		var offset = menuYloc+$(document).scrollTop()+contentDivOffset - winoffset +"px";
        $(name).animate({bottom:offset},{duration:500,queue:false});
	});
	
	$("#close-intro-video").click(function(){
		$(name).fadeOut();
	});
	
      function doSomething() {
		var xoffset = "-"+((($(window).width() - 1000)/2)/2) + "px";
		$(name).animate({marginRight:xoffset},{duration:300,queue:false});
      };

      var resizeTimer = null;
      $(window).bind('resize', function() {
		if (resizeTimer) clearTimeout(resizeTimer);
		resizeTimer = setTimeout(doSomething, 100);
      });
	  */
});
