function showStdPodpis (q, i)
{
	$.post (
		root + "/modules/ajax/getStdPodpis.php",
		{lang:lang},
		function (data)
		{
			var pcl = eval ("(" + data + ")");
			var res = "";
			
			if (pcl.length)
			{
				res += "<strong>" + langs[88] + ": " + q + "</strong>"
				res += "<div style='height:258px; overflow:auto;'>";
				
				for (j = 0; j < pcl.length; j++)
				{
					if (pcl[j].podpis.length)
					{					
						res += "<span style='font-style:italic;'>" + pcl[j].name + "</span><br>";
						
						for (k = 0; k < pcl[j].podpis.length; k++)
						{
							res += "<div style='float:left; width:94px; height:102px; text-align:center; margin:0 10px 10px 0;'>" + 								
								       "<img src='" + root + "/img/podpis/" + pcl[j].podpis[k].img + "' class='podpisimg'><br>" +
									   "<input type='text' id=podpis'" + pcl[j].podpis[k].id + "' class='podpisq' value='0' style='width:30px; text-align:right;'>&nbsp;" + langs[46] +
								   "</div>";							
						}
						
						res += "<div style='clear:both;'></div>";	
					}					
				}
				
				res += "</div>";
				$("#itemmore_wrap" + i + " #podpisblock").slideUp (500, function(){$("#itemmore_wrap" + i + " #podpisblock").html (res)});				
				
				$(".podpisq").change (function ()
				{
					var curq = 0;
					
					$(".podpisq").each (function ()
					{						
						curq += parseInt ($(this).attr("value"), 10);
					});
					
					if (curq > q)
						alert (langs[89]);
				});
				
				$("#itemmore_wrap" + i + " #podpisblock").slideDown (500);
			}
		}
	);
}

function showUserTxtPodpis (q, i)
{
	var res = "";
	res += "<strong>" + langs[88] + ": " + q + "</strong><br>"
	res += "<textarea id='usertxt' style='width:300px; height:200px;'></textarea>";
	$("#itemmore_wrap" + i + " #podpisblock").slideUp (500, function(){$("#itemmore_wrap" + i + " #podpisblock").html (res)});
	$("#itemmore_wrap" + i + " #podpisblock").slideDown (500);				
}

function showUserImgPodpis (q, i)
{
	var res = "";
	var curq = 0;
	res += "<strong>" + langs[88] + ": " + q + "</strong><br>"
	res += langs[90] + ":<br><input type='file' id='userimgfile' name='Filedata' style='border:1px #aaa solid; width:300px; display:none;'>";
	res += "<div id='uploaded'></div>";
	$("#itemmore_wrap" + i + " #podpisblock").slideUp (500, function()
		{
			$("#itemmore_wrap" + i + " #podpisblock").html (res);
			$("#itemmore_wrap" + i + " #podpisblock").slideDown (500, function ()
				{
					$("#userimgfile").uploadify({
						'uploader': root + '/js/jquery.uploadify/uploadify.swf',
						'script': root + '/js/jquery.uploadify/uploadify.php',		
						'cancelImg': root + '/js/jquery.uploadify/cancel.png',
						'auto' : true,
						'onComplete' : function (ev, queue, obj, res, data)
							{
								curq++;
								if (curq > q)
									alert (langs[89]);
								else
								{								
									var img = "<img src='" + root + "/downloads/" + res + "' class='podpisimg' style='margin:0 5px 5px 0;'>";
									$('#uploaded').append (img);
								}
							},
						'buttonImg' : root + '/js/jquery.uploadify/btn.gif',
						'sizeLimit' : 999999999
					});					
				});	
		});
}


function hidePodpis (i)
{	
	$("#itemmore_wrap" + i + " #podpisblock").slideUp (500);	
}

function uploadImg (file)
{
	alert (file);
}
