//leaflet.js
//author: 			Bjoern Sellnau @ PIXELTEX
//added:				14-08-2009
//modified:			22-08-2009
//version				0.10
//=====================================================

$(document).ready(function()
{
    document.closeLeafletMenu = function()
    {
    	$('.leaflet_frame').find(":nth-child(1)").css('overflow','hidden').slideUp('fast',function(){
				$(this).css('overflow','auto');
			});
      $('.leaflet_widget').animate({top:'269px'},500,'swing',function(){
      	$('.leaflet').css('height','0px');
      });    
    }

/* leaflet close link */
    $('.leaflet_close').click(function()
    {
       $('.leaflet_frame').find(":nth-child(1)").slideUp('fast');
       $('.leaflet_widget').animate({top:'269px'},500,'swing',function(){
       	$('.leaflet').css('height','0px');
       }); 
       return false;
    });
/* leaflet add link */
    $('.leaflet_link').click(function()
    {
/*
    	if($('#leaflet_frame').length >= 1)
    	{
       $('#leaflet_frame').remove();
    	}
     	$('.leaflet_frame').append('<iframe id="leaflet_frame" src="/leaflet/leaflet.cfm" border="0" frameborder="0" framespacing="0" ALLOWTRANSPARENCY="true"></iframe>');
*/		
     	$('.leaflet').css('height','260px').get(0).scrollIntoView(true);
      $('.leaflet_widget').animate({top:'0px'},500,'swing',function()
      {
				$.fn.leafletPXL.addItem($('.leaflet_link'));				    
      });
      
      setTimeout('document.closeLeafletMenu()',2500); 
      return false;
    });
	
/* leaflet open/close 'favoris' link */
	$('.leaflet_open').click(function()
    {
    	if($('.leaflet_widget').css('top') == '269px')
    	{
      	$('.leaflet').css('height','260px')
        $('.leaflet_widget').animate({top:'0px'},500,'swing',function(){

       	$('#leaflet_frame').slideDown('fast');
       }); 
    	} else {

    	if($('#leaflet_frame').length >= 1)
    	{
	       $('#leaflet_frame').slideUp('fast');
			}

       $('.leaflet_widget').animate({top:'269px'},500,'swing',function(){
       	$('.leaflet').css('height','0px');
       });     	
    	}
       return false;
    });

})
