﻿// Declare function to fade out content
function fadeOutContent() {
	$("div#container > div > div").delay(200).fadeOut(500,
		function() {
			$("div").removeClass("visible");
		}).delay(10);
}

// Begin when document is ready
$(document).ready(
    function() {


        // logo click
        $("#streamer").click(
            function() {
                $(location).attr("href", "/")
            });

        // remove other than category
        $("p.label").each(
            function(index, value) {
                $(value).html($(value).html().replace(/Frontpage/ig, ""));
            });

        //configure headings on page.php
        $("p.checklabel").each(
            function(index, value) {
                var getLocation = $(value).html().indexOf("/");
                $(value).html($(value).html().slice(0, getLocation));
            });

        $("h1.checkheading").each(
            function(index, value) {
                var getLocation = $(value).html().indexOf("/");
                var getLength = $(value).html().length;
                $(value).html($(value).html().slice(getLocation + 2, getLength));
            });


        // statements hover
        $("#statements p a").mouseenter(
            function(event) {
                $(this).siblings(".line").animate({ opacity: "1" }, 250);
                $(this).animate({ color: "#999000" }, 250);
            });

        $("#statements p a").mouseleave(
            function(event) {
                $(this).siblings(".line").animate({ opacity: "0" }, 350);
                $(this).animate({ color: "#000" }, 350);
            });


        //widget hover
        $("div.widget").mouseenter(
            function(event) {
                $(this).animate({ backgroundColor: "#d0d0d0" }, 200);
            });

        $("div.widget").mouseleave(
            function(event) {
                $(this).animate({ backgroundColor: "#dadada" }, 350);
            });


        //entry hover
        $("div.bigtext, div.smalltext").mouseenter(
            function(event) {
                $(this).children(".label").animate({ backgroundColor: "#005bac" }, 200);
            });

        $("div.bigtext, div.smalltext").mouseleave(
            function(event) {
                $(this).children(".label").animate({ backgroundColor: "#006ccc" }, 350);
            });

    });
