
function handleClick(button)

{

    var menu_name;
    if(button.id=="button1")
    {
        menu_name="corporate"
    }
    else
    if(button.id=="button2")
    {
        menu_name="solutions"
    }
    else
    if(button.id=="button3")
    {
        menu_name="references"
    }
    else
    if(button.id=="button4")
    {
        menu_name="contact"
    }
    else
    if(button.id=="button5")
    {
        menu_name="midwife"
    }
    else
    if(button.id=="button6")
    {
        menu_name="news"
    }
    else
    if(button.id=="button7")
    {
        menu_name="press"
    }
        animateButton(menu_name);
}

function animateButton(menu_name)
{

       
     //calculate screen size
    var winXY = getWindowCoords();
    var topX = (winXY[1]*0.05+374); 
        //choose the right background:
    if(menu_name=="contact" || menu_name=="midwife")
    {
          $j("#boomContentBackground").css("backgroundImage","url('"+BOOMCONTENTBACKGROUNDSMALL+"')");
    }
    $j("#boomCenter").animate(
    {
        left:"0px",
        top:"0px",
        width:"100%",
        height:winXY[1]+"px",
    },900,function()
    {
        finishBoom(menu_name);
        
    });
    animateContentBackground('open');
    $j("#boomHeader").css("display","block");   
    $j("#boomBackground").css("z-index","2");
     $j("#boomBackground").animate(
    {
        width:"100%",
        height:"100%",
        left:"0px",
        filter:"alpha(opacity=100)",
        opacity:"1.0"
    },2000);
    

 }
 
function animateContentBackground(type)
{
    
         var contentBackgroundHeight = $j("#boomContentBackground").height();
        if(type=="open"){
        $j("#boomContentBackground").css("height","0px");
          $j("#boomContentBackground").animate(
          {
            height:contentBackgroundHeight+"px",
          
          },900
          );
            $j("#boomContentBackground").css("display","block");  
         }
         else if(type=="close")
         {

            $j("#boomContentBackground").animate(
          {
            height:"0px",
          
          },900, function()
          {
            $j("#boomContentBackground").css("display","none");
            $j("#boomContentBackground").css("height",contentBackgroundHeight+"px");
          }
          );
            
         }


}

function finishBoom(menu_name)
{
     $j("#boomContentBackground").css("display","block");  
    if(menu_name=="corporate")
    {

        loadCorporate();
    }
    
    else if(menu_name=="solutions")
    {
         
        loadSolutions();
    }
    
    else if(menu_name=="references")
    {
    
        loadReferences();
    }
    
    else if(menu_name=="contact")
    {
    
        loadContact();
    }
    
    else if(menu_name=="midwife")
    {
    
        loadMidwife();
    }
    
    else if(menu_name=="news")
    {
    
        loadNews();
        
    }
    
    else if(menu_name=="press")
    {
    
        loadPress();
    }
}

function closeBoom()
{
    //calculate screen size
    var winXY = getWindowCoords();
    var topX = (winXY[1]*0.05+374);
    $j("#boomCenter").css("height",winXY[1]);
    $j("#boomCenter").animate(
    {
        left:"473px",
        top:topX+"px",
        width:"0px",
        height:"0px"
    },900
    ,function()
    {
        finishCloseBoom();
    });
    animateContentBackground('close')
    {
    
    }
    
     $j("#boomBackground").animate(
    {
        filter:"alpha(opacity=0)",
        opacity:"0"
    },900,
    function()
    {
    finishCloseBackground();
    
    });
    
    
}
function finishCloseBackground()
{
         $j("#boomBackground").css("z-index","0");
}
function finishCloseBoom()
{
    $j("#boomHeader").css("display","none");
     $j("#boomCenter").css("min-height","0px");
     $j("#boomCenter").css("height","");
}
function finishAnimation()
{
    $j("#center").css("top","0px");
     $j("#gammadia").css("top","0px");
      $j("#gammadia").css("left","0px");

}


function getWindowCoords() {
  if (window.innerWidth || window.innerHeight) {
    return [window.innerWidth,window.innerHeight];
  } else {
    return [(document.documentElement.clientWidth||document.body.clientWidth||document.body.scrollWidth),(document.documentElement.clientHeight||document.body.clientHeight||document.body.scrollHeight)];
  }
}

$j("#boomCenter").ready(
function()
{
    var winXY = getWindowCoords();
    var topX = (winXY[1]*0.05+374);
    $j("#boomCenter").css("top",topX+"px");
}

);

function displayAllButtonText()
{
     $j(".buttonHomeText").css("display","block");
     $j("#gammadiaText").css("display","block");
}
function hideAllButtonText()
{
    $j(".buttonHomeText").css("display","none");
    $j("#gammadiaText").css("display","none");
}
$j(window).load(
function() {
    $j("#gammadia").mouseover(
    function()
    {
       displayAllButtonText();
    });
    $j("#gammadia").mouseout(
    function()
    {
        hideAllButtonText();
    }
    );
    $j(".button").each(
    function()
    {
        $j(this).mouseover(
        function()
        {
            displayAllButtonText();
        
        });
        $j(this).mouseout(
        function()
        {
            hideAllButtonText();
        });
    })
}

);
