/// <reference path="jquery-vsdoc.js" />

$(document).ready(function () {

    $('.product-nav li').hover(function () { $(this).addClass('hover') }, function () {
        $(this).removeClass('hover')
    });

    $('.home #derma-bodywash').hover(function () {
        $("#derma-bodywash-desc").css({ left: "505px" })
    }, function () {
        $("#derma-bodywash-desc").css({ left: "-9999px" })
    });

    $('.home #derma-bodymoisturiser').hover(function () {
        $("#derma-bodymoisturiser-desc").css({ left: "445px" })
    }, function () {
        $("#derma-bodymoisturiser-desc").css({ left: "-9999px" })
    });

    $('input, select, textarea').focus(function () {
        $(this).addClass('focus');
    }).blur(function () {
        $(this).removeClass('focus');
    });

    $('input[type="text"]').each(function () {
        $(this).val($(this).attr('title'))
    });

    $('input[type="text"]').click(function () {
        if ($(this).val() == $(this).attr('title'))
            $(this).val('');
    }).blur(function () {
        if ($(this).val() == "")
            $(this).val($(this).attr('title'));
    });

    $('ul, ol').each(function () {
        $('li:first', this).addClass('first-child');
        $('li:last', this).addClass('last-child');
    });


    if ($('.product-nav').length != 0) {
        var page = window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1);
        switch (page) {
            case "GentleSkinCleanser.aspx":
                $('.product-nav li:eq(0)').addClass('hover');
                break;
            case "OilySkinCleanser.aspx":
                $('.product-nav li:eq(1)').addClass('hover');
                break;
            case "GentleCleansingBar.aspx":
                $('.product-nav li:eq(2)').addClass('hover');
                break;
            case "DailyAdvanceUltraHydratingLotion.aspx":
                $('.product-nav li:eq(3)').addClass('hover');
                break;
            case "MoisturisingLotion.aspx":
                $('.product-nav li:eq(4)').addClass('hover');
                break;
            case "MoisturisingCream.aspx":
                $('.product-nav li:eq(5)').addClass('hover');
                break;
            case "IntensiveMoisturisingLotion.aspx":
                $('.product-nav li:eq(6)').addClass('hover');
                break;
        }

    }
});