
function randomString(length) {
	var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
	
	if (! length) {
		length = Math.floor(Math.random() * chars.length);
	}
	
	var str = '';
	for (var i = 0; i < length; i++) {
		str += chars[Math.floor(Math.random() * chars.length)];
	}
	return str;
}


/*
function addFileinput(szaporitodiv) {
	randid = randomString(8);
	fileitem = '<div id="'+randid+'" style="display:none;">'+
				'<input type="file" name="file[]" class="fileinput" />'+
				'<input type="button" value="-" onclick="'+
				'$(\'#'+randid+'\').hide(\'slow\', function(){'+
				'		$(\'#'+randid+'\').remove();'+
				'});'+
				'" class="fileremover" /><div class="fileclear"></div></div>';			
	$(szaporitodiv).append(fileitem);	
	$('#'+randid).show('slow');
}	
*/

function addFileinput(szaporitodiv) {
	var randid = randomString(8);
	//var fileitem = "<div>sdfsdfsdf</div>";
	var fileitem = 	'<div id="'+randid+'" style="display:none;">'+
					'<span class="file_container_1">'+	
					'<input type="file" name="file[]" class="file"  onchange="$(\'#file_field_'+randid+'\').attr(\'value\',this.value);">'+
					'<input type="text" name="file_field_'+randid+'" value=" " id="file_field_'+randid+'" class="file_field"></span>'+
					' <label>&nbsp;</label><input type="button" value="-" onclick=" '+
					'$(\'#'+randid+'\').hide(\'slow\', function(){'+
					'		$(\'#'+randid+'\').remove(); '+
					'});'+
					'" class="fileremover" /><div class="fileclear"></div></div>';	
	
				
				//alert(szaporitodiv);
	// $(szaporitodiv).append('<div id="'+randid+'" style="display:none;">');	
	// $(szaporitodiv).append('<span class="file_container_1">');
	// $(szaporitodiv).append('<input type="file" name="file[]" class="file"  onchange="');	
	// $(szaporitodiv).append("$('#file_field_"+randid+"').attr('value', this.value);");	
	// $(szaporitodiv).append('">');');
	// $(szaporitodiv).append('<input type="text" name="file_field_'+randid+'" value=" " id="file_field_'+randid+'" class="file_field">');
	// $(szaporitodiv).append('</span>');
	// $(szaporitodiv).append('<label>&nbsp;</label><input type="button" value="-" onclick="');
	// $(szaporitodiv).append("$('#"+randid+"').hide('slow', function(){$('#"+randid+"').remove();});");
	// $(szaporitodiv).append('" class="fileremover" /><div class="fileclear"></div>');
	// $(szaporitodiv).append('</div>');
	//alert(szaporitodiv+' <= '+fileitem);
	$(szaporitodiv).append(fileitem);	
	$('#'+randid).fadeIn('slow');
}



function Clickheretoprint()
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
  var content_vlue = document.getElementById("print_content").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>Inel Power System</title> <link rel="stylesheet" type="text/css"  media="all" href="http://www.univerzumuzletek.lan/css/print.css">'); 
   docprint.document.write('</head><body onLoad="self.print()"><div id="print_content">');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</div></body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}
