(function($,W,D){
		   
	/**
	 * Method fill invoice input of personal data
	 * @param {Object} form - object <form> where is set person data and invoice data
	 * @param {Array[form, to} fillInputElement - array where is context form input into to input  
	*/	   
    function fillInvoice(form, fillInputElement) {
		$.each(fillInputElement, function(index, value){
			var fromValue = $(form).find('input#'+value.from).val();
			//fill value into invoice
			$(form).find('input#'+value.to).val(fromValue);
		});		
    }
	
	/**
	 * Method cleraing all input by invoice
	 * @param {Object} form - object <form> where is set person data and invoice data
	 * @param {Array[form, to} fillInputElement - array where is context form input into to input  
	*/
	function clearInvoice(form, fillInputElement) {
		$.each(fillInputElement, function(index, value){			
			$(form).find('input#'+value.to).val('');
		});		
	}
    
    // Expose functionality to jQuery namespace:
    $.fn.fillInvoiceRegistration = function(settings) {
        // Initiate:
        return this.each(function(){
            fillInvoice.call(this, settings.form, settings.fillInputElement);
			
			if(!settings.hasClearInvoice)
				clearInvoice.call(this, settings.form, settings.fillInputElement);
        });        
    };
    
})(jQuery,window,document);
