$.easing.bouncy = function (x, t, b, c, d) {
    var s = 1.70158;
    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
$.tools.tooltip.addEffect("bouncy",

	function(done) {
		this.getTip().animate({top: '+=220'}, 0, 'bouncy', done).show();
	},

	function(done) {
		this.getTip().animate({top: '-=15'}, 200, 'bouncy', function()  {
			$(this).hide();
			done.call();
		});
	}
); 
$.easing.drop = function (x, t, b, c, d) {
	return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
};
$.tools.overlay.addEffect("drop", function(css, done) { 

   var conf = this.getConf(),
       overlay = this.getOverlay();           
	   
   if (conf.fixed)  {
      css.position = 'fixed';
   } else {
      //css.top += $(window).scrollTop();
      //css.left += $(window).scrollLeft();
	  css.top = 0;
	  css.left = $(window).width() - overlay.width();
	  css.opacity = 0;
      css.position = 'absolute';
   } 
   
   overlay.css(css).show();
   
   overlay.animate({ top: '+=135', left: ($(window).width() - overlay.width()) / 2,  opacity: 1}, 400, 'drop', done);
   
   }, function(done) {
      this.getOverlay().animate({top:'-=135', left: $(window).width() - this.getOverlay().width(), opacity:0}, 300, 'drop', function() {
         $(this).hide();
         done.call();      
      });
   }
);
$.tools.validator.localize("zh-cn", {
	':number' 		: '*必须为数字！',
	'[required]' 	: '*不能为空！'
});

$(function(){
	$(".demo img[title]").tooltip({effect:'bouncy'});
	$(".menu li a").mouseover(function(){
		$(".menuList").show();
	});
	$(".menu li").mouseout(function(){
		$(".menuList").hide();
	});
	$(".menuList").mouseover(function(){
		$(this).show();
	});
	$(".menuList").mouseout(function(){
		$(this).hide();
	});
	$(".menu li a").mouseover(function(){
		var val = $(this).attr("lang");
		$.ajax({
			url: 'ajax2312.asp',
			type: 'post',
			data: {'action':'menu','val':val},
			beforeSend: function(){
				$(".menuList").html('loading...');
			},
			success: function(data){
				$(".menuList").html(data);
			}
		});
	});
	$(".types li span").click(function(){
		$(this).prev(".tips1").show();
	});
	$(".types li").mouseout(function(){
		$(".tips1", this).hide();
	});
	$(".types li .tips1").mouseover(function(){
		$(this).show();
	});
	$("#login").overlay({
		closeOnClick: false,
		mask: {
			color: '#666666',
			loadSpeed: 200,
			closeSpeed: 0,
			opacity: 0.2
		},
		onBeforeClose: function(){
			$(".error").hide();
		},
		speed: 0,
		fixed: false,
		effect: 'drop'
	});
	$("#suggest1").focus(function(){
		if($(this).val() == "手机的事儿，找叶叶。")
			$(this).val("");
	});
	$("#suggest1").autocomplete("autoComplete.asp", {
		delay: 0,
		extraParams: {trigger:"suggest1"},
		max: 0
	});
	$("#loginform").validator({
		lang : 'zh-cn',
		message : '<div><em/></div>',
		position : 'top right',
		inputEvent : 'blur',
		offset :	[-8, -40]
	});
});
