﻿
$(document).ready(function () {

    // Listpage

    $(".listing ul li, .articleFront, .mainSectionBox ul li, .col div.colArticle").mouseenter(function () {
        $(this).addClass("active");
    }).mouseleave(function () {
        $(this).removeClass("active");
    }).click(function () {
        var listLink = $(this).find(".link a").attr("href");
        window.location = listLink;
        return false;
    });
    $(".listing ul li .link a").focus(function () {
        $(this).parent().parent().parent().addClass("active");
    }).blur(function () {
        $(this).parent().parent().parent().removeClass("active");
    });

    // Articles
    $(".articleFront .link, .mainSectionBox .link, .article .link").hide();

    //Main navigation fist and last td
    $("#mainNavigation table td:last, .tabs li:last").addClass("last");
    $("#mainNavigation table td:first, .reportTable tr td:first-child, .tabs li:first").addClass("first");


    //Complaint form
    $(".complaintForm ul li:first-child").addClass("firstChild");


    /*
    $("img").each(function () {
    if (jQuery(this).attr('alt') == '') {
    jQuery(this).attr('alt', '');
    }
    });
    */



    // Languages
    jQuery("#imagecombobox").msDropDown({ showIcon: true });
    var currentLang = $('#imagecombobox :selected').val();
    $('#uiHdfSelectedLanguage').val(currentLang);

    $('#imagecombobox').change(function () {
        var src = $(this).val();
        if (currentLang != src) {
            $('#uiHdfSelectedLanguage').val(src);

            $('#uiBtnChangeLanguage').click();
        }
    });




    // search button styling
    $("#global li.hideLabel input.submit").bind("mouseover focus", function () {
        $(this).attr("src", "/Templates/Images/btn-search2.png");
    }).bind("mouseout blur", function () {
        $(this).attr("src", "/Templates/Images/btn-search.png");
    });

    $(".searchBut").bind("mouseover focus", function () {
        $(this).attr("src", "/Templates/images/backgrounds/search-butt2.png");
    }).bind("mouseout blur", function () {
        $(this).attr("src", "/Templates/images/backgrounds/search-butt.png");
    });



    /*login
    var fields = new Object();

    $('.autorisationEMail input, .autorisationPassword input').each(function (i) {
    fields[$(this).attr('name')] = $(this).attr('value');
    });

    $('.autorisationEMail input, .autorisationPassword input').focus(function () {
    if ($(this).attr('value') == fields[$(this).attr('name')]) {/            $(this).attr('value', '');
    }
    });

    $('.autorisationEMail input, .autorisationPassword input').blur(function () {
    $('input').each(function (i) {
    if (!$(this).attr('value')) {
    $(this).attr('value', fields[$(this).attr('name')]);
    }
    });
    });
    */
});
