$(document).ready(function(){
	
	// homepage tabs
	$('#hp-tabcluster .tabcluster-tabs ul li').bind('click', function(){
		$('.tabcluster-tabs ul li').each(function(){$(this).removeClass('active');})
		
		$(this).addClass('active');
		
		$('#tcp-topsellers, #tcp-whatsnew, #tcp-ecofriendly, #tcp-seasonal').hide();
		$($(this).attr('rel')).show();
	});
	
	// left nav accordionify
	$('#fw-leftnav ul li div').bind('click', function(){
		$(this).parent('li').children('ul').slideToggle();
	});
	
	// product detail tabs
	$('.tab-control .ttabs .ttab').bind('click', function(e){
		e.preventDefault();    
		
		$(this).parent('.ttabs').children('a').removeClass('active');
		$(this).addClass('active');
		tcontent = $(this).parent('.ttabs').parent('.tab-control').children('.tab-content');
		tcontent.children('div').hide();
		tcontent.children($(this).attr('href')).show();
	});
	
});

function __doPostBack(eventTarget, eventArgument) {
	
	var theForm = document.forms['aspnetForm'];
	if (!theForm) {
		theForm = document.aspnetForm;
	}
	
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}

