function setImageURL(strUrl,i)
{				
	if(strUrl.length>0)
	{
		if(i == "0" || i == "")
		{
			document.getElementById("strAlbumPicURL").value=strUrl;		
		}
		else
		{
			document.getElementById("strAlbumPicURL"+i).value = strUrl;
		}
	}	
}
function addRow(id,idWriter,key)
{
	var PicBody=document.getElementById(id);
	if(PicBody.rows.length >= 5) {
		alert("对不起，最多只能加4行！");
		return false;
	} else {
		for(var i = 1; i<5 ; i++){
			var obj = document.getElementById("strAlbumPicTr"+i);
			if(obj == null){
				tr=document.createElement("tr");
				tr.id="strAlbumPicTr"+i;
				td=document.createElement("td");
				td.id="strAlbumPicTd"+i;
				tr.appendChild(td);
				PicBody.appendChild(tr);
				td.innerHTML='<a href=javascript:delRow("'+i+'") title=清空><img src=http://www1.tianya.cn/new/images/icon-.gif border=0></a>&nbsp;描述：<input type="text" name="picDesc'+i+'" maxlength="100" class="input" size="10" onkeydown="if(event.keyCode==13){event.keyCode=0;return false}"> <input type="text" name="picUrl'+i+'" id="strAlbumPicURL'+i+'" size="40" class="input" maxlength="255" onkeydown="if(event.keyCode==13){event.keyCode=0;return false}" value="http://">&nbsp;<a href="javascript:void(0);" onclick=open("http://laiba.tianya.cn/laiba/RedirLogin?msg=0&page="+escape("http://laiba.tianya.cn/laiba/TianyaForumUploader?n=1&idWriter='+idWriter+'&Key='+key+'&callback=setImageURL&rowNum='+i+'"),"imagelist","width=550,height=480,scrollbars=yes,resizable=yes,titlebar=no");>相册取图</a><br>';
				break;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
			}
		}
	}
}

function delRow(i)
{
	if(i==0)
	{
		document.getElementById("strAlbumPicURL").value="";
		return;
	}
	var tr=document.getElementById("strAlbumPicTr"+i);
	document.getElementById("strAlbumPicURL"+i).value="";
	tr.parentNode.removeChild(tr);
}

function openWindow(url,wide,high,name) {
	window.open(url,name,'width='+wide+',height='+high+',scrollbars=yes,resizable=yes,titlebar=no')
}
