﻿frontPage = false;


function menuCallback(pUrl) {
    obj = window.jobframe;
    if (obj != null) {
        self.location.href = '#';
        obj.executeCallback(pUrl, obj.location.href);
    }
}

function createXavioMenuElement(menuUl, elementText, elementUrl, elementGfx) {

    newLi = document.createElement('li');
    newLink = document.createElement('a');

    if (elementGfx.length > 0) {
        newImg = document.createElement('img');
        newImg.src = elementGfx;
        newLink.appendChild(newImg);
    }

    textSpan = document.createTextNode(elementText);

    newLink.appendChild(textSpan);
    newLi.appendChild(newLink);
    menuUl.appendChild(newLi);


    if (elementText == '') {
        newLi.className = 'xavio_submenu1_li_spacer';
        newLink.href = 'javascript:void(0);';
    } else {
        newLi.className = 'xavio_submenu1_li';
        newLink.href = 'javascript:menuCallback(\'' + elementUrl + '\')';
    }

}

function removeChildren(cell) {
    if (cell.hasChildNodes()) {
        while (cell.childNodes.length >= 1) {
            cell.removeChild(cell.firstChild);
        }
    }
}


function goSitemap() {
    lol = location.href;
    lil = location.search;
    baseUrl = lol.substring(0, parseInt(lol.length - lil.length));
    location.href = baseUrl + "?sitemap=true";
    return false;
}

function goSearch() {
    _search_div = document.getElementById('search_div');
    _s_query = document.getElementById('s_query');

    if (_search_div.style.display == 'none') {
        _search_div.style.display = 'block';
        _s_query.focus();
    } else {
        _search_div.style.display = 'none';
    }
}


function init() {   
    fixSearchButton();
}

function fixSearchButton() {
    sLink = document.getElementById('custom_search_link');
    sDiv = document.getElementById('search_div');

    if (sLink != null && sDiv != null) {
        inputs = sDiv.getElementsByTagName('input');
        if (inputs.length > 0) {
            sLink.appendChild(document.createTextNode(inputs[1].value));
        }
    }
}


function initLogin() {
    ct = document.getElementById('col2_content_div_2');

    if (ct != null) {
        ctl = ct.getElementsByTagName('a');
        if (ctl.length > 0) {

            wp = ctl[0].toString();
            jp = ctl[1].toString();

            ctl[1].className = 'greenbtn';
        }
    }
}

function validateFrontPageLogin() {
    uid  = document.getElementById('login_username');
    upwd = document.getElementById('login_password');
    tos = document.getElementById('acceptbox3');

    if (uid.value.length > 0 && upwd.value.length > 0 && tos.checked) {
        return true;
    } else {
    return false;
    }
}


window.onload = function () {
    init();
}


