$(document).ready(function(){
	
	$('#main-slider').cycle({ 
		fx:     'scrollHorz',
		cleartype:  true,
		cleartypeNoBg:  true, 
		speed:  800, 
		timeout: 6000, 
		pause: 1,
		pager:  '#slider-nav', 
		prev: '#slider .prev',
		next: '#slider .next',
		pagerAnchorBuilder: function(idx, slide) { 
			// return selector string for existing anchor 
			return '#slider-nav li:eq(' + idx + ') a'; 
		} 
	});
	
	// Adds arrow to lists that have a second level
	$('#main-menu ul ul>li:has(ul)>a').append('<span class="arrow"></span>');
	
	// Add arrow to sidebar nav items
	$('#side a').append('<span class="arrow"></span>');
	
	// Inputs that remember value
	var textInputValue = [];
	$('input[type="text"]').each(function(currentIndex) {
		textInputValue.push($(this).val());
		$(this).focus(function() {
			$(this).removeClass("unfocused");
			var textInputDefault = $(this).val();
			if ($(this).val() == textInputValue[currentIndex]) {
				$(this).val('');
			}

			$(this).blur(function() {
				var userTextInput = $(this).val();
				if (userTextInput == '') {
					$(this).val(textInputDefault);
					$(this).addClass("unfocused");
				}
			});
		});
	});
	
});
