
	google_style = 'background: rgb(255, 255, 255) url(http://www.google.com/coop/intl/en/images/google_custom_search_watermark.gif) no-repeat scroll left center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;';
	current_search_text = null;

	$('#cse-search-box .text').blur(function () {
		if ($(this).val() == '' && $('#cse-search-box #search_type').val() != 'google') {
			$('#cse-search-box .text').attr('style','');
			$('#cse-search-box .text').val(current_search_text).addClass('lite');
		} 
		  		
	});
	
	$('#cse-search-box .text').focus(function() {
		if ($(this).hasClass('lite')) {
			$(this).removeClass('lite').val('');
		}
		
	});

	$('#search-box .eye').click(function() {
		$('#cse-search-box #soompi-search').toggle();
		return false;
	});
	
	
	$('#cse-search-box #soompi-search li').click(function() {
		$('#cse-search-box #search_type').val($(this).attr('id'));
		
		switch($(this).attr('id')) {
			case 'google':
				action = 'http://soompi.com/forums/search.php';
				type = 'Search SOOMPI';
				img = 'search_google.png';
				break;
			case 'members':
				action = '/search/friends';
				type = 'Search Members';
				img = 'search_members.png';
				break;
			case 'tags':
				action = '/search/tags';
				type = 'Search Tags';
				img = 'search_tags.png';
				break;
		}
		
		current_search_text = type;

		$('#cse-search-box').attr('action', action);
		$('#search-box .eye').attr('src', '/static/images/' + img);

		if ($('#cse-search-box #search_type').val() != 'google') {
		
			$('#cse-search-box .text').attr('style','');
			
			if ($('#cse-search-box .text').hasClass('lite') || $('#cse-search-box .text').val() == '') {
				$('#cse-search-box .text').val(type).addClass('lite');
			}
		}
		else {  // if it IS google
			// case 1: no text, LITE other type == get rid of text, add google style
			if ($('#cse-search-box .text').hasClass('lite')) {
				$('#cse-search-box .text').val('');
				$('#cse-search-box .text').attr('style',google_style);
			}	
		
		}
		
		$('#cse-search-box #soompi-search li').removeClass('check');
		$(this).addClass('check');
		$('#cse-search-box #soompi-search').fadeOut('medium');
		
	});

