function reset_share(direct) {if (!direct && !$('#share').attr('ready')) return;if (!direct) $('#share').stop();var pos = $("#game").offset();var pos2 = $("#gameblock").offset();var width = $("#share").outerWidth();var left = 0;if (pos2.left >= width + 10) {var left = pos2.left - width - 10;var top = Math.max($(document).scrollTop() + 10, pos.top);if (direct) {$('#share').css({left:left + "px", top:top + "px"});} else {$('#share').animate({left:left + "px", top:top + "px"}, 'slow');}} else {var left = pos.left - width - 10;var top = pos.top;$('#share').css({left:left + "px", top:top + "px"});}}
function check_share() {var width = $("#share").outerWidth();if (width < 20) {setTimeout(check_share, 500);return;}setTimeout(function() {reset_share(true);$('#share').fadeIn('slow',
function() {$('#share').attr('ready', '1');});}, 1000);};$(document).ready(function() {$(window).bind('scroll resize', function() {reset_share(false);});});
function writehtml(html) {document.write(html);}
function track(id) {A('/a/track/' +id, {referer:document.referrer});}
function A(url, param, success, error) {var ajax = {type: "POST", url: url, dataType: 'json'};if (param) ajax.data = param;ajax.success = function(data) {if (data.no == 0) {if (success) success(data.data);} else {if (error) error(data.no, data.msg);}};if (error) ajax.error = error;$.ajax(ajax);}
(function($) {$.fn.slide = function(o) {var _this = this;if (this.length == 0) return log('No element selected.');this.next = function() {if ($(_this).attr('stop') != 1) {var current = parseInt($(_this).attr('current'));if (current >= $(_this).children().length / 2) {current = 0;$(_this).css({left:'0px'});}current += 1;$(_this).attr('current', current);$(_this).children().each(function(i){if (current == i) {var left = $(this).position().left;$(_this).animate({left:-left+'px'}, 1000, function() {setTimeout(function(){_this.next()}, 2000);});}});} else {setTimeout(function(){_this.next()}, 2000);}};var html = $(this).html();$(this).css({width:'10000000px', position:'relative'});$(this).html(html + html);$(this).attr('current', 0);$(this).attr('stop', 0);$(this).bind('mouseover', function(){$(_this).attr('stop', '1');}).bind('mouseout', function() {$(_this).attr('stop', '0');});setTimeout(this.next, 2000);return this;}})(jQuery);
