jQuery(document).ready(function() {
	
	/*
	jQuery('#sdbx_ss_upload_image_button').click(function() {		
	 	formfield = jQuery('#sdbx_ss_upload_image').attr('name');
	 	tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
	 	return false;
	});
	
	window.send_to_editor = function(html) {
	 imgurl = jQuery('img',html).attr('src');
	 jQuery('#sdbx_ss_upload_image').val(imgurl);
	 tb_remove();
	}*/

});


function sdbx_ss_removeImageItem(sender) {
	
	jQuery(sender).parent().remove();	
}

function sdbx_ss_fade(animate, randomize) {
    var $active = jQuery('#sdbx-slideshow img.active');

    if ( $active.length == 0 ) $active = jQuery('#sdbx-slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next() : jQuery('#sdbx-slideshow img:first');
        
	if (randomize == 1) {
		var $sibs  = $active.siblings();
    	var rndNum = Math.floor(Math.random() * $sibs.length );
    	var $next  = jQuery( $sibs[ rndNum ] );
	}

    $active.addClass('last-active');

	if (animate == 1) {
		$next.css({ opacity: 0.0 }).addClass('active').animate({ opacity: 1.0 }, 1000, function(){ $active.removeClass('active last-active');});
	}
	else {
		$next.css({ opacity: 0.0 }).addClass('active').animate({ opacity: 0 }, 1000, function(){ $active.removeClass('active last-active');});		
	}
}





