﻿$(function(){
    
    
    var h;
    
    function getFooterHeigth()
    {
        if (typeof(window.innerHeight) == "number")
        {
            h =  window.innerHeight - 570;
        }
        else
        {
            h =  document.documentElement.clientHeight - 570;
        }    
        if (h<100)
        {
            h=100;
        }
        return h;
    }
    
    
    
    
    $(window).resize(function(){
        $("div.footer").css({"height" : getFooterHeigth()}); 
    });
    
    $("div.footer").css({"height" : getFooterHeigth()}); 
    
    var hidePriceTimer;
    var priceBar = $("#pricebar");
    var lbl_price = $("#lbl_prices")
        
    function hidePrice()
    {
        hidePriceTimer = window.setTimeout(function(){priceBar.hide();}, 500);
    }
    
    function showPrice()
    {
        var pposition = $(this).position();
        priceBar
            .css({"left" : pposition.left - 63, "top" : pposition.top + 20, "height" : 100})
            .show();
    }
    
    lbl_price.mouseover(showPrice);
    lbl_price.mouseout(hidePrice);
    
    $("p.price").mouseover(function(){
            window.clearTimeout(hidePriceTimer);
        }
      );
          
    priceBar.mouseover(function(){
            window.clearTimeout(hidePriceTimer);
        }
      );  

    priceBar.mouseout(hidePrice);
    
    
//    btn_price.click(function(){
//        var pposition = $(this).position();
//        if (priceBar.css("display") != "none")
//        {
//            hidePrice();
//        }
//        else
//        {
//            priceBar
//                .css({"left" : pposition.left - 163, "top" : pposition.top + 20})
//                .animate({height:100}, 300);
//         }
//        }
//       );
//       
//    $("p.price").mouseover(function(){
//            window.clearTimeout(hidePriceTimer);
//        }
//      );
//          
//    priceBar.mouseover(function(){
//            window.clearTimeout(hidePriceTimer);
//        }
//      );  

//    priceBar.mouseout(function(){
//            hidePrice();
//        }
//       );
//       
//     btn_price.mouseout(
//        function(){
//               if (priceBar.css("display") != "none")
//               {
//                    hidePrice();
//               }
//        }
//       );
})
