$.extend({
  getUrlVars: function(url){
    //var vars = [], hash;
    var hashes = url.split('/');
    
//    for(var i = 0; i < hashes.length; i++)
//    {
//      hash = hashes[i];//.split('=');
//      vars.push(hash[0]);
//      vars[hash[0]] = hash[1];
//    }
    return hashes;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  },
  getLanguage: function(parametersArray){
      var language;
      $.each(parametersArray, function(i, value)
      {
          if(value=="de")
          {
              language = "de";
              return false;
          }
          else if(value=="en")
          {
              language = "en";
              return false;
          }
          else
          {
              language = "pl";
          }
               
      });
      return language;
  }
});

function menu()
{
    
    $('#menuWrapper .menu li').hover( 
        function () { 
            //show its submenu 
            $('ul', this).slideDown(300); 
  
        },  
        function () { 
            //hide its submenu 
            $('ul', this).slideUp(300);          
        } 
    ); 
    
}

function showLogo(prefix)
{
    
    $('div#'+prefix+'lang_sel_header').fadeIn(300);
    $('div#'+prefix+'facebookLink').fadeIn(300);
    $('div#'+prefix+'logoBackground').animate({'width':'200px', 'height':'60px', 'top':'0px', 'left':'0px'}, 800,
        function ()
        {
            $('div#'+prefix+'logoContent').animate({'width':'200px', 'height':'60px', 'top':'0px', 'left':'0px'}, 600,
                function ()
                {
                    $('div#'+prefix+'logoFlower3').fadeIn(250,
                        function ()
                        {
                            $('div#'+prefix+'logoFlower2').fadeIn(250);
                            $('div#'+prefix+'logoFlower4').fadeIn(250,
                                function ()
                                {
                                        $('div#'+prefix+'logoFlower1').fadeIn(250);
                                        $('div#'+prefix+'logoFlower5').fadeIn(250);
                                }
                            );
                        }
                    );
                }
            );
        }
    );
}

function hideLogo(prefix)
{
    $('div#'+prefix+'logoFlower1').fadeOut(300);
    $('div#'+prefix+'logoFlower5').fadeOut(300);
    $('div#'+prefix+'lang_sel_header').fadeOut(300,
    function ()
    {
        $('div#'+prefix+'logoFlower2').fadeOut(300);
        $('div#'+prefix+'logoFlower4').fadeOut(300,
        function ()
        {
            $('div#'+prefix+'logoFlower3').fadeOut(300,
            function ()
            {
                $('div#'+prefix+'logoContent').animate({'width':'0px', 'height':'0px', 'top':'0px', 'left':'100px'}, 800,
                function ()
                {
                    $('div#'+prefix+'logoBackground').animate({'width':'0px', 'height':'0px', 'top':'0px', 'left':'100px'}, 1000);
                }
                );
            }
            );
        }
        );
    }
    );
    
}

function startSite()
{
        $('div#container').animate({'margin-top' : '0px'}, 1000,
        function() 
        {
            
            $('div#rightBoxForSlideshow').animate({'margin-top' : '0px'}, 800);
            $('div#header').animate({'margin-top' : '0px'}, 800, 
            function()
            {
                showLogo('');
                $('div#menuWrapper').animate({'margin-left' : '0px'}, 800,
                function()
                {
                    $('div#content, div#sidebarFooter, div#slideshowWrapper, div#welcomeText').fadeIn(300);
                }
                );
                
            });  
        });
        
        menu();  
}

function slideshow()
{
    $('#slideshowImageList').cycle({
        fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    });
    
}


$(document).ready(function () 
{

    $('#priceAccordion').accordion({header: "h5"});
    showLogo('');
    menu();
    slideshow();
}); 



