$(document).ready(function() {
 
$.each($("#hmenus div.nav a"),function() {
        if($(this).text() == 'Questions') {
        $(this).text('Küsimused');
    } else if($(this).text() == 'Tags') {
        $(this).text('Märksõnad');
    } else if($(this).text() == 'Users') {
        $(this).text('Kasutajad');
    } else if($(this).text() == 'Badges') {
        $(this).text('Medalid');
    } else if($(this).text() == 'Unanswered') {
        $(this).text('Vastamata');
    } else if($(this).text() == 'Ask Question') {
        $(this).text('Uus küsimus');
    }   
});
 
$.each($("#subheader h2"),function() {
    if($(this).text() == "Recent Questions") {
        $(this).text("Viimased küsimused");
    } else if($(this).text() == "All Questions") {
        $(this).text("Kõik küsimused");
    } else if($(this).text() == "Tags") {
        $(this).text("Märksõnad");
    } else if($(this).text() == "Users") {
        $(this).text("Kasutajad");
    } else if($(this).text() == "Unanswered Questions") {
        $(this).text("Vastamata küsimused");
    } else if($(this).text() == "Ask a Question") {
        $(this).text("Uus küsimus");
    } else if($(this).text() == "Badges") {
        $(this).text("Medalid");
    } else if($(this).text().search(" Answers") > 0) {
        $(this).html($(this).html().replace(" Answers", " vastust"));
    } else if($(this).text().search(" Answer") > 0) {
        $(this).html($(this).html().replace(" Answer", " vastus"));
    }
});
 
$.each($("#subheader #tabs a"),function() {
    if($(this).text() == 'active') {
        $(this).text('aktiivsed');
    } else if($(this).text() == 'hot') {
        $(this).text('kuumad');
    } else if($(this).text() == 'week') {
        $(this).text('nädal');
    } else if($(this).text() == 'month') {
        $(this).text('kuu');            
    } else if($(this).text() == 'newest') {
        $(this).text('uued');
    } else if($(this).text() == 'featured') {
        $(this).text('preemiaga');
    } else if($(this).text() == 'votes') {
        $(this).text('häältega');          
    } else if($(this).text() == 'name') {
        $(this).text('nimi');         
    } else if($(this).text() == 'reputation') {
        $(this).text('kuulsus');     
    } else if($(this).text() == 'oldest') {
        $(this).text('vanimad');              
    } else if($(this).text() == 'tags') {
        $(this).text('märksõnad');
    } else if($(this).text() == 'my tags') {
        $(this).text('minu märksõnad');
    } else if($(this).text().search('featured') == 1) {
        $(this).html($(this).html().replace("featured", "preemiaga"));
    }
});
 
 
$.each($("div.question-summary div"),function() {
    if($(this).text() == 'votes') {
        $(this).text('häält');
    } else if($(this).text() == 'vote') {
        $(this).text('hääl');
    } else if($(this).text() == 'answers') {
        $(this).text('vastust');
    } else if($(this).text() == 'answer') {
        $(this).text('vastus');
    } else if($(this).text() == 'views') {
        $(this).text('vaatajat');
    } else if($(this).text() == 'view') {
        $(this).text('vaataja');
    }
});
 
 
$.each($("#topbar a"),function() {
    if($(this).text() == "login") {
        $(this).text("logi sisse");
    } else if($(this).text() == "log out") {
        $(this).text("logi välja");
    } else if($(this).text() == "faq") {
        $(this).text("KKK");
    }
});
 
$.each($("#post-form h2"),function() {
    if($(this).text() == "Your Answer") {
        $(this).text("Sinu vastus");
    }
});
 
$.each($("#post-form label"),function() {
    if($(this).text() == "Title") {
        $(this).text("Pealkiri");
    } else if($(this).text() == "Tags ") {
        $(this).text("Märksõnad");
    } else if($(this).text() == "OpenID Login ") {
        $(this).text("OpenID tunnus");
    } else if($(this).text() == "Name ") {
        $(this).text("Nimi");
    } else if($(this).text() == "Email never shown") {
        $(this).text("Email - seda ei näidata kunagi");
    } else if($(this).text() == "Home Page ") {
        $(this).text("Kodulehekülg");
    }                   
});
 
$.each($("div#sidebar div.module h4"),function() {
    if($(this).text() == "Related") {
        $(this).text("Seotud");
    } else if($(this).text() == "Formatting Reference") {
        $(this).text("Vormindamise abi");
    } else if($(this).text() == "Related Tags") {
        $(this).text("Seotud märksõnad");
    } else if($(this).text() == "Legend") {
        $(this).text("Legend");
    } else if($(this).text() == "Interesting Tags") {
        $(this).text("Huvitavad märksõnad");
    } else if($(this).text() == "Ignored Tags") {
        $(this).text("Ignoreeritud märksõnad");
    } else if($(this).text() == "Recent Tags") {
        $(this).text("Viimased märksõnad");
    } else if($(this).text() == "Recent Badges") {
        $(this).text("Viimased medalid");
    } else if($(this).text() == "all tags »") {
        $(this).text("kõik märksõnad »");
    }
});
 
$.each($("div#sidebar div.module p"),function() {
    if($(this).text() == "all tags") {
        $(this).text("kõik märksõnad");
    } else if($(this).text() == "all badges") {
        $(this).text("kõik medalid");
    }
});
 
$.each($("#mainbar H2"),function() {
    if($(this).text() == "Looking for more?") {
        $(this).text("Otsid rohkemat?");
    } else if($(this).text() == "log out") {
        $(this).text("logi välja");
    } else if($(this).text() == "faq") {
        $(this).text("KKK");
    }
});
 
$.each($("#post-form div.form-item-info"),function() {
    if($(this).text().search('Combine multiple words into single-words, space to separate up to 5 tags') > 0) {
        $(this).html($(this).html().replace("Combine multiple words into single-words, space to separate up to 5 tags", "Kombineeri mitu sõna liit-sõnadeks, eralda tühikutega kuni 5 märksõna"));
    } else if($(this).text().search('Get an') > 0) {
        $(this).html($(this).html().replace("Get an", "Get an"));
    }   
});
 
if($("#submit-button").val() == "Ask Your Question") {
    $("#submit-button").val("Küsi oma küsimus");
} else if($("#submit-button").val() == "Post Your Answer") {
    $("#submit-button").val("Postita oma vastus");
}
 
});
 
