// JavaScript Document
var flash;
var isReady = false;
var filename;
var flash_div = "flashcontent";
function getFlashMovie(movieName) {
	if (window.document[movieName])
	return window.document[movieName];
	if (navigator.appName.indexOf("Microsoft Internet") == -1) {
	if (document.embeds && document.embeds[movieName])
	return document.embeds[movieName];
	} else
	return document.getElementById(movieName);
}
function flashReady()
{
	flash = getFlashMovie(flash_div);
	flash.loadImage(filename);
	isReady = true;
}
function setBackground(file, fit_to_screen, stretch, animate)
{
	filename = file;
	
	if(typeof(fit_to_screen) === undefined) fit_to_screen = true;
	if(typeof(stretch) === undefined) stretch = false;
	if(typeof(animate) === undefined) animate = true;
	
	$("body").css({width:'100%', height:'100%'});
	$("body").wrapInner('<div id="static_content_container" style="position:absolute; top:0px; left:0px;  width:100%; height:100%;"></div>');
	$("body").prepend('<div id="static_background_container" style="position:fixed; width:100%; height:100%;"><div id="flashcontent"></div></div>');
	
	var flashvars = {};
	flashvars.fit_to_screen = fit_to_screen;
	flashvars.stretch = stretch;
	flashvars.animate = animate;
	flashvars.screen_width = $(window).width();
	flashvars.screen_height = $(window).height();
	var params = {};
	params.menu = "false";
	params.quality = "high";
	params.wmode = "transparent";
	params.allowfullscreen = "false";
	swfobject.embedSWF("http://www.orange-element.com/swf/swfBackground.swf", flash_div, "100%", "100%", "9.0.0", false, flashvars, params);
	
	$("object").css({display:'block'});
	
	if(isReady)
	{
		flash.loadImage(filename);
	} 
	
}
function changeBackground(file)
{
	filename = file;
	flash.loadImage(filename);
}
function trace(msg)
{
	//console.log(msg);
}