function toggleDefaultText($input) {
	$input.bind('focus', function() {
        if (this.value == this.defaultValue) {
        	this.value = '';
    	}
        if (this.value != this.defaultValue) {
	    	this.select();
        }
	});

	$input.bind('blur', function() {
        if (this.value == ''){
        	this.value = (this.defaultValue ? this.defaultValue : '');
    	}				
	});
}

$(document).ready(function() {
	
	// twitter
	$('.tweets .inner').tweet({
		count : 3,
		username : ["unicasual"],
		loading_text : "Searching twitter..."
	});		
	
	// casual voices
	// randomised on the front-end to overcome caching
	var vCount = gVoices.length,
		vIdx = Math.floor(Math.random() * vCount);
		
	$('.casualVoices blockquote span').html(gVoices[vIdx]);	
	
	// cycle
	if ($('#slider ol').length > 0) {
		$('#slider ol').cycle({ 
		    fx : 'scrollHorz', 
		    speed : 600, 
		    timeout : 0, 
		    pager : '#pager',
		    cleartypeNoBg : true
		});
	}
	
	// replace selects
	$('#select_tag').pseudoSelect();
	$('#select_date').pseudoSelect();
	$('#select_links').pseudoSelect();
	
	// toggle default input text (search)
	toggleDefaultText($('#input_keyword'));
	
});
