// FUNCTIONS EXECUTED WHEN DOM IS BUILD
$(document).ready(function() {

	miniDetect();
	initRight();
	initLeft();
	initAGrade();

	// STEP 1: Show Accessory description
	$(".showproddesc").click(function() {
		$(this).hide();
		$(this).next().show();
		$(this).parent().parent().parent().find(".productdescription").show();
	});
	
	$(".hideproddesc").click(function() {
		$(this).hide();
		$(this).prev().show();
		$(this).parent().parent().parent().find(".productdescription").hide();
	});
		
	// STEP 1: Show B_grade accessory
	$(".showmoreacc").click(function() {
		$(this).hide();
		$(".showlessacc").show();
		$(".B_grade").show();
	})

	$(".showlessacc").click(function() {
		$(this).hide();
		$(".showmoreacc").show();
		$(".B_grade").hide();
	})
			 
});

function initAGrade() {	
	if( ($("#accessories").find("li").is(".A_grade")) && ($("#accessories").find("li").is(".B_grade"))) {
		$(".showmoreacc").show();
		$(".B_grade","#accessories").hide();		
	}
}
