﻿

// Scripts to run on every page when the DOM is loaded.
window.addEvent('domready', function(){
    // Enable the automatic hide of a default value in a text box
    showHideDefaultValue($$('.showHideDefaultValue'));
});


// Enable the automatic hide of a default value in a text box
function showHideDefaultValue(elements) {
    elements.each(function(item){
        if ($type(item) == 'element' && (item.type == 'text' || item.type == 'textarea')) {
            item.addEvent('focus', function(){
                if (this.retrieve('initValue') == null) { this.store('initValue', this.value); }
                if (this.retrieve('initValue') == this.value) { this.value = ''; }
            });
            item.addEvent('blur', function(){
                if (this.value == '') { this.value = this.retrieve('initValue'); }
            });
        }
        if ($type(item) == 'element' && item.type == 'password') {
            item.addEvent('focus', function(){
                if (this.retrieve('initValue') == null) { this.value = ''; this.store('initValue', ''); }
            });
        }
    });
}


// 
var showSimpleSearch=function(){
    try{
        $$('div.simpleSearchPanel')[0].style.display='block';
        $$('div.advancedSearchPanel')[0].style.display='none';
        var c=Cookie.write('SearchPanelState','simple');
    }catch(e){}
};


// 
var showAdvancedSearch=function(){
    try{
        $$('div.simpleSearchPanel')[0].style.display='none';
        $$('div.advancedSearchPanel')[0].style.display='block';
        var c=Cookie.write('SearchPanelState','advanced');
    }catch(e){}
};


function showhide(layer_ref) {
    var hza = document.getElementById(layer_ref);
    var state = hza.style.display;

    if (state == 'block') {
        state = 'none';
    }
    else {
        state = 'block';
    }
    hza.style.display = state;
}

