	//TAKE OUT WHAT NEEDS TO BE SET IN A FUNCTIONS .JS FILE
	//WOULD BE NICE TO MAKE CHANGING STATES NOT REQUIRE A REFRESH
	
//begin document ready
$(function() { 
	//begin open dialogue
	$.fx.speeds._default = 1000;
	// increase the default animation speed to exaggerate the effect
	$('#dialog').dialog({
		autoOpen: false,
		//show: 'fade',
		//'hide: 'explode'
		resizable: false,
		height:240,
		width:400,
		modal: true,
		buttons: {
			'Select State': function() {
				$(this).dialog('close');
				$('#selectState').submit();
			},
			Cancel: function() {
				$(this).dialog('close');
				dialogTimer();
			}
		}
	});
	//end open dialogue
	
	//begin dialog timer
	function dialogTimer() {
		setTimeout(function () {
		   $('#dialog').dialog("open");
		}, 60000);
	}
	//end dialog timer

	//begin hiding and toggling channel definitions for dialog
	$("#DescriptionFinancialInstitution").hide();
	$("#DescriptionBrokerage").hide();
	$("a#defLinkFI").hover(function(){
		$("#DescriptionFinancialInstitution").toggle();
	});
	$("a#defLinkB").hover(function(){
		$("#DescriptionBrokerage").toggle();
	});
	//end hiding and toggling channel definitions for dialog
	
	//begin get last 2 blog entries for news & communications blogs
	$.get('http://www.assetbasedltc.com/news/wp-rss.php', function(xml){ 
		$("item:lt(2)", xml).each(function(){ 
			$(this).each(function(){
				$("#rss ul").append("<li><a href='" + $(this).find('link').text() +"'>" + $(this).find('title').text() + "</a></li> ");
			});
		});
	});
	$.get('http://www.assetbasedltc.com/communications/wp-rss.php', function(xml){ 
		$("item:lt(2)", xml).each(function(){ 
			$(this).each(function(){
				$("#rss ul").append("<li><a href='" + $(this).find('link').text() +"'>" + $(this).find('title').text() + "</a></li> ");
			});
		});
	});
	//end get last 2 blog entries for news & communications blogs
	
	//		//Right now is hiding flash, but I think would be better to import it to save load time???
	//		//begin hide content unless logged in
	//		$("#Content1").hide();
			//end hide content unless logged in
			
	//		// Get the value of a cookie:
	//		$.cookie('sampleCookie');
	//		 
	//		// Create (or update) the value of a cookie:
	//		$.cookie('sampleCookie', 'cookieValue');
	//		 
	//		//Create (or update) the value of a cookie to expire in 2 days:
	//		$.cookie('sampleCookie', 'cookieValue', { expires: 2 });
	//		 
	//		// Delete a cookie:
	//		$.cookie('sampleCookie', null);

	//GETS IN THE WAY OF HOVER AND VIDLINKS MAYBE TRY IF STATEMENT
	//begin to show/populate sidebar if cookie is detected
	if ($.cookie('oaState')) {
		//$("H1#top").html("Protecting Assets & Securing Long-Term Care Needs"); -- only for homepage
		if ($.cookie('oaState') && $.cookie('oaFSMName')) {
			$("#sidenav").show();
			$(".ConsumerContent").hide();
			$(".BrokerOnlyContent").show();
			$("#yesFSM").show(); $("#noFSM").hide();
			$("#Content1").hide();
			//if ($.cookie('oaInitialLoginTime') != date("Y-m-d h:i")
			$("#FSMPhotoURL").attr("src", unescape($.cookie('oaFSMPhotoURL')));
			$("a#FSMName").html("Contact " + unescape($.cookie('oaFSMName')));
			$("a.opener, clearcookie, FSM_link").html(unescape($.cookie('oaState')));
			if ($.cookie('oaDistributionChannel') == "Brokerage") {
				$(".FSM_text").append("<br><br><a class=\"SSA_link\" href=\"/Sales_Support_Associates.php\">Get to know your Sales Support Associates</a>");
			}
		}
		else {
			//$("#yesFSM").hide();
			$("#noFSM").show(); $("#yesFSM").hide();
			$("#FSMPhotoURL").attr("src", unescape($.cookie('oaFSMPhotoURL')));
			$("a#FSMName").html("Contact " + unescape($.cookie('oaFSMName')));
			$("a.opener, clearcookie, FSM_link").html(unescape($.cookie('oaState')));
		}
	}
		else {
			//Start timer for popup login
			dialogTimer();
//			//Detect Flash & show flash or html
//			// -----------------------------------------------------------------------------
//			// Globals
//			// Major version of Flash required
//			var requiredMajorVersion = 8;
//			// Minor version of Flash required
//			var requiredMinorVersion = 0;
//			// Minor version of Flash required
//			var requiredRevision = 0;
//			// -----------------------------------------------------------------------------
//			// Version check based upon the values entered above in "Globals"
//			var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
//			
//			// Check to see if the version meets the requirements for playback
//			if (hasReqestedVersion) {
//				// if we've detected an acceptable version
//				// embed the Flash Content SWF when all tests are passed
//				$("#introContent").load("/includes/introFlash.php #FlashIntroBoxEmpty.yesFlash, #introText");
//			} else {  // flash is too old or we can't detect the plugin
//				$("#introContent").load("/includes/introFlash.php #FlashIntroBoxEmpty.noFlash, #introText");
//			}
		}
		//end to show/populate sidebar if cookie is detected
	
	//begin function to open dialogue if certain link is clicked
	$('a.opener').click(function(event) {
		event.preventDefault();
		$('#dialog').dialog('open');
		//attempt to get list of territoris when dialog opened
		//$("#selectState").append("<input type=\"hidden\" name=\"r\" value=\"" + $(this).attr('url') + "\">"); -- PUT IF HAS URL DO THIS
		//$("#selectState").append("<input type=\"hidden\" name=\"r\" value=\"/Cost_of_Long_Term_Care/Long_Term_Care_Cost_Calculator-google.php\">"); works to switch urls
	});
	//end function to open dialogue if certain link is clicked

	//begin product image hovers
	$("img.hover").hover(
	function() {
	$(this).animate({"opacity": ".5"}, 200);
	},
	function() {
	$(this).animate({"opacity": "1"}, 500);
	});
	//end product image hovers
	
	//		//begin function to open dialogue if certain link is clicked
	//		$('a.opener2').click(function(event) {
	//			dialogOpen("/Cost_of_Long_Term_Care/Long_Term_Care_Cost_Calculator-google.php")
	//		});
	//		//end function to open dialogue if certain link is clicked

	//intially hide #videoLinks
	$("#videoLinks").hide();
	//function to show #videoLinks
	$("#hideVideoLinks").click(function() {
	$("#videoLinks").toggle();
	});
});
//end document ready
