var obj = null;
var $j = jQuery.noConflict();
$j(document).ready(function() {

    if ($j.fn.bgiframe) {
        $j('.main-menu LI UL').bgiframe();
    }

    $j(".sizes").children("LI").click(function() {
        $j(".sizes").children("LI").removeClass("active");
        $j(this).addClass("active");
    });

    $j('UL#photo-list LI.current').each(function(i) {
        if (!i) {
            var photoUrl = $j(this).children('a').attr('href');
            loadPhoto(photoUrl);
        }
    });
    $j('.thumbs A').click(function() {
        $j('UL#photo-list LI').removeClass('current');
        $j(this).parent('LI').addClass('current');
        var photoUrl = $j(this).attr('href');
        $j('#photo-preview').fadeOut(300, function() {
            loadPhoto(photoUrl);
        });
        $j('#photo-preview').fadeIn(300);
        return false;
    });

});

function loadPhoto(url) {
    if (url == '') { return; }
    var photo = new Image();
    $j(photo).load(function() {
        $j('#photo-preview').removeClass('loading').html('').append(this);
    }).attr('src', url);
}

