<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<!-- #include file="inc/function.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p14")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<HTML>
<HEAD>
<TITLE>获得广告代码</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
</style>

</HEAD>
<BODY>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<tr bgcolor="#F5F5F5">
<td style="padding:10px;">
<%
dim id,adtype
id=cint(request.QueryString("id"))
adtype=Cint(request.QueryString("adtype"))
if(id<1) then
	response.Write("没有找到id="&id&"的记录！")
	response.End()
end if
	Set rs = Server.CreateObject("Adodb.RecordSet")
	sql="select adType,photo,linkUrl,imgW,imgH,catalogId,content,title,moditime from ad where id="&id&" order by id desc " 
	rs.Open sql,conn,3,1
	if not rs.eof then
		tempArr=rs.GetRows()
	else
		response.Write("没有找到记录")
		response.End()
	end if
	rs.close
	set rs=nothing
''''''''''''''''''''''''''''''''''初使化''''''''''''''''''''''''''''
dim tempJsStr,sJsStr,sfunc
sfunc="function ad2url(){"&Chr(10)
sfunc=sfunc&" window.open('"&SiteUrl&"/aa/click.asp?id="&id&"');"&Chr(10)
sfunc=sfunc&"}"&Chr(10)
tempJsStr=sfunc
if(tempArr(0,0)=0) then
	sJsStr="<a href="""&SiteUrl&"/aa/click.asp?id="&id&""" target=""_blank"">"&tempArr(6,0)&"</a>"
elseif(tempArr(0,0)=1) then
	sJsStr="<a href="""&SiteUrl&"/aa/click.asp?id="&id&""" target=""_blank""><img src="""&tempArr(1,0)&""" border=""0"" width="""&tempArr(3,0)&""" height="""&tempArr(4,0)&"""></a>"
elseif(tempArr(0,0)=2) then
	sJsStr="<div id=""ap"&id&"_1"" style=""position:relative; width:"&tempArr(3,0)&"px; height:"&tempArr(4,0)&"px; z-index:2;""><div id=""ap"&id&"_2"" style=""position:absolute; width:"&tempArr(3,0)&"px;	height:"&tempArr(4,0)&"px;	z-index:1; left: 0px;	top: 0px; filter:alpha(opacity=0); opacity:0; background-color:#fff; cursor:pointer;"" onClick=""window.open(\'"&SiteUrl&"/aa/click.asp?id="&id&"\');""></div>"
	sJsStr=sJsStr&"<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"" width="""&tempArr(3,0)&""" height="""&tempArr(4,0)&""">"
	sJsStr=sJsStr&"<param name=""movie"" value="""&tempArr(1,0)&""">"
	sJsStr=sJsStr&"<param name=""quality"" value=""high""><param name=""wmode"" value=""transparent"">"
	sJsStr=sJsStr&"<embed src="""&tempArr(1,0)&""" quality=""high"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" type=""application/x-shockwave-flash"" width="""&tempArr(3,0)&""" height="""&tempArr(4,0)&"""></embed>"
	sJsStr=sJsStr&"</object></div>"
end if
select case adtype
	case 0
		tempJsStr="document.write('"&sJsStr&"');"
	case 1
		tempJsStr=tempJsStr&"var AdContentHtml = '"&sJsStr&"';"
		'tempJsStr=tempJsStr&"document.write('<div id=""AdLayer11"" style=""position: absolute; z-index:1"">"&sJsStr&"<div align=""center""><a target=""_self"" href=""javascript:closeDiv11();"">关闭</a></div></div>');"&Chr(10)
		'tempJsStr=tempJsStr&"document.write('<div id=""AdLayer12"" style=""position: absolute; z-index:1"">"&sJsStr&"<div align=""center""><a target=""_self"" href=""javascript:closeDiv11();"">关闭</a></div></div>');"
		tempJsStr=tempJsStr&Chr(10)&ReadFromTextFile(server.mappath("/ad/effect/1.js"))&Chr(10)&""
	case 2
		tempJsStr=tempJsStr&"document.write('<DIV id=""AdLayer21"" style=""Z-INDEX: 100; POSITION: absolute;  visibility: visible;"">"&sJsStr&"<div align=""center""><a target=""_self"" href=""javascript:closeDiv21();"">关闭</a></div></div>');"&Chr(10)
		tempJsStr=tempJsStr&Chr(10)&ReadFromTextFile(server.mappath("/ad/effect/2.js"))&Chr(10)
	case 3
		tempJsStr=tempJsStr&"document.write('<DIV id=""AdLayer31"" style=""Z-INDEX: 100; POSITION: absolute; text-align:center; visibility: visible;"">"&sJsStr&"<div align=""center""><a target=""_self"" href=""javascript:closeDiv();"">关闭</a></div></div>');"&Chr(10)
		ad3_jstr=ReadFromTextFile(server.mappath("/ad/effect/3.js"))
		ad3_jstr=replace(ad3_jstr,"$width$",tempArr(3,0))
		ad3_jstr=replace(ad3_jstr,"$heigh$",tempArr(4,0))
		tempJsStr=tempJsStr&Chr(10)&ad3_jstr&Chr(10)
end select
'生成JS
call SaveTextFile(server.mappath("../aa/js_"&id&".js"),tempJsStr)

response.write("<p>广告"&id&"的调用代码为：<br><br><textarea style=""width:100%"" rows=""5"">&lt;script src="""&SiteUrl&"/aa/js_"&id&".js""&gt;&lt;/script&gt;</textarea></p>")
response.write("<p align=""center"">请将以上代码复制到您要插入广告的地方。</p>") 
response.write("<p align=""center""><a href=""#"" onClick=""javascript:history.back()""><==返 回</a></p>") 
call connclose()
%>
</td>
</tr>
</TABLE>
</body>
</html>