// Fade-in for all Images


$(document).ready(function(){
						   
                            $("img").fadeTo("fast", 1.0); // This sets the opacity of the thumbs to fade down to 100% when the page loads
                            $("img").hover(function(){
                            $(this).fadeTo("fast", 0.8); // This should set the opacity to 80% on hover
                            },function(){
                            $(this).fadeTo("fast", 1.0); // This should set the opacity back to 100% on mouseout
                            });
                            });


// Toggle Category List

$(function(){
	
	$('.boxes').slideToggle("fast");
	$(".box_head").each(function (i) {
        idelem = $(this).attr('id');
		idelemdiv = idelem.replace('boxhead_', 'box_');
		change_boximage(idelem);
    });


	$('.box_head').click(function(){
		idelem = $(this).attr('id');
		idelemdiv = idelem.replace('boxhead_', 'box_');
		$('#'+idelemdiv).slideToggle("normal");
		change_boximage(idelem);
	});

	$('.box_head').hover(
		function() { $(this).css('cursor', 'pointer'); },
		function() { $(this).css('cursor', 'default'); }
	);
});

function change_boximage(elem){
	src = $('#'+elem).attr('src');
	if (src.indexOf("_open") >= 0){
		src = src.replace('_open', '_close');
	} else {
		src = src.replace('_close', '_open');
	}
	src = $('#'+elem).attr('src', src);
}




