function mproduse(event){
  event.stopPropagation();
  if($("#smProduse").css("display")=="block") {
    $("#smProduse").fadeOut("fast",function(){$(".subMenuBackground").slideUp("slow");});
  } else 
    if($(".subMenuBackground").css("display")=="block") mproduseR()
      else mproduseT();
}
function mproduseR(){
  $("#smSfaturi").fadeOut("fast");
  $("#smProduse").fadeOut("fast");
  $("#smContact").fadeOut("fast",function(){
    $(".subMenuBackground").slideUp("fast",mproduseT);
  });
}
function mproduseT(){
  $(".subMenuBackground").height(115);
  $(".subMenuBackground").slideDown("slow",function(){
    $("#smProduse").fadeIn("slow");
  });
}

function msfaturi(event){
  event.stopPropagation();
  if($("#smSfaturi").css("display")=="block") {
    $("#smSfaturi").fadeOut("fast",function(){$(".subMenuBackground").slideUp("slow");});
  } else 
    if($(".subMenuBackground").css("display")=="block") msfaturiR()
      else msfaturiT();
}
function msfaturiR(){
  $("#smSfaturi").fadeOut("fast");
  $("#smProduse").fadeOut("fast");
  $("#smContact").fadeOut("fast",function(){
    $(".subMenuBackground").slideUp("fast",msfaturiT);
  });
}
function msfaturiT(){
  $(".subMenuBackground").height(45);
  $(".subMenuBackground").slideDown("slow",function(){
    $("#smSfaturi").fadeIn("slow");
  });
}

function mcontact(event){
  	event.stopPropagation();
  if($("#smContact").css("display")=="block") {
    $("#smContact").fadeOut("fast",function(){$(".subMenuBackground").slideUp("slow");});
  } else 
    if($(".subMenuBackground").css("display")=="block") mcontactR()
      else mcontactT();
}
function mcontactR(){
  $("#smSfaturi").fadeOut("fast");
  $("#smProduse").fadeOut("fast");
  $("#smContact").fadeOut("fast",function(){
    $(".subMenuBackground").slideUp("fast",mcontactT);
  });
}
function mcontactT(){
  $(".subMenuBackground").height(60);
  $(".subMenuBackground").slideDown("slow",function(){
    $("#smContact").fadeIn("slow");
  });
}
      
$(document).ready(function(){
  $(".subMenuBackground").css("opacity","0.9");
  $(".sideSpacer").css("width",Math.round( ($(window).width() - 749)/2 ));
  $(".splashCalcContainer").css("left",Math.round( ($(window).width() - 749)/2 + 486));
  $(".footer").css("position","relative");
  $("#mproduse").click(mproduse);
  $("#msfaturi").click(msfaturi);
  $("#mcontact").click(mcontact);
  $(".subMenuText").click(function(event){
  	event.stopPropagation();
    $("#smSfaturi").fadeOut("fast");
    $("#smProduse").fadeOut("fast");
    $("#smContact").fadeOut("fast",function(){
      $(".subMenuBackground").slideUp("slow");
    });
  });
  $("body").click(function(){
    $("#smSfaturi").fadeOut("fast");
    $("#smProduse").fadeOut("fast");
    $("#smContact").fadeOut("fast",function(){
      $(".subMenuBackground").slideUp("slow");
    });
  });
});
