<script>
	jQuery(function($) {
		var $ = jQuery;
		
		$("#type").change(function() {
	      var type = $(this).val();

	      $(".slidesettings").hide();
	      $(".scrollsettings").hide();

	      switch(type) {
	      	case 'slideleft':
			case 'slideright':
			case 'slideup':
			case 'slidedown':
				$(".slidesettings").show();
				break;
			case 'scrollleft':
			case 'scrollright':
			case 'scrollup':
			case 'scrolldown':
				$(".scrollsettings").show();
				break;
	      }
	    });

	    $("#type").change();

		// Uploading files
  		$('.upload_image_button').live('click', function( event ){
		    event.preventDefault();

		    window.parent.loadImageFrame($(this), function(attachment) {
		    	jQuery("#image").val(attachment.id);
		    	$('#image-thumb').attr('src', attachment.url);

		    	if ( $('#preview-content').length > 0 ) {
                  $('#preview').click();
                }
		    });
		});
	});
</script>