
// tabchanger Plugin (jQuery)
// Written by Chris Wittor
// Copyright by Chris Wittor and Radio One

function tabchange(num) {
	$.post('http://www.one-radio.tk/ajax/tabchanger.php', {
		code: "893dd83f832ebfcca3e5d989a14cfd8e",
		action: 'tab',
		tab: num
	}, function (data) { 
		$('#hometabs').html(data);
	});
	$('.tab-active').removeClass("tab-active").addClass("tab");
	$('#'+num).removeClass("tab").addClass("tab-active"); 
	return false;
}

function blend(typ, text) {
	if(typ == 'okay') {
		$('#'+typ).html('<span style="color: black;">'+text+'</span>');
	}
	else {
		$('#'+typ).html(text);
	}
	$('#'+typ).slideDown('slow');
	window.setTimeout("$('#"+typ+"').slideUp('slow')", 3000);
}

function wunschbox() {
	$.post('http://www.one-radio.tk/ajax/wb-view.php', {
		code: '893dd83f832ebfcca3e5d989a14cfd8e',
	}, function (data) {
		$('#fadebox').html(data);
		$('#fadebox').modal({
			overlayClose: true,
			focus: false,
			onOpen: function (dialog) {
				dialog.overlay.fadeIn('slow', function () {
					dialog.data.hide();
					dialog.container.fadeIn('slow', function () {
						dialog.data.slideDown('slow');
					});
				});
			}
		});
	});
}
function streamheader() {
	$.post('http://www.one-radio.tk/ajax/header.php', {
		code: '893dd83f832ebfcca3e5d989a14cfd8e',
	}, function (data) {
		if(data != '0 ') {
			$('#offline').hide();
			var res = data.split('||%||');
			if(res['1'] != $('#akt-title').html()) {
				$('#akt-title').fadeOut('slow', function () {
					$('#last-title').fadeOut('slow', function () {
						$('#akt-title').html(res['1']);
						$('#last-title').html(res['2']);
						$('#akt-title').fadeIn('slow');
						$('#last-title').fadeIn('slow');
					});
				});
			}
			if(res['3'] != $('#akt-dj').html()) {
				$('#akt-dj').fadeOut('slow', function () {
					$('#akt-show').fadeOut('slow', function () {
						$('#akt-time').fadeOut('slow', function () {
							$('#akt-dj').html(res['3']);
							$('#akt-show').html(res['4']);
							$('#akt-time').html(res['5']);
							$('#akt-dj').fadeIn('slow');
							$('#akt-time').fadeIn('slow');
							$('#akt-show').fadeIn('slow');
						});
					});
				});
			}
			if(res['3'] != 'd36f5h') {
				$('img[alt$=Wunschbox]').fadeOut('slow');
			} else {
				$('img[alt$=Wunschbox]').fadeIn('slow');
			}
			$('#online').show();
		} else {
			$('#online').hide();
			$('#offline').show();
		}
	});
}
