﻿// ==UserScript==
// @name                切换城市js
// @description         切换城市
// @created date        2009/9/27   11:22
// @created author      Tiger(tigershi0507@gmail.com)
// @version             1.0.1
// @version owner       Copyright (C) 2009-2010 keerr.com All rights reserved.
// ==/UserScript==
/*************************************************
	verified time 	:	2009/10/13   14:28
	verified author	:	Tiger
	verified purpose:	添加了排行详细页面的侧边栏的css样式切换
**************************************************/
/*************************************************
	verified time 	:	2009/10/16   13:41
	verified author	:	Tiger
	verified purpose:	添加排行的鼠标移动切换样式功能
**************************************************/
/*************************************************
	verified time 	:	2009/10/22   16:39
	verified author	:	Tiger
	verified purpose:	修改了mouseover事件，改成了mouseenter
**************************************************/
/*************************************************
	verified time 	:	2009/10/22   17:07
	verified author	:	Tiger
	verified purpose:	修改了mouse事件的逻辑，将clear class动作放置到了mouseleave事件中去了
**************************************************/
/// <summary>
/// 首页切换城市
/// </summary>
/// <param name=""></param>
/// <param name=""></param>
function changeCity() {
    $("#change_city")
    .bind("mouseenter", function() {
        $(this).find("div").show();
    })
    .bind("mouseleave", function() {
        $(this).find("div").fadeOut();
    });
}

///// <summary>
///// 排行详细页面的侧边栏的css样式切换
///// </summary>
///// <param name=""></param>
///// <param name=""></param>
//function changePhxx() {
//    $(".phxx_sidebar li").click(function() {
//        $(".phxx_sidebar .phxx_tabon").removeClass("phxx_tabon");
//        $(this).addClass("phxx_tabon");
//    });
//}

$.fn.toggleOnOff = function(options) {
    var d = {
        offCls: "",
        onCls: "",
        childTagName: "li"
    };
    var flagTimeout;
    var s = options ? $.extend({}, d, options) : d;
    return this.each(function() {
        var $_thisObj = $(this);
        $_thisObj.find(s.childTagName)//.mouseover(function() {
        .bind("mouseenter", function() {
            var $_thisObj = $(this);
            //clearTimeout(flagTimeout);
            //flagTimeout = setTimeout(function() {
            //$("." + s.onCls).attr("class", s.offCls);
            $_thisObj.addClass(s.onCls).removeClass(s.offCls);

            //}, 200);

        })
        .bind("mouseleave", function() {
            //clearTimeout(flagTimeout);
            $("." + s.onCls).addClass(s.offCls).removeClass(s.onCls);
        });
    })
}

//$(function() {
//    
//});