//var kk ={"n","n","n","n","n","n","n","n","n","n"}; ;//created by Ricky Yang In Phoenixtv co. //2006-9-2//创建xmlhttprequest对象function createXMLHttpRequest() {	var xmlHttp=null;    if (window.ActiveXObject)     {        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");    }     else if (window.XMLHttpRequest)     {        xmlHttp = new XMLHttpRequest();    }    return xmlHttp;}//和服务端通讯function startRequest(url,func){    var xmlHttp = createXMLHttpRequest();	xmlHttp.onreadystatechange = function(){		if(xmlHttp.readyState == 4)     	{       		 if(xmlHttp.status == 200)         		{    				if(func)    				{       					func(xmlHttp,url);    				}       			}   		 }   	};    xmlHttp.open("GET",url,true);	xmlHttp.send(null);	}//和服务端通讯function startRequests(url,func,nums,k){    var xmlHttp = createXMLHttpRequest();    xmlHttp.onreadystatechange = function(){    	if(xmlHttp.readyState == 4)     	{       		 if(xmlHttp.status == 200)        		{    				if(func)    				{    											if(k >= 0)    				    {    				        func(xmlHttp,nums,url,k);	    				    } 						else						{							func(xmlHttp,nums,url);						}     				}    				      			    			}   		 }   	};    xmlHttp.open("GET",url,true);    xmlHttp.send(null);}//总体定制退订入口function doit(url1,url2,string){    if(url1=='aa')   {      document.getElementById("info").innerHTML='';      alert("您已经取消订阅");       }      else   	  alert("您已经订阅该栏目！");        startRequest(url1,parseResults);	     url2+='&cache='+new Date().getTime();   //alert(url2);   startRequest(url2,ads); } function ads(){   //alert("it is first!");}//这部分为了动态增加用户定制种子function another(xmlHttp,nums,url,k) {	document.getElementById("info").innerHTML='';    var results = xmlHttp.responseXML;    var title = null;    var item = null;    var link = null;    var author = null;    var pubDate = null;    var desc = null;    var channel = results.getElementsByTagName("channel");    for(var i = 0; i < channel.length; i++)     {      item = channel[i];      title = item.getElementsByTagName("title")[0].firstChild.nodeValue;      link = item.getElementsByTagName("link")[0].firstChild.nodeValue;      des = item.getElementsByTagName("description")[0].firstChild.nodeValue;      //document.getElementById("info").innerHTML+='<table  border="0" align="left" cellpadding="0" cellspacing="0" style="color:#ff0000;font-size:12px;"><tr><td ><div align="center" style="padding:2px 0 0 0;height:14px;color:#fff;font-weight:bold;background:#ff0000;">'+title+'</div></td></tr></table>  ';	  if (document.getElementById(title))	  {		  document.getElementById("info").innerHTML+= '<table  border="0" align="left" cellpadding="0" cellspacing="0" style="color:#ff0000;font-size:12px;"><tr><td ><div align="center" style="padding:2px 0 0 0;height:14px;color:#fff;font-weight:bold;background:#ff0000;">'+document.getElementById(title).name+'</div></td></tr></table>&nbsp;&nbsp;<font style="color:#ff0000;font-size:12px;">' + document.getElementById(title).value + '</font>';	  }    }    var items = results.getElementsByTagName("item");	if (items.length>0)	{	var len = null    if(nums)        len = nums;    else        len = items.length;    for(var i = 0; i < len; i++) {        item = items[i];        title = item.getElementsByTagName("title")[0].firstChild.nodeValue;		if (title.length>20)		{			title = title.substring(0, 18) + '...';		}		link = item.getElementsByTagName("link")[0].firstChild.nodeValue;        author = item.getElementsByTagName("author")[0].firstChild.nodeValue;        pubDate = item.getElementsByTagName("pubDate")[0].firstChild.nodeValue;        //pubDate = pubDate.substring(0,16);//+'?'+pubDate.substring(16,25); 		if(item.getElementsByTagName("description")[0].firstChild!=null)		desc = item.getElementsByTagName("description")[0].firstChild.nodeValue;		        if(desc)        {                       if(document.getElementById('links').innerText.indexOf(link) > -1)               { 	                                 	    document.getElementById("info").innerHTML+='<li><td height="25" ><img src="images/rss/aniu03.gif" width="9" height="9" /><a href=\''+link+'\' onclick="saveLink(\'' + link + '\');startRequests(\''+url+'\',another,'+nums+','+i+');" target="_blank">'+title+'</a>     '+pubDate+'   '+author+'  <br><div style="font-size:12px;">'+desc+'</div><div style="font-size:12px;"><a href=\''+link+'\' onclick="saveLink(\'' + link + '\');startRequests(\''+url+'\',another,'+nums+','+i+');" target="_blank">阅读全文</a></div></td></li>';                          }  else {			       document.getElementById("info").innerHTML+='<li><td height="25" ><img src="images/rss/aniu02.gif" width="9" height="9" /><a href=\''+link+'\' onclick="saveLink(\'' + link + '\');startRequests(\''+url+'\',another,'+nums+','+i+');" target="_blank">'+title+'</a>    '+pubDate+'    '+author+'  <br><div style="font-size:12px;">'+desc+'</div><div style="font-size:12px;"><a href=\''+link+'\' onclick="saveLink(\'' + link + '\');startRequests(\''+url+'\',another,'+nums+','+i+');" target="_blank">阅读全文</a></div></td></li>'; 			   }		}		               else           document.getElementById("info").innerHTML+='<li><td height="25" ><img src="images/rss/aniu02.gif" width="9" height="9" /><a href=\''+link+'\' onclick="saveLink(\'' + link + '\');startRequests(\''+url+'\',another,'+nums+','+i+');" target="_blank">'+title+'</a>    ' + pubDate + '    '+author + '</td></li>';             }	}    }  //这部分是为了显示动态的新闻内容function parseResults(xmlHttp,url) {    var item = null;    var title = null;    var link = null;    var des = null;    var results = xmlHttp.responseXML;    var channel = results.getElementsByTagName("channel");    for(var i = 0; i < channel.length; i++)     {      item = channel[i];      title = item.getElementsByTagName("title")[0].firstChild.nodeValue;	  if (title.length > 10)	  {		   title = title.substring(0,9)+'...';	  }      link = item.getElementsByTagName("link")[0].firstChild.nodeValue;      des = item.getElementsByTagName("description")[0].firstChild.nodeValue;       //var s = link.lastIndexOf("/");       //var str = 'http://localhost:8080/phoenixtvrss/xml/kk.xml';      //+link.substring(s);       //alert(str);             document.getElementById("resultsTitle").innerHTML+='<table><tr><td width="55%"><a href="#" onclick="startRequests(\''+url+'\',another);" onMouseOver="startRequests(\''+url+'\',another,2)">'+document.getElementById(title).name+'</a></td><td><img src="images/rss/aniu06.gif" width="34" height="20" onclick="up(this.parentNode.parentNode.parentNode)"/><img src="images/rss/aniu07.gif" width="34" height="20" onclick="dw(this.parentNode.parentNode.parentNode);"/><!--  <a href="#" onclick="startRequests(\''+url+'\',another);">更多</a>--></td></tr></table>';     }  }function getFocus(){}//删除节点function del(obj){	var _node=obj.parentNode;	checkUserRssList(_node);	if(_node.parentNode != null)		_node.parentNode.removeChild(_node);}//把该节点往上移动function up(obj){	var _node=obj.parentNode;	var _lastNode=_node.previousSibling;	if(_lastNode){		appendBefore(_lastNode,_node);	}else{ 	} }//把该节点往下移动function dw(obj){	var _node=obj.parentNode;	var _nextNode=_node.nextSibling;	if(_nextNode){		appendAfter(_nextNode,_node);	}   else   	{   		}}//在前面加一个节点function appendBefore(node, newNode){	if (node.parentNode){ 		node.parentNode.insertBefore(newNode,node); 	}}//在后面追加一个节点function appendAfter(node, newNode) { 	if (node.parentNode)	{  		if (node.nextSibling) 			node.parentNode.insertBefore(newNode, node.nextSibling);		else 			node.parentNode.appendChild(newNode);	}}function saveLink(linkAddress) {     document.getElementById("links").innerText+=linkAddress;}function hide(elementId) {	document.getElementById(elementId).style.display = 'none';}function show(elementId) {	document.getElementById(elementId).style.display = 'block';}		var myAppInfo;	//定义用户登录凭证		 var SSOUrl = "http://space.ifeng.com/rss/ajaxProxyServer.do";	//代理地址		 var drawLogin = "";	  function getLoginInfo() {	  	var url = 'http://space.ifeng.com/rss/userDetailQuery.do?t='+new Date().getTime();	  	var oJS = document.getElementById('loginjs');	  	if (oJS!=null && oJS.tagName.toLowerCase()=="script") {         				document.getElementsByTagName("head").item(0).removeChild(oJS);			}	  	oJS = document.createElement('script');			oJS.setAttribute("type","text/javascript");			oJS.setAttribute("src",url);			oJS.setAttribute("id",'loginjs');			document.getElementsByTagName("head").item(0).appendChild(oJS);	  }	  	  window.onload = drawLoginApp;	   //根据状态用户凭证判断用户登录状态	  	function drawLoginApp() {	  	var content = '';	  	var oLogin = document.getElementById('slogin');	  	content += '<table width="100%" border="0" cellpadding="7" cellspacing="0" class="bian">\					        <tr>\					          <td valign="top" bgcolor="FBFBFB">\							  <form id="login" name="login" method="post" action="">\							  	<input type="hidden" name="actionid" value="0"/>\					            <input type="hidden" name="smethod" value="0"/>\								<div id="loginMsg"></div>\					            <table width="100%" border="0" cellspacing="4" cellpadding="0" style="font-size:12px;color:#686868;font-weight:bold;">\					              <tr>\					                <td width="23%">\					                        <div align="center"><img src="images/rss/aniu08.gif" width="39" height="29" /></div>\					                      </td>\					                <td width="25%">用户名：</td>\					                <td width="52%"><input type="text" name="username" size="17"/></td>\					              </tr>\					              <tr>\					                <td>\					                        <div align="center"><img src="images/rss/aniu09.gif" width="39" height="29" /></div>\					                      </td>\					                <td>密　码：</td>\					                <td><input type="password" name="password" size="18"/></td>\					              </tr>\					              <tr>\					                <td colspan="2">忘记密码</td>\					                <td>\					                        <div align="center"><input type="image" src="images/rss/aniu10.gif" onclick="return sCheckLogin();"/>\											<a href="http://sso.ifeng.com/usr/register.jsp?backurl=http://space.ifeng.com/rss/"><img src="images/rss/aniu11.gif" width="50" height="20" border="0"></a></div>\					                      </td>\					              </tr>\					            </table>\					                    </form>\					          </td>\					        </tr>\					      </table>';		//判断是否处于登录状态	  	if(myAppInfo) {	  	//用户已登录	  		if(myAppInfo.isRegister) {	  			loginInit();	  			content ='<form id="login" name="login">'					+ '<table width="100%" border="0" cellpadding="7" cellspacing="0" class="bian">'					+ '<tr>'					+ '<td valign="top" bgcolor="FBFBFB">'					+ '<table width="100%" border="0" cellspacing="4" cellpadding="0" style="font-size:12px;color:#686868;">'					+ '<tr>'					+'<td colspan="3"><div id="sloingoutMsg" align="center"><img src="images/rss/aniu12.gif" width="16" height="16" /> '+myAppInfo.userName+'登陆成功！</div></td>'					+ '</tr>'					+'<tr>'					+'<td><div align="center"><img src="images/rss/aniu09.gif" width="39" height="29" /></div></td>'					+'<td colspan="2"><a href="http://sso.ifeng.com/usr/modify.jsp" target="_blank"><img src="images/rss/aniu15.gif" width="66" height="17" border="0"/></a></td>'					+'</tr>'					+'<tr>'					+'<td>&nbsp;</td>'					+'<td align="right"><a href="http://mall.ifeng.com/phoenixtv_order.jsp?userid='+myAppInfo.userName+'&ccode='+myAppInfo.userDigest+'"><img src="images/rss/aniu16.gif"/ style="border:0px"></a></td>'					+'<td><div align="center">'					+'<input type="hidden" name="username" value="'+myAppInfo.sid+'"/>'					+'<input type="hidden" name="ip" value="'+myAppInfo.ip+'"/>'					+'<input type="hidden" name="backurl" value="http://space.ifeng.com/rss/loginoutsuccess.htm"/>'					+'<input type="hidden" name="actionid" value="1"/>'					+'<img src="images/rss/aniu13.gif" width="15" height="9" />'					+'<a href="#" onclick="javascript:SSOloginout();">退出</a>'					+'</div></td>'					+'</tr>'					+'</table>'					+'</td>'					+'</tr>'					+'</table>'					+'</form>';			}	  	}	  	subscribBoxTitle(myAppInfo);	  	oLogin.innerHTML = content;	  }	  	  //获取用户凭证	  function loadUserDetail() {	  	var url = 'http://space.ifeng.com/rss/userDetailQuery.do?t='+new Date().getTime();	  	var ajaxRequest = new Ajax.Request(			url,			{			asynchronous:false,			method:'get',			onComplete:evalUserDetail			});	  }	  	  //获取用户凭证回调函数	  function evalUserDetail(xmlHttpRequest) {	  	if(xmlHttpRequest.status == 200) {	  		var _script = xmlHttpRequest.responseText;	  		try {	  			//alert(_script);	  			eval(_script);	  		} catch (e) {}	  		document.getElementById('subscribeList').innerHTML = myAppInfo.userName + '每天爱看的内容';	  	}	  }  //用户登录	  		function SSOlogin() {				var loginPars = Form.serialize($('login'));				loginPars = decodeURIComponent(loginPars);				var ajaxUpdate = new Ajax.Request(					SSOUrl,					{					method:'post',					parameters:loginPars,					onLoading:showLoging,					onComplete:showLoginSucess					});			}//用户注销						function SSOloginout() {				var loginPars = Form.serialize($('login'));				loginPars = decodeURIComponent(loginPars);				var ajaxUpdate = new Ajax.Request(					SSOUrl,					{					method:'post',					parameters:loginPars,					onComplete:showLoginoutSucess					});			}						function showLoging(xmlHttpRequest) {				$('loginMsg').innerHTML = '登录中...';			}			//用户登录回调函数						function showLoginSucess(xmlHttpRequest) {				var loginMsgObj = $('loginMsg');				var sLoginObj = $('slogin');				var loginFlag;				var loginSucessCnxt = '';				var respText = xmlHttpRequest.responseText;				var rRegx = /\d{1}/g;				loginFlag = respText.match(rRegx);				if(SSOLoginVerify(loginFlag)) {					loginInit();					subscribBoxTitle(myAppInfo);					loginSucessCnxt = '<form id="login" name="login">'					+ '<table width="100%" border="0" cellpadding="7" cellspacing="0" class="bian">'					+ '<tr>'					+ '<td valign="top" bgcolor="FBFBFB">'					+ '<table width="100%" border="0" cellspacing="4" cellpadding="0" style="font-size:12px;color:#686868;">'					+ '<tr>'					+'<td colspan="3"><div id="sloingoutMsg" align="center"><img src="images/rss/aniu12.gif" width="16" height="16" /> '+myAppInfo.userName+'登陆成功！</div></td>'					+ '</tr>'					+'<tr>'					+'<td><div align="center"><img src="images/rss/aniu09.gif" width="39" height="29" /></div></td>'					+'<td colspan="2"><a href="http://sso.ifeng.com/usr/modify.jsp" target="_blank"><img src="images/rss/aniu15.gif" width="66" height="17" border="0"/></a></td>'					+'</tr>'					+'<tr>'					+'<td>&nbsp;</td>'					+'<td align="right"><a href="http://mall.ifeng.com/phoenixtv_order.jsp?userid='+myAppInfo.userName+'&ccode='+myAppInfo.userDigest+'"><img src="images/rss/aniu16.gif"/ style="border:0px"></a></td>'					+'<td><div align="center">'					+'<input type="hidden" name="username" value="'+myAppInfo.sid+'"/>'					+'<input type="hidden" name="ip" value="'+myAppInfo.ip+'"/>'					+'<input type="hidden" name="backurl" value="http://space.ifeng.com/rss/loginoutsuccess.htm"/>'					+'<input type="hidden" name="actionid" value="1"/>'					+'<img src="images/rss/aniu13.gif" width="15" height="9" />'					+'<a href="#" onclick="javascript:SSOloginout();">退出</a>'					+'</div></td>'					+'</tr>'					+'</table>'					+'</td>'					+'</tr>'					+'</table>'					+'</form>';					loginMsgObj.innerHTML = "";					drawLogin = sLoginObj.innerHTML;					sLoginObj.update(loginSucessCnxt);				} else {					loginMsgObj.innerHTML ='登陆失败，请确认用户名密码！';				}			}//用户注销回调函数							function showLoginoutSucess(xmlHttpRequest) {				var sLoginObj = $('slogin');				var respText = xmlHttpRequest.responseText;				if(respText.indexOf('success') != -1) {					sLoginObj.update(drawLogin);					loginoutDestory();				} else {					alert('服务器异常,请重试');				}			}//SSO接口认证			function SSOLoginVerify (validateFlag) {				//认证成功				if(validateFlag == 0)					return true;				//认证失败				else if(validateFlag == 1)					return false;				return false;			}	  	  		function imgSwitch(oImg,oDiv) {				var imgObj=$(oImg);				if (imgObj.src.indexOf("comment_ico4.gif") >= 0) {					imgObj.src = "images/comment/comment_ico5.gif";					hide(oDiv);				} else {					imgObj.src = "images/comment/comment_ico4.gif";					show(oDiv);				}				return false;			}						function sCheckLogin() {				var name = document.login.username;				var passwd = document.login.password;				if (name.value == "") {					alert("请输入用户名！");					name.focus();					return false;				}				if (passwd.value == "") {					alert("请输入密码！");					passwd.focus();					return false;				}				SSOlogin();				return false;			}									//用户登录时初始化右侧RSS列表导航栏			function drawLoginRssList() {				var newsRank = document.getElementById('newsRank');				var newsRankDiv = document.getElementById('newsRankDiv');				var newsRankYL = document.getElementById('newsRankYL');				var newsRankYLDiv = document.getElementById('newsRankYLDiv');				newsRank.setAttribute('src','images/comment/comment_ico5.gif');				newsRankYL.setAttribute('src','images/comment/comment_ico5.gif');				newsRankDiv.style.display = 'none';				newsRankYLDiv.style.display = 'none';			}						//用户注销时初始化右侧RSS列表导航栏			function drawLoginoutRssList() {				var newsRank = document.getElementById('newsRank');				var newsRankDiv = document.getElementById('newsRankDiv');				var newsRankYL = document.getElementById('newsRankYL');				var newsRankYLDiv = document.getElementById('newsRankYLDiv');				newsRank.setAttribute('src','images/comment/comment_ico4.gif');				newsRankYL.setAttribute('src','images/comment/comment_ico4.gif');				newsRankDiv.style.display = 'block';				newsRankYLDiv.style.display = 'block';			}						function subscribBoxTitle(userDetail) {				var _subscribeList = document.getElementById('subscribeList');				_subscribeList.innerHTML = '每天爱看的内容';				if(userDetail && userDetail.isRegister) {					_subscribeList.innerHTML = userDetail.userName+'每天爱看的内容';				}			}						//用户订阅			function RSSsubscribe(fid) {				var subscribeUrl = "http://space.ifeng.com/rss/subscribeFeed.do?method=subscribe&uid="+encodeURIComponent(myAppInfo.userName)+"&fid="+fid+"&t="+new Date().getTime();				if(!myAppInfo.isRegister) {					alert('请先登录');				} else {					var ajaxUpdate = new Ajax.Request(						subscribeUrl,						{						asynchronous:false,						method:'get',						onComplete:addUserFeed						});				}			}			//用户订阅回调函数			function addUserFeed(xmlHttpRequest) {				var _text = xmlHttpRequest.responseText;				if(_text.indexOf('success') != -1) {					alert('您已成功订阅');					loadUserRssList();	//重获取订阅列表				} else {					alert('您已订阅过该栏目');				}			}						//获取用户订阅列表			function loadUserRssList() {				var loadUserRssListUrl = "http://space.ifeng.com/rss/userRssList.do?method=unsubscribe&uid="+encodeURIComponent(myAppInfo.userName)+"&t="+new Date().getTime();				var ajaxUpdate = new Ajax.Request(						loadUserRssListUrl,						{						asynchronous:false,						method:'get',						onComplete:drawUserRssList						});			}						//用户退订			function RssUnubscribe(fid) {				var subscribeUrl = "http://space.ifeng.com/rss/subscribeFeed.do?method=unsubscribe&uid="+encodeURIComponent(myAppInfo.userName)+"&fid="+fid+"&t="+new Date().getTime();				if(!myAppInfo.isRegister) {					alert('请先登录');				} else {					var ajaxUpdate = new Ajax.Request(						subscribeUrl,						{						asynchronous:false,						method:'get',						onComplete:removeUserFeed						});				}			}			//用户退订回调函数			function removeUserFeed(xmlHttpRequest) {				var _text = xmlHttpRequest.responseText;				if(_text.indexOf('success') != -1) {//					alert('退订成功');				}			}						//用户订阅列表回调函数			function drawUserRssList(xmlHttpRequest) {				var rssSubList = document.getElementById('rssSubList');				var userFeeds = xmlHttpRequest.responseText;				eval(userFeeds);				var userRssBox = '';				if(userRssList.length == 0) {					userRssBox += '<table width="100%" border="0" align="center" cellpadding="7" cellspacing="0">';					userRssBox += '<tr>';					userRssBox += '<td height="25" style="color:#1A89D8;font-weight:bold;">目前没有您订阅的栏目!</td>';					userRssBox += '</tr>';					userRssBox += '</table>';				}				for(var i = 0; i < userRssList.length; i++) {					userRssBox += '<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="font-size:12px;">';					userRssBox += '<tr>';					userRssBox += '<td width="32%"  style="height:14px;padding:3px 0 0 0;">';					userRssBox += '<a href="#" onclick="startRequests(\''+userRssList[i][2]+'\',another);" onMouseOver="startRequests(\''+userRssList[i][2]+'\',another,2);">'+userRssList[i][1]+'</a>';					userRssBox += '</td>';					userRssBox += '<td width="68%" align="center" style="padding:4px 0 0 0">';					userRssBox += '<input type="image" src="images/rss/aniu05.gif" width="43" height="20" onclick="javascript:RssUnubscribe('+userRssList[i][0]+'),del(this.parentNode.parentNode.parentNode);"/><img src="images/rss/aniu06.gif" width="34" height="20" onclick="up(this.parentNode.parentNode.parentNode)"/><img src="images/rss/aniu07.gif" width="34" height="20" onclick="dw(this.parentNode.parentNode.parentNode);"/>';					userRssBox += '</td>';					userRssBox += '</tr>';					userRssBox += '</table>';				}				rssSubList.innerHTML = userRssBox;			}						function checkUserRssList(feedNode) {				var rssSubList = document.getElementById('rssSubList');				var feedNodeRoot = feedNode.parentNode;				var userRssBox = '';				if(feedNodeRoot.childNodes.length == 1) {					userRssBox += '<table width="100%" border="0" align="center" cellpadding="7" cellspacing="0">';					userRssBox += '<tr>';					userRssBox += '<td height="25" style="color:#1A89D8;font-weight:bold;">目前没有您订阅的栏目!</td>';					userRssBox += '</tr>';					userRssBox += '</table>';					rssSubList.innerHTML = userRssBox;				}			}						function initNewsList() {				var _newsList = document.getElementById('newsList');				if(myAppInfo.isRegister) {									}							}						//销毁用户订阅列表			function clearUserRssList() {				var rssSubList = document.getElementById('rssSubList');				rssSubList.innerHTML = '';			}						//销毁RSS标题列表			function clearTitleList() {				var titleList = document.getElementById('info');				titleList.innerHTML = '';			}			//销毁用户凭证			function destoryUserDetail() {				if(myAppInfo) {					myAppInfo.destory();;				}			}						//注销时销毁函数			function loginoutDestory() {				destoryUserDetail();				drawLoginApp();				drawLoginoutRssList();				clearUserRssList();				clearTitleList();				subscribBoxTitle();			}						//登录时初始化函数			function loginInit() {				loadUserDetail();				loadUserRssList();				drawLoginRssList();			}