<!--[4,64,69] published at 2011-04-30 18:30:51 from #202 by 209-->
document.domain = "chinanews.com";

var moodurl='http://mood.chinanews.com.cn/';
var moodpath='data';
var toppath='top';
var sortpath="rank";
var moodlength=8;
window.onload=function(){

	$('#moodiframe',top.document).attr('height','103');	
	var aid=$('#newsid',top.document).val();
	oninit(aid);
}
function oninit(newsid){

	var e=1;
	var strCookie=document.cookie;
	var newstime=$('#newstime',top.document).val();
	var pubtime=$('#pubtime',top.document).val();
	var pid=$('#pid',top.document).val();
	var tid=$('#tid',top.document).val();
	var pix="";
	if($('#pid',top.document).length>0){
		pix=pid+"-"+tid+"-";
	}

	var dd=newstime.split('-');
	var arrCookie=strCookie.split(";");

	for(var i=0;i<arrCookie.length;i++){
		var ac=$.trim(arrCookie[i]);
	    if(ac.indexOf(newsid+'=')!=-1){
	    	e=2;
	    	var newac=ac.replace(newsid+'=','');
	    	if(newac.indexOf('tem')!=-1){
	    		var moods=newac.split('%23');
	    		var moodnum=moods[1];
	    		$('#moodiframe',top.document).attr('height','415');
	    		window.location.href=moodurl+moodpath+"/"+dd[0]+"/"+dd[1]+"/"+dd[2]+"/"+newsid+".shtml#"+moodnum;
	    		break;
	    	}
	   }
	}
	if(e==1){
		$('#feeltext').html('\u60a8\u770b\u5b8c\u8fd9\u7bc7\u6587\u7ae0\u6709\u4f55\u611f\u89c9\uff1f');	
	}
}

function onsub(mood){
	var newstype=$('#newstype',top.document).val();
	var pubtime=$('#pubtime',top.document).val();
	var aid=$('#newsid',top.document).val();
	var newstitle=$('#newstitle',top.document).val();
	var newstime=$('#newstime',top.document).val();
	var newsurl=$('#newsurl',top.document).val();
	var url="/newsHeart/newscount";
	var pid=$('#pid',top.document).val();
	var tid=$('#tid',top.document).val();
	var pix="";
	if($('#pubtime',top.document).length<1){
		pubtime=newstime+" 00:00:01";
	}
	if($('#pid',top.document).length>0){
		pix=pid+"-"+tid+"-";
	}
	var cookiemood=mood;
	var zs="aid="+aid+"&tid="+tid+"&mood="+mood+"&pubtime="+pubtime+"&newstype="+newstype+"&newstime="+newstime+"&newsurl="+newsurl+"&newstitle="+encodeURIComponent(newstitle)+"&ajaxsubmittime0_=" + encodeURI( Math.random()+ (new Date()));
	$.ajax({
				url:url,
				data:zs,
				type:		'POST',
				dataType:	'xml',
				timeout:	20000,
				error:		function(){window.location.href=moodurl+moodpath+"/"+dd[0]+"/"+dd[1]+"/"+dd[2]+"/"+aid+".shtml#"+cookiemood;	},
				success:	function(xml){
								var result=xml.getElementsByTagName("result");				
								var res=result[0].firstChild.data;
								var dd=newstime.split('-');	
								setCookie(aid,'tem#'+cookiemood);
								window.location.href=moodurl+moodpath+"/"+dd[0]+"/"+dd[1]+"/"+dd[2]+"/"+aid+".shtml#"+cookiemood;		
							}
				});
	}

 function   setCookie(name,value)   
  {   
      var   Days   =   1;  
      var   exp     =   new   Date();   
      exp.setTime(exp.getTime()   +   Days*24*60*60*1000);   
      document.cookie=name+ "="+ escape(value)   +";expires="+exp.toGMTString();   
  } 

