<script>
	jQuery(function($) {
		var $ = jQuery;
		
		$('.upload_image_button').live('click', function( event ){
			event.preventDefault();
			var target = $(this).data('target-id');

			window.parent.loadImageFrame($(this), function(attachment) {
				jQuery("#" + target).val(attachment.id);

				if ( attachment.sizes.thumbnail ) {
					jQuery("#" + target + "-thumb").attr("src", attachment.sizes.thumbnail.url);
				} else {
					jQuery("#" + target + "-thumb").attr("src", attachment.url);
				}

				jQuery("#caption").val(attachment.caption);
				jQuery("#title").val(attachment.title);
				jQuery("#alt").val(attachment.alt);

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

		$('.parallaxsettings').hide();
		$('.adipolisettings').hide();
		$('.camansettings').hide();
		$('.picstripsettings').hide();

		$('#type').change(function() {
			var value = $(this).val();

			$('.parallaxsettings').hide();
			$('.camansettings').hide();
			$('.picstripsettings').hide();
			$('.standardsettings').hide();

			switch(value) {
				case 'standard':
					$('.standardsettings').show();
					break;
				case 'caman':
					$('.camansettings').show();
					break;
				case 'fixed':
					$('.parallaxsettings').show();
					$('.parallaxstandard').hide();
					break;
				case 'parallax':
					$('.parallaxsettings').show();
					$('.parallaxstandard').show();
					break;
				case 'picstrip':
					$('.picstripsettings').show();
					break;
			}
		});

		$('#hover_effect').change(function() {
			var value = $(this).val();

			$('.effecktsettings').hide();
			$('.adipolisettings').hide();
			$('.subtlesettings').hide();

			switch(value) {
				case 'effeckt':
					$('.effecktsettings').show();
					break;
				case 'adipoli':
					$('.adipolisettings').show();
					break;
				case 'subtle':
					$('.subtlesettings').show();
					break;
			}
		});
	});
</script>
