/* Top.js */
(function() {
function setStyleDisplay(id, status) {
	document.getElementById(id).style.display = status;
}
function goTop(acceleration, time) {
	acceleration = acceleration || 0.1;
	time = time || 16;
	var dx = 0;
	var dy = 0;
	var bx = 0;
	var by = 0;
	var wx = 0;
	var wy = 0;
	if (document.documentElement) {
		dx = document.documentElement.scrollLeft || 0;
		dy = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
		bx = document.body.scrollLeft || 0;
		by = document.body.scrollTop || 0;
	}
	var wx = window.scrollX || 0;
	var wy = window.scrollY || 0;

	var x = Math.max(wx, Math.max(bx, dx));
	var y = Math.max(wy, Math.max(by, dy));

	var speed = 1 + acceleration;
	window.scrollTo(Math.floor(x / speed), Math.floor(y / speed));
	if(x > 0 || y > 0) {
		var invokeFunction = "MGJS.goTop(" + acceleration + ", " + time + ")"
		window.setTimeout(invokeFunction, time);
	}
}
window['MGJS'] = {};
window['MGJS']['setStyleDisplay'] = setStyleDisplay;
window['MGJS']['goTop'] = goTop;
})();
/* qq.js */
function postToWb(){
	var _url = encodeURIComponent(document.location);
	var _assname = encodeURI("skyocom");//你注册的帐号，不是昵称
	var _appkey = encodeURI("3a7cc07e1cfa41c2bc9271d146977874");//你从腾讯获得的appkey
	var _pic = encodeURI('');//（例如：var _pic='图片url1|图片url2|图片url3....）
	var _t = '';//标题和描述信息
	var metainfo = document.getElementsByTagName("meta");
	for(var metai = 0;metai < metainfo.length;metai++){
		if((new RegExp('description','gi')).test(metainfo[metai].getAttribute("name"))){
			_t = metainfo[metai].attributes["content"].value;
		}
	}
	_t =  document.title+_t;//请在这里添加你自定义的分享内容
	if(_t.length > 120){
		_t= _t.substr(0,117)+'...';
	}
	_t = encodeURI(_t);

	var _u = 'http://share.v.t.qq.com/index.php?c=share&a=index&url='+_url+'&appkey='+_appkey+'&pic='+_pic+'&assname='+_assname+'&title='+_t;
	window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
}
/* sina.js */
function postToXWb(){
	var _url = encodeURIComponent(document.location);
	var _ralateUid = encodeURI("1711088872");
	var _appkey = encodeURI("1481112766");
	var _pic = encodeURI('');
	var _t = '';
	var metainfo = document.getElementsByTagName("meta");
	for(var metai = 0;metai < metainfo.length;metai++){
		if((new RegExp('description','gi')).test(metainfo[metai].getAttribute("name"))){
			_t = metainfo[metai].attributes["content"].value;
		}
	}
	_t =  document.title+_t;
	if(_t.length > 120){
		_t= _t.substr(0,117)+'...';
	}
	_t = encodeURI(_t);

	var _u = 'http://service.weibo.com/share/share.php?url='+_url+'&appkey='+_appkey+'&title='+_t+'&pic='+_pic+'&ralateUid='+_ralateUid;
	window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
}
/* Searchbox.js */
jQuery(document).ready(
	function(){
		jQuery('#searchbox .textfield').focus(
			function() {
				if(jQuery(this).val() == '搜索...') {
					jQuery(this).css({color:"#555"}).val('');
				}
			}
		).blur(
			function(){
				if(jQuery(this).val() == '') {
					jQuery(this).css({color:"#999"}).val('搜索...');
				}
			}
		);
		jQuery('#searchbox .button').click(
			function() {
				if(jQuery('#searchbox .textfield').val() == '' || jQuery('#searchbox .textfield').val() == '搜索...') {
					return false;
				} else {
					jQuery(this).submit();
				}
			}
		);
		jQuery(
			function() {
				if(jQuery('#searchbox .textfield').val() == '' || jQuery('#searchbox .textfield').val() == '搜索...') {
					jQuery('#searchbox .textfield').css({color:"#999"}).val('搜索...');
				}
			}
		);
	}
)
/* Loading+Target.js */
jQuery(document).ready(function($){
    $("a[rel='external nofollow']").click(function(){window.open(this.href);return false;});
	$(".title h2 a").hover(function(){$(this).stop().animate({marginLeft:"+=8"},250);},function(){$(this).stop().animate({marginLeft:"0"},150);});
	$('.title h2 a').click(function(){$(this).text('页面载入中,请稍候......');window.location = $(this).attr('href')});
});
