﻿
var pl=0;var atitle;var browser=navigator.appName
var b_version=navigator.appVersion
var version=b_version.split(";");var trim_Version=version[1].replace(/[ ]/g,"");var col=new Array();col[0]='#BBBBBB';col[1]='#BCBCBC';col[2]='#CCCCCC';col[3]='#CDCDCD';col[4]='#DDDDDD';col[5]='#DEDEDE';col[6]='#EEEEEE';col[7]='#EFEFEF';col[8]='#FFFFFF';var colen=col.length;function prores(req)
{var response=getResponseText(req);if(response!=null)
{}
else
{}}
function addsub(id)
{var params=new Object();params.cmd="add";params.cid=id;ajax.get("subscripe.ashx",params,prores);}
function removesub(id)
{var params=new Object();params.cmd="del";params.cid=id;ajax.get("subscripe.ashx",params,prores);}
function addsub2(id,attr,prores)
{var params=new Object();params.cmd="add";params.cid=id;params.attr=attr;ajax.get("subscripe.ashx",params,prores);}
function removesub2(id,prores)
{var params=new Object();params.cmd="del";params.cid=id;ajax.get("subscripe.ashx",params,prores);}
function $(d){return document.getElementById(d);}
function showDetail(d,f,ct,sid){var father=d;var floatdiv=document.getElementById(f);var floatbg=document.getElementById("detail");var classname=father.className;if(classname=="ownChannel"){floatdiv=document.getElementById("detail_choosen");}
var aObj=floatdiv.getElementsByTagName("a")[2];var did=d.id;var cid=did.substr(2,did.length-1);var childs=father.getElementsByTagName("img")[0];var showimg=floatdiv.getElementsByTagName("img")[0];showimg.src=childs.src;showimg.title=childs.title;var t=father.offsetTop;var l=father.offsetLeft;while(father=father.offsetParent){t+=father.offsetTop;l+=father.offsetLeft;}
var ah1Obj=floatdiv.getElementsByTagName("a")[1];var aimgObj=floatdiv.getElementsByTagName("a")[0];var ulObj=floatdiv.getElementsByTagName("ul")[0];var asrc=d.getElementsByTagName("a")[0];var h1src=d.getElementsByTagName("h1")[0];var ulsrc=d.getElementsByTagName("ul")[0];floatdiv.style.visibility="visible";floatbg.style.visibility="visible";aObj.innerHTML=asrc.innerHTML;aObj.href=asrc.href;ah1Obj.innerHTML=h1src.innerHTML;ulObj.innerHTML=ulsrc.innerHTML;ah1Obj.href="channeldetail.aspx?cid="+cid+"&ct="+ct+"&sid="+sid;aimgObj.href="channeldetail.aspx?cid="+cid+"&ct="+ct+"&sid="+sid;floatdiv.style.top=t-1+"px";floatdiv.style.left=l-1+"px";floatbg.style.top=t-1+"px";floatbg.style.left=l-1+"px";}
function phoneDetail(d,f){var n=-1;var father=d;var floatdiv=document.getElementById(f);var floatbg=document.getElementById("detailCh");var scrollH=document.getElementById("choosenCh");var childs=father.getElementsByTagName("img")[0];var showimg=floatdiv.getElementsByTagName("img")[0];showimg.src=childs.src;var floatdiv3A=floatdiv.getElementsByTagName("a")[0];var did=d.id;var cid=did.substr(4,did.length-1);floatdiv3A.href="javascript:drop('detail_channel',"+cid+");";var t=father.offsetTop;var l=father.offsetLeft;while(father=father.offsetParent){t+=father.offsetTop;l+=father.offsetLeft;}
floatdiv.style.visibility="visible";floatbg.style.visibility="visible";floatdiv.style.top=t-22-scrollH.scrollTop+"px";floatdiv.style.left=l-13+"px";floatbg.style.top=t-22-scrollH.scrollTop+"px";floatbg.style.left=l-13+"px";var pp=document.getElementById("choosenCh");var tmpimg=null;var tmph1=d.getElementsByTagName("h1")[0];if(tmph1!=undefined)
{floatdiv.getElementsByTagName("h1")[0].innerHTML=tmph1.innerHTML;}}
function closeF(f,b,e){var e=e||window.event;var obj=document.getElementById(f);var floatbg=document.getElementById(b);if(e.currentTarget){if(e.relatedTarget!=obj){if(obj!=e.relatedTarget.parentNode&&obj!=e.relatedTarget.parentNode.parentNode){obj.style.visibility="hidden";floatbg.style.visibility="hidden";}}}else{if((e.toElement!=null)&&(e.toElement!=obj)){if(obj!=e.toElement.parentNode&&obj!=e.toElement.parentNode.parentNode){obj.style.visibility="hidden";floatbg.style.visibility="hidden";}}}}
function closeD(d){var floatdiv=document.getElementById(d);var floatbg=document.getElementById("detail");if(document.getElementById("detailCh")){floatbg=document.getElementById("detailCh");}
floatdiv.style.visibility="hidden";floatbg.style.visibility="hidden";}
function chget(cid,attr){var div=document.getElementById("divc_"+cid);if(div==null)
{return;}
var spans=div.getElementsByTagName("span");if(spans==null)
{return;}
var spancount=spans[0];if(spancount!=null)
{var cout=0;cout=parseInt(spancount.innerHTML);cout=cout+1;spancount.innerHTML=cout;}
var img1=document.getElementById("divcimg1_"+cid);if(img1!=null)
{img1.alt="退订";img1.src="App_Themes/White/images/cancelsmall.gif";}
var a1=document.getElementById("divca1_"+cid);if(a1!=null)
{a1.innerHTML="退订";a1.href="javascript:drop("+cid+");";}
var a2=document.getElementById("divca2_"+cid);if(a2!=null)
{a2.innerHTML="退订";a2.href="javascript:drop("+cid+");";}
var img2=document.getElementById("divcimg2_"+cid);if(img2!=null)
{img2.alt="退订";img2.src="App_Themes/White/images/cancelsmall.gif";}
addsub2(cid,attr,null);return;}
function drop(cid){var div=document.getElementById("divc_"+cid);if(div==null)
{return;}
var spans=div.getElementsByTagName("span");if(spans==null)
{return;}
var spancount=spans[0];if(spancount!=null)
{var cout=spancount.innerHTML;spancount.innerHTML=cout-1;}
var img1=document.getElementById("divcimg1_"+cid);if(img1!=null)
{img1.alt="订阅";img1.src="App_Themes/White/images/booksmall_icon.gif";}
var a1=document.getElementById("divca1_"+cid);if(a1!=null)
{a1.href="javascript:OnSubchannel("+cid+");";a1.innerHTML="订阅";}
var a2=document.getElementById("divca2_"+cid);if(a2!=null)
{a2.innerHTML="订阅";a2.href="javascript:OnSubchannel("+cid+");";}
var img2=document.getElementById("divcimg2_"+cid);if(img2!=null)
{img2.alt="订阅";img2.src="App_Themes/White/images/booksmall_icon.gif";}
removesub(cid);}
function plus(cid)
{var params=new Object();params.cmd="plus";params.cid=cid;ajax.get("subscripe.ashx",params,function(req){var response=getResponseText(req);if(response!=null&&response=="ok")
{var markobj=document.getElementById("grademark");var mark=parseInt(markobj.value);mark+=1;markobj.value=mark;}
else
{}});}
function minus(cid)
{var params=new Object();params.cmd="minus";params.cid=cid;ajax.get("subscripe.ashx",params,function(req){var response=getResponseText(req);if(response!=null&&response=="ok")
{var markobj=document.getElementById("grademark");var mark=parseInt(markobj.value);mark-=1;markobj.value=mark;}
else
{}});}
function showflashpop()
{colen=col.length;if(document.getElementById("flashpopMask")==undefined)
{var flashpopMask=document.createElement("div");flashpopMask.id="flashpopMask";document.body.appendChild(flashpopMask);}
var flashpopMask=document.getElementById("flashpopMask");if(navigator.userAgent.indexOf("Firefox")>0)
{}
else
{flashpopMask.style.width=document.body.clientWidth>document.body.scrollWidth?document.body.clientWidth:document.body.scrollWidth;flashpopMask.style.height=document.body.clientHeight>document.body.scrollHeight?document.body.clientHeight:document.body.scrollHeight;}
flashpopMask.style.visibility="visible";changebgcolor();flashpopMask.onclick=function()
{flashpopMask.style.visibility="hidden";help('helpId1','helpC1');};}
function changebgcolor()
{var flashpopMask=document.getElementById("flashpopMask");if(colen>=0){colen--;flashpopMask.style.backgroundColor=col[colen];setTimeout('changebgcolor()',80);}}
function selectTag(showContent,selfObj,title){var tag=document.getElementById(title).getElementsByTagName("li");var taglength=tag.length;for(i=0;i<taglength;i++){tag[i].className="";}
selfObj.parentNode.className="selectTag";for(i=0;j=document.getElementById("tagContent"+i);i++){j.style.display="none";}
document.getElementById(showContent).style.display="block";document.cookie='seltag='+escape(selfObj.id)+";";document.cookie=' tagname='+escape(showContent)+";";}
function myselectTag(showContent,selfObj,title){var tag=document.getElementById(title).getElementsByTagName("li");var taglength=tag.length;for(i=0;i<taglength;i++){tag[i].className="";tag[i].getElementsByTagName("a")[0].className="noselect";}
selfObj.parentNode.className="selectTag";selfObj.className="select";for(i=0;j=document.getElementById("tagContent"+i);i++){j.style.display="none";}
document.getElementById(showContent).style.display="block";document.cookie='seltag='+escape(selfObj.id)+";";document.cookie=' tagname='+escape(showContent)+";";}
function pichover(td){var obj=td.parentNode;obj.style.background="url(App_Themes/white/images/imgbghover.gif) left top no-repeat";obj.style.position="relative";}
function picclick(td,divname,inputname){var obj=td.parentNode;obj.style.background="url(App_Themes/white/images/imgbghover.gif) left top no-repeat";obj.style.position="relative";obj.style.top=2+"px";var o=document.getElementById(divname);var imgobj=o.getElementsByTagName("img")[0];var re=/<img(?:\s+\w+=[^\s>]+)*\s+src=([^\s>]*)/gim;re.exec(obj.getElementsByTagName("img")[0].parentNode.innerHTML);imgobj.src=obj.getElementsByTagName("img")[0].src;var input1=document.getElementById(inputname);input1.value=(RegExp.$1).replace(/["']/g,"");closepics('pics','chooseIcon');}
function picclick2(td,divname,inputname){var obj=td.parentNode;obj.style.position="relative";obj.style.top=2+"px";var o=document.getElementById(divname);var imgobj=o.getElementsByTagName("img")[0];var re=/<img(?:\s+\w+=[^\s>]+)*\s+src=([^\s>]*)/gim;re.exec(obj.getElementsByTagName("img")[0].parentNode.innerHTML);imgobj.src=obj.getElementsByTagName("img")[0].src;var input1=document.getElementById(inputname);input1.value=(RegExp.$1).replace(/["']/g,"");closepics('pics','chooseIcon1');}
function pic(td){var obj=td.parentNode;obj.style.background="url(App_Themes/white/images/imgbg.gif) 2px 2px no-repeat";obj.style.position="relative";obj.style.top=0+"px";}
function choosepic(d,f,evt){var father=d;var floatdiv=document.getElementById(f);var browser=navigator.appName;var b_version=navigator.appVersion;var version=b_version.split(";");var trim_Version=version[1].replace(/[ ]/g,"");if(floatdiv.style.display=="none"){father.style.background="url(App_Themes/white/images/picchooseIcon2.gif) left top no-repeat";var t=father.offsetTop;var l=father.offsetLeft;while(father=father.offsetParent){t+=father.offsetTop;l+=father.offsetLeft;}
floatdiv.style.display="block";floatdiv.style.top=(t-20)+"px";floatdiv.style.left=(l-100)+"px";if(browser=="Microsoft Internet Explorer"&&trim_Version=="MSIE7.0")
floatdiv.style.top=t+55+"px";}
else if(floatdiv.style.display==""||floatdiv.style.display=="block"){father.style.background="url(App_Themes/white/images/picchooseIcon.gif) left top no-repeat";floatdiv.style.display="none";}
var e=(evt)?evt:window.event;if(window.event){e.cancelBubble=true;}else{e.stopPropagation();}}
function closepics(f,d)
{try{var floatdiv=document.getElementById(f);var father=document.getElementById(d);floatdiv.style.display="none";father.style.background="url(App_Themes/white/images/picchooseIcon.gif) left top no-repeat";father.title='';}
catch(err){}}
function switchTag(tag,content,phoneid)
{var t=document.getElementById("downTitle");var lis=t.getElementsByTagName("li");for(i=1;i<=lis.length;i++)
{if("tag"+i==tag)
{document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="selectspan"+i;}else{document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="";}
if("content"+i==content)
{document.getElementById(content).className="";}else{document.getElementById("content"+i).className="hidecontent";}
document.getElementById("downcon").className=content;}
if(content=="content1")
{document.getElementById(phoneid).focus();}else{document.getElementById(phoneid).blur();}}
function hoverphone(o){var obj=o;o.style.border="1px #d39500 solid"
o.getElementsByTagName("h4")[0].className="hoverphone";}
function outphone(o){o.style.border="1px #dadada solid"
o.getElementsByTagName("h4")[0].className="hasphone";}
function myselect(tagid){var tags=document.getElementById("infotag").getElementsByTagName("li");var id=parseInt(tagid);for(var i=1;i<id;i++){document.getElementById("myinfotag"+i).className="nonowtag2";document.getElementById("tagleft"+i).className="tagotherleft12";document.getElementById("tagcenter"+i).className="tagothercenter2";document.getElementById("tagright"+i).className="tagotherright2";}
document.getElementById("tagleft1").className="tagotherfirstleft2";for(var j=id+1;j<=tags.length;j++){document.getElementById("myinfotag"+j).className="nonowtag2";document.getElementById("tagleft"+j).className="tagotherleft2";document.getElementById("tagcenter"+j).className="tagothercenter2";document.getElementById("tagright"+j).className="tagotherright2";}
document.getElementById("tagright"+tags.length).className="tagotherlastright2";if(id==tags.length){document.getElementById("myinfotag"+id).className="nowtag2";document.getElementById("tagleft"+id).className="tagnowleft2";document.getElementById("tagcenter"+id).className="tagnowcenter2";document.getElementById("tagright"+id).className="tagnowlastright2";}
else{document.getElementById("myinfotag"+id).className="nowtag2";document.getElementById("tagleft"+id).className="tagnowleft2";document.getElementById("tagcenter"+id).className="tagnowcenter2";document.getElementById("tagright"+id).className="tagnowright2";}
document.cookie='seltag='+escape(tagid)+";";}
function articles(tagid){var tags=document.getElementById("infotag").getElementsByTagName("li");var id=parseInt(tagid);for(var i=1;i<id;i++){document.getElementById("myinfotag"+i).className="notnowart";document.getElementById("tagleft"+i).className="artotherright";document.getElementById("tagcenter"+i).className="artothercenter";document.getElementById("tagright"+i).className="artotherleft";}
document.getElementById("tagleft1").className="artotherfirstleft";for(var j=id+1;j<=tags.length;j++){document.getElementById("myinfotag"+j).className="notnowart";document.getElementById("tagleft"+j).className="artotherleft";document.getElementById("tagcenter"+j).className="artothercenter";document.getElementById("tagright"+j).className="artotherright";}
document.getElementById("tagright"+tags.length).className="artotherlastright";if(id==tags.length){document.getElementById("myinfotag"+id).className="nowtag";document.getElementById("tagleft"+id).className="artnowleft";document.getElementById("tagcenter"+id).className="artnowcenter";document.getElementById("tagright"+id).className="artnowlastright";}
else{document.getElementById("myinfotag"+id).className="nowtag";document.getElementById("tagleft"+id).className="artnowleft";document.getElementById("tagcenter"+id).className="artnowcenter";document.getElementById("tagright"+id).className="artnowright";}
for(var n=1;n<=tags.length;n++){document.getElementById("article"+n).style.display="none";document.getElementById("icon"+n).style.display="none";}
document.getElementById("article"+tagid).style.display="block";document.getElementById("icon"+tagid).style.display="block";if(browser=="Microsoft Internet Explorer"&&trim_Version=="MSIE6.0")
{document.getElementById("icon"+tagid).style.marginRight="4px";}}
function LimitLen(id,len)
{var txt=document.getElementById(id);if(txt.value.length>len)
{txt.blur();txt.value=txt.value.substring(0,len);txt.focus();ShowHtmlMsg('您输入的字数超过了'+len+'字！','',true,false,null,null,null);}}
function closeMsg()
{document.getElementById("sendpopid").style.display="none";document.getElementById("msgcontent").innerHTML="";document.getElementById("msgcontent").value="";document.getElementById("msgRemCount").innerHTML="200";}
function hidechopic(obj)
{if(document.getElementById(obj)!=null&&document.getElementById(obj)!=undefined)
{closepics('pics','chooseIcon');}}
function viewGhost(userid)
{window.open('selfviewallchannel.aspx?userid='+userid);}
function viewHotArticle(userid)
{window.open('selfviewallpopart.aspx?userid='+userid);}
function DrawImage(ImgD,FitWidth,FitHeight){var image=new Image();image.src=ImgD.src;if(image.width>0&&image.height>0){if(image.width/image.height>=FitWidth/FitHeight){if(image.width>FitWidth){ImgD.width=FitWidth;ImgD.height=(image.height*FitWidth)/image.width;}else{ImgD.width=image.width;ImgD.height=image.height;}}else{if(image.height>FitHeight){ImgD.height=FitHeight;ImgD.width=(image.width*FitHeight)/image.height;}else{ImgD.width=image.width;ImgD.height=image.height;}}}}
function showflash()
{if(document.getElementsByTagName("object")){var obj=document.getElementsByTagName("object");for(var i=0;i<obj.length;i++){if(obj[i].style.visibility=="hidden")
{obj[i].style.visibility="visible";}}}
else{}}
function hideflash()
{if(document.getElementsByTagName("object")){var obj=document.getElementsByTagName("object");for(var i=0;i<obj.length;i++){obj[i].style.visibility="hidden";}}
else{}}
function lastname(obj,filetype){var filepath=document.getElementById(obj).value;var re=/(\\+)/g;var filename=filepath.replace(re,"#");var one=filename.split("#");var two=one[one.length-1];var three=two.split(".");var last=three[three.length-1];var rs=filetype.indexOf(last.toUpperCase());if(rs>=0){return true;}else{alert("您选择的上传文件\""+two+"\"不是有效的图片文件！");location.href=location.href;}}
function checkemals(addrs)
{var tmpaddrs=addrs.split(',');var len=tmpaddrs.length;var bok='0';for(i=0;i<len;++i)
{if(tmpaddrs[i].length>4&&tmpaddrs[i].indexOf('@')>0&&tmpaddrs[i].indexOf('.')>0)
{bok='1';}
else if(tmpaddrs[i].length!=0)
{bok='0';break;}}
if(bok=='1')
{return true;}
else
{return false;}}
function HanderMyFriend(uid,itype,iReload,Msg)
{var cmd=itype==1?'del':'add';jQuery.ajax({type:'GET',url:'hdgetfriends.ashx',data:{"cmd":cmd,"uid":uid},success:function(resout){var userJson=jQuery.json.decode(resout);if(userJson)
{ShowHtmlMsg(userJson.msg,'',true,false,null,null,null);}},error:function(err){ShowHtmlMsg(err,'',true,false,null,null,null);}});}
String.prototype.Trim=function()
{return this.replace(/(^\s*)|(\s*$)/g,"");}
String.prototype.LTrim=function()
{return this.replace(/(^\s*)/g,"");}
String.prototype.RTrim=function()
{return this.replace(/(\s*$)/g,"");}