var homepage_banner_object;

(function ($) {$(document).ready(function() {
	/*
	//main navigation decoration
	$("ul.sf-menu").superfish({hoverClass:'sf-menu-hover',pathClass:'sf-menu-path',pathLevels:1,autoArrows:false});
	$(".action-nav li:last").addClass("action-nav-last");
	$("#page-nav a:first").addClass("page-nav-first");
	
	//state select box
	var state_styles = {
		comboboxContainerClass: "state-select-container",
		comboboxValueContainerClass: "state-select-value-container",
		comboboxValueContentClass: "state-select-value-content",
		comboboxDropDownClass: "state-select-dropdown",
		comboboxDropDownButtonClass: "state-select-dropdown-button",
		comboboxDropDownItemClass: "state-select-item",
		comboboxDropDownItemHoverClass: "state-select-item-hover",
		comboboxDropDownGroupItemHeaderClass: "state-select-item-header",
		comboboxDropDownGroupItemContainerClass: "state-select-item-group-container",
		animationType: "",
		width: ""
	};
	$("#state_select").combobox(state_styles);
	$("#state_select").combobox.onChange = 	changeLocation;

	//text input default value switcher
	$("input[type='text']").focus ( function() { if ( this.value == this.defaultValue ) { this.value = ""; }; } );
	$("input[type='text']").blur ( function() { if ( $.trim ( this.value ) == "" ) { this.value = ( this.defaultValue ? this.defaultValue : "" ); }; } );

	//homepage flash
	var flashvars = {
		path: "wp-content/themes/repower/flash/RepowerHomepageBanner.xml"

	};

	var params = {
	wmode: "transparent"
	};

	var attributes = {
	};

	if($('#flash-holder').length) {
		swfobject.embedSWF("wp-content/themes/repower/flash/RepowerHomepageBanner.swf", "flash-holder", "1900", "389", "9.0.28", "wp-content/themes/repower/js/expressInstall.swf", flashvars, params, attributes);
	}
	
	homepage_banner_object = document.getElementById("flash-holder");
	*/
});
		   })(jQuery);

function reloadFlashXML(xmlPath) {
	homepage_banner_object.loadXMLIntoFlash(xmlPath);
}

function changeLocation() {
	var choice = jQuery('#state_select option:selected').eq(0);
	var code = choice.val();
	if(code != '') {
		var state = choice.text();
		jQuery.cookie('location', 'country=United+States&countrycode=US&region='+state.replace(' ','+')+'&regioncode='+code, {expires: 7, path: '/'});
		location.href = '/in-your-state/' + state.toLowerCase().replace(' ', '_') + '/';
	}
}
