﻿function changecolor(id, color) {
    document.getElementById(id).style.background = color;
}//end funcation
function SearchItem(domain) {
    
    if ((document.getElementById('ctl00_commonSearch_txtSearchFor').value != '') && (document.getElementById('ctl00_commonSearch_txtSearchNear').value != '')) {
        location.replace(domain + '/redir.aspx?item=' + document.getElementById('ctl00_commonSearch_txtSearchFor').value + '&location=' + document.getElementById('ctl00_commonSearch_txtSearchNear').value);
    }
    else {
        alert('Both Search Item and Location are Required.\nPlease Enter Search Item and Location, and try again.');
    }
} //end function

function EnterKeyPress(domain) {
    if (event.keyCode == '13') {
        if ((document.getElementById('ctl00_commonSearch_txtSearchFor').value != '') && (document.getElementById('ctl00_commonSearch_txtSearchNear').value != '')) {
            location.replace(domain + '/redir.aspx?item=' + document.getElementById('ctl00_commonSearch_txtSearchFor').value + '&location=' + document.getElementById('ctl00_commonSearch_txtSearchNear').value);
        }
        else {
            alert('Both Search Item and Location are Required.\nPlease Enter Search Item and Location, and try again.');
        }
    }
} 
function DE(el) { return document.getElementById(el); }
function SetIH(id, v) { var e = DE(id); e.innerHTML = ''; e.innerHTML = v; }
function SH(id, s) { var e = DE(id); if (s) { e.style.display = 'block'; } else { e.style.display = 'none'; } }
function SelectAllCheckboxes(spanChk) {

    // Added as ASPX uses SPAN for checkbox
    var oItem = spanChk.children;
    var theBox = (spanChk.type == "checkbox") ?
        spanChk : spanChk.children.item[0];
    xState = theBox.checked;
    elm = theBox.form.elements;

    for (i = 0; i < elm.length; i++)
        if (elm[i].type == "checkbox" &&
              elm[i].id != theBox.id) {
        //elm[i].click();
        if (elm[i].checked != xState)
            elm[i].click();
        //elm[i].checked=xState;
    }
} //end function

function ShowTab(id, basic, personal, contact, account) {
    if (id == basic) {
        document.getElementById(basic).style.display = 'block';
        document.getElementById(personal).style.display = 'none';
        document.getElementById(contact).style.display = 'none';
        document.getElementById(account).style.display = 'none';
    }
    else if (id == personal) {
        document.getElementById(basic).style.display = 'none';
        document.getElementById(personal).style.display = 'block';
        document.getElementById(contact).style.display = 'none';
        document.getElementById(account).style.display = 'none';
    }
    else if (id == contact) {
        document.getElementById(basic).style.display = 'none';
        document.getElementById(personal).style.display = 'none';
        document.getElementById(contact).style.display = 'block';
        document.getElementById(account).style.display = 'none';
    }
    else {
        document.getElementById(basic).style.display = 'none';
        document.getElementById(personal).style.display = 'none';
        document.getElementById(contact).style.display = 'none';
        document.getElementById(account).style.display = 'block';
    }
}
