﻿// JScript File
function showSubMenu(nMenu)
{
    var subMenu = document.getElementById("middleColumn");
    subMenu.innerHTML = menus[nMenu][0];
    subMenu.style.visibility = "visible";
    
    // hide end menu:
    var endMenu = document.getElementById("endColumn");
    endMenu.style.visibility = "hidden";
    
    // make the link selected:
    var link = document.getElementById("mainLink" + nMenu);
    link.className = "selectedLink";
}

function showEndMenu(nMenu, nSubMenu)
{
    var subMenu = document.getElementById("endColumn");
    subMenu.innerHTML = menus[nMenu][1][nSubMenu];
    subMenu.style.visibility = "visible";
}
function showContact()
{
    var subMenu = document.getElementById("middleColumn");
    subMenu.innerHTML = contact[0];
    subMenu.style.visibility = "visible";
    
    var endMenu = document.getElementById("endColumn");
    endMenu.innerHTML = contact[1];
    endMenu.style.visibility = "visible";
}
function onMouse(nImage)
{
    if (document.images)
    {
        var preview = document.getElementById("previewImg");
        preview.src = image_url[nImage];
    }
}
function offMouse()
{
    if (document.images)
    {
        var preview = document.getElementById("previewImg");
        preview.src = image_url[0];
    }
}

function hideIt(theControl){

    for (var subCategory = 1; document.getElementById(theControl + "_subcategory" + subCategory) != null; subCategory++){
        if (document.getElementById(theControl + "_subcategory" + subCategory).className.lastIndexOf('-hidden') != -1)
            document.getElementById(theControl + "_subcategory" + subCategory).className = document.getElementById(theControl + "_subcategory" + subCategory).className.replace('-hidden', '');
        else
            document.getElementById(theControl + "_subcategory" + subCategory).className += '-hidden';
    }
}
function showIt(theControl){
    if (theControl.className == "hidden")
        theControl.className = "not-hidden";
    else
        theControl.className = "hidden";
}
function changePlusMinus(theImage){
    if (document.getElementById(theImage).childNodes[0].src.lastIndexOf("plus") == -1)
        document.getElementById(theImage).childNodes[0].src = document.getElementById(theImage).childNodes[0].src.replace("minus", "plus");
    else
        document.getElementById(theImage).childNodes[0].src = document.getElementById(theImage).childNodes[0].src.replace("plus", "minus");
}
function rowOver2(theRow, secondclass){
    theRow.className = theRow.className + '-over';
    theRow.children[1].className = theRow.className + '-over';
}
function rowOver(theRow){
    for (var i=0; i < document.getElementById(theRow).childNodes.length; i++){
         document.getElementById(theRow).childNodes[i].className = document.getElementById(theRow).childNodes[i].className + '-over';
    }
}
function checkRowOut(theRow, secondRow){
    if (document.getElementById(secondRow).className == "invisible")
        rowOut(theRow);
}
function rowOut(theRow){
    
        for (var i=0; i < document.getElementById(theRow).childNodes.length; i++){
            document.getElementById(theRow).childNodes[i].className = document.getElementById(theRow).childNodes[i].className.replace('-over', '');
        }
}
function changeChecked(theCheckBox){
    theCheckBox.checked = (theCheckBox.checked == true) ? false : true;
}
function objOver(obj){
    if (obj.className.lastIndexOf("-over") == -1){
        obj.className = obj.className + " " + obj.className + '-over';
    }
}
function objOut(obj){
    if (obj.className.indexOf(' ') > -1)
    {
        obj.className = obj.className.substr(0, obj.className.indexOf(' '));
    }
}
function changeText(ID, newText){
    document.getElementById(ID).innerHTML = newText;
}
function checkEnter(event, button)
{
    if (event.keyCode == 13)
    {
        event.returnValue = false;
        event.cancel = true;
        button.click();
        
    }
}
var newwindow;
function popwindow(url, width, height)
{
	newwindow=window.open(url,'popwindow', "height=" + height + ",width=" + width + ", scrollbars=no, resizable=no, menubar=no, titlebar=no, toolbar=no, status=no, location=no");
	if (window.focus) {newwindow.focus()}
}
function popwindow(url, width, height, scroll)
{
	newwindow=window.open(url,'popwindow', "height=" + height + ",width=" + width + ", scrollbars=" + scroll + ", resizable=no, menubar=no, titlebar=no, toolbar=no, status=no, location=no");
	if (window.focus) {newwindow.focus()}
}
function hideTD(tdID)
{
    theTD = document.getElementById(tdID);
    theTD.style.display = "none";
}
function hideObj(objId)
{
    obj = document.getElementById(objId);
    obj.style.display = "none";
}
function showObj(objId)
{
    obj = document.getElementById(objId);
    obj.style.display = "inline";
}
function switchHideObj(objId)
{
    obj = document.getElementById(objId);
    if (obj.style.display == "none")
        obj.style.display = "inline";
    else
        obj.style.display = "none";
}
function showTD(tdID)
{
    theTD = document.getElementById(tdID);
    theTD.style.display = "inline";
}
function onOver(idStr){
    theObject = document.getElementById(idStr);
    if (theObject.className.lastIndexOf("-over") == -1){
        theObject.className = theObject.className + '-over';
    }
}
function onOut(idStr){
    theObject = document.getElementById(idStr);
    theObject.className = theObject.className.replace('-over', '');
}