﻿/// <reference path="jquery-1.3.2-vsdoc.js" />


$(function() {

    $(".rollover").each(
        function() {
            var overSrc = "";
            if (this.src.endsWith(".gif"))
                overSrc = this.src.replace(".gif", "-over.gif");
            if (this.src.endsWith(".jpg"))
                overSrc = this.src.replace(".jpg", "-over.jpg");
            if (this.src.endsWith(".png"))
                overSrc = this.src.replace(".png", "-over.png");

            jQuery("<img>").attr("src", overSrc);
        }
    );

    $(".rollover").hover(
        function() {
            if (this.src.search("-over") < 0) {
                var overSrc = "";
                if (this.src.endsWith(".gif"))
                    overSrc = this.src.replace(".gif", "-over.gif");
                if (this.src.endsWith(".jpg"))
                    overSrc = this.src.replace(".jpg", "-over.jpg");
                if (this.src.endsWith(".png"))
                    overSrc = this.src.replace(".png", "-over.png");

                this.src = overSrc;
            }
        },
        function() {
            this.src = this.src.replace("-over", "");
        }
    );

    $("ul.submenu").addClass("hide");

    $(".menu li").hover(
        function() {
            var menu = $(this);
            menu.attr("hover", "true");
            $("ul", menu).fadeIn("def");
        },
        function() {

            var menu = $(this);
            menu.attr("hover", "false");

            setTimeout(function() {
                if (menu.attr("hover") == "false")
                    $("ul", menu).fadeOut("def");
            }, 500);
        }
    );

    $("input.watermark").each(function() {

        $(this).Watermark($(this).attr("watermark"));
    });

    $(".view-pricing").click(function() {
        $(this).next(".pricing").slideToggle("slow");
    });

    Cufon.replace("h1");
    Cufon.replace("h2");
    Cufon.replace("h3");
    Cufon.replace("#menu li a");
    Cufon.replace("#tabs .title");
    Cufon.replace("#tabs li a");
});