function playAudio(title, url, player) {
	var obj = document.getElementById(player);
	if (obj && typeof obj.playAudio != 'undefined') {
		$("#audio_player_div").show();
		obj.playAudio(title, url);
	}
}

function showVideo(){
	var arr = arguments[0].split("*");
	jQuery.scrollTo({ top:0, left:0 }, 300, { easing:'easeInSine', onAfter:function(){
		Shadowbox.open({
			title: arr[3],
			player: 'swf',
			content: 'http://vimeo.com/moogaloop.swf?server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=FF6633&fullscreen=1&loop=1&autoplay=1&clip_id='+arr[0],
			width: arr[1],
			height: arr[2],
			enableKeys: true,
			options:{
				onOpen:function(){
					jQuery("body").css("overflow","hidden");
				},
				onClose:function(){
					jQuery("body").css("overflow","scroll");
				}
			}
		});
	}});
}

function Tab(tab){
	var modId = tab.attr("moduleId");
	var what = tab.attr("id").replace("dnp_tab_"+modId+"_","").toLowerCase();
	var div = $("#tab_header_"+modId);
	div.find("div").each(function(index) {
		var tab = $(this);
		var a = tab.find("a:first");
		a.removeClass("active");
		tab.attr("class","dnp_tab_normal");
		if (what==a.text().toLowerCase()) {
			a.addClass("active");
			tab.attr("class","dnp_tab_active");
			// contenido
			var td_int = $("#td_tab_content_"+modId);
			td_int.find(".tab_container").each(function(index){
				$(this).hide();
				if ($(this).attr("id").toLowerCase()==what+"_"+modId+"_container") $(this).show();
			});
		}
	});
}

$().ready(function(){
	$('div.tabs').slideshow();
	$(".dnp_tabs").each(function(index) {
		var div = $(this);
		var modId = div.attr("id").replace("tab_header_","");
		var flashvars = {};
		var params = { swliveconnect:'true', wmode:'transparent' };
		var attributes = { id:'audio_player_'+modId, name:'audio_player_'+modId };
		swfobject.embedSWF(_dnp_control_path+'Movies/audio.swf', 'audio_player_'+modId, '100%', '15', '9.0.0', _dnp_control_path+'Movies/express.swf', flashvars, params, attributes);
		$("#videos_"+modId).mbScrollable({
			width:275,
			height:140,
			elementsInPage:1,
			elementMargin:0,
			shadow:'false',
			controls:'#video_controls_'+modId,
			slideTimer:300,
			autoscroll:true,
			scrollTimer:10000
		});
		div.attr("moduleId",modId);
		div.find("div").each(function(index) {
			var tab = $(this);
			var a = tab.find("a:first");
			a.attr("moduleId", modId);
			if (index==0) Tab(a);
			a.click(function(){
				Tab($(this));
				return false;
			});
		});
	});
});
