/****************************************
* Good Experience
* Base JavaScript
****************************************/

// Perform initial window onloads

$(document).ready(function() {
	setupForms();
	setupSubscribeInput();
});

// Set up for behaviors

function setupForms() {
	// Fake :focus state for IE
	$('input[type=text]', 'select', 'textarea').each(function(input) {
		input.focus(function() {
			this.addClass('focus');
		});

		input.blur(function() {
			this.removeClass('focus');
		});
	});
}


// Set up a single default input
function setupSubscribeInput() {
	var input = $('#subscribe-input');
	var defaultValue = 'Enter email address...';
	input.addClass('empty').val(defaultValue);

	input.focus(function() {
		input.removeClass('empty');
		if(input.val() == defaultValue) 
			input.val('');
	});
	
	input.blur(function() {
		if(input.val() == defaultValue || input.val() == '') 
			input.addClass('empty');
		if(input.val() == '') 
			input.val(defaultValue);
	});
};


// Hide Something

function hideThis(target) {
	$(target).setStyle('display','none');
}

// Show Something

function showThis(target) {
	$(target).setStyle('display','block');
}

// Go to a url

function goTo() {
	var sE = null, url;
	if(document.getElementById) {
		sE = document.getElementById('urlList');
	} else if(document.all) {
		sE = document.all['urlList'];
	}
	if(sE && (url = sE.options[sE.selectedIndex].value)) {
		location.href = url;
	}
}

