<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_Link.aspx.vb" Inherits="TourEx.Web.Admin_Link" %>
<%@ Import Namespace="TourEx.BLL" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题页</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<script type="text/javascript" src="../Sys/Js/jquery.js"></script>
<script type="text/javascript" src="../Sys/Js/CreateSelect.js"></script>
<script type="text/javascript" src="../Sys/Js/jquery.validate.js"></script>
<script type="text/javascript" src="../Sys/Js/jquery.validate.check.js"></script>
<script type="text/javascript" src="../Sys/WebEdit/xheditor-zh-cn.min.js"></script>
<script type="text/javascript" src="../Sys/WebEdit/xheditor_plugins/ubb.min.js"></script>
</head>
<body>
<ul class="navLocation">
	<li>您当前位置：<a href="Admin_Main.aspx">首页</a> > <a href="Admin_LinkList.aspx">友情链接列表</a> > <asp:Label ID="navIgation" runat="server" Text=""></asp:Label></li>
	</ul>
<form runat="server" id="TourExForm">
<asp:HiddenField ID="RanNum" runat="server" />
<div class="infoBox">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="infoBoxTd">网站名称：</td>
		<td><asp:TextBox ID="L_Name" runat="server" size="40" class="formTitle"></asp:TextBox></td>
	</tr>
	<tr>
		<td class="infoBoxTd">友情链接类型：</td>
		<td>
			<span id="CategoryList">
                <asp:RadioButtonList ID="L_Type" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                <asp:ListItem Value="0" onclick="changetype(0);">文字</asp:ListItem>
                <asp:ListItem Value="1" onclick="changetype(1);">图片</asp:ListItem>
                </asp:RadioButtonList>
			</span>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">链接：</td>
		<td>
			<asp:TextBox ID="L_Url" runat="server" size="50" class="formTitle"></asp:TextBox>
		</td>
	</tr>
	<tr id="Logo">
		<td class="infoBoxTd">Logo：</td>
		<td>
			<iframe src="" id="UpIframe" width="300" height="25" scrolling="No" frameborder="0"></iframe>
			<asp:HiddenField ID="L_Logo" runat="server" />
			<div id="Preview"></div>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">排序：</td>
		<td>
			<asp:TextBox ID="L_OrderId" runat="server" onkeyup="this.value=this.value.replace(/\D/g,'');"
                            size="6" maxlength="6" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))" class="formTitle"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">&nbsp;</td>
		<td><asp:Button ID="Button1" runat="server" Text="确定" CssClass="formInput01" /></td>
	</tr>
</table>
</div>
</form>

<script language="javascript" type="text/javascript">
	<!--//
	changetype($('input[name="L_Type"]:checked').val());
	function changetype(t)
	{
	    if(t==0){$('#Logo').hide();}else{$('#Logo').show();}
	}
	$(function(){
		$('#UpIframe').attr('src','../sys/Upload.aspx?r='+$('#RanNum').val())
		UpReturn('',$('#L_Logo').val());
		$("#TourExForm").validate({
			rules:{
				L_Name: {required: true},
				L_Url: {required: true,url:true},
				L_Logo:{required:function(){return ($('input[name="L_Type"]:checked').val()==0?false:true);}}
			},
			messages: {
				L_Name: {required: '请填写网站名称'},
				L_Url: {required: '请填写网站链接'},
				L_Logo:{required:'请上传Logo'}
			}
		}); 
	});
	function UpReturn(err,msg)
	{
		var M=200;
		var Pic='L_Logo';
		$("#L_Logo").val(msg);
		if(err!=""){
			alert(err);
		}else if(msg!=''){
			$("#Preview").html('<div style="position:relative;float:left"><img src="Images/cross.gif" style="position:absolute;cursor:pointer;right:0;top:0" onClick="$(this).parent().remove();$(\'#'+Pic+'\').val(\'\');"/><img src="<%=UpFolder%>'+msg+'" style="max-height:'+M+'px; max-width:'+M+'px"/></div>');
		}
	}
	//-->
</script>
</body>
</html>
