window.addEvent('domready', function() {

	//init the accordion
	new Accordion($('quick_order_sections'), $$('#quick_order_sections .toggler'), $$('#quick_order_sections .content'), {
		opacity: false,
		show: 0,
		onActive: function(toggler, element){ toggler.morph('.header4'); toggler.setStyle('backgroundImage', 'url(images/down_arrow.gif)'); },
                onBackground: function(toggler, element){ toggler.morph('.header3'); toggler.setStyle('backgroundImage', 'url(images/right_arrow.gif)'); }
	})


	$('new_combo_form').addEvent('submit', function(e) {
                e = new Event(e).stop();
                var form = $('new_combo_form');
                form.set('send', { url: 'io/add_shopping_cart_combo.php', method: 'post', onRequest: showShader, onSuccess: showCartResult });
                form.send();
        });

});

function showCartResult(html) {
        var target = $('account_shopcart');
        target.setStyle('visibility', 'hidden');
        
        target.set('html', html)
        .set('tween', { duration: 700, onComplete: function(){ $('shader').set('html', ''); } })
        .fade(0, 1);
        
        if(Browser.Engine.trident) {
                target.center(); 
                window.addEvent('resize', function(e) { target.center(); });
                window.addEvent('scroll', function(e) { target.center(); });
        } else {
                var top = window.getSize().y.toInt()/2 - target.getSize().y.toInt()/2;
                var left = window.getSize().x.toInt()/2 - target.getSize().x.toInt()/2;
                target.setStyles({ 
                        'top': top,
                        'left': left
                });
                target.setStyle.delay(200, target, ['position', 'fixed']);
        }
}

function validateComboForm() {
        return true;
}

