function LightBox() {
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var layer = document.createElement('div');
    layer.style.zIndex = 2;
    layer.id = 'layer';
    layer.style.position = 'absolute';
    layer.style.top = '0px';
    layer.style.left = '0px';
    layer.style.height = document.documentElement.scrollHeight + 'px';
    layer.style.width = width + 'px';
    layer.style.backgroundColor = 'black';
    layer.style.opacity = '.6';
    layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
    document.body.appendChild(layer);
    /*  var div = document.createElement('div');  div.style.zIndex = 3;  div.id = 'box';  div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';  div.style.top = '200px';  div.style.left = (width / 2) - (400 / 2) + 'px';   div.style.height = '50px';  div.style.width = '400px';  div.style.backgroundColor = 'white';  div.style.border = '2px solid silver';  div.style.padding = '20px';  document.body.appendChild(div);  var p = document.createElement('p');  p.innerHTML = '<span class="title">Sign In</span>';  div.appendChild(p);  var a = document.createElement('a');  a.innerHTML = 'Sign In';  a.href = 'javascript:void(0)';  a.onclick = function()  {    document.body.removeChild(document.getElementById('layer'));    document.body.removeChild(document.getElementById('box'));  };  div.appendChild(a);  */
}
function CloseLogin() {
    if (document.getElementById('layer')) { document.body.removeChild(document.getElementById('layer')) };
    document.getElementById("LoginBox").style.display = "none";
}
function ShowCustomDropdown(ElementID) {
    var DDoptions = document.getElementById(ElementID);
    if (DDoptions.style.display == "block") {
        DDoptions.style.display = "none";
    } else {
        DDoptions.style.display = "block";
    }
}
function CustomDropdownSelect(SelectValue, SelectText, InputBox) {
    var input = document.getElementById(InputBox);
    var TextArea = document.getElementById(InputBox + "_TextArea");
    input.value = SelectValue;
    TextArea.innerHTML = SelectText;
    ShowCustomDropdown(InputBox + "_options");
}

/* THIS LOADS THE SLIDER */
$(document).ready(function () {
    $("#latest_jobs").easySlider({
        auto: true,
        speed: 1000,
        vertical: true,
        pause: 7000,
        continuous: true
    });
});
function toggleAdvancedSearch() {
    if ($("#advancedoptions").is(":hidden")) {
        $("#advancedoptions").slideDown("slow");
    } else {
        $("#advancedoptions").slideUp("slow");
    }
}
function LoginPopup() {
    window.location = "../login.aspx";
    //LightBox();
    //document.getElementById("LoginBox").style.display="block";
}
function Register() {
    window.location = "register.aspx";
    //LightBox();
    //document.getElementById("LoginBox").style.display="block";
}
function ClearMessage(MessageElement) {
    self.setTimeout(function () {
        var Message = document.getElementById(MessageElement);
        Message.innerHTML = "";
    }, 5000);
}
function BroadBeanPopup(BB_Link) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(BB_Link, 'BroadBean', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=900,height=600,left = 560,top = 300');");
    var Message = document.getElementById("ctl00_ContentPlaceHolder1_message");
    Message.innerHTML = 'Job Completely added to Recruit Business website and Broadbean';
}
function DownloadError(NavUrl) {
    var password;

    var pass1 = "rbdownload2011";

    password = prompt('Please enter the password to view this document!', '');

    if (password == pass1)
        window.location = NavUrl;
    else {
        alert("Password Incorrect");
    }


}

function querySt(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i = 0; i < gy.length; i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
    }
}


$(document).ready(function () {
    var permanent = querySt("permanent");
    var contract = querySt("contract");

    if (permanent == "False") {
        $('#QuickSearch_JobType_CheckBoxList_0').attr('checked', false);
    }

    if (contract == "False") {
        $('#QuickSearch_JobType_CheckBoxList_1').attr('checked', false);
    }

});

