﻿var implementXFrameFix = document.getElementById("ImplementXFrameFix").value.toLowerCase();

if (implementXFrameFix === 'true') {
    //X-Frame-fix
    if (window.location.pathname.toLowerCase().indexOf("affiliatesv1") > 0) {
        window.location.pathname = "affiliates"
    }
    //pop out of frames
    if (top.location != location) {
        top.location.href = document.location.href;
    }
}
else {
    if (top.location.pathname.indexOf("affiliatesv1") > 0) {
        top.location.pathname = "affiliates"
    }
}

$(function () {
    disableButton();

    $("form").submit(function () {
        if ($("#txtUsername").val() != "" && document.getElementById('txtPassword').value != "") {
            $("#btnLogin").prop('disabled', true);
        }

        return true;
    });
});

function disableButton() {
    history.pushState({ page: 1 }, "", "#");
    window.location.hash = "";
    window.location.hash = ""; //again because google chrome don't insert first hash into history
    window.onhashchange = function (event) {
        window.location.hash = " ";
    };
}