
var avCombinations = new Array();

function showRelated (color, current){
	if (color > 0) {
		$("#main .extras-list").hide();
		$("#relatedcolor-"+color).fadeIn(500);
	}		
}


$(document).ready(function(){
	
	$('.btn, .btn-round').corner();
	$('.tabs li').corner();
	
	/* Country selector */
	$("#country-sel").change(function() {
		window.location = $(this).val();
	});
	
	/* image slides */

	if ( $('.bigimage').length ){
		$('.wrapper-content').cycle({ fx:'fade', pager:'#tabs'});
	}
	
	$('.popup').click( function() {
        window.open( '/' + $(this).attr('href'), "","menubar=0, location=0,status=0,toolbar=0, scrollbars=1, width=800,height=400" );
        return false;
    });
	
	/* basket alert if product out of stock */
    if ( $('#basket-no-stock').length ){
	  	$('#basket-no-stock').fadeIn( 2000, function (){
	  		$('#basket-no-stock').animate({opacity: 1.0}, 2000).fadeOut(2000);
	  	});
	}
		
	$(".chain-selectors-1").show(); 
	$(".com-list-action-entry input").attr("disabled", "disabled");
	$("#attr-1").change(function(){
		var id = parseInt(this.id.split("-")[1]);
		showRelated($(this).val());
	}).change();
	
	
//	$('img[@src$=.png]').ifixpng();
//	$('a.lightbox').lightbox();
	
	
	/* collapsing  menu for category tree */
	$("a.toggle").click( function (){
		list = $(this).parent("li");
		if ($(list).hasClass("expanded")){
			$(this).next().hide();
			$(list).removeClass("expanded");
		}else {
			$(this).next().show();
			$(list).addClass("expanded");
		}
		return false;
	});
});
