$(document).ready(function () {

    //.btn-submit
    $(".btn-submit").click(function () {
        $(this).parent().submit();
    });

    //.btn-submit
    $(".btn-search").click(function () {
        $(this).parents().eq(1).submit();
    });

    //.send
    //	$(".default-form .send").click(function(event){
    //		event.preventDefault();
    //		$(".default-form").submit();
    //	});

    //form
    if ($("form").length) {
        $("form").Forms();
    }

    if ($(".selectbox").length) {
        $(".selectbox").selectbox();
    }

    //#product-slideshow
    if ($("#product-slideshow .pictures ul li a").length) {
        $("#product-slideshow .pictures ul li a").jqzoom();
    }

    //pictureOverlay
    if ($("#ultimas-noticias .overlay").length) {
        $("#ultimas-noticias").pictureOverlay();
    }

    //#slideshow
    if ($("#slideshow").length) {
        $("#slideshow").Slideshow();
    }


    //#product-slideshow
    if ($("#product-slideshow").length) {
        $("#product-slideshow").Slideshow();
    }

    //#news-slideshow
    if ($("#news-slideshow").length) {
        $("#news-slideshow").Slideshow();
    }

    //inputfile
    if ($("#arquivo span").length) {
        $("#arquivo span").InputFile();
    }

    //menu
    if ($("#menu").length) {
        $("#menu").Submenu();
    }


    //------------------------------------------------------------->

    /*
	
    //#btn-downloads
    $("#btn-downloads").click(function(){
    document.location = $("base").attr("href") + "?location=downloads";							   
    });
	
    //#btn-finalizar-orcamento
    $("#btn-finalizar-orcamento").click(function(){
    document.location = $("base").attr("href") + "";							   
    });
	
    //#btn-logout
    $("#btn-logout").click(function(){
    document.location = $("base").attr("href") + "";							   
    });
	
    //#btn-continuar-orcando
    $("#btn-continuar-orcando").click(function(){
    document.location = $("base").attr("href") + "";							   
    });
	
    //#btn-cancelar-orcamento
    $("#btn-cancelar-orcamento").click(function(){
    document.location = $("base").attr("href") + "";							   
    });
	
    */

    //------------------------------------------------------------->

    //#btn-assine
    //	$("#btn-assine").click(function(){
    //		Msgboxes(
    //			"Assine nossa newsletter", 
    //			"Assine nossa newsletter e receba <br />not&iacute;cias em seu email.", 
    //			{"try-again" : false, "close" : false, "no" : false, "yes" : false}, 
    //			true
    //		);
    //	});

    $("#outras-colecoes").click(function (event) {
        event.preventDefault();
        $("#more-items").slideToggle();
        $("html, body").animate({ scrollTop: $(this).offset().top }, 1000);
    });

    if ($("a.colorbox").length) {
        $("a.colorbox").colorbox({ rel: 'amplia' });
    }

    $("#details-pic .btn-expand-collapse").click(function () {
        var btn = $(this);
        if (btn.is(".less")) {
            $('.description').animate({
                left: '-=350'
            }, 500, function () {
                var altura = $('.description').height() + 21;
                btn.removeClass("less").addClass("more");
                btn.parent().addClass("closed");
                btn.parent().css('left', '0px');
                btn.parent().css('bottom', altura + 'px');
            });
        } else {

            btn.parent().removeClass("closed");
            btn.parent().css('left', '-350px');
            btn.parent().css('bottom', '30px');
            btn.parent().removeClass("closed");
            $('.description').animate({
                left: '+=350'
            }, 500, function () {
                btn.removeClass("more").addClass("less");
                //btn.parent().css('left', '0px');
                //btn.parent().css('bottom', '30px');
            });
        }
    });

    //hover link lista produtos

//    $(".default-list .item a").hover(function () {
//        $(this).parent().find("a").css("color", "#CC7F7F");
//    }, function () {
//        $(this).parent().find("a").css("color", "#333");
//    });

    $(".item.new").click(function () {
        document.location = $(this).find("a:eq(0)").attr("href");
    });

});
