/**
 * Additional onload functionality
 */
$(document).ready(function() {
	if($('#keyword_input').isDefined()) {
		$('#keyword_input').inputToggle('Search');
	}
	$('.rounded').corners();
	
	if(typeof(pageMode)=='undefined') return;
	
});

function popSearchLink(phrase) {
	$('#keyword_input').val(phrase);
	var loc_val = $('#location_input').val();
	if(loc_val == '' || loc_val == defaultLocationPhrase) {
		$('#location-error').html('<p>Please enter a location</p>');
		$('#location-error').show();
		$('#location_input').focus();
	} else {
		$('#searchFormHolder').submit();
	}
	
	return false;
}


jQuery.fn.isDefined = function() {
	return typeof($(this)[0]) != 'undefined';
}
jQuery.fn.inputToggle = function(phrase) {
	var t = $(this);
	if(t.val() == '') t.val(phrase);
	t.bind("focus", function(e) {
		if(t.val() == phrase) t.val('');
	});
	t.bind("blur", function(e) {
		if(t.val() == '') t.val(phrase);
	});
}