
/*overstate*/
$(document).ready(function() {
    $(".menuoverstate").each(function(i) {

        preload_image = new Image();
        preload_image.src = this.src.replace(".jpg", "_o.jpg");

        $(this).hover(
            function() {
                if (this.src.indexOf("_o.jpg") == -1) {
                    this.src = this.src.replace(".jpg", "_o.jpg");
                }

            },

            function() {
                this.src = this.src.replace("_o.jpg", ".jpg");

            });

    }
        );

    $(".menuoverstategif").each(function(i) {

        preload_image = new Image();
        preload_image.src = this.src.replace(".gif", "-o.gif");

        $(this).hover(
            function() {
                if (this.src.indexOf("-o.gif") == -1) {
                    this.src = this.src.replace(".gif", "-o.gif");
                }

            },

            function() {
                this.src = this.src.replace("-o.gif", ".gif");

            });

    }
        );


    /*subnav*/
    $('#guide').hover(
		function() {
		    $('#guide a').addClass('current');
		    $('ul', this).delay(1000).stop(true, true).slideDown(300);
		},
		function() {
		    $('ul', this).delay(1000).stop(true, true).slideUp(300);
		    $('#guide a').removeClass('current');
		}
	);

    $('#events').hover(
		function() {
		    $('#events a').addClass('current');
		    $('ul', this).delay(1000).stop(true, true).slideDown(300);
		},
		function() {
		    $('ul', this).delay(1000).stop(true, true).slideUp(300);
		    $('#events a').removeClass('current');
		}
	);

    /*bookmakers details*/

    $('#btn-details').click(function() {
        $('#details-more').slideToggle(1000);
        $('#btn-details').hide();
    });

    $('#btn-hide').click(function() {
        $('#details-more').slideToggle(1000);
        $('#btn-details').show();
    });

    $('#btn-close').hide();
    $('#reviews-hidden').hide();
    $('#btn-close').click(function() {
        $('#reviews-hidden').slideToggle(1000);
        $('#btn-close').hide();
        $('#btn-open').show();
    });

    $('#btn-open').click(function() {
        $('#reviews-hidden').slideToggle(1000);
        $('#btn-open').hide();
        $('#btn-close').show();
    });

    $('.fadecategory').animate({ opacity: 0.2 }, 1500);

});

