/* flvbox
 * requires         : jQuery & swfObject
 * version          : 1.1
 * update           : 08.07.18
 * written by       : Kowata Keigo
 * based on code by : 4mir Salihefendic (http://amix.dk)
 *              and   John Resig        (http://jquery.com/)
 * license          : LGPL
 */

/*
$(document).ready(function(){
	$("a.flvbox").click(function(){
		fb_show( this.rel );
		return false;
	});
});
*/
function fb_show( arg ) {
	var fb_rel    = arg.split(" ").join("").split(",");
	var fb_flv    = fb_rel[0];
	var fb_width  = fb_rel[1];
	var fb_height = fb_rel[2];
	
	$(document.body).append("<div id='fb_cont'><div style='margin:100px auto; padding:50px; width:300px; border:1px solid #c00; background:#000; color:#f00; text-align:center; '>Please upgrade your <a href='http://www.adobe.com/go/BPCKX' target='_blank' style='color:#f00; font-weight:bold;'>Flash Player</a>.<br />&nbsp;<br /><a href='#' onclick='fb_hide()' style='color:#f00;'>[ &times; CLOSE ]</a></div>");
	
	// <![CDATA[
	var so = new SWFObject("flvplayer.swf", "flvplayer", "100%", "100%", "8", "#000000");
	so.addVariable("fb_flv",    fb_flv );
	so.addVariable("fb_width",  fb_width );
	so.addVariable("fb_height", fb_height );
	so.addVariable("fb_close",  "fb_hide" );
	so.addParam("allowScriptAccess", "always");
	so.addParam("menu", "false");
	so.addParam("wmode", "transparent");
	so.write("fb_cont");
	// ]]>
	
	//css
	$("#fb_cont").css({ "position":"fixed", "margin":0, "top":0, "left":0, "z-index":100 });
	//resize
	$(window).resize(fb_resize);
	fb_resize();
	//scroll
	$(window).scroll(fb_scroll);
	fb_scroll();
	//hide other swf
	//$("div.swf").hide();
};


//remove
function fb_hide() {
	//show other swf
	//$("div.swf").show();
	//remove
	$("#fb_cont").remove();
};


//resize
function fb_resize() {
	var de = document.documentElement;
	var w = self.innerWidth  || (de&&de.clientWidth) || document.body.clientWidth;
	var h = self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	$("#fb_cont").css({ "width":w+"px", "height":h+"px" });
}

//scroll
function fb_scroll() {
	var ua = navigator.userAgent.toLowerCase();
	//for WIN IE
	if( ua.indexOf("windows") > 0 && ua.indexOf("msie") > 0){
		var scrollTop  = document.body.scrollTop  || document.documentElement.scrollTop;
		$("#fb_cont").css({ "position":"absolute", "top":scrollTop+"px" });
	};
};
