// turn on this img if not already on
function rollOver(obj){obj.src = obj.src.replace(/(\.[a-z0-9]+)$/i,'_on$1');};

// turn off this img if not off
function rollOff(obj){obj.src = obj.src.replace(/_on(\.[a-z0-9]+)$/i,'$1');};

// behaviour rules
var rules = {
    '.email'  : function(element){
        element.onclick     = function (event) {
            var k = window.open(this.href, 'Inquiry', 'width=333,height=333,scrollbars=no');
            k.focus();
            return false;
        }
    },
    'a'   : function(element){
        element.onfocus = function(event) {
            this.blur();
        }
    },
    '#go' : function(element){
        element.onclick     = function () {
            var val    = $('value').value;
            if(val){
                window.location = '/items/search/' + encodeURI(val);
                return;
            }
            return false;
        }
    },
    '#value' : function(element){
        element.onkeydown    = function (event) {
            if(event.keyCode == 13){
                window.location = '/items/search/' + encodeURI(this.value);
                return;
            }
        }
    }
};

Behaviour.register(rules);


Behaviour.addLoadEvent( function()
{
    /*
    var k = new Array();
    
    for(var i = 1; i <= 6; i++){
        k[i]     = new Image();
        k[i].src = $('i'+i).src.replace(/(\.[a-z0-9]+)$/i,'_on$1');
        $('debug').innerHTML = k[i].src;
    }
    */
});
