﻿$(document).ready(function () {
    $("#accordion > li > div").click(function () {
        $("#accordion > li > div").css('font-weight', 'normal');
        if (false == $(this).next().is(':visible')) {
            //            $(this).css('font-weight', 'bold');
            //            $('#accordion ul').slideUp(300);
            //            $("#imgContent").attr('src', $(this).attr('id'));
        }
        //$(this).next().slideToggle(300);
    });

    $("#accordion > li ul> li > a").click(function () {
        //        $("#accordion > li ul> li > a").css('font-weight', 'normal');
        //        $(this).css('font-weight', 'bold');
        //        $("#imgContent").attr('src', $(this).attr('id'));
        $("#imgContent").protectImage();
    });
    $('.quest').click(function () {
        //$('.answer').slideToggle(300);

        $(".quest").css('font-weight', 'normal');
        if (false == $(this).next().is(':visible')) {
            $(this).css('font-weight', 'bold');
            $('.answer').slideUp(300);
        }
        else {
            $("#A" + $(this).attr("id")).hide();
            $(this).css('font-weight', 'normal');
            return;
        }
        $(this).next().slideDown(300);
    });
    $(".Image1").click(function () {
        window.location = '/coleccoes/jardim.html'
    });
    $(".Image3").click(function () {
        window.location = '/coleccoes/anjinho.html'
    });
    $(".Image6").click(function () {
        window.location = '/coleccoes/lollipop.html'
    });
    $(".Image8").click(function () {
        window.location = '/coleccoes/fundomar.html'
    });

});
jQuery.fn.protectImage = function(settings) {
	settings = jQuery.extend({
	    image: '/Images/blank.gif',
		zIndex: 10
	}, settings);

	return this.each(function() {
		var position = $(this).offset();
		var height = $(this).height();
		var width = $(this).width();
		var width = $(this).width();
		$('<img />').attr({
			width: width,
			height: height,
			src: settings.image
		}).css({
			border: '0px solid',
			top: position.top,
			left: position.left,
			position: 'absolute',
			zIndex: settings.zIndex
		}).appendTo('body')
	});
};

$(window).bind('load', function() {
	$('#imgContent').protectImage();
});

