var adsH=null;
TSN.sectCTN={fbSlctr:"#adsCTN",init:function(){if(typeof $AD.headline.data[TSN.sect]!=="undefined"&&TSN.arcDate===TSN.pubDate){if($AD.headline.data[TSN.sect].length>0){var c=[];
var d=$AD.headline.data[TSN.sect][0];
c.push('<tr><td valign="top" class="col1 photo" style="padding-bottom:25px">');
if(d.photo){c.push("<div>");
c.push('<a href="'+d.url+'"><img class="headlineADPhoto" title="'+d.title+'" alt="'+d.title+'" original="'+d.photo+'"></img></a>');
c.push("</div>")
}c.push('</td><td valign="top" class="col2 title">');
c.push('<div class="clear sectMainTitleCTN">');
c.push('<a href="'+d.url+'" class="sectMainTitle">'+d.title+"</a>");
c.push('<a href="'+d.url+'" class="sectMainTitleNewWindow" target="_blank">&nbsp;</a>');
c.push("</div>");
c.push('<a href="'+d.url+'" class="sectMainAbstract">'+d.paragraph+"&nbsp;(客戶資訊)</a>");
c.push("</td></tr>");
$("#twoColLeftCTN table.section:first tr:first").after(c.join(""));
$("#twoColLeftCTN table.section img.headlineADPhoto").imgmask({width:"168px",height:"102px",border:"1px solid #D5D5D5"})
}if($AD.headline.data[TSN.sect].length>1){var c=[];
var d=$AD.headline.data[TSN.sect];
for(var b=1;
b<d.length;
b++){var e=d[b].url.split("|");
var a=(e.length>1)?' target="_blank"':"";
c.push('<li><a href="'+e[0]+'" style="color:'+d[b].txtColor+";background-color:"+d[b].bgColor+'"'+a+">客戶資訊︰"+d[b].title+"</a></li>")
}$("#twoColLeftCTN table.section:first td.relatedtitle ul.blackCommonList").append(c.join(""))
}}$(this.fbSlctr).append('<div class="nextCTN"><iframe src="http://www.facebook.com/plugins/recommendations.php?site=http%3A%2F%2Fthe-sun.on.cc&amp;width=300&amp;height=500&amp;header=true&amp;colorscheme=light" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:500px;" allowTransparency="true"></iframe></div>')
}};
TSN.videoList={acXmlPath:"/cnt/keyinfo/"+TSN.arcDate+"/articlecode.xml",vlXmlPath:"/cnt/keyinfo/"+TSN.arcDate+"/videolist.xml",flag:true,acl:null,video_list:[],bind:function(data){with(TSN.videoList){acl=$(data);
$.ajax({url:vlXmlPath,success:function(data){var vList=$(data).find("news");
for(var i=0;
i<vList.length;
i++){var vItem=$(vList[i]);
var acItem=acl.find('article[id="'+vItem.find("articleID").text()+'"]');
if(typeof acItem.attr("id")!="undefined"){var o={rel:"",url:"",title:"",thumbnail:""};
o.rel=vItem.find("articleID").text();
o.url=vItem.find("video_url").text();
o.title=acItem.find("title").text();
o.thumbnail=vItem.find("thumbnail").text();
video_list[video_list.length]=o
}}TSN.videoList.apply_video();
$("#twoColLeftCTN table.section a[rel] img[original]").imgmask({width:"168px",height:"102px",border:"1px solid #D5D5D5"});
if(typeof DD_belatedPNG!=="undefined"){DD_belatedPNG.fix("#twoColLeftCTN .overlay")
}},error:function(){$("#twoColLeftCTN table.section a[rel] img[original]").imgmask({width:"168px",height:"102px",border:"1px solid #D5D5D5"});
if(typeof DD_belatedPNG!=="undefined"){DD_belatedPNG.fix("#twoColLeftCTN .overlay")
}}})
}},apply_video:function(){$("#twoColLeftCTN table.section a[rel]").each(function(){var b=$(this);
for(var a=0;
a<TSN.videoList.video_list.length;
a++){if(TSN.videoList.video_list[a].rel===b.attr("rel")){b.html('<div class="playIcon" style="border:1px solid #D5D5D5;background-image:url(/ontv/'+TSN.arcDate+"/"+TSN.videoList.video_list[a].thumbnail+')"><div class="overlay"/></div>')
}}})
},init:function(){$.ajax({url:TSN.videoList.acXmlPath,success:function(a){TSN.videoList.bind(a)
},error:function(){$("#twoColLeftCTN table.section a[rel] img[original]").imgmask({width:"168px",height:"102px",border:"1px solid #D5D5D5"})
}})
}};
TSN.ctnBox={init:function(){if($AD.ctnBox.loaded){var a="";
a+='<div id="adContentBoxCTN"><div class="nextCTN">';
a+='<h2><a href="'+$AD.ctnBox.url+'" target="'+$AD.ctnBox.target+'">'+$AD.ctnBox.title+'</a></h2><div class="hrThin"></div>';
a+='<a href="'+$AD.ctnBox.url+'" target="'+$AD.ctnBox.target+'">';
if(typeof $AD.ctnBox.img!=="undefined"){var b=($AD.ctnBox.img.align||"right");
a+='<img src="'+$AD.ctnBox.img.path+'" border="0" style="float:'+b+";margin-"+((b==="left")?"right":"left")+':10px">'
}a+=$AD.ctnBox.desc;
a+="</a></div></div>";
$("#miscContentCTN").before(a)
}$("#miscContentCTN").show()
}};
TSN.charity_area={id:"#charity_area",init:function(){var a=[];
a.push(charity_link.title+"<br>");
a.push("<a href='/cnt/"+charity_link.sect_L1_name+"/"+charity_link.pubdate+"/index.html'>"+charity_link.content+"</a>");
a.push('<div><a href="/cnt/charity/book.html">&gt;&gt;「心之書」助清貧生笑迎新學年</a></div>');
$(this.id).append(a.join(""))
}};
$(document).ready(function(){if($AD.hasBoxBg||typeof $AD.hasBoxBg=="undefined"){$AD.attachFile("/css/tsn_graybox.css")
}TSN.videoList.init();
TSN.ctnBox.init();
TSN.sectCTN.init();
PTY.searchFrm.init();
var d=[];
d.push('<div id="miscCTN">');
d.push("<div class=\"campaign nextCTN\"><h2>太陽新版意見收集箱</h2><div class=\"hrThin\"></div><a href=\"javascript:(function(){window.open('/promo/campaign.html', '太陽新版意見收集', 'dependent=yes,location=no,toolbar=no,scrollbars=yes,menubar=no,status=no,resizable=no,width=500,height=443')})()\">為迎合大眾上網看新聞的喜好，太陽報網頁不斷力求進步！歡迎你在這裡留下對網頁的任何意見！</a></div>");
d.push('<div id="pollInfoCTN" class="nextCTN"><h2>民意中心</h2><div class="hrThin"></div><div>快些投下你的一票：</div></div>');
d.push('<div id="charity_area" class="nextCTN"><h2>愛心基金</h2><div class="hrThin"></div></div>');
d.push("</div>");
d.push('<iframe class="yahoo_keywords_ifrm nextCTN" frameborder=0 height="130" marginheight=0 marginwidth=0 scrolling=no src="/js/v2/yahoo_keywords.html?row_count=10"></iframe>');
d.push('<iframe class="nextCTN" frameborder=0  marginheight=0 marginwidth=0 scrolling=no width="300" height="300" ');
d.push('src="/js/v2/iframe_ysm_utf8.html?size=wider&key=');
d.push(TSN.sect);
d.push("&url=");
d.push(window.location.href);
d.push('"></iframe>');
$("#twoColRightCTN").append(d.join(""));
TSN.pollInfo.init();
TSN.charity_area.init();
TSN.load_timeslider.init();
var b=$("table.liberal").html();
if($("table.liberal").length>=1){for(var c=0;
c<=5;
c++){b=b.replace("通識攻略：","")
}$("table.liberal").html(b);
$("table.liberal").show()
}var a=$.strToDate(TSN_PUBDATE);
if(a.getDay()==0||a.getDay()==6){if($("table.liberal").length==0){$("#pty_mini_search_frm").after('<a  href="/go/?s=00661" style="display:block;width:300px;height: 60px;margin-top: 10px;"><img src="/img/liberal_Inbox.gif" /></a>')
}}});
