	var UpContainer = 'UpPic'; //容器
	var DefaultPic = 'NoPoto.gif'; //默认图片
	var Ups = 1; //上传数
	var PicPath = 'AdPic/';//上传路径
	var ThisForm = 'FbForm';//表单名
	var UpForm = 'FormSubmit';//上传框架名
	function $(obj){return document.getElementById(obj);}
	function ShowUpLoad()
	{
		var P_Str,i,A_Pic,T_Pic,Temp='';
		P_Str = $('Pic').value;
		for(i=0;i<Ups;i++) P_Str += '|';
		A_Pic = P_Str.split('|');
		for(i=0;i<Ups;i++)
		{
			if(A_Pic[i]=='')
			{
				Temp += '<li><input name="hidden" type="hidden" id="PicList_'+i+'" value="" /><img id="GGS_UploadImg_'+i+'" src="'+DefaultPic+'" /><br /><input id="GGS_UploadInput_'+i+'" type="file" onchange="Input_OnChange('+i+')" value="" name="GGS_UploadInput_'+i+'" /><span id="GGS_UploadMsg_'+i+'" style="display:none"></span><div id="GGS_UploadDel_'+i+'" style="display:none"><a onclick="DelPic('+i+')" href="javascript:void(0);">删除</a></div></li>';
			}else{
				Temp += '<li><input name="hidden" type="hidden" id="PicList_'+i+'" value="'+A_Pic[i]+'" /><img id="GGS_UploadImg_'+i+'" src="'+PicPath+A_Pic[i]+'" /><br /><input id="GGS_UploadInput_'+i+'" type="file" onchange="Input_OnChange('+i+')" value="'+A_Pic[i]+'" name="GGS_UploadInput_'+i+'" /><span id="GGS_UploadMsg_'+i+'" style="display:none"></span><div id="GGS_UploadDel_'+i+'"><a onclick="DelPic('+i+')" href="javascript:void(0);">删除</a></div></li>';
			}
		}
		$(UpContainer).innerHTML = Temp;
	}
	function Input_OnChange(num)
	{
		if($('GGS_UploadInput_'+num).value=='')return;
		$("GGS_UploadMsg_"+num).style.display = '';
		$("GGS_UploadMsg_"+num).innerHTML = '正在上传...';
		$("GGS_UploadInput_"+num).style.display = 'none';
		var tag = document.getElementsByTagName('INPUT');
		for(var i=0;i<tag.length;i++)
		{
			if(tag[i].getAttribute('type')=='file')
			{
				if(tag[i].id!='GGS_UploadInput_'+num)tag[i].disabled = true;
			}
		}
		$(ThisForm).action = 'UpLoad/?num='+num;
		$(ThisForm).target = UpForm;
		$(ThisForm).encoding = 'multipart/form-data';
		$(ThisForm).submit();
		$("GGS_UploadInput_"+num).disabled = true;
	}
	function DelPic(num)
	{
		$('GGS_UploadImg_'+num).src=DefaultPic;
		ClearValue($("GGS_UploadInput_"+num));
		$("GGS_UploadInput_"+num).style.display = '';
		$("GGS_UploadInput_"+num).disabled = false;
		$("GGS_UploadMsg_"+num).style.display = 'none';
		$("GGS_UploadDel_"+num).style.display = 'none';
		$("Pic").value = $("Pic").value.replace('|'+$("PicList_"+num).value,'').replace($("PicList_"+num).value+'|','')
		$("PicList_"+num).value = '';
	}
	function UpLoadBack(num,str)
	{
		if(str.indexOf('.')==-1)
		{
			DelPic(num);
			alert(str);
			return;
		}
		$("GGS_UploadMsg_"+num).style.display = '';
		$("GGS_UploadMsg_"+num).innerHTML = '上传成功';
		$('GGS_UploadImg_'+num).src = PicPath+str;
		$("PicList_"+num).value = str;
		$("GGS_UploadDel_"+num).style.display = '';
		var tag = document.getElementsByTagName('INPUT');
		for(var i=0;i<tag.length;i++)
		{
			if(tag[i].getAttribute('type')=='file' && tag[i].value=='')
			{
				if(tag[i].id!='GGS_UploadInput_'+num)tag[i].disabled = false;
			}
		}
		$('Pic').value=$('Pic').value==''?str:$('Pic').value+'|'+str;
	}
	function ClearValue(file)
	{
        var form=document.createElement('form');
        document.body.appendChild(form);
        //记住file在旧表单中的的位置
        var pos=file.nextSibling;
        form.appendChild(file);
        form.reset();
        pos.parentNode.insertBefore(file,pos);
        document.body.removeChild(form);
	}