﻿
$().ready(function () {
    $(".row-item").click(function () {
        var that = $(this);
        $(".row-item div").animate({
            marginTop: 0
        }, 500);

        $(".banner-context").hide();
        that.find("div").animate({
            marginTop: "-35px"
        }, 500, null, function () {
            $("#banner-" + that.attr("id")).fadeIn(500)
        });

        return false;
    });
    /*if ($(".text-content-view").height() < 350) {
        $(".text-content-view").css("height", 350);
    }*/
    setMenu();
    setFooter();
	$(".page-menu ul li").hover(function(){$(this).addClass("active-selected");},function(){$(this).removeClass("active-selected");})

});

function createProducts(xml) {
    console.log(xml);
}

function setMenu(){
   var x = document.location.href;
   var y = x.split(".com")[1]
   var z = y.split("/")[1]
   $(".page-menu-view-item").each(function () {
       if (z == $(this).attr("rel")) {
           $(this).show();
       }
   });
   $(".page-menu-view-item ul li").each(function () {
       if (y == $("a", this).attr("href")) {
           $(this).addClass("active-selected");
           $(this).parents("li").addClass("active-selected");
       }
   });
   $(".navigation li").each(function () {
       if ($(this).attr("class").split("nav-")[1] == z) {
           $(this).addClass("selected");
       }
   });
}

function setFooter() {
    if ($(window).height() > parseInt($("#header").height() + $("#content").height() + $("#footer").innerHeight())) {
        $("#footer").css("margin-top", $(window).height() - parseInt($("#header").height() + $("#content").height() + $("#footer").innerHeight() + 10) + "px");
    }
    else {
        $("#footer").css("margin-top", "auto");
    }
}

