function afterflashinit(e){
	if(e.success == true){
		$("#head").css('background', 'url(/images/header.jpg) 0px 147px no-repeat');
	}else{
		$("#flash .alt").css('display', 'block');
	}
}

$(document).ready(function(){
						   
	$("#language_select ul a").click(function(){
		var code = $(this).attr('id');
		$("#language_form input[name='language']").val( code );
		$("#language_form").submit();
	});
	  
	//Reset dropdown menus
	$(".DDroot").css('display', 'none');
	$(".DDroot").css('display', 'block');
	
	//Display Flash
	swfobject.embedSWF('/swf/top.swf', 'topanim', '997', '183', '6.0.65.0', '/swf/expressInstall.swf', {}, {bgcolor: '#FFFFFF', menu: 'false', wmode: 'transparent'}, {id: 'topanim'}, afterflashinit);
	
	
	$(".confirm_link").click(function(){
		var message = "";
		message += "Are you sure you want to navigate away from this page?\n\n";
		message += "The changes you have made have not been saved yet. You can choose to stay on the current page in order to save the changes ('Cancel'), or you can leave this page, losing any changes you have made ('OK').\n\n";
		message += "Press OK to continue, or Cancel to stay on the current page.";
							 
		return confirm( message );				 
	});
	
	
	//Init ajax-update of state pulldown menu
	$(".loading").hide();
	$("select#country").change(function(){
		update_state_pulldown();
	})	
});