function changeBrand()
{
	//location.href = '?brand=' + $F('shop_brand') + ($F('shop_discount') == '1' ? '&discount=' + $F('shop_discount') : '');
	location.href = '?brand=' + $F('shop_brand') + 
					($F('shop_discount') == '1' ? '&discount=' + $F('shop_discount') : '') + 
					($F('shop_show_prices') == '1' ? '&show_prizes=' + $F('shop_show_prices') : '');
}

function keypressedToNextInput(e)
{
	var key;

    if(window.event)
         key = window.event.keyCode;     //IE
    else
         key = e.which;     //firefox

    if(key == 13){
    	var nextElement = $(e).up().next().down();
    	if(nextElement){
    		if(nextElement.hasClassName('input-box')){
    			nextElement.focus();
    		}
    	}
    	return false;
    }
    return true; 
}

var brothers = {
	init: function(){
		$$('div.brother_area').each(function(el){
			var info = el.firstDescendant();
			
			el.setStyle({cursor:'pointer'});
			Element.observe(el, 'mouseover', function(){
				info.setStyle({display:'block'});
			});
			Element.observe(el, 'mouseout', function(){
				info.setStyle({display:'none'});
			});
		});
		$$('div.info').each(function(el){
			el.setStyle({display:'none'});
		});
        if($('brother_floris_link')){
            $('brother_floris_link').observe('click', function(e){
                Event.stop(e);
                $(this.id.substr(0, this.id.length - 5)).setStyle({
                    display: 'block'
                });
            });
            $('close_floris').observe('click', function(e){
                Event.stop(e);
                $('brother_' + this.id.substr(6)).setStyle({
                    display: 'none'
                });
            });
        }
        if($('brother_pepijn_link')){
            $('brother_pepijn_link').observe('click', function(e){
                Event.stop(e);
                $(this.id.substr(0, this.id.length - 5)).setStyle({
                    display: 'block'
                });
            });
            $('close_pepijn').observe('click', function(e){
                Event.stop(e);
                $('brother_' + this.id.substr(6)).setStyle({
                    display: 'none'
                });
            });
        }
        if($('brother_reynier_link')){
            $('brother_reynier_link').observe('click', function(e){
                Event.stop(e);
                $(this.id.substr(0, this.id.length - 5)).setStyle({
                    display: 'block'
                });
            });
            $('close_reynier').observe('click', function(e){
                Event.stop(e);
                $('brother_' + this.id.substr(6)).setStyle({
                    display: 'none'
                });
            });
        }
	}
}

var links = {
	init: function(){
		$$('a.anchor').each(function(el){
			Element.observe(el, 'click', function(e){
				e.stop(e);
				Effect.ScrollTo($(el.rel), {durantion: 2});
			});
		});
		$$('a.top').each(function(el){
			Element.observe(el, 'click', function(e){
				e.stop(e);
				Effect.ScrollTo($('container'), {durantion: 2});
			});
		});
	}
}

var thumbs = {
  init: function(){
    $$('#thumbs a').each(function(el){      
      Element.observe(el, 'click', function(e){
        e.stop(e);
        $('shoe_image').src = imageUrl + '../uploads/shoes/' + this.rel;
      });
    });
  }
}

var shop_thumbs = {
  init: function(){
    $$('#shop_thumbs a').each(function(el){      
      Element.observe(el, 'click', function(e){
        e.stop(e);
        $('shop_image').src = imageUrl + '../uploads/auth_shops/' + this.rel;
      });
    });
  }
}

document.observe('dom:loaded', function(){
	brothers.init();
	links.init();
	thumbs.init();
	shop_thumbs.init();
}, false);