//You need an anonymous function to wrap around your function to avoid conflict
(function($){

	//Attach this new method to jQuery
	$.fn.extend({ 
 		
		//Plugin Name
		myWPSearchBox: function(options) {
			
			var defaults = {
				returnURL: location.href				
			}
			
			var options = $.extend(defaults, options);
				
			//Iterate over the current set of matched elements
    		return this.each(function() {
				
				// Get defaults option;
				var defaults = options;
				
				// The selector that the plugin will work with
				var object = $(this);
				
				// Search input
				var searchInput = object.find('input');
				
				// Search input default value that got from plugin's options.
				// (The value that will be returned if user's search value is empty, or will be used to check if user's search value is equal to this value)
				var searchDefaultValue = searchInput.val();
				
				// Function that used to check input value
				var checkInputValue = function () {
					// Get search input current value
					var searchInputValue = searchInput.val();
					
					if (searchInputValue == searchDefaultValue) {
						searchInput.val('');
					}
					
					if (searchInputValue == '') {
						searchInput.val(searchDefaultValue);
					}
				}
				
				// Function that used to validate submitted value
				var formValidate = function() {
					// Get search input current value
					var searchInputValue = searchInput.val();
					
					if(searchInputValue != searchDefaultValue && searchInputValue != '') {
						window.location=defaults.returnURL+'?s='+searchInputValue;
					} else {
						alert('Your search value is empty or invalid. Please try again!');
						$('input#s').focus();
					}
				}
				
				/*
				function submit_search_value (){
					var search_value = $('input#s').val();
		
					if(search_value != default_value && search_value != '') {
						window.location='<?php bloginfo('url'); ?>?s='+search_value;
					}else{
						alert('Your search value is empty or invalid. Please try again!');
						$('input#s').focus();
					}
				}
				*/
				
				// Search input's events: focus and blur
				searchInput.focus(function(){
					checkInputValue()
				}).blur(function() {
					checkInputValue()
				})
				
				// Form search's event: submit
				object.submit(function(){
					formValidate();
					return false;
				});
			});
    	}
	});
	
//pass jQuery to the function		
})(jQuery);