function popup(where) {
    window.open(where, '', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, width=760, height=570, resizable=1');
}

function popupMedium(where) {
    window.open(where, '', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, width=590, height=385, resizable=1');
}

function popupSmall(where) {
    window.open(where, '', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, width=400, height=200, resizable=1');
}

function popupLarge(where) {
    window.open(where, '', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, width=780, height=570, resizable=1');
}

function externalPopup(where) {
    window.open(where);
}

function handleKeyPress(e) {
    var characterCode;

    if(e && e.which) { //if which property of event object is supported (NN4)
        e = e;
        characterCode = e.which; //character code is contained in NN4's which property
    } else {
        e = event;
        characterCode = e.keyCode; //character code is contained in IE's keyCode property
    }

    if(characterCode == 13) { //if generated character code is equal to ascii 13 (if enter key)
        document.login.submit(); //submit the form
    }
}

function goPage() {
    if(document.dropdown.cntryMenu.selectedIndex != 0) {
        window.location = document.dropdown.cntryMenu.options[document.dropdown.cntryMenu.selectedIndex].value;
    }
}

function showContactInfo(selectedIndex) {
    var contactList1 = document.getElementById('contactList1');
    var contactList2 = document.getElementById('contactList2');
    var contactList3 = document.getElementById('contactList3');

    var name1 = document.getElementById('name1');
    var name2 = document.getElementById('name2');
    var name3 = document.getElementById('name3');

    if(selectedIndex == 1) {
        changeDistImage(1);
        if(contactList1 != null) {
            contactList1.style.display = "block";
        }

        if(contactList2 != null) {
            contactList2.style.display = "none";
        }

        if(contactList3 != null) {
            contactList3.style.display = "none";
        }

        if(name1 != null) {
            name1.style.fontWeight = "bold";
        }

        if(name2 != null) {
            name2.style.fontWeight = "normal";
        }

        if(name3 != null) {
            name3.style.fontWeight = "normal";
        }
    } else if(selectedIndex == 2) {
        changeDistImage(2);
        if(contactList1 != null) {
            contactList1.style.display = "none";
        }

        if(contactList2 != null) {
            contactList2.style.display = "block";
        }

        if(contactList3 != null) {
            contactList3.style.display = "none";
        }

        if(name1 != null) {
            name1.style.fontWeight = "normal";
        }

        if(name2 != null) {
            name2.style.fontWeight = "bold";
        }

        if(name3 != null) {
            name3.style.fontWeight = "normal";
        }
    } else if(selectedIndex == 3) {
        changeDistImage(3);
        if(contactList1 != null) {
            contactList1.style.display = "none";
        }

        if(contactList2 != null) {
            contactList2.style.display = "none";
        }

        if(contactList3 != null) {
            contactList3.style.display = "block";
        }

        if(name1 != null) {
            name1.style.fontWeight = "normal";
        }

        if(name2 != null) {
            name2.style.fontWeight = "normal";
        }

        if(name3 != null) {
            name3.style.fontWeight = "bold";
        }
    }
}

function changeDistImage(photoIndex) {
    var distImage1 = document.getElementById("distImage1");
    var distImage2 = document.getElementById("distImage2");
    var distImage3 = document.getElementById("distImage3");

    if(photoIndex == 1) {
        distImage1.style.display = "block";
        distImage2.style.display = "none";
        distImage3.style.display = "none";
    } else if(photoIndex == 2) {
        distImage1.style.display = "none";
        distImage2.style.display = "block";
        distImage3.style.display = "none";
    } else if(photoIndex == 3) {
        distImage1.style.display = "none";
        distImage2.style.display = "none";
        distImage3.style.display = "block";
    }
}