<?php
global $str;
?>
<html>
<head>
	<title></title>
	<style>
		body {
			border: 0px;
			margin: 0px;
			padding: 0px;
			overflow:hidden;
		}
	</style>
	<!-- Load Feather code -->
	<script type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/js/feather.js"></script>
	<!-- Instantiate Feather -->
	<script type='text/javascript'>
		var featherEditor = new Aviary.Feather({
			apiKey: 'r8td5g456ar32gc8',
			apiVersion: 3,
			theme: 'light', displayImageSize: true,
			tools: 'all', noCloseButton: true, fileFormat: 'original',
			postUrl: '<?php echo $str->safeJS($this->data['saveURL'])?>',
			appendTo: 'injection_site',
			onLoad: function() {
				launchEditor('image1', '<?php echo $str->safeJS($this->data['fileURL'])?>');
			},
			onSave: function(imageID, newURL) {
				var img = document.getElementById(imageID);
				img.src = newURL;
				with (window.parent){
				FR.UI.grid.load(FR.currentPath);
				}
			},
			onError: function(errorObj) {alert(errorObj.message);}
		});
		function launchEditor(id, src) {
			featherEditor.launch({
				image: id,
				url: src
			});
			return false;
		}
	</script>
</head>

<body>
<div id="injection_site"></div>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td align="center" valign="middle">
	<img id="image1" style="display:none;" src="<?php echo $this->data['fileURL']?>" />
	</td>
</tr>
</table>
</body>
</html>