

function showRshareDlg(fuid,urpid)
{openWindow('/!rshare/!trans_dialog.php?fuid='+fuid+'&urpid='+urpid+'&do=start&r='+Math.random(),562,375,'转发分享');}
function showRshareVoteDlg(fuid,urpid,vote,action,title)
{openWindow('/!rshare/!trans_dialog.php?fuid='+fuid+'&urpid='+urpid+'&vote='+vote+'&do='+action+'&r='+Math.random(),562,375,title);}
function rshareVote(i,rpid,urpid,fuid){var url="/!rshare/!vote.php";var pars="i="+i+"&rpid="+rpid;var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){rshareVoteResult(req,i,urpid,fuid);}});}
function rshareVoteResult(req,i,urpid,fuid){r=req.responseText;eval("r="+r);if(r.ret==1)
{updateRshareVote(i,urpid);}else if(r.ret==4){alert("你已经投过票了");}else if(r.ret==3){alert("未登录");}else if(r.ret==6){alert("投票不存在");}else{alert("数据错误");}}
function updateRshareVote(i,urpid){var j=0;$j('.rsharefadeclass'+urpid).fadeOut("normal",function(){j=j+1;if(j==i){$('num'+i+""+urpid).innerHTML=parseInt($('num'+i+""+urpid).innerHTML)+1;var total=parseInt($('num1'+urpid).innerHTML)+parseInt($('num2'+urpid).innerHTML)+parseInt($('num3'+urpid).innerHTML);var perfect1=Math.round(parseInt($('num1'+urpid).innerHTML)*100/total);var perfect2=Math.round(parseInt($('num2'+urpid).innerHTML)*100/total);var perfect3=100-perfect1-perfect2;$('perfect1'+urpid).innerHTML=perfect1;$('perfect2'+urpid).innerHTML=perfect2;$('perfect3'+urpid).innerHTML=perfect3;var totalwidth=106;var width1=Math.round(totalwidth*perfect1/100);var width2=Math.round(totalwidth*perfect2/100);var width3=Math.round(totalwidth*perfect3/100);$('width1'+urpid).style.width=width1+"px";$('width2'+urpid).style.width=width2+"px";$('width3'+urpid).style.width=width3+"px";}
$j('.rsharefadeclass'+urpid).fadeIn("normal",function(){});});}
var ems=$$('input.rshareurpid');var nodes=$A(ems);var urpids='';nodes.each(function(node){urpids=urpids+node.value+',';});var ems=$$('input.rshareuid');var nodes=$A(ems);var uids='';nodes.each(function(node){uids=uids+node.value+',';});if(urpids.length>0&&uids.length>0){rshareGetVote(urpids,uids);}
function rshareGetVote(urpids,uids){var url="/!rshare/!getvote.php";var pars="urpids="+urpids+"&uids="+uids;var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){updateRshareVoteIndex(req);}});}
function updateRshareVoteIndex(req){r=req.responseText;eval("r="+r);if(r.flag!=1){return false;}
r=r.list;var len=r.length;for(var i=0;i<len;i++){urpid=r[i]['urpid'];var total=parseInt(r[i]['num1'])+parseInt(r[i]['num2'])+parseInt(r[i]['num3']);if(total>0){$('num1'+urpid).innerHTML=r[i]['num1'];$('num2'+urpid).innerHTML=r[i]['num2'];$('num3'+urpid).innerHTML=r[i]['num3'];var perfect1=Math.round(parseInt(r[i]['num1'])*100/total);var perfect2=Math.round(parseInt(r[i]['num2'])*100/total);var perfect3=100-perfect1-perfect2;$('perfect1'+urpid).innerHTML=perfect1;$('perfect2'+urpid).innerHTML=perfect2;$('perfect3'+urpid).innerHTML=perfect3;var totalwidth=106;var width1=Math.round(totalwidth*perfect1/100);var width2=Math.round(totalwidth*perfect2/100);var width3=Math.round(totalwidth*perfect3/100);$('width1'+urpid).style.width=width1+"px";$('width2'+urpid).style.width=width2+"px";$('width3'+urpid).style.width=width3+"px";}}}

var g_agt=navigator.userAgent.toLowerCase();var is_opera=(g_agt.indexOf("opera")!=-1);var g_title="";var g_title_bg="ts3";var g_iframeno=0;var g_dialog_sWord;var g_dialog_sButton;var g_dialog_sAction;var g_dialog_excss;function exist(s)
{return $(s)!=null;}
function myInnerHTML(idname,html)
{if(exist(idname))
{$(idname).innerHTML=html;}}
function _closeDialog()
{if('function'==typeof(close_dlg_callback))
{close_dlg_callback();}
new dialog().close();}
function dialog(v_w,v_h,v_title)
{var width=v_w;var height=v_h;var title=v_title;g_title=title;var sBox='\
  <div id="dialogBox" style="display:none;z-index:1999999;width:'+width+'px;">\
   <div class=ts460 style="position:absolute;top:0px;width:'+width+'px;opacity:0.4;filter:alpha(opacity=40);"><img src="http://img1.kaixin001.com.cn/i/h460_t.gif" width="'+width+'" height="8" /></div>\
   <div style="position:absolute;height:'+height+'px;top:8px;" >\
   <table border="0" cellpadding="0" cellspacing="0">\
   <tr style="height:'+(height)+'px;"><td style="background:#000000;width:7px;opacity:0.4;filter:alpha(opacity=40);"></td>\
   <td style="width:'+(width-14)+'px;">\
    <div style="border:1px solid #565656;">\
    <table width="100%" border="0" cellpadding="0" cellspacing="0">\
    ';if(typeof arguments[3]!="undefined")
{var sClose='<a href="javascript:new dialog().close();"><img src="http://img1.kaixin001.com.cn/i2/knowme/close.gif" width="10" alt="关闭"></a>';if(0==arguments[3])
{sBox+='\
     <tr valign="top">\
      <td id="dialogBody" style="height:'+(height-2)+'px" bgcolor="#ffffff"></td>\
     </tr>\
   ';}
else
{sBox+='\
      <tr height="24" bgcolor="#ffffff">\
       <td>\
        <div class="'+g_title_bg+'" style="background:#ffffff;border-bottom:1px solid #ffffff;">\
         <div id="dialogBoxTitle" class="ts31" >'+title+'</div>\
         <div id="dialogClose" class="ts32" style="margin-top:5px;margin-right:5px;">'+sClose+'</div>\
        </div>\
       </td>\
      </tr>\
      <tr valign="top">\
       <td id="dialogBody" style="height:'+(height-28)+'px" bgcolor="#ffffff"></td>\
      </tr>\
   ';}}
else
{var sClose='<a href="javascript:_closeDialog();"><b>×</b></a>';sBox+='\
     <tr height="24" bgcolor="#6795B4">\
      <td>\
       <div class="'+g_title_bg+'">\
        <div id="dialogBoxTitle" class="ts31">'+title+'</div>\
        <div id="dialogClose" class="ts32">'+sClose+'</div>\
       </div>\
      </td>\
     </tr>\
     <tr valign="top">\
      <td id="dialogBody" style="height:'+(height-28)+'px" bgcolor="#ffffff"></td>\
     </tr>\
  ';}
sBox+='\
    </table>\
    </div>\
   </td>\
   <td style="background:#000000;width:7px;opacity:0.4;filter:alpha(opacity=40);"></td></tr>\
   </table>\
   </div>\
   <div class=ts460 style="position:absolute;top:'+(height+8)+'px;width:'+width+'px;opacity:0.4;filter:alpha(opacity=40);"><img src="http://img1.kaixin001.com.cn/i/h460_b.gif" width="'+width+'" height="8" /></div>\
  </div><div id="dialogBoxShadow" style="display:none;z-index:19998;"></div>\
 ';var sIfram='\
  <iframe id="dialogIframBG" name="dialogIframBG" frameborder="0" marginheight="0" marginwidth="0" hspace="0" vspace="0" scrolling="no" style="position:absolute;z-index:19997;display:none;"></iframe>\
 ';var sBG='\
  <div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;"></div>\
 ';this.init=function()
{$('dialogCase')?$('dialogCase').parentNode.removeChild($('dialogCase')):function(){};var oDiv=document.createElement('span');oDiv.id="dialogCase";if(!is_opera)
{oDiv.innerHTML=sBG+sIfram+sBox;}
else
{oDiv.innerHTML=sBG+sBox;}
document.body.appendChild(oDiv);}
this.open=function(_sUrl)
{this.show();if(typeof document.body.style.maxHeight==="undefined")
{var openIframe="<iframe width='100%' height='100%' name='iframe_parent' id='iframe_parent' frameborder='0' scrolling='no'></iframe>";myInnerHTML('dialogBody',openIframe);$('iframe_parent').src=_sUrl;}
else
{var openIframe="<iframe width='100%' height='100%' name='iframe_parent' id='iframe_parent' src='"+_sUrl+"' frameborder='0' scrolling='no'></iframe>";myInnerHTML('dialogBody',openIframe);}}
this.show=function()
{this.middle('dialogBox');if($('dialogIframBG'))
{$('dialogIframBG').style.top=$('dialogBox').style.top;$('dialogIframBG').style.left=$('dialogBox').style.left;$('dialogIframBG').style.width=$('dialogBox').offsetWidth+"px";$('dialogIframBG').style.height=$('dialogBox').offsetHeight+"px";$('dialogIframBG').style.display='block';}
if(!is_opera){this.shadow();}}
this.reset=function()
{this.close();}
this.close=function()
{if(window.removeEventListener)
{window.removeEventListener('resize',this.event_b,false);window.removeEventListener('scroll',this.event_b,false);}
else if(window.detachEvent)
{try{window.detachEvent('onresize',this.event_b);window.detachEvent('onscroll',this.event_b);}catch(e){}}
if($('dialogIframBG')){$('dialogIframBG').style.display='none';}
$('dialogBox').style.display='none';$('dialogBoxBG').style.display='none';$('dialogBoxShadow').style.display="none";if(typeof(parent.onDialogClose)=="function")
{parent.onDialogClose($('dialogBoxTitle').innerHTML);}}
this.set_title=function(title)
{if($("dialogBoxTitle"))
{$("dialogBoxTitle").innerHTML=title;}
return this;}
this.shadow=function()
{this.event_b_show();if(window.attachEvent)
{window.attachEvent('onresize',this.event_b);window.attachEvent('onscroll',this.event_b);}
else
{window.addEventListener('resize',this.event_b,false);window.addEventListener('scroll',this.event_b,false);}}
this.event_b=function()
{var oShadow=$('dialogBoxShadow');oShadow['style']['width']=$j(document).width()+"px";oShadow['style']['height']=$j(document).height()+"px";if(oShadow.style.display!="none")
{if(this.event_b_show)
{this.event_b_show();}}}
this.event_b_show=function()
{var oShadow=$('dialogBoxShadow');oShadow['style']['position']="absolute";oShadow['style']['display']="";oShadow['style']['opacity']="0.2";oShadow['style']['filter']="alpha(opacity=20)";oShadow['style']['background']="#000";var sClientWidth=parent?parent.document.body.offsetWidth:document.body.offsetWidth;var sClientHeight=parent?parent.document.body.offsetHeight:document.body.offsetHeight;var sScrollTop=parent?(parent.document.body.scrollTop+parent.document.documentElement.scrollTop):(document.body.scrollTop+document.documentElement.scrollTop);oShadow['style']['top']='0px';oShadow['style']['left']='0px';oShadow['style']['width']=sClientWidth+"px";oShadow['style']['height']=$j(document).height()+"px";}
this.middle=function(_sId)
{$(_sId)['style']['display']='';$(_sId)['style']['position']="absolute";var sClientWidth=parent.document.body.clientWidth;var sClientHeight=parent.document.body.clientHeight;var sScrollTop=parent.document.body.scrollTop+parent.document.documentElement.scrollTop;var sleft=(sClientWidth-$(_sId).offsetWidth)/2;var iTop=sScrollTop+80;var sTop=iTop>0?iTop:0;$(_sId)['style']['left']=sleft+"px";$(_sId)['style']['top']=sTop+"px";}
this.resize=function(v_w,v_h)
{var dialogBody=$("dialogBody");var dialogBox=$("dialogBox");if(!dialogBody||!dialogBox)
{return;}
if($("dialogBoxTitle"))
{dialogBody.setStyle({height:(v_h-28)+"px"});}
else
{dialogBody.setStyle({height:(v_h-2)+"px"});}
dialogBox.setStyle({width:v_w+"px"}).down(".ts460").setStyle({width:v_w+"px"}).down().setStyle({width:v_w+"px"}).up().next(1).setStyle({top:(v_h+8)+"px",width:(v_w)+"px"}).down().setStyle({width:(v_w)+"px"}).up().previous().setStyle({height:(v_h)+"px"}).down().down("tr").setStyle({height:(v_h)+"px"}).down("td",1).setStyle({width:(v_w-14)+"px"});return this;}}
function openWindow(_sUrl,_sWidth,_sHeight,_sTitle)
{if(typeof arguments[4]!="undefined")
{var oEdit=new dialog(_sWidth,_sHeight,_sTitle,arguments[4]);}
else
{var oEdit=new dialog(_sWidth,_sHeight,_sTitle);}
oEdit.init();oEdit.open(_sUrl);}
function openAlert(_sWord,_sButton,_sWidth,_sHeight,_sTitle,_sAction,_sButton2,_sAction2)
{return _openAlert(_sWord,_sButton,_sWidth,_sHeight,_sTitle,_sAction,"",_sButton2,_sAction2);}
function openAlertBlue(_sWord,_sButton,_sWidth,_sHeight,_sTitle,_sAction)
{var excss='.rbs1{border:1px solid #d7e7fe; float:left;}\n'+'.rb1-12,.rb2-12{height:23px; color:#fff; font-size:12px; background:#355582; padding:3px 5px; border-left:1px solid #fff; border-top:1px solid #fff; border-right:1px solid #6a6a6a; border-bottom:1px solid #6a6a6a; cursor:pointer;}\n'+'.rb2-12{background:#355582;}\n';return _openAlert(_sWord,_sButton,_sWidth,_sHeight,_sTitle,_sAction,excss);}
function _openAlert(_sWord,_sButton,_sWidth,_sHeight,_sTitle,_sAction,_excss,_sButton2,_sAction2)
{var oEdit=new dialog(_sWidth,_sHeight,_sTitle);oEdit.init();oEdit.show();var framename="iframe_parent_"+g_iframeno++;g_dialog_sWord=_sWord;g_dialog_sButton=_sButton;g_dialog_sAction=_sAction;g_dialog_excss=_excss;g_dialog_sButton2=_sButton2;g_dialog_sAction2=_sAction2;var openIframe="<iframe width='100%' height='100%' name='"+framename+"' id='"+framename+"' src='http://www.kaixin001.com/interface/diablank.php' frameborder='0' scrolling='no' onload=\"javascript:_openAlert_write('"+framename+"')\"></iframe>";myInnerHTML('dialogBody',openIframe);}
function _openAlert_write(framename)
{var _sWord=g_dialog_sWord;var _sButton=g_dialog_sButton;var _sAction=g_dialog_sAction;var _sButton2=g_dialog_sButton2;var _sAction2=g_dialog_sAction2;var _excss=g_dialog_excss;var iframe=window.frames[framename];if(_excss&&_excss.length)
{try
{iframe.document.getElementsByTagName('head').item(0).innerHTML+='<style>'+_excss+'</style>';}
catch(exc)
{var ss=iframe.document.createElement('style');ss.type="text/css";ss.styleSheet.cssText=_excss;iframe.document.getElementsByTagName('head').item(0).appendChild(ss);}}
if(_sAction==undefined)
{_sAction="new parent.dialog().reset();";}
iframe.document.body.innerHTML=alertHtml(_sWord,_sButton,_sAction,_sButton2,_sAction2);}
function alertHtml(_sWord,_sButton,_sAction,_sButton2,_sAction2)
{var html="";var html='<div class="ts4">\
   <div class="ts45" style="border-top:none;padding-top:0;">\
     '+_sWord+'\
    <div class="c"></div>\
   </div>\
   <div class="ts42 r">\
    <div class="rbs1"><input type="button" style="width:68px;" value="'+_sButton+'" title="'+_sButton+'" class="rb1-12" onmouseover="this.className=\'rb2-12\';" onmouseout="this.className=\'rb1-12\';" onclick="javascript:'+_sAction+'" /></div>';if(typeof(_sButton2)!="undefined")
{if(typeof(_sAction2)=="undefined")
{_sAction2="new parent.dialog().reset();";}
html+='<div class="flw5">&nbsp;</div><div class="rbs1"><input type="button" style="width:68px;" value="'+_sButton2+'" title="'+_sButton2+'" class="rb1-12" onmouseover="this.className=\'rb2-12\';" onmouseout="this.className=\'rb1-12\';" onclick="javascript:'+_sAction2+'" /></div>';}
html+='<div class="c"></div></div>';html+='</div>';return html;}