<?php
require_once '../library/functions.php';
require_once '../library/logged.php';
?>

<script type="text/javascript" src="../../js2/plupload.js"></script>
<script type="text/javascript" src="../../js2/plupload.gears.js"></script>
<script type="text/javascript" src="../../js2/plupload.silverlight.js"></script>
<script type="text/javascript" src="../../js2/plupload.flash.js"></script>
<script type="text/javascript" src="../../js2/plupload.browserplus.js"></script>
<script type="text/javascript" src="../../js2/plupload.html4.js"></script>
<script type="text/javascript" src="../../js2/plupload.html5.js"></script>
<link href="../css/css_admin.css" rel="stylesheet" type="text/css">
<body style="background:#fff">
<strong style="font-size:15px; font-family: arial">Mutltiple Product Upload Here.</strong>
          <div id="container" class="common">
    <div id="filelist" style="color:#ccc; font-size:13px" >No runtime found.</div>
    <br />
    <a id="pickfiles" href="javascript:;">Select files</a> 
   <a id="uploadfiles" href="javascript:;">Upload files</a>
   <div class="clearfix"></div>
   <p>
    <strong style="font-size:13px; font-family: arial; color:red">*Select the file and click "Upload files".</strong>
    </p>
</div>
<script type="text/javascript">
// Custom example logic
function $(id) {
	return document.getElementById(id);	
}


var uploader = new plupload.Uploader({
	runtimes : 'gears,html5,flash,silverlight,browserplus',
	browse_button : 'pickfiles',
	container: 'container',
	max_file_size : '2mb',
	url : 'multi_process_product.php?cat_id=<?php echo $_GET['cat_id']?><?php if($_GET['subcat_id']){echo '&subcat_id='.$_GET['subcat_id'];}?>',
	resize : {width : <?php echo $_GET['pic_w']?>, height : <?php echo $_GET['pic_h']?>, quality : 90},
	flash_swf_url : '../../js2/plupload.flash.swf',
	silverlight_xap_url : '../../js2/plupload.silverlight.xap',
	filters : [
		{title : "Image files", extensions : "jpg,gif,png"},
		{title : "Zip files", extensions : "zip"}
	]
});

uploader.bind('Init', function(up, params) {
	$('filelist').innerHTML = "<div>Current runtime: " + params.runtime + "</div>";
});

uploader.bind('FilesAdded', function(up, files) {
	for (var i in files) {
		$('filelist').innerHTML += '<div id="' + files[i].id + '">' + files[i].name + ' (' + plupload.formatSize(files[i].size) + ') <b></b></div>';
	}
});

uploader.bind('UploadProgress', function(up, file) {
	$(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
});

$('uploadfiles').onclick = function() {
	uploader.start();
	return false;
};

uploader.init();
</script>
</body>