var tabs_img=_url+'images/tabs_item_corner.jpg';
var tabs_img_on=_url+'images/tabs_item_corner_on.jpg';
function open_tab(id){
	$("div.tabs_bg").hide();
	$("#tab_"+id).show();
	$("div.tabs_top div").removeClass("item_on").addClass("item");
	$("div.tabs_top div img").attr("src", tabs_img);
	$("#otab_"+id).removeClass("item").addClass("item_on");
	if($("#otab_"+id).attr("first")=="1"){
		$("#otab_"+id+" img").attr("src", tabs_img_on);
	}
}
function ddb_expand(id){
	$("#"+id+" div.ddb_selection").show();
	$("#"+id).addClass("ddb_on");
	$("#"+id).bind('mouseenter', function(e){
		if(ddb_box){
			clearTimeout(ddb_box);
		}
	});
	$("#"+id).bind('mouseleave', function(e){
		ddb_box=setTimeout("$('#"+id+" div.ddb_selection').hide();$('#"+id+"').removeClass('ddb_on');", 1000);
	});
}
function slideSwitch(id) {
    var $active = $(id+' IMG.active');

    if ( $active.length == 0 ) $active = $(id+' IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next("img").length ? $active.next("img")
        : $(id+' IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
