function Customer(o){
	
	var defaults =  {
			'image_data' : 'customerupdate-photo_data'
			
	};
	
	init();
	
	function init(){
		
		defaults = $.extend(defaults,o);
		
		 Webcam.set({
		        width: 160,
		        height: 120,
		        dest_width: 320,
		        dest_height: 240,
		        image_format: 'jpeg',
		        jpeg_quality: 90,
//		        force_flash: false,
//		        flip_horiz: true,
//		        fps: 45
		    });
		
		Webcam.attach( '#my_camera' );
		
		$("#snap").click(snap);
		
		preventSubmit( '#customerupdate-replacementcardnumber' );
		preventSubmit( '#customercreate-cardnumber' );
	}
	
	 function preventSubmit($selector){
		$($selector).keydown(function(e) {
			  if(e.keyCode == 13) { // enter key was pressed
				  e.preventDefault();
//				  e.stopImmediatePropagation();
//				  e.stopPropagation();
			    // run own code
			    return false; // prevent execution of rest of the script + event propagation / event bubbling + prevent default behaviour
			  }
			});
		$($selector).keyup(function(e) {
			if(e.keyCode == 13) { // enter key was pressed
				e.preventDefault();
//				  e.stopImmediatePropagation();
//				  e.stopPropagation();
				// run own code
				return false; // prevent execution of rest of the script + event propagation / event bubbling + prevent default behaviour
			}
		});
		$($selector).keypress(function(e) {
			if(e.keyCode == 13) { // enter key was pressed
				e.preventDefault();
//				  e.stopImmediatePropagation();
//				  e.stopPropagation();
				// run own code
				return false; // prevent execution of rest of the script + event propagation / event bubbling + prevent default behaviour
			}
		});
	}
	
	function snap(){
		Webcam.snap( function(data_uri) {
	        document.getElementById('my_result').innerHTML = '<img width="160" height="120" src="'+data_uri+'"/>';
	        
	        var raw_image_data = data_uri.replace(/^data\:image\/\w+\;base64\,/, '');

	        document.getElementById(defaults.image_data ).value = raw_image_data;
	        
	    } );
	}
	
}