
var flashVersionRequired = "9";
var flashMovie;

$( document ).ready( function()
{
    $( document ).pngFix();
    $( "a.map" ).overlay();

	// SETUP TABS FOR CONTEST
	$( "ul.tabs" ).tabs( "div.pane",
	{
		current: "active",
		//effect: "ajax",
		onClick: function()
		{
			
		}
	}).history();
	
	var tooltipAPI = $( "#entryform input[type=text]" ).tooltip(
	{
		tip: '.help-tip',
		offset: [0, -5],
		opacity: 1,
		effect: "fade",
		position: "center left",
		api: "true",
		onBeforeShow: function()
		{
			if( this.getTrigger().hasClass( "required-on" ) )
			{
				this.getTrigger().parent().css({ background: "#FF0000" });
				this.getTip().css({ background: "#FF0000" });
			}
			else
			{
				this.getTrigger().parent().css({ background: "#000000" });
				this.getTip().css({ background: "#000000" });
			}
		},
		onBeforeHide: function()
		{
			this.getTrigger().parent().css({ background: "none" });
		},
		events: { input: 'focus, blur', tooltip: ',' }
	}); 
	
	
});

function VideoBox()
{
	var inner = CreatePopup( "auto", "auto", "video-box" );

	var video = $( "<div />" );

	video.attr( "id", "video-player" );

	inner.append( video );
}

function CreatePlayer( videoFile )
{
	VideoBox();
	swf = LoadFlash(
		swfobject,
		"video-player",
		"inc/interactive/player.swf",
		"inc/interactive/expressInstall.swf",
		"100%",
		"100%",
		{ 
			width: "360",
			height: "290",
			file: "/inc/media/video/" + videoFile,
			autostart: "true",
			repeat: "false",
			fullscreen: "true"		
		}
	);
}

//================================================================================
// Flash loading 
//================================================================================

function LoadFlash( swfobject, id, flashFile, xiFile, width, height, flashVars )
{
	var params = {};

	params.wmode				= "transparent";
	params.allowscriptaccess	= "always";
	params.allowfullscreen		= "true";
	params.scale				= "showAll";

	var attributes = {};

	attributes.id				= id + "-jsswf";
	attributes.name				= id + "-jsswf";

	

	swfobject.embedSWF( flashFile, id, width, height, flashVersionRequired, xiFile, flashVars, params, attributes );

	return( document.getElementById( id + "-jsswf" ) );
	
}



