(function(o,s,x,y,d){
			s = o.style;//id为w的元素直接充当这里的o了
			d = document;//
			o.onselectstart = function(){ return false; }; //阻止选择
			o.onmousedown = function(e){
				e = e||event;
				x = e.clientX-o.offsetLeft+100;
				y = e.clientY-o.offsetTop;
				d.onmousemove = function(e){
					e = e||event;
					s.left = e.clientX - x+200 + "px";
					s.top = e.clientY - y + "px";
				}
				d.onmouseup = function(){ d.onmouseup = d.onmousemove = ""; }
			}
})(document.getElementById("twitter"))

//滔滔
var lis=$$('#id_apiPane li');
var perHeight=lis[0].getStyle('height').toInt();//移动一次偏移margin
var nowShowLi=0;//当前出现的li号，由0开始
var nowSpan=lis[nowShowLi].getElementsByTagName('SPAN')[0];
$('twi_up').addEvent('click',function(event){
	if(nowShowLi>0){
		nowShowLi--;
		nowSpan=lis[nowShowLi].getElementsByTagName('SPAN')[0];
		$('id_apiPane').setStyle('margin-top',-nowShowLi*perHeight);
		userTooFast(event,'Message:'+(nowShowLi+1));
		resetSpan();
		txtSpanInter=spanCicleMove.delay(1000);
	}
	else
	userTooFast(event,'No previous message!');
	
	return false;
	
});
$('twi_down').addEvent('click',function(event){
	if(nowShowLi<lis.length-1){
		nowShowLi++;
		nowSpan=lis[nowShowLi].getElementsByTagName('SPAN')[0];
		$('id_apiPane').setStyle('margin-top',-nowShowLi*perHeight);
		userTooFast(event,'Message:'+(nowShowLi+1));
		resetSpan();
		txtSpanInter=spanCicleMove.delay(1000);
	}
	else
	userTooFast(event,'No next message!');
	
	return false;
	
});
var txtSpanInter=null;//计时器
var txtWidth=0;//当前span
function spanCicleMove(){
	span=lis[nowShowLi].getElementsByTagName('SPAN')[0];
	//获取实际宽度
	span.setStyle('visibility','hidden');
	span.setStyle('position','absolute');
	txtWidth=span.getStyle('width').toInt();
	span.setStyle('position','relative');
	span.setStyle('visibility','visible');
	$clear(txtSpanInter);
	txtSpanInter=moveTxt.periodical(25);
}
function moveTxt(){
	m=nowSpan.getStyle('margin-left').toInt();
	nowSpan.setStyle('margin-left',m-1);
	if(260+txtWidth<=-span.getStyle('margin-left').toInt()){
		span.setStyle('margin-left',220);
	}
}
function resetSpan(){
	$clear(txtSpanInter);
	span=$$('#id_apiPane li .txt');
	span.each(function(e){e.setStyle('margin-left',0)});
}
$('twitter').addEvent('mouseenter',function(event){
	txtSpanInter=spanCicleMove.delay(1000);
});
$('twitter').addEvent('mouseleave',function(event){
	$clear(txtSpanInter);
	nowSpan.tween('margin-left',0);
});

//看过的日志
setSlideShow($('J_viewed'),54,21);
if($('J_relatived'))
setSlideShow($('J_relatived'),72,21);
function setSlideShow(e,width,height){
	e.setStyle('visibility','hidden');
	e.setStyle('width','');
	e.setStyle('height','');
	var viewedWidth=[];
	var viewedheight=[];
	viewedWidth[e.id]=e.getStyle('width').toInt();
	viewedheight[e.id]=e.getStyle('height').toInt();
	e.setStyle('width',width);
	e.setStyle('height',height);
	e.setStyle('visibility','visible');
	var myEffect = new Fx.Morph(e, {
		duration: 'long', 
		transition: Fx.Transitions.Sine.easeOut
	});
	e.addEvent('mouseenter',function(){
		this.addClass('viewedHover');
		myEffect.cancel();
		myEffect.start({
			'height': viewedheight[e.id], 
			'width': viewedWidth[e.id]
		});
	
	});
	e.addEvent('mouseleave',function(){
		this.removeClass('viewedHover');
		myEffect.cancel();
		myEffect.start({
			'height': height, 
			'width': width
		});
	
	});
}
//收藏
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

//alert
var div = new Element('div',{
    'id': 'J_note',
    'class': 'ajaxNote'
    }
);
var span = new Element('span');

span.inject(div, 'top');
div.inject($$('body')[0]);
//mouse position alert
function userTooFast(ev,txt){
	alertShow(ev.page.x+10,ev.page.y-10,txt,1100);
}
//certain position alert
function alertShow(x,y,txt,delay){
	if(txt)$$('#J_note span')[0].innerHTML=txt;
	$('J_note').setStyle('top',y);
	$('J_note').setStyle('left',x);
	$('J_note').setStyle('display','block');
	$('J_note').tween('opacity',1);
	var a=function(){
		$('J_note').tween('opacity',0);
	}.delay(delay);
}
