﻿$(function () {
    //ЛайтБокс
    $('a.LightBox').lightBox();

    //Прелоад
    preload('../special/search1.gif');

    //Счетчики
    $("#count").css({ opacity: 0.5 });

    //Поиск
    $("#SearchImageButton").hover(
        function () {
            $(this).attr("src", "../special/search1.gif");
        },
        function () {
            $(this).attr("src", "../special/search0.gif");
        }
    );
    $("#SearchTextBox").attr("value", "Искать").css("color", "#808080").click(
        function () {
            var SearchText = $("#SearchTextBox").attr("value");
            if (SearchText == "Искать") {
                $("#SearchTextBox").attr("value", "").css("color", "#333333");
            }
        }
    );
    $("#SearchImageButton").click(
        function () {
            var SearchText = $("#SearchTextBox").attr("value");
            if (SearchText == "Искать") {
                $("#SearchTextBox").attr("value", "");
            }
        }
    );
    $("#SearchTextBox").focusout(
        function () {
            var SearchText = $("#SearchTextBox").attr("value");
            if (SearchText == "") {
                $("#SearchTextBox").attr("value", "Искать").css("color", "#808080");
            }
        }
    );

    //Логин
    $("#LoginTextBox").attr("value", "Логин").css("color", "#808080").click(
        function () {
            var SearchText = $(this).attr("value");
            if (SearchText == "Логин") {
                $(this).attr("value", "").css("color", "#333333");
            }
        }
    );
    $("#LoginTextBox").focusout(
        function () {
            var SearchText = $(this).attr("value");
            if (SearchText == "") {
                $(this).attr("value", "Логин").css("color", "#808080");
            }
        }
    );

    //Пароль
    $("#PasswordTextBox").attr("value", "Пароль").css("color", "#808080").click(
        function () {
            var SearchText = $(this).attr("value");
            if (SearchText == "Пароль") {
                $(this).attr("value", "").css("color", "#333333");
            }
        }
    );
    $("#PasswordTextBox").focusout(
        function () {
            var SearchText = $(this).attr("value");
            if (SearchText == "") {
                $(this).attr("value", "Пароль").css("color", "#808080");
            }
        }
    );
});
function preload() {
    if (document.images) {
        var imgsrc = preload.arguments;
        arr = new Array(imgsrc.length);
        for (var j = 0; j < imgsrc.length; j++) {
            arr[j] = new Image;
            arr[j].src = imgsrc[j];
        }
    }
}
