/*
* Mouse Over functions
* <div> elements.
*
* by Peter Heibrink, http://www.vanadgroup.com/
*/
function mouseOverColorAndShowContent(elementType, activeInfoItem, inactiveInfoClass, activeInfoClass, activeExtraInfoItem, inactiveExtraInfoClass, activeExtraInfoClass) {
    var divs = document.getElementsByTagName(elementType);
    for (var i = 0; i < divs.length; i++) {
        var theDiv = divs[i];

        if (theDiv.Id != activeInfoItem && theDiv.className.match(activeInfoClass)) {
            theDiv.className = inactiveInfoClass;
        }
        if (theDiv.Id != activeExtraInfoItem && theDiv.className.match(activeExtraInfoClass)) {
            theDiv.className = inactiveExtraInfoClass;
        }
    }

    var activeInfoDiv = document.getElementById(activeInfoItem);
    activeInfoDiv.className = activeInfoClass;
    var activeExtraInfoDiv = document.getElementById(activeExtraInfoItem);
    activeExtraInfoDiv.className = activeExtraInfoClass;

    
}

function mouseOverColor(elementType, activeInfoItem, inactiveInfoClass, activeInfoClass) {

    var divs = document.getElementsByTagName(elementType);

    for (var i = 0; i < divs.length; i++) {
        var theDiv = divs[i];

        if (theDiv.Id != activeInfoItem && theDiv.className.match(activeInfoClass)) {
            theDiv.className = inactiveInfoClass;
        }
    }

    var activeInfoDiv = document.getElementById(activeInfoItem);
    if (activeInfoDiv != null) {
        activeInfoDiv.className = activeInfoClass;
    }
}



function changeRef(element, image) {

    $('#RefImage').attr('src', image);
    $('#' + element).css('display', 'block');
   

   if ($('#previousRef').attr('value') != element) {
       var oldElement = $('#previousRef').attr('value');
      $('#' + oldElement).hide();
   }
   $('#previousRef').attr('value',element);

}
/*
* JQuery MEnu
*
* by Peter Heibrink, http://www.vanadgroup.com/
*   Original by Christian Budschedl, http://www.kriesi.at/
*/
function mainmenu() {
    $(" #TopNavigation ul ").css({ display: "none" }); // Opera Fix
    $(" #TopNavigation li").hover(function() {
        $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(0);
    }, function() {
        $(this).find('ul:first').css({ visibility: "hidden" });
    });
}

$(document).ready(function() {
    mainmenu();
});

/*
 * Clear Default Text: functions for clearing and replacing default text in
 * <input> elements.
 *
 * by Ross Shannon, http://www.yourhtmlsource.com/
 */

addEvent(window, 'load', init, false);

function init() {
    var formInputs = document.getElementsByTagName('input');
    for (var i = 0; i < formInputs.length; i++) {
        var theInput = formInputs[i];
        
        if (theInput.type == 'text' && theInput.className.match(/\bcleardefault\b/)) {  
            /* Add event handlers */          
            addEvent(theInput, 'focus', clearDefaultText, false);
            addEvent(theInput, 'blur', replaceDefaultText, false);
            
            /* Save the current value */
            if (theInput.value != '') {
                theInput.defaultText = theInput.value;
            }
        }
    }
}

function clearDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == target.defaultText) {
        target.value = '';
    }
}

function replaceDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == '' && target.defaultText) {
        target.value = target.defaultText;
    }
}
