// JavaScript Document

$(document).ready(function()
{
	
	// Apply the CSS class to the checkbox so that it becomes positioned off-screen
	$('#field-remember-me').addClass('remember-me-checkbox');
	
	// Determine the current state of the checkbox.
	if($('#field-remember-me').attr('checked') == true)
	{
		// Apply the checked CSS class to the label
		$('label#label-field-remember-me').addClass('remember-me-label-checked');
	}
	else
	{
		// Apply the unchecked CSS class to the label
		$('label#label-field-remember-me').addClass('remember-me-label-unchecked');
	}
	
	// Add a click handler to the label.
	$('label#label-field-remember-me').click(function()
	{
		// Toggle the classes as necessary
		$('label#label-field-remember-me').toggleClass('remember-me-label-checked');
		$('label#label-field-remember-me').toggleClass('remember-me-label-unchecked');
	});
	
	// Apply the CSS class to the Forgot Password link so that it looks consistent with the Remember Me link
	$('div#forgot-password-link').addClass('forgot-password');

	if($('input#field-login').val() == '')
	{
		$('input#field-login').val('Email address');
	}
	
	$('input#field-login').blur(function(e)
	{
		if($(this).val() == '')
		{
			$(this).val('Email address');
		}
	});
		
	$('input#field-login').focus(function(e) 
	{
		if($(this).val() == 'Email address')
		{
			$(this).val('');
		}
	});
	
	$('input#search-field').blur(function(e)
	{
		if($(this).val() == '')
		{
			$(this).val('Search');
		}
	});
		
	$('input#search-field').focus(function(e) 
	{
		if($(this).val() == 'Search')
		{
			$(this).val('');
		}
	});

	
	if($('input#field-password').val() == '')
	{
		$('input#field-password').val('xxxxxxxxxxxx');
	}
	
	$('input#field-password').blur(function(e)
	{
		if($(this).val() == '')
		{
			$(this).val('xxxxxxxxxxxx');
		}
	});
		
	$('input#field-password').focus(function(e) 
	{
		if($(this).val() == 'xxxxxxxxxxxx')
		{
			$(this).val('');
		}
	});
	
	
	if($('#homepage-flash') && $('#homepage-callout-FPO-1') && $('#homepage-callout-FPO-2') && $('#homepage-callout-FPO-3')) 
	{
		
	
		// http://code.google.com/p/reallysimplehistory/wiki/UsageInstructions
		
		// http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701&sliceId=1
		// http://code.google.com/p/swfobject/wiki/documentation
		
		// 1. swfUrl (String, required) specifies the URL of your SWF
		// 2. id (String, required) specifies the id of the HTML element (containing your alternative content) you would like to have replaced by your Flash content
		// 3. width (String, required) specifies the width of your SWF
		// 4. height (String, required) specifies the height of your SWF
		// 5. version (String, required) specifies the Flash player version your SWF is published for (format is: "major.minor.release")
		// 6. expressInstallSwfurl (String, optional) specifies the URL of your express install SWF and activates Adobe express install [ http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 ]. Please note that express install will only fire once (the first time that it is invoked), that it is only supported by Flash Player 6.0.65 or higher on Win or Mac platforms, and that it requires a minimal SWF size of 310x137px.
		// 7. flashvars (Object, optional) specifies your flashvars with name:value pairs
		// 8. params (Object, optional) specifies your nested object element params with name:value pairs
			// * play
			// * loop
			// * menu
			// * quality
			// * scale
			// * salign
			// * wmode
			// * bgcolor
			// * base
			// * swliveconnect
			// * flashvars
			// * devicefont [ http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_13331 ]
			// * allowscriptaccess [ http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16494 ] and [ http://www.adobe.com/go/kb402975 ]
			// * seamlesstabbing [ http://www.adobe.com/support/documentation/en/flashplayer/7/releasenotes.html ]
			// * allowfullscreen [ http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html ]
			// * allownetworking [ http://livedocs.adobe.com/flash/9.0/main/00001079.html ] 
		// 9. attributes (Object, optional) specifies your object's attributes with name:value pairs 
			// * id (NOTE: when undefined, the object element automatically inherits the id from the alternative content container element)
			// * name
			// * styleclass (used instead of class, because this is also an ECMA4 reserved keyword)
			// * align 
			
		var flashvars = 
		{
			baz: "bat",
			foo: "bar"
		};
		
		var params = 
		{
			allowscriptaccess: "always",
			swliveconnect: "true",
			seamlesstabbing: "true",
			allowfullscreen: "false",
			allownetworking: "all",
			play: "true",
			loop: "true",
			menu: "false",
			quality: "autohigh",
			scale: "default",
			wmode: "transparent",
			bgcolor: "#FF6600",
			base: "/flash"
		};
		
		var attributes = 
		{
			//id: "homepage-callout-FPO-1",
			//name: "homepage-callout-FPO-1"	
		};
		
		swfobject.embedSWF("/flash/btnTest_01.swf", "homepage-callout-FPO-1", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_02.swf", "homepage-callout-FPO-2", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_03.swf", "homepage-callout-FPO-3", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		// swfobject.embedSWF("/flash/Home_Anim_Rev1.swf", "homepage-flash", "717", "399", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/si09_final3.swf", "homepage-flash", "717", "399", "9.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
	}
	
	/* This is option2 stuff.  Can be deleted later, if client doesn't like it */
	if($('#homepage2-flash')) 
	{
		var flashvars = 
		{
			baz: "bat",
			foo: "bar"
		};
		
		var params = 
		{
			allowscriptaccess: "always",
			swliveconnect: "true",
			seamlesstabbing: "true",
			allowfullscreen: "false",
			allownetworking: "all",
			play: "true",
			loop: "true",
			menu: "false",
			quality: "autohigh",
			scale: "default",
			wmode: "transparent",
			bgcolor: "#FF6600",
			base: "/flash"
		};
		
		var attributes = 
		{
			//id: "homepage-callout-FPO-1",
			//name: "homepage-callout-FPO-1"	
		};
		
		swfobject.embedSWF("/flash/btnTest_01.swf", "homepage-callout-FPO-1", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_02.swf", "homepage-callout-FPO-2", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_03.swf", "homepage-callout-FPO-3", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/si09_final2.swf", "homepage2-flash", "717", "399", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
	}
	
	/* This is option3 stuff.  Can be deleted later, if client doesn't like it */
	if($('#homepage3-flash')) 
	{
		var flashvars = 
		{
			baz: "bat",
			foo: "bar"
		};
		
		var params = 
		{
			allowscriptaccess: "always",
			swliveconnect: "true",
			seamlesstabbing: "true",
			allowfullscreen: "false",
			allownetworking: "all",
			play: "true",
			loop: "true",
			menu: "false",
			quality: "autohigh",
			scale: "default",
			wmode: "transparent",
			bgcolor: "#FF6600",
			base: "/flash"
		};
		
		var attributes = 
		{
			//id: "homepage-callout-FPO-1",
			//name: "homepage-callout-FPO-1"	
		};
		
		swfobject.embedSWF("/flash/btnTest_01.swf", "homepage-callout-FPO-1", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_02.swf", "homepage-callout-FPO-2", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_03.swf", "homepage-callout-FPO-3", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/Home_Anim_Rev1.swf", "homepage3-flash", "717", "399", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
	}
	
	/* This is option4 stuff.  Can be deleted later, if client doesn't like it */
	if($('#homepage4-flash')) 
	{
		var flashvars = 
		{
			baz: "bat",
			foo: "bar"
		};
		
		var params = 
		{
			allowscriptaccess: "always",
			swliveconnect: "true",
			seamlesstabbing: "true",
			allowfullscreen: "false",
			allownetworking: "all",
			play: "true",
			loop: "true",
			menu: "false",
			quality: "autohigh",
			scale: "default",
			wmode: "transparent",
			bgcolor: "#FF6600",
			base: "/flash"
		};
		
		var attributes = 
		{
			//id: "homepage-callout-FPO-1",
			//name: "homepage-callout-FPO-1"	
		};
		
		swfobject.embedSWF("/flash/btnTest_01.swf", "homepage-callout-FPO-1", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_02.swf", "homepage-callout-FPO-2", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/btnTest_03.swf", "homepage-callout-FPO-3", "333", "146", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
		swfobject.embedSWF("/flash/", "homepage4-flash", "717", "399", "8.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
	}
	
});