﻿/// <reference path="../libs/jquery-1.3.1.min-vsdoc.js" />
(function($) {
    /**
    * jQuery delayed event execution.
    */
    $.fn.delay = function(options) {
        var timer;
        var delayImpl = function(eventObj) {
            if (timer != null) {
                clearTimeout(timer);
            }
            var newFn = function() {
                options.fn(eventObj, $(this));
            };
            timer = setTimeout(newFn, options.delay);
        }

        return this.each(function() {
            var obj = $(this);
            obj.bind(options.event, function(eventObj) {
                delayImpl(eventObj);
            });
        });
    };
})(jQuery);
$(document).ready(function() {
    //    $('#typeinme').delay({
    //        delay: 500,
    //        event: 'mouseover',
    //        fn: function() {
    //            alert(this.value);
    //        }
    //    });

//    $('.categoryTypeList label').hover(function() {
//        var timer;
//        var delayImpl = function(eventObj) {
//            if (timer != null) {
//                clearTimeout(timer);
//            }
//            var newFn = function() {
//                options.fn(eventObj, $(this));
//            };
//            timer = setTimeout(newFn, options.delay);
//        }
//        
//    })

    //    .delay({
    //        delay: 10,
    //        event: 'mouseover',
    //        fn: function(eventObj, obj) {
    //            console.log(obj);
    //            $('.categoryTypeList ul').hide();
    //            $(eventObj).parent().find('ul').slideDown(500);
    //        }
    //    });

    $('.categoryTypeList_obsolute label').mouseover(function() {
        $('.categoryTypeList ul').hide();
        $(this).parent().find('ul').slideDown(500);
    });
    $('.categoryList li a').mouseover(function() {

        $('.categoryList-imageList-i li').removeClass('on');
        $('.categoryList-imageList-i .' + $(this).attr('class')).parent().addClass('on');

        $('.categoryList li a').removeClass('on');

    });
    $('.categoryList li a').mouseleave(function() {
        $('.categoryList-images li').removeClass('on-proxy');
    });

    $('.categoryList-images li').mouseover(function() {

        //$('.categoryList li a.' + $(this).find('a').attr('class')).addClass('on');
    });

    $('.categoryList-imageList-i li a').mouseover(function() {
        $('.categoryList-imageList-i li').removeClass('on');
        // alert('dsds');
        $(this).parent().addClass('on');
        $('.categoryList a').removeClass('on');
        $('.categoryList a.' + $(this).attr('class')).addClass('on');

    });


});