$(document).ready(function (){

	// Automate links to open in new windows for any links in USEFUL LINKS (SMR), ??, and any links in the SMR text.
	// As well as: The About pages (targeted by .entry a), Quotes/About panels under SMR (.sub-panel a), Key Facts (.widget_smr_key_facts a),
	// and Multimedia (.widget_smr_multimedia a)
	$('#links-widget a, .widget_links a, .entry a, .sub-panel a, .widget_smr_key_facts a, .widget_smr_multimedia a').attr('target', '_blank');

	/* Removed 'disabled' from first search filter option if JavaScript is enabled...*/
	$('.linkselect').removeAttr('disabled'); // Currently this isn't in place as the disabled attribute causes the title to not even show...

	/* Attach the linkselect functionality to all elements of class .linkselect */
	$('.linkselect').linkselect();

	/* Hide the first option in the box, otherwise known as the title option (this colud probably be done via the plugin...but I'm not sure how right now. */
	$('.linkselectContainer ul li:first-child').hide();

	/* Hide the 'submit' button for the filters if JS is enabled, change the name to 's', and make them auto-submit upon selection. */
	$('#search_filters input[type="submit"]').hide();
	$('#location').attr('name', 's');
	$('#industry').attr('name', 's');
	
	$('#company_list li').click(function() {
		$('#company').siblings(':submit').trigger('click');
	});

	$('#location_list li').click(function() {
		$('#location').siblings(':submit').trigger('click');
	});

	$('#industry_list li').click(function() {
		$('#industry').siblings(':submit').trigger('click');
	});
	

	/* Search field hide/show and text color change if empty */
	if (($('#search_item #s').val() == '') ||
			($('#search_item #s').val() == 'Search...')) {
		$('#search_item #s').val('Search...').css('color', '#888');
	}

	$("#search_item #s")
		.focus(function() {
			$(this).css('color', '#000');
			if ($(this).val() == 'Search...') {
				$(this).val('');
			}
		})
		.blur(function() {
			if ($(this).val() == '') {
				$(this)
				.val('Search...')
				.css('color', '#888');
			}
		});

	$('.home #rss-3 h2 a').attr('href', 'http://whatshappening.lewispr.com');

});
