;(function( $ ){

	$.fn.createListingTitle = function() {
    
		return this.each( function() {
			$(this).click( onClick );
		});
		
		function onClick() {
			
			$tipTypeVal = $(this).val();
			$listingTitleVal = $("#listingTitleInput").val();
			
			if( $(this).is(':checked') ) {
				if( $tipTypeVal == "Business" ) {
					$("#CompanyName").val( $listingTitleVal );
				} else if( $tipTypeVal == "Product" ) {
					$("#productServiceName").val( $listingTitleVal );
				}
			} else {
				if( $tipTypeVal == "Business" ) {
					$("#CompanyName").val( "" );
				} else if( $tipTypeVal == "Product" ) {
					$("#productServiceName").val( "" );
				}
			} 
	
		}
		
	};
	
	$.fn.resetListingTitle = function( options ) {
		
		var opts = $.extend( {}, $.fn.resetListingTitle.defaults, options);
	
		$(this).load( function() {
			
			$listingTitleVal = $("#listingTitleInput").val();
			if( $listingTitleVal == opts.validationStr ) {
				$("#listingTitleInput").val( "" );
			}
			
		});
		
		$.fn.resetListingTitle.defaults = { validationStr: "No Business Subject Available" }
		
	}
	
})( jQuery );