<?php
//Gif合成
if(file_exists('output/output.gif'))
{
$show_pic = <<<show_pic
<div id="show_pic">
	<img src="output/gifcompose.gif">
</div>
show_pic;
}

$html = <<<html
<style type="text/css">
#table_gifCompose td{text-align:left;}
</style>
<link rel="stylesheet" href="css/colorpicker.css" type="text/css" />
<script type="text/javascript" src="../../script/colorpicker.js"></script>
<script type="text/javascript">
var count = 3;
var clickNum = 3;
function showColor(src)
{
	$('#'+src).ColorPicker({
		onSubmit: function(hsb, hex, rgb, el) {
			colorValue = '#'+hex;
    		$(el).val(colorValue);
    		$(el).ColorPickerHide();
		},
		onBeforeShow: function () {
    		$(this).ColorPickerSetColor(this.value);
    	}
	}).bind('keyup', function(){
    	$(this).ColorPickerSetColor(this.value);
    });
	
}
function addPic()
{
	if(clickNum > 10)
	{
		alert("不能再添加了！");
	}
	else
	{
		var trId = "tr"+count;
		$('tbody').append('<tr id="'+trId+'"><td valign="top" nowrap><span>图片'+count+':</span></td><td><div class="tdstyle"><input id="pic'+count+'" type="file" name="pic'+count+'"/><input type="button" value="删除" onclick="removePic(\''+trId+'\');"></div></td><td valign="top" style="width:5px;*width:100px;"><span>图片文字：</span></td><td><div class="tdstyle"><input id="pic'+count+'_txt" type="text" name="pic'+count+'_txt"/></div></td><td valign="top" style="width:5px;*width:100px;"><span>颜色：</span></td><td><input id="pic'+count+'_color" type="text" name="pic'+count+'_color" onclick="showColor(\'pic'+count+'_color\');"/></td></tr>');
		count++;
		clickNum++;
	}
}
function removePic(src)
{
	clickNum--;
	$("#"+src).remove();
}
</script>
<div style="text-align:left;font-size:18px;font-family:'microsoft yahei';color:#006ec6;">Gif图片合成</div>
<div class="tabstyle"></div>
<div class="divsettings">
	<form enctype="multipart/form-data" action="server.php" method="post">
	<input type="hidden" name="id" value="gifCompose"/>
	<table cellspacing="0" cellpadding="4" width="100%" border="0" id="table_gifCompose">
		<tbody>
			<tr>
				<td style="text-align:left;" valign="top">切换速度：</td>
				<td style="width:5px;"><input type="text" name="speed"></td>
				<td>
					<div class="tdstyle">
						<input style="position:relative;right:120px;" id="add_pic" type="button" value="增加一张新的" onclick="addPic();"/>
                    </div>
				</td>
			</tr>
			<tr>
				<td valign="top"><span style="color:red;">*</span><span title="必须要上传图片">图片1:</span></td>
				<td>
					<div class="tdstyle">
						<input id="pic1" type="file" name="pic1"/>
                    </div>
				</td>
				<td valign="top" style="width:5px;*width:100px;">
					<span>图片文字：</span>
				</td>
				<td>
					<div class="tdstyle">
						<input id="pic1_txt" type="text" name="pic1_txt"/>
                    </div>
				</td>
				<td valign="top" style="width:5px;*width:100px;">
					<span>颜色：</span>
				</td>
				<td>
					<input id="pic1_color" type="text" name="pic1_color" onclick="showColor('pic1_color');"/>
				</td>
			</tr>
			<tr>
				<td valign="top"><span style="color:red;">*</span><span title="必须要上传图片">图片2:</span></td>
				<td>
					<div class="tdstyle">
						<input id="pic2" type="file" name="pic2" value=""/>
                    </div>
				</td>
				<td valign="top" style="width:5px;*width:100px;">
					<span>图片文字：</span>
				</td>
				<td>
					<div class="tdstyle">
						<input id="pic2_txt" type="text" name="pic2_txt"/>
                    </div>
				</td>
				<td valign="top" style="width:5px;*width:100px;">
					<span>颜色：</span>
				</td>
				<td>
					<input id="pic2_color" type="text" name="pic2_color" onclick="showColor('pic2_color');"/>
				</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<td></td>
				<td class="tdstyle"><input type="submit" value="创建我的logo >>" style="width:244px;" /></td>
			</tr>
		</tfoot>
	</table>
	</form>
</div>
$show_pic
html;
?>