(function(){function e(u){return document.getElementById(u)}var j=!!window.ActiveXObject;var g=document.compatMode&&(document.compatMode!="BackCompat");var s={extendObj:function(u,w){for(var v in u){w[v]=u[v]}},cmbObj:function(){var u={},x;for(var w=0,v=arguments.length;w<v;w++){x=arguments[w];for(var y in x){u[y]=x[y]}}return u},pina:function(x,u){for(var w=0,v=u.length;w<v;w++){if(u[w]==x){return true}}},extendClass:function(v,w){for(var u in v.prototype){if(w.prototype[u]==undefined){w.prototype[u]=v.prototype[u]}}}};var o={hl:function(w,v){if(w.isShowing){return false}var u={_timer:null,_step:4,_delay:100,_clear:function(){if(this._timer){clearInterval(this._timer)}},setopt:function(y,x){this["_"+y]=x},show:function(x){var z=this;var y=x.style.backgroundColor;this._curcolor=60;x.style.backgroundColor="rgb(100%,100%,60%)";x.isShowing=true;this._timer=setInterval(function(){z._curcolor+=z._step;if(z._curcolor>100){z._clear();x.style.backgroundColor="rgb(100%,100%,100%)";x.style.backgroundColor=y;x.isShowing=false;if(typeof(z._afterF)=="function"){z._afterF()}}else{x.style.backgroundColor="rgb(100%,100%,"+z._curcolor+"%)"}},this._delay)}};u.setopt("afterF",v);u.show(w)},dragit:function f(v,u){DragO={getAbsX:function(y){var z=g?document.documentElement.scrollLeft:document.body.scrollLeft;var w=j?y.clientX+z:y.pageX;return w},getAbsY:function(x){var w=g?document.documentElement.scrollTop:document.body.scrollTop;var z=j?x.clientY+w:x.pageY;return z},setAlpha:function(x,w){if(document.all){x.style.filter="alpha(opacity="+w+"0)"}else{x.style.opacity=w/10}},doDown:function(B){B=B?B:window.event;var z=j?B.offsetX:B.layerX;var C=j?B.offsetY:B.layerY;var w=this.tar;var A=this;DragO.setAlpha(w,6);document.onmousemove=function(x){x=x?x:event;j?A.setCapture():window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);w.style.left=(DragO.getAbsX(x)-z)+"px";w.style.top=(DragO.getAbsY(x)-C)+"px"};document.onmouseup=function(x){x=x?x:event;document.onmousemove=null;j?A.releaseCapture():window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);DragO.setAlpha(w,10)}},init:function(x,w){x.onmousedown=this.doDown;x.tar=w;x.style.cursor="move"}};DragO.init(v,u)}};function r(u){this._tpl=u}r.filter={arrayclass:function(u){if(u==1){return'class="pollNone"'}return u%2?"":'class="even"'},trclass:function(u){return u%2?'class="even"':""},titlepre:function(u){return"调查"+u+"."},spanclass:function(u){var u=u+1;return["style",(u%5)].join("")},output_ans_head:function(u){if(u%4==1){return'<tr align="center" valign="top">'}else{return""}},output_ans_head_noatr:function(u){if(u%4==1){return"<tr>"}else{return""}},output_ans_head_as:function(u){if(u%4==1){return'<tr align="center" valign="top" class="as">'}else{return""}},output_ans_tail:function(u){if(u%4==0){return"</tr>"}else{return""}}};r.prototype={_dotpl:function(x,v){var v=v;var x=x;var w=/\%\(if\s+([^)]*)\)(.*?)\%\(endif\)/ig;var u=/%\(questionloop\)(.*)%\(\/questionloop\)/i;x=this._proqloop(x,v);x=this._proif(x,v);return this._rnd(x,v)},_proif:function(D,x){var Q=D,O,v,L,M,P,I,A,B,E;var y;var N=[];var C=[];var H=/\%\(if\s+([^)]*)\)(.*?)\%\(endif\)/ig;var K=/\%\(if\s+([^)]*)\)(.*?)\%\(endif\)/i;var z=/\%\(elif\s+([^)]*?)\)(.*?(%\(elif|%\(else|$))/i;var u=D.match(H);if(!u){return Q}for(var J=0,w=u.length;J<w;J++){E="";N=[],C=[];O=u[J];v=O.match(K);L=v[1];M=v[2];I=M.indexOf("%(elif")!=-1?M.indexOf("%(elif"):M.indexOf("%(else");P=I!=-1?M.substr(0,I):M;while(M.match(z)){y=M.match(z);N.push(y[1]);C.push(y[2].replace(y[3],""));M=M.replace(y[0].replace(y[3],""),"")}B=M.indexOf("%(else)");if(B!=-1){E=M.substr(B+7)}if(x[L]){A=P}else{A=E?E:""}for(var G=0,F=N.length;G<F;G++){if(x[N[G]]){A=C[G]}}Q=Q.replace(O,A)}return Q},_proqloop:function(G,A){var Q=G,O,P;var x=/%\(questionloop\)(.*)%\(\/questionloop\)/i;var D=G.match(x);if(!D){return Q}var C=D[1];var y=/%\(answerloop\)(.*?)%\(\/answerloop\)/ig;var N=/%\(answerloop\)(.*?)%\(\/answerloop\)/i;var J=C.match(y);if(!J){alert("no answer loop");return false}for(var E=0,w=J.length;E<w;E++){C=C.replace(N,"%(answerblock"+E+")")}var v="";for(var K=0,B=A.question.length;K<B;K++){var z=A.question[K];s.extendObj(A,z);for(var F=0,u=J.length;F<u;F++){var M="";P=J[F].replace(/\%\(\/?answerloop\)/ig,"");for(var I=0,H=z.answer.length;I<H;I++){var L=z.answer[I];s.extendObj(z,L);s.extendObj({answerloopid:I+1},L);O=this._proif(P,L);M+=this._rnd(O,L);O=null}z["answerblock"+F]=M}O=this._proif(C,z);v+=this._rnd(O,z);O=null}Q=Q.replace(x,v);return Q},_proaloop:function(E,J){var D=E,H,I,F,y,z,G,B,C,x;var u=/%\(answerloop\)(.*?)%\(\/answerloop\)/ig;var w=/%\(answerloop\)(.*?)%\(\/answerloop\)/i;matcharr=E.match(u);if(!matcharr){return D}for(var A=0,v=matcharr.length;A<v;A++){H=matcharr[A];I=H.match(w);F=I[1];F=this._proif(F,J);B=this._rnd(F,J);D=D.replace(H,B)}},_rnd:function(u,x){var w=r.filter;var v=function(y,B){B=B.split("|");var A=x[B[0]];for(var z=1;z<B.length;z++){A=w[B[z]](A)}if(A===""){return""}if(A==0||A==-1){A+=""}return A||"Null"};return u.replace(/%\(([A-Za-z0-9_|.]*)\)/g,v)},render:function(v){var u=this._tpl;u=u.replace(/\<\!\-\-|\-\-\>/g,"");u=u.replace(/\n|\r/ig,"");u=u.replace(/%\(c\)(.*?)%\(\/c\)/ig,"");return this._dotpl(u,v)}};function n(u,v){this.init(u,v)}n.prototype={init:function(u,v){this._sid=u;this._pagetpl=new r(v.pagetpl);this._resulttpl=new r(v.resulttpl);this._minipagetpl=new r(v.minipagetpl);window["pplivecontrol"+this._type+this._sid]=this;this._extdata={};this._initextdata()},_sid:null,_type:null,_ismini:false,_urlpre:{},_config:{},_data:null,_datastat:false,_view:null,_beforeF:null,_afterF:null,_getdata:function(y){var v=this;var x=y=="v"?function(){v.showpage()}:function(){v.showresult()};var u=function(z){v._updatedata(z);x()};var w=[this._urlpre.getdataurl,"SubjectID=",this._sid,"&random=",Math.random()].join("");m.sendJs(w,u)},_updatedata:function(u){},_initextdata:function(){},setopt:function(w,u){this["_"+w]=u},config:function(w,u){this._config[w]=u},setextd:function(w,u){this._extdata.p=u},dosubmit:function(){},showpage:function(){this.closer();this._updatepage()},_updatepage:function(){if(this._datastat){var w=s.cmbObj(this._extdata,this._data);var v=this._ismini?this._minipagetpl:this._pagetpl;var u=e(this._config.containerpre+this._sid);if(!u){return}if(this._data.subjectid=="0"){return}u.innerHTML=v.render(w);if(typeof(this._afterupdatepage)=="function"){this._afterupdatepage()}return true}this._getdata("v")},showresult:function(){},_openr:function(v){var w=e(this._config.containerpre+"_result"+this._sid);var u=e(this._config.containerpre+this._sid);if(!w){w=document.createElement("div");w.id=this._config.containerpre+"_result"+this._sid;document.body.insertBefore(w,document.body.firstChild)}w.innerHTML=this._resulttpl.render(v);w.style.position="absolute";w.style.display="block";w.style.zIndex=1000;w.getElementsByTagName("div")[0].style.margin="0";c(w);o.dragit(e("resulthandler"+this._sid),w)},closer:function(){try{e(this._config.containerpre+"_result"+this._sid).style.display="none"}catch(u){}return false}};var a={pagetpl:'<!--<div class="window_A1" style="width:500px "><div class="pollMotion" style="display:none;" id="votetip%(subjectid)">正在提交数据，请稍后……</div><table class="w_C1" width="500">  <tr>    <th class="pollTitle"><i>&nbsp;</i>%(subjectname)</th>  </tr>	  %(questionloop)	    	<tr>	    		<td class="pollNote">		    		%(if subjectmore)					%(questionloopid|titlepre)%(questionname)				%(else)					%(questionname)				%(endif)			</td>	  	</tr>	  	<tr>	    		<td class="resultView whiteBody">				%(if qimgtype)				<table class="pollContent pollImg">      				%(c)<tr align="center" valign="top">%(/c)      				%(answerloop)      					%(answerloopid|output_ans_head)       					 <td %(answerloopid|arrayclass)>       					 <label for="no%(answerid)">       					 <img src="%(answerimg)" /><br />       					 %(if subjectshowi)       					 <input type="%(answertype)" name="%(qinputname)" id="no%(answerid)" value="%(ainputvalue)"/>       					 %(endif)       					 %(answername)       					 </label>       					</td>       				%(answerloopid|output_ans_tail)       				%(/answerloop)	      				%(c)</tr>%(/c)    				</table>    				%(else)				<table class="pollContent">				%(answerloop)					<tr>					  <td %(answerloopid|arrayclass)>				%(if subjectshowi)				<input type="%(answertype)" name="%(qinputname)" id="no%(answerid)" value="%(ainputvalue)" style="padding-right:10px; " />				%(endif)					  <label for="no%(answerid)">%(answername)</label>					  </td>					</tr>				%(/answerloop)					</table>				%(endif)			</td>  		</tr>	%(/questionloop)	  <tr>    		<td align="center" class="pollSbt">			%(if subjectopenvote)				<input type="submit" class="sbt_A1" value="投票" onclick="%(dovotes)"/>			%(endif)    			%(if subjectopenresult)				<input type="submit" class="sbt_A2" value="查看" onclick="%(showresult)"/>			%(endif)		</td>  	</tr> 	 <tr>    		<td class="pollOther">    		    	<table width="100%"  border="0" cellspacing="0" cellpadding="0">      			<tr>      			%(if subjectvotetip)<td align="left" class="C_F60">%(subjectvotetip)</td>%(endif)      			<td align="right">　    			%(if subjectplink)[<a href="%(subjectplink)" class="C_F60">观看节目</a>]%(endif)    			%(if subjectpost)[<a href="%(subjectpost)" class="C_F60">去P吧讨论</a>]%(endif)    			</td>    			</tr>    			</table>    		</td> 	 </tr>	  </table></div>-->',minipagetpl:'<dl class="areaD question">    <dt><span class="imgIco">用户调查</span></dt>    <dd>	%(questionloop)	<h1>%(questionname)</h1>	%(answerloop)	<p>		%(if subjectshowi)			<input type="%(answertype)" name="%(qinputname)" id="no%(answerid)" value="%(ainputvalue)" />		%(endif)		<label for="no%(answerid)">%(answername)</label>	</p>	%(/answerloop)	<ins>	%(if subjectopenvote)		<input type="submit" class="sbt_57x21_001" value="投票" onclick="%(dovotes)"/>	%(endif)	%(if subjectopenresult)		<input type="submit" class="sbt_57x21_002" value="查看" onclick="%(showresult)"/>	%(endif)	</ins>	<br style="clear:both" />	%(/questionloop)	</dd></dl>',resulttpl:'<!--<div class="window_A1" style="width:500px "><table class="w_C1" width="500">  <tr>    <th class="pollTitle" id="resulthandler%(subjectid)"><span onclick="%(closer)"><a href="#1" class="close_A1" title="返回" >返回</a></span>%(subjectname)</th>  </tr>	  %(questionloop)	    	<tr>	    		<td class="pollNote">		    		%(if subjectmore)					%(questionloopid|titlepre)%(questionname)				%(else)					%(questionname)				%(endif)			</td>	  	</tr>	  	<tr>	    		<td class="resultView whiteBody">	    		%(if qimgtype)	    			<table class="pollContent pollImg">		  			%(c)<tr align="center" valign="top" class="as">%(/c)		  			%(answerloop)		  			%(answerloopid|output_ans_head_as)       					 <td %(answerloopid|arrayclass)>       					 <label for="no%(answerid)">       					 <img src="%(answerimg)" /><br />       					 %(answername)       					 </label>       					</td>       					%(answerloopid|output_ans_tail)       					%(/answerloop)			 			 %(c)</tr>%(/c)				</table>	    		%(endif)				<table class="pollContent">				%(answerloop)				          <tr %(answerloopid|arrayclass)>           					<th width="32%">%(answerloopid).%(answername)</th>            					<th width="33%"><span style="width:%(answershowpect)%" class="%(answerloopid|spanclass)"></span></th>            					<th width="35%"><big>%(answercount)票</big> <tt>(%(answerpect)%)</tt></th>          				</tr>				%(/answerloop)					</table>			</td>  		</tr>	%(/questionloop) 	 <tr>    		<td align="right" class="pollOther">    			%(if subjectplink)[<a href="%(subjectplink)" class="C_F60">观看节目</a>]%(endif)    			%(if subjectpost)[<a href="%(subjectpost)" class="C_F60">去P吧讨论</a>]%(endif)    		</td> 	 </tr> 	 </table></div>-->'};function t(u,v){this.init(u,v)}t.prototype={_type:"poll",_urlpre:{getdataurl:"http://poll.pplive.com/Result.aspx?",dovoteurl:"http://poll.pplive.com/poll.aspx?",quepre:"answers"},_config:{containerpre:"",inpnamepre:"pplivevotequt",inpvaluepre:"pplivevoteans",waitvotedata:false,resultafvote:true,viewtype:1,hasvote:false,mustvote:false,resultnotopen:false},_updatedata:function(G){var N={};var A=G.Subject;N.subjectid=A.Id;N.subjectname=A.Name;var L=i.get("haspplivedovote"+this._sid);var y=L?2:1;this.config("hasvote",L);N.subjectopenvote=parseInt(A.EnablePoll)&&!(L);N.subjectvotetip="";N.subjectvotetip+=parseInt(A.EnablePoll)?"":"超过今日投票限额 ";N.subjectvotetip+=L?"已投票,谢谢关注":"";if(A.OverTimeType=="2"){N.subjectopenvote=false;N.subjectvotetip="投票已截止,谢谢关注"}else{if(A.OverTimeType=="0"){N.subjectopenvote=false;N.subjectvotetip="投票尚未开始,谢谢关注"}}N.EnableView=A.EnableView;N.ViewStyle=A.ViewStyle;N.subjectopenresult=A.EnableView&y;N.subjectresulttip="不能查看";N.subjectplink=A.SynacastURL;N.subjectpost=A.P8URL;N.subjectshowi=A.OverTimeType=="1"&&N.subjectopenvote;this.config("showinpage",A.ViewStyle=="1");if(this._config.showinpage){this._extdata.closer=this._extdata.showvote}if(A.ViewStyle=="2"){N.subjectopenresult=false;this.config("resultnotopen",A.ViewStyle=="2")}N.question=[];var C=A.Questions?A.Questions.Question:[];if(!(C instanceof Array)){C=[C]}var z,u,x,v,J;if(C.length>1){N.subjectmore=true}for(var I=0,B=C.length;I<B;I++){z=C[I];u={};u.questionname=z.Name;u.questionid=z.Id;u.qimgtype=z.Type&2;u.questionloopid=I+1;u.qinputname=[z.Id,"_",this._config.inpnamepre].join("");u.answer=[];try{x=z.Answers.Answer}catch(K){N.question.push(u);continue}if(!(x instanceof Array)){x=[x]}u.totlecount=0;var w=1;var D;for(var M=0,E=x.length;M<E;M++){D=0;if(!x[M]["Count"]){break}D=parseInt(x[M]["Count"]);u.totlecount+=D;if(D>w){w=D}}for(var H=0,F=x.length;H<F;H++){v={};J=x[H];v.answername=J.Name;v.answerimg=J.ImageURL;v.answertype=z.Type&1?"checkbox":"radio";v.answerid=J.Id;v.ainputvalue=J.Id+"_"+this._config.inpvaluepre;if(J.Count){v.answercount=parseInt(J.Count);if(!u.totlecount){v.answerpect="0.0"}else{v.answerpect=(100*v.answercount/parseInt(u.totlecount)).toString().substr(0,4)}v.answershowpect=(100*v.answercount/w).toString().substr(0,4)}u.answer.push(v)}N.question.push(u)}this._data=N;this._datastat=true},_initextdata:function(){this._extdata.dovotes="window.pplivecontrol"+this._type+this._sid+".dosubmit();return false";this._extdata.showresult="window.pplivecontrol"+this._type+this._sid+".showresult();return false";this._extdata.showvote="window.pplivecontrol"+this._type+this._sid+".showpage();return false";this._extdata.closer="window.pplivecontrol"+this._type+this._sid+".closer();return false"},_getvote:function(){var A={},x=[],y,E,D;var C=[];var v=e(this._config.containerpre+this._sid);var B=v.getElementsByTagName("input");for(var z=0,w=B.length;z<w;z++){D=B[z];E=D.value.split("_")[0];if(D.type=="checkbox"){if(D.checked){if(D.name in A){A[D.name].push(E)}else{A[D.name]=[E]}}}if(D.type=="radio"){if(D.checked){A[D.name]=[E]}}}if(!A){return false}for(var u in A){if(typeof(A[u])!="function"){x=x.concat(A[u])}}if(!x){return false}C=x;return C},dosubmit:function(){this.closer();var x=this._getvote();var v=x.join(",");if(!v){alert("你还没有选择");return false}var w=this;var A={sid:w._sid,showresult:function(){w.showresult()}};var u=function(B){A.responseText=B.responseText;if(typeof(w._afterF)=="function"){w._afterF(A)}};var y=[this._urlpre.dovoteurl,"SubjectID=",this._sid,"&",this._urlpre.quepre,"=",v].join("");if(typeof(w._beforeF)=="function"){w._beforeF(A)}this._setHasvote();try{this._addVote(x)}catch(z){}if(this._config.waitvotedata){m.sendJs(y,u)}else{m.sendJs(y,function(){});A.responseText="200-ok";if(typeof(w._afterF)=="function"){setTimeout(function(){w._afterF(A)},1000)}}return true},_setHasvote:function(){i.set("haspplivedovote"+this._sid,"1",1);this._config.hasvote|=1;this._data.subjectopenvote=false;this._data.subjectshowi=false;this._data.subjectvotetip="已投票,谢谢关注";this._data.subjectopenresult=this._data.ViewStyle!="2"&&(this._data.EnableView&2)?true:false},_addVote:function(C){var v=this._data.question;var D,F,z,u;for(var B=0,x=v.length;B<x;B++){D=v[B];u=false;for(var A=0,E=D.answer.length;A<E;A++){z=D.answer[A];if(s.pina(z.answerid,C)){z.answercount++;D.totlecount++;u=true}}z=null;if(u){for(var y=0,w=D.answer.length;y<w;y++){z=D.answer[y];z.answerpect=(100*z.answercount/parseInt(D.totlecount)).toString().substr(0,4)}}}},showresult:function(){if(!this._config.showinpage||!this._config.resultnotopen){this._updatepage()}if(this._config.resultnotopen){return false}if(this._config.mustvote&&!this._config.hasvote){alert("请先投票再查看");return false}if(this._datastat){var u=s.cmbObj(this._extdata,this._data);if(this._config.showinpage&&!this._ismini){e(this._config.containerpre+this._sid).innerHTML=this._resulttpl.render(u)}else{this._openr(u)}return false}this._getdata("r")}};s.extendClass(n,t);function h(w,y,v){var y=y||{};var v=v||{};var u=y.containerpre||"pplivepollcontainer";var x=y.containerclass||"pplivepollcontainer";var B=y.afterF||null;var A=y.beforeF||null;var z=new t(w,a);z.setopt("afterF",B);z.setopt("beforeF",A);z.setopt("ismini",v.showmini);z.config("containerpre",u);z.showpage()}var l={beforeF:function(u){e("votetip"+u.sid).innerHTML='<img src="http://res.pplive.com/poll/images/buffer_A1.gif" width="32" height="32" />正在提交数据，请稍后……';c(e("votetip"+u.sid));e("votetip"+u.sid).style.display="block"},afterF:function(u){e("votetip"+u.sid).innerHTML="投票成功";o.hl(e("votetip"+u.sid),function(){e("votetip"+u.sid).style.display="none";u.showresult()})}};var k={pagetpl:'<div class="window_A1" style="width:500px"><div class="pollMotion" style="display:none;" id="wagertip%(subjectid)">正在投票，请稍后……</div><table class="w_C1">  <tr>    <th class="pollTitle">%(subjectname)</th>  </tr>  %(questionloop)  <tr>    <td class="pollNote">%(subjectdec)</td>      </tr>  <tr>    <td class="resultView whiteBody" id="wagertablecon%(subjectid)">	    <table class="pollContent" >	    %(answerloop)          <tr %(loopid|trclass) id="wagertr%(answerid)">            <td width="32%">            %(if showrad)            <input type="radio" name="%(qinputname)" id="no%(answerid)" value="%(inpvalue)"/>            %(endif)            <label for="no%(answerid)">%(answername)</label>            </td>            %(if showapic)<td width="32%"><span style="width:%(answerpect)%" class="%(loopid|spanclass)"></span></td>%(endif)            <td width="36%">%(if showman)<big>%(gpc)人</big>%(endif) %(if showval)<tt>(%(gval)分)</tt>%(endif)<label id="wagerla%(answerid)"></label></td>          </tr>          %(/answerloop)        </table>	</td>  </tr>  %(/questionloop)  <tr>    <td align="left" id="wagertipcon%(subjectid)">		<table cellspacing="5" class="jcIntegral">			<tr><td colspan="2" class="jcIco2">当前奖金总额：<i class="C_090" id="prizepoll%(subjectid)">%(prizepoll)</i>分</td>		    </tr>			<tr>			<td class="jcpre" id="pointarea%(subjectid)"></td>			<td align="left" valign="top"  id="timearea%(subjectid)"></td>		    </tr>		</table>	</td>  </tr>  <tr>    <td align="center" class="pollSbt">	%(if showwager)	<input type="submit" class="sbt_A1" value="提交" onclick="%(dosubmit)" />	%(endif)	</td>  </tr>  <tr>    <td align="right" class="pollOther">    %(if subjectplink)[<a href="%(subjectplink)" class="C_F60">观看节目</a>]%(endif)    %(if subjectpost)[<a href="%(subjectpost)" class="C_F60" target="_blank">去P吧讨论</a>]%(endif)    <a href="#"><img src="http://res.pplive.com/poll/images/help.gif" border="0" style="margin-bottom:-2px" /></a>    </td>  </tr></table></div>',minipagetpl:'<dl class="areaD question">	<dt><span class="imgIco yellow">竞猜</span></dt>	<dd>		<h3>本期奖金<i>%(prizepoll)</i></h3>		<h2 id="timearea%(subjectid)">开奖日期：2007年8月15日</h2>		%(questionloop)			<h1>%(subjectdec)</h1>			%(answerloop)				<p>					%(c)%(if showrad)%(/c)					<input type="radio" name="%(qinputname)" id="no%(answerid)" value="%(inpvalue)"/>					%(c)%(endif)%(/c)					<label for="no%(answerid)">%(answername)</label>				</p>			%(/answerloop)		<h2><span id="pointarea%(subjectid)"></span></h2>		%(if showwager)			<ins><input type="submit" class="sbt_57x21_001" value="提交" onclick="%(dosubmit)" /></ins>		%(endif)		<br style="clear:both" />		%(/questionloop)	</dd></dl>',resulttpl:'<div class="window_A1" style="width:430px "><table class="w_B1">  <tr>    <th class="pollTitle" id="resulthandler%(subjectid)">    <span onclick="%(closer)"><a href="#1" class="close_A1" title="返回" >返回</a></span><i>&nbsp;</i>竞猜结果</th>  </tr>  <tr>    <td class="pollTopic jcIco1">%(subjectname)</td>  </tr>  %(questionloop)  <tr>    <td class="pollNote">%(subjectdec)</td>  </tr>  <tr>    <td class="resultView whiteBody">	    <table class="pollContent">             %(answerloop)			<tr %(answerloopid|arrayclass)>           		<th width="32%">%(answerloopid).%(answername)</th>            		<th width="33%"><span style="width:%(answerpect)%" class="%(answerloopid|spanclass)"></span></th>            		<th width="35%"><big>%(gpc)人</big> <tt>(%(gval))分</tt></th>          		</tr>          %(/answerloop)        </table>	</td>  </tr>  %(/questionloop)  <tr>    <td align="right" class="pollOther">    %(if subjectplink)[<a href="%(subjectplink)" class="C_F60" target="_blank">观看节目</a>]%(endif)    %(if subjectpost)[<a href="%(subjectpost)" class="C_F60" target="_blank">去P吧讨论</a>]%(endif)    </td>  </tr></table></div>'};function q(u,v){this.init(u,v)}q.prototype={_type:"wager",_urlpre:{getdataurl:"http://jingcai.pplive.com/Result.aspx?",dowagerurl:"http://jingcai.pplive.com/Guess.aspx?"},_config:{containerpre:"pplivewagercontainer",chipinput:"pplivewagerchip",inpnamepre:"pplivewagerqut",inpvaluepre:"pplivewagerval",waitvotedata:true,MinChip:0,MaxChip:0},_updatedata:function(u){var C={};var v=u.Subject;var A;var w=0,y=0;C.subjectid=v.Id;C.subjectname=v.Name;C.subjectdec=v.Description;C.state=v.State;C.daan=v.CorrectOption;C.question=[{}];C.question[0].qinputname=v.Id+"_"+this._config.inpnamepre;try{ops=v.Options.Option}catch(B){ops=[]}if(!(ops instanceof Array)){ops=[ops]}for(var z=0,x=ops.length;z<x;z++){w+=parseInt(ops[z].GuessValue);y+=parseInt(ops[z].GuessPersonCount)}C.question[0].prizecount=w;C.question[0].peoplecount=y;C.question[0].answer=[];ans=C.question[0].answer;for(var z=0,x=ops.length;z<x;z++){ans[z]={};ans[z].answerid=ops[z].Id;ans[z].answerpect=ops[z]["GuessPersonCount"]!="0"?((100*parseInt(ops[z]["GuessPersonCount"])/parseInt(y)+"").substr(0,4)):"0";ans[z].loopid=z;ans[z].answername=ops[z].Name;ans[z].inpvalue=ops[z].Id+"_"+this._config.inpvaluepre;ans[z].gval=ops[z].GuessValue;ans[z].gpc=ops[z].GuessPersonCount}C.showman=v.ViewOption&2;C.showval=v.ViewOption&1;C.showapic=C.showman||C.showval;C.prizepoll=w+parseInt(v.PrizePool);C.chipinput=this._sid+"_"+this._config.chipinput;C.minprize=parseInt(v.MinValue);C.maxprize=parseInt(v.MaxValue);C.wagerend=v.State=="2";if(v.State=="3"){C.wagerend=true;C.wagercheck=true}if(v.State=="4"){C.deleted=v.State=="4"}C.endtime=v.EndTime;C.checktime=v.CheckTime;if(C.minprize==C.maxprize){C.givenprize=true}this.config("MinChip",C.minprize);this.config("MaxChip",C.maxprize);C.subjectplink=v.SynacastURL;C.subjectpost=v.P8URL;C.showwager=true;C.haswager=false;C.userright=false;if(v.User){if(v.User.IsCanPoll=="False"){C.showwager=false;C.haswager=true}C.usergval=v.User.GuessValue;A=v.User.PrizeValue||"0";A=A+"";C.userprize=A.indexOf(".")==-1?A:A.substr(0,A.indexOf("."));if(C.userprize!="0"){C.userright=true}}C.showwager=C.showrad=(C.wagerend||C.wagercheck||C.haswager||C.deleted)?false:true;this._data=C;this._datastat=true},_initextdata:function(){this._extdata.dosubmit="window.pplivecontrol"+this._type+this._sid+".dosubmit();return false";this._extdata.showresult="window.pplivecontrol"+this._type+this._sid+".showresult();return false";this._extdata.closer="window.pplivecontrol"+this._type+this._sid+".closer();return false"},_getUname:function(){var v=i.get("PPName")||"";var u=v.split("$")[0];u=encodeURIComponent(u);return u?u:false},dosubmit:function(){var x=this._getVal();if(!x){return}this.closer();var v=this;var y={sid:v._sid,showresult:function(){v.showresult()}};var u=function(A){var B=A.responseText.split("-")[0];var z=A.responseText.split("-")[1];if(B=="6"){v._setHaswager();v._addWager(x);v._updatepage()}v.showtip(z,4000);y.responseText=A.responseText;if(typeof(v._afterF)=="function"){v._afterF(y)}};var w=[this._urlpre.dowagerurl,"OptionID=",x[0],"&GuessValue=",x[1]].join("");if(typeof(v._beforeF)=="function"){v._beforeF(y)}if(this._config.waitvotedata){m.sendJs(w,u)}else{m.sendJs(w,function(){});this._setHaswager();this._addWager(x);this._updatepage();y.responseText="1-ok";if(typeof(v._afterF)=="function"){setTimeout(function(){v._afterF(y)},1000)}}return true},_getVal:function(){var y=retval=null;var u=e(this._config.containerpre+this._sid);var v=u.getElementsByTagName("input");for(var x=0,w=v.length;x<w;x++){if(v[x].type=="radio"&&v[x].checked){y=v[x].value.split("_")[0];break}}if(!y){alert("你还没有选择!");return false}retval=parseInt(e(this._sid+"_"+this._config.chipinput).value);if(!retval){alert("请输入投注积分");return false}if(retval<this._config.MinChip||retval>this._config.MaxChip){this.showtip("请输入合法积分",1500);return false}return[y,retval]},_setHaswager:function(){},_addWager:function(A){var x=this._data;var y=null,u=null,z=false;x.haswager=true;x.prizepoll+=A[1];x.showrad=false;x.showwager=false;y=x.question[0];y.prizecount+=A[1];y.peoplecount++;for(var w=0,v=y.answer.length;w<v;w++){z=false;u=y.answer[w];if(u.answerid==A[0]){u.gpc=parseInt(u.gpc)+1;u.gval=parseInt(u.gval)+A[1];z=true}u.answerpect=(100*u.gpc/parseInt(y.peoplecount)).toString().substr(0,4)}},_afterupdatepage:function(){var A=this._data;var z=e("pointarea"+this._sid);var v=e("timearea"+this._sid);var x="";var u="";var w=[this._sid,"_",this._config.chipinput].join("");if(A.deleted){e("prizepoll"+this._sid).innerHTML="0";e("wagertablecon"+this._sid).style.display="none";e("wagertipcon"+this._sid).style.borderTop="1px solid #D5D5D5";z.innerHTML="<i>竟猜因故取消，原投注金额已返回用户个人帐户。</i>";return}if(A.wagerend){if(A.wagercheck){if(!this.ismini){try{e("wagertr"+this._data.daan).className+=" pollProper";e("wagerla"+this._data.daan).innerHTML="正确答案"}catch(y){}}if(A.haswager){if(A.userright){z.className="pollright";x=['<i><img src="http://res.pplive.com/poll/images/happy.gif" width="20" height="20" />恭喜！您猜对了！</i>',"竞猜",A.usergval,"分，共获得",A.userprize,'分。可去<a href="http://passport.pplive.com/UserCenter.aspx">我的PP中心</a>','><a href="http://passport.pplive.com/Guess.aspx?username=',this._getUname(),'">我的竞猜</a>'," 查看详情"].join("")}else{z.className="pollwrong";x=['<i><img src="http://res.pplive.com/poll/images/mad.gif" width="20" height="20" />您猜错了，真遗憾！</i>','可去<a href="http://passport.pplive.com/UserCenter.aspx">',"我的PP中心</a>>",'<a href="http://passport.pplive.com/Guess.aspx?username=',this._getUname(),'">我的竞猜</a> 查看详情'].join("")}}else{x="本次竞猜已结束,期待你下次参与"}}else{x="竞猜投交已截止,请等待结果公布";u="结果公布时间  "+A.checktime}if(this._ismini&&!u){u="竞猜已截止"}}else{if(A.haswager){x="竞猜已投交,请等待结果公布";u="结果公布时间  "+A.checktime}else{if(A.givenprize){x=["本次竞猜需要消耗",A.minprize,'个积分<input type="hidden" value="',A.minprize,'" id="',w,'" />'].join("")}else{x=['输入本注投注积分<input type="text" size="4" style="height:16px;line-height:16px" id="',w,'"/>分<i>(',A.minprize,"--",A.maxprize,"分)</i>"].join("")}u="本次竞猜截止时间  "+A.endtime}}z.innerHTML=x;v.innerHTML=u},islogin:function(){return this._getUname()?true:false},showtip:function(w,v){var v=v==undefined?2:v;e("wagertip"+this._sid).innerHTML=w;c(e("wagertip"+this._sid));e("wagertip"+this._sid).style.display="block";var u=this;var x=function(){o.hl(e("wagertip"+u._sid),function(){e("wagertip"+u._sid).style.display="none"})};clearTimeout(this._tiptimer);this._tiptimer=setTimeout(x,v)},shownotlogin:function(){e(this._config.containerpre+this._sid).innerHTML='你还没有登录,请先<a href="http://passport.pplive.com/Login.aspx?APReturnURL='+window.location.href+'">登录</a>再参加竞猜'},showresult:function(){var u=s.cmbObj(this._extdata,this._data);this._openr(u)}};s.extendClass(n,q);function d(w,y,v){var y=y||{};var v=v||{};var u=y.containerpre||"pplivewagercontainer";var x=y.containerclass||"pplivewagercontainer";var B=y.afterF||null;var A=y.beforeF||null;var z=new q(w,k);z.setopt("afterF",B);z.setopt("beforeF",A);z.setopt("ismini",v.showmini);z.config("containerpre",u);z.showpage()}var b={beforeF:function(u){e("wagertip"+u.sid).innerHTML='<img src="http://res.pplive.com/poll/images/buffer_A1.gif" width="32" height="32" />正在提交数据，请稍后…';c(e("wagertip"+u.sid));e("wagertip"+u.sid).style.display="block"}};var m={sendJs:function(w,z,v){var x=document.getElementsByTagName("head")[0];var y=document.createElement("script");y.id=yun.getGuid();yun.regJson(y.id,z,v);y.type="text/javascript";var u="&cb=yun.dojson&jsonId="+y.id;w=w.match(/\?/)?w+u:w+"?"+u;y.src=w;x.appendChild(y)}};var i={get:function(u){var y=null;if(document.cookie&&document.cookie!=""){var x=document.cookie.split(";");for(var w=0;w<x.length;w++){var v=x[w].replace(/^\s+|\s+$/g,"");if(v.substring(0,u.length+1)==(u+"=")){y=decodeURIComponent(v.substring(u.length+1));break}}}return y},set:function(v,B,A){var u="";var z=new Date();z.setTime(z.getTime()+A*24*60*60*1000);u="; expires="+z.toUTCString();var y="; path=/";var w="; domain=pplive.com";var x="";document.cookie=[v,"=",encodeURIComponent(B),u,y,w,x].join("")}};function c(w){var v=p.getScrollTop()+p.getHeight()/2-w.clientHeight/2;var u=p.getScrollLeft()+p.getWidth()/2-w.clientWidth/2;w.style.top=v+"px";w.style.left=u+"px"}var p=new function(){this.getScrollTop=function(){return g?document.documentElement.scrollTop:document.body.scrollTop};this.getScrollLeft=function(){return g?document.documentElement.scrollLeft:document.body.scrollLeft};this.getHeight=function(){var v=document.body.clientHeight;var u=document.documentElement.clientHeight;return g?u:v};this.getWidth=function(){var v=document.body.clientWidth;var u=document.documentElement.clientWidth;return g?u:v};this.pageHeight=function(){var u=this.getHeight();var v=document.body.scrollHeight;return Math.max(u,v)}};window.initpoll=h;window.Pollopt=l;window.initwager=d;window.Wageropt=b})();if(!yun){var yun={ver:"1.1.5",idseq:100,id:"yun",htData:[]}}yun.getGuid=function(){return this.id+this.idseq++};yun.reg=function(a,b){this.htData[a]=b};yun.regJson=function(c,b,a){this.reg(c,{cb:b,op:a})};yun.dojson=function(c,b){var a=this.htData[c];a.cb(b,a.op);a.cb=a.opt=a=this.htData[c]=null};