/********************************************************************
    File:   
        common.js
    Brief:  
        -
    Author:
        DigitalCavalry
    Author URI:
        http://themeforest.net/user/DigitalCavalry
*********************************************************************/
                                                           

function setupAsyncImages(p)
{
    $(p).each(
        function()
        {   
            var loader = $(this);
            var imagePath = loader.attr('rel');

            var img = new Image();
            $(img).css("opacity", "0.0")

                .load(
                    function() 
                    {
                        loader.append(this).removeAttr('title');
                        $(this)
                            .css("margin", "0px")
                            .css("opacity", "0.0")
                            .animate({opacity: 1.0}, 500,
                                function()
                                {
                                    loader.css("background-image", "none");
                                }
                            );
                    }
                ).attr('src', imagePath);                        
        }
    );
}



/**********************************************
    MAIN CODE - CALLED THEN PAGE SI LOADED
***********************************************/

$(document).ready(
    function()
    {
         
       slider_acc.setup('#accordion-container');
       setupAsyncImages('.async-img');      
    }         
);
