<script type="text/javascript" src="<?=base_url()?>js/jquery.form.js"></script>
				
				<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" id="theme">
				<!--<link rel="stylesheet" href="<?php echo base_url() ?>css/jquery.fileupload-ui.css">
				
                -->
                <div class="breadcrumb ui-corner-tl ui-corner-tr">
                <div style="float:left; position:relative;"><img class="breadcrumbIcon" align="absmiddle"  src="<?php echo base_url();?>images/homePage.png" /><a href="<?php echo base_url(); ?>">Strona WWW</a><img src="<?php echo base_url(); ?>images/breadcrumbSeparator.png" align="absmiddle" style="" /></div>
                <?php
				$counter = count($parents);
				$count = 1;
				$lastNode = null;
				 foreach($parents as $node){
					 
					echo '<div class="contenerNodeBreadcrumb"><img src='.base_url().'images/newspaper.png align="absmiddle" class="breadcrumbIcon"><a href="'.base_url().'admin/wyswietl/'.$node->id.'">'.truncate($node->nodeData['name']).'</a>';
				//	if($counter==$count) echo '<img style="position:absolute; left:40%; top:32px;" src='.base_url().'images/pointer_breadcrumb.png /> ';
				
					echo '</div><img src="'.base_url().'images/breadcrumbSeparator.png"  align="absmiddle"  class="separatorBreadcrumb" />'; 
				 $count++;
				 $lastNode = $node; 
				 } 
				 echo '<div class="contenerNodeBreadcrumb"><img src="'.base_url().'images/brick_mini.png" align="absmiddle" class="breadcrumbIcon" /><a  href="'.base_url().'admin/module/'.$this->uri->segment(3).'">'.truncate($module->modules_name).'</a> <img class="pointerBreadcrumb" src='.base_url().'images/pointer_breadcrumb.png /></div>';
				?>
                <a href="<?php echo base_url()?>admin/wyswietl/<?php echo $lastNode->id ?>"><img src="<?=base_url(); ?>images/back_cms_main.png" border="0" style="float:right;"></a>
                </div>
				<div>
					<script type="text/javascript">
						function successFunc(data)  { 
							//alert(data);
							$('#ajax-loader').html("");
							var base_url = "<?php echo base_url(); ?>";
							var i = Math.floor(Math.random()*100000);

							var base_url = "<?php echo base_url(); ?>";
					        var modId = "<?php echo $this->uri->segment(3); ?>";
					        
				            if(!$.browser.msie) $("#sortableFiles").html('Proszę czekać...').load(base_url+"admin/module/"+modId+" div.defaultDataRow");
				            else if($.browser.msie) window.location.href="<?=base_url()?>admin/module/"+modId;
						}
						$(document).ready(function(){
							$('form.upload input[name=file]').change(function(){
								
								var options = { 
								        target:        '',   // target element(s) to be updated with server response 
								        dataType:	'html', 
								        success:	successFunc  // post-submit callback 
								 		//,
								 		//url: '<?=base_url()?>index.php/strona/tmp_logo'
								    }; 
								$("form.upload").ajaxSubmit(options);
								
								$('#ajax-loader').html("<img src='<?=base_url()?>images/ajax-loader.gif' />");
							});
						});
					</script>
					<form class="upload" action="<?php echo base_url() ?>admin/addfile/<?=$this->uri->segment(3)?>" method="POST" enctype="multipart/form-data">
					    <input type="file" name="file" >
					    <!--<button>Upload</button>
					    <div class=""><img src="<?php echo base_url(); ?>images/package_add.png" align="absmiddle" /> Dodaj pliki</div>
					-->
					</form>
					<div id="ajax-loader"></div>
					<table class="upload_files"></table>
					<table class="download_files">
                  </table>

					
				<script type="text/javascript" src="<?php echo base_url(); ?>js/submitDelete.js"></script>
					
					
                	<br/>
                    <p>Kliknij na numerek i przenieś element aby posortować pliki</p>
                	<div id="dodane_pliki"><div id="dodane_pliki_content">
                	<ul id="sortableFiles">
					<?php if($pliki && $pliki->num_rows() > 0){
						echo '';
					$counter=1;
						foreach($pliki->result() as $row){ ?>
                        <div class="defaultDataRow" id="file_<?php echo $row->ID_pliki?>">
                        <span class="counterFile tooltip" title="Kliknij i przeciągnij"><?php echo $counter; ?> </span>
                         <span class="fileType">
                         <?php if($row->pliki_filetype=='pdf') { ?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/file_extension_pdf.png" />
                         <?php } elseif($row->pliki_filetype=='doc' || $row->pliki_filetype=='docx' || $row->pliki_filetype=='rtf') { ?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_word.png" />
                         <?php } elseif($row->pliki_filetype=='avi' || $row->pliki_filetype=='mpg' || $row->pliki_filetype=='mpeg') { ?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/film.png" />
                         <?php } elseif($row->pliki_filetype=='zip' || $row->pliki_filetype=='rar' || $row->pliki_filetype=='7z') {?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_compress.png" />
                         <?php } elseif($row->pliki_filetype=='xls' || $row->pliki_filetype=='xlsx') {?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_excel.png" />
                         <?php } elseif($row->pliki_filetype=='ppt' || $row->pliki_filetype=='pptx') {?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_powerpoint.png" />
                         <?php } else echo $row->pliki_filetype?>
                         </span>
                         <span class="fileName">
						<a target="blank" href="<?php echo reduce_double_slashes(prep_url($adres) .'/uploads/'. $row->pliki_filename); ?>"><?php echo $row->pliki_name; ?></a>
						</span>
                        <span class="deleteFile"> <a href="<?php echo base_url(); ?>admin/removefile/<?php echo $row->ID_pliki; ?>/<?php echo $this->uri->segment(3); ?>"  class="button buttonLightGrey tooltip usunplik" title="Usuń plik"><img style="margin-right:0px;" src="<?php echo base_url(); ?>images/bin.png" /></a></span>
                        </div>
                        
                        <?php /*?>
							<li class="ui-state-default moduleRowContener fileRowContener ui-corner-all" style="position:relative;" id="file_<?php echo $row->ID_pliki; ?>"><a><span class="moduleTitle"><?php echo $row->pliki_name; ?></span></a>
	                            <span style="position:absolute; right:0px; margin-right:10px;">
								<a target="blank" class=" button buttonLightGrey" href="<?php echo prep_url($adres); ?>/uploads/<?php echo $row->pliki_filename; ?>"><img src="<?php echo base_url(); ?>images/pencil.png" />Otwórz</a>
	                            <a  class="usunplik button buttonLightGrey" href="<?php echo base_url(); ?>admin/removefile/<?php echo $row->ID_pliki; ?>/<?php echo $this->uri->segment(3); ?>"><img src="<?php echo base_url(); ?>images/bin.png" />Usuń</a>
								</span>
							</li><?php */?>
						<?php $counter++; } ?>
						
						<?php //echo $plik->pliki_name.' '.$plik->pliki_filetype.'<br/>';
					}?>
					</ul>
					</div></div>
				
				</div>
				
				<!--
				<script src="<?php echo base_url()?>js/jquery.fileupload.js"></script>
				<script src="<?php echo base_url()?>js/jquery.fileupload-ui.js"></script>
				<script>
				$(function () {
					var uploadCounter = 0,
			        onCompleteAll = function () {
						var base_url = "<?php echo base_url(); ?>";
				        var modId = "<?php echo $this->uri->segment(3); ?>";
				        //window.location.reload();
			            $("#sortableFiles").html('Proszę czekać...').load(base_url+"admin/module/"+modId+" div.defaultDataRow");
			            //$("#sortableFiles").sortable("refresh");			            
			        };
			        var uploadSequence = [];
			        uploadSequence.start = function (index) {
			            var next = this[index];
			            if (next) {
			                next();
			                this[index] = null;
			            }
			        };
			    			        
								
				    $('.upload').fileUploadUI({
				        uploadTable: $('.upload_files'),
				        downloadTable: $('.download_files'),
				        buildUploadRow: function (files, index) {
				            var file = files[index];
				            return $(
				                '<tr>' +
				                '<td>' + file.name + '<\/td>' +
				                '<td class="file_upload_progress"><div><\/div><\/td>' +
				                '<td class="file_upload_cancel">' +
				                '<div class="ui-state-default ui-corner-all ui-state-hover" title="Anuluj">' +
				                '<span class="ui-icon ui-icon-cancel">Anuluj<\/span>' +
				                '<\/div>' +
				                '<\/td>' +
				                '<\/tr>'
				            );
				        },
				        buildDownloadRow: function (file) {
					        //var base_url = "<?php echo base_url(); ?>";
					        //var modId = "<?php echo $this->uri->segment(3); ?>";
					        
					        //load(base_url+"admin/module/"+modId+" div#dodane_pliki_content");
				        	return $(   '<tr><td>' + file.name + '<\/td><\/tr>'   );
				            //<td>'+file.type+'<\/td><td>'+file.size+'<\/td>
				        },
				        onComplete: function (event, files, index, xhr, handler) {
				        	uploadSequence.start(index + 1);

					        uploadCounter = uploadCounter + 1;
				            if (uploadCounter === files.length) {
				                uploadCounter = 0;
				                //$("div#dodane_pliki").html('asd');
				                
				                onCompleteAll();
				            }
				        },
				        onAbort: function (event, files, index, xhr, handler) {
				            handler.removeNode(handler.uploadRow);
				            uploadCounter = uploadCounter + 1;
				            if (uploadCounter === files.length) {
				                uploadCounter = 0;
				                onCompleteAll();
				            }
				            
				            uploadSequence[index] = null;
				            uploadSequence.start(index + 1);
								            
				        },
				        beforeSend: function (event, files, index, xhr, handler, callBack) {
				            uploadSequence.push(callBack);
				            if (index === 0) {
				                uploadSequence.splice(0, uploadSequence.length - 1);
				            }
				            if (index + 1 === files.length) {
				                uploadSequence.start(0);
				            }
				        }
								        
								        
				    });
				});
				</script>			
						-->		

          <?php /*
          
          
          
				
				<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" id="theme">
				<link rel="stylesheet" href="<?php echo base_url() ?>css/jquery.fileupload-ui.css">
				
                <div class="breadcrumb ui-corner-tl ui-corner-tr">
                <div style="float:left; position:relative;"><img class="breadcrumbIcon" align="absmiddle"  src="<?php echo base_url();?>images/homePage.png" /><a href="<?php echo base_url(); ?>">Strona WWW</a><img src="<?php echo base_url(); ?>images/breadcrumbSeparator.png" align="absmiddle" style="" /></div>
                <?php
				$counter = count($parents);
				$count = 1;
				$lastNode = null;
				 foreach($parents as $node){
					 
					echo '<div class="contenerNodeBreadcrumb"><img src='.base_url().'images/newspaper.png align="absmiddle" class="breadcrumbIcon"><a href="'.base_url().'admin/wyswietl/'.$node->id.'">'.truncate($node->nodeData['name']).'</a>';
				//	if($counter==$count) echo '<img style="position:absolute; left:40%; top:32px;" src='.base_url().'images/pointer_breadcrumb.png /> ';
				
					echo '</div><img src="'.base_url().'images/breadcrumbSeparator.png"  align="absmiddle"  class="separatorBreadcrumb" />'; 
				 $count++;
				 $lastNode = $node; 
				 } 
				 echo '<div class="contenerNodeBreadcrumb"><img src="'.base_url().'images/brick_mini.png" align="absmiddle" class="breadcrumbIcon" /><a  href="'.base_url().'admin/module/'.$this->uri->segment(3).'">'.truncate($module->modules_name).'</a> <img class="pointerBreadcrumb" src='.base_url().'images/pointer_breadcrumb.png /></div>';
				?>
                <a href="<?php echo base_url()?>admin/wyswietl/<?php echo $lastNode->id ?>"><img src="<?=base_url(); ?>images/back_cms_main.png" border="0" style="float:right;"></a>
                </div>
				<div>
				
					<form class="upload" action="<?php echo base_url() ?>admin/addfile/<?=$this->uri->segment(3)?>" method="POST" enctype="multipart/form-data">
					    <input type="file" name="file" multiple>
					    <button>Upload</button>
					    <div class=""><img src="<?php echo base_url(); ?>images/package_add.png" align="absmiddle" /> Dodaj pliki</div>
					</form>
					
					<table class="upload_files"></table>
					<table class="download_files">
                  </table>

					
				<script type="text/javascript" src="<?php echo base_url(); ?>js/submitDelete.js"></script>
					
					
                	<br/>
                    <p>Kliknij na numerek i przenieś element aby posortować pliki</p>
                	<div id="dodane_pliki"><div id="dodane_pliki_content">
                	<ul id="sortableFiles">
					<?php if($pliki && $pliki->num_rows() > 0){
						echo '';
					$counter=1;
						foreach($pliki->result() as $row){ ?>
                        <div class="defaultDataRow" id="file_<?php echo $row->ID_pliki?>">
                        <span class="counterFile tooltip" title="Kliknij i przeciągnij"><?php echo $counter; ?> </span>
                         <span class="fileType">
                         <?php if($row->pliki_filetype=='pdf') { ?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/file_extension_pdf.png" />
                         <?php } elseif($row->pliki_filetype=='doc' || $row->pliki_filetype=='docx' || $row->pliki_filetype=='rtf') { ?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_word.png" />
                         <?php } elseif($row->pliki_filetype=='avi' || $row->pliki_filetype=='mpg' || $row->pliki_filetype=='mpeg') { ?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/film.png" />
                         <?php } elseif($row->pliki_filetype=='zip' || $row->pliki_filetype=='rar' || $row->pliki_filetype=='7z') {?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_compress.png" />
                         <?php } elseif($row->pliki_filetype=='xls' || $row->pliki_filetype=='xlsx') {?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_excel.png" />
                         <?php } elseif($row->pliki_filetype=='ppt' || $row->pliki_filetype=='pptx') {?>
                         	<img src="<?php echo base_url(); ?>images/fileExtensions/page_white_powerpoint.png" />
                         <?php } else echo $row->pliki_filetype?>
                         </span>
                         <span class="fileName">
						<a target="blank" href="<?php echo reduce_double_slashes(prep_url($adres) .'/uploads/'. $row->pliki_filename); ?>"><?php echo $row->pliki_name; ?></a>
						</span>
                        <span class="deleteFile"> <a href="<?php echo base_url(); ?>admin/removefile/<?php echo $row->ID_pliki; ?>/<?php echo $this->uri->segment(3); ?>"  class="button buttonLightGrey tooltip usunplik" title="Usuń plik"><img style="margin-right:0px;" src="<?php echo base_url(); ?>images/bin.png" /></a></span>
                        </div>
                        
                        <?php /*?>
							<li class="ui-state-default moduleRowContener fileRowContener ui-corner-all" style="position:relative;" id="file_<?php echo $row->ID_pliki; ?>"><a><span class="moduleTitle"><?php echo $row->pliki_name; ?></span></a>
	                            <span style="position:absolute; right:0px; margin-right:10px;">
								<a target="blank" class=" button buttonLightGrey" href="<?php echo prep_url($adres); ?>/uploads/<?php echo $row->pliki_filename; ?>"><img src="<?php echo base_url(); ?>images/pencil.png" />Otwórz</a>
	                            <a  class="usunplik button buttonLightGrey" href="<?php echo base_url(); ?>admin/removefile/<?php echo $row->ID_pliki; ?>/<?php echo $this->uri->segment(3); ?>"><img src="<?php echo base_url(); ?>images/bin.png" />Usuń</a>
								</span>
							</li><?php * /?>
						<?php $counter++; } ?>
						
						<?php //echo $plik->pliki_name.' '.$plik->pliki_filetype.'<br/>';
					}?>
					</ul>
					</div></div>
				
				</div>
				
				
				<script src="<?php echo base_url()?>js/jquery.fileupload.js"></script>
				<script src="<?php echo base_url()?>js/jquery.fileupload-ui.js"></script>
				<script>
				$(function () {
					var uploadCounter = 0,
			        onCompleteAll = function () {
						var base_url = "<?php echo base_url(); ?>";
				        var modId = "<?php echo $this->uri->segment(3); ?>";
				        //window.location.reload();
			            $("#sortableFiles").html('Proszę czekać...').load(base_url+"admin/module/"+modId+" div.defaultDataRow");
			            //$("#sortableFiles").sortable("refresh");			            
			        };
			        var uploadSequence = [];
			        uploadSequence.start = function (index) {
			            var next = this[index];
			            if (next) {
			                next();
			                this[index] = null;
			            }
			        };
			    			        
								
				    $('.upload').fileUploadUI({
				        uploadTable: $('.upload_files'),
				        downloadTable: $('.download_files'),
				        buildUploadRow: function (files, index) {
				            var file = files[index];
				            return $(
				                '<tr>' +
				                '<td>' + file.name + '<\/td>' +
				                '<td class="file_upload_progress"><div><\/div><\/td>' +
				                '<td class="file_upload_cancel">' +
				                '<div class="ui-state-default ui-corner-all ui-state-hover" title="Anuluj">' +
				                '<span class="ui-icon ui-icon-cancel">Anuluj<\/span>' +
				                '<\/div>' +
				                '<\/td>' +
				                '<\/tr>'
				            );
				        },
				        buildDownloadRow: function (file) {
					        //var base_url = "<?php echo base_url(); ?>";
					        //var modId = "<?php echo $this->uri->segment(3); ?>";
					        
					        //load(base_url+"admin/module/"+modId+" div#dodane_pliki_content");
				        	return $(   '<tr><td>' + file.name + '<\/td><\/tr>'   );
				            //<td>'+file.type+'<\/td><td>'+file.size+'<\/td>
				        },
				        onComplete: function (event, files, index, xhr, handler) {
				        	uploadSequence.start(index + 1);

					        uploadCounter = uploadCounter + 1;
				            if (uploadCounter === files.length) {
				                uploadCounter = 0;
				                //$("div#dodane_pliki").html('asd');
				                
				                onCompleteAll();
				            }
				        },
				        onAbort: function (event, files, index, xhr, handler) {
				            handler.removeNode(handler.uploadRow);
				            uploadCounter = uploadCounter + 1;
				            if (uploadCounter === files.length) {
				                uploadCounter = 0;
				                onCompleteAll();
				            }
				            
				            uploadSequence[index] = null;
				            uploadSequence.start(index + 1);
								            
				        },
				        beforeSend: function (event, files, index, xhr, handler, callBack) {
				            uploadSequence.push(callBack);
				            if (index === 0) {
				                uploadSequence.splice(0, uploadSequence.length - 1);
				            }
				            if (index + 1 === files.length) {
				                uploadSequence.start(0);
				            }
				        }
								        
								        
				    });
				});
				</script>			
								

                
              		
						
			
						
				
          
          
          
          */?>      
            		
						
			
						
				