// vim: set ts=4 sts=4 sw=4 si noet:

// media selection for embedding in tinymce
$('#attachments-browser a.select').live('click', jm.tinymce.selectAttachment);
$('a[rel*=facebox]').facebox({
	loadingImage : jm.cfg.base + '/css/facebox/loading.gif',
	closeImage   : jm.cfg.base + '/css/facebox/closelabel.gif'
});

// setup tooltips
$('.small-tip').tooltip();
$('.big-tip').tooltip({tipClass: 'tooltip-big'});
$('.extrabig-tip').tooltip({tipClass: 'tooltip-extrabig'});
$('.vote-sms').tooltip({
	relative: true
});
$('.icon-tip').tooltip({
	relative: true
});

// mp3 flash player
function play() {
	    document.getElementById("monFlash").SetVariable("player:jsPlay", "");
}
function pause() {
	    document.getElementById("monFlash").SetVariable("player:jsPause", "");
}
function stop() {
	    document.getElementById("monFlash").SetVariable("player:jsStop", "");
}
function volume(n) {
	    document.getElementById("monFlash").SetVariable("player:jsVolume", n);
}

// flowplayer
$('.player').flowplayer(jm.cfg.base + '/img/flowplayer/flowplayer-3.2.7.swf', {

	clip : {
		url: 'http://202.152.233.190/jagoanmuda/index.php', // the name of stream names
		live: true,
//		provider: 'rtmp', // provider name
		autoPlay: true,
	},

	plugins : {
		rtsp: {
			url: jm.cfg.base + '/img/flowplayer/flowplayer.rtmp-3.2.3.swf',
			netConnectionUrl: 'rtsp://202.152.233.189/h264' // defines where the streams are found
			},
			controls: {
			playlist: false
			}
	}
});

$('.flowplayer.small.autoplay').flowplayer(jm.cfg.base + '/img/flowplayer/flowplayer-3.2.1.swf', {
	clip : {
		autoPlay: true
	},
	plugins : {
		controls: {
			time: false,
			stop: true,
			volume: true,
			scrubber: false
		}
	}
});

$('.flowplayer.small.no-autoplay').flowplayer(jm.cfg.base + '/img/flowplayer/flowplayer-3.2.1.swf', {
	clip : {
		autoPlay: false
	},
	plugins : {
		controls: {
			time: false,
			stop: false,
			volume: true,
			scrubber: false
		}
	}
});

$('.flowplayer.autoplay:not(.small)').flowplayer(jm.cfg.base + '/img/flowplayer/flowplayer-3.2.1.swf', {
	clip : {
		autoPlay: true
	},
	plugins : {
		controls: {
			time: false,
			stop: true,
			volume: true,
			scrubber: true
		}
	}
});

//slide banner

$('.images').tabs('.images > div', {
	effect: 'slide',
	rotate: true
}).slideshow({
	autoplay:true,
	interval: 7000,
	clickable: false
	});

$('.images2').tabs('.images2 > div', {
	effect: 'fade',
	rotate: true
}).slideshow({
	autoplay: true,
	interval: 5000,
	clickable: false
	});

$('.images3').tabs('.images3 > div', {
	effect: 'fade',
	rotate: true
}).slideshow({
	autoplay: true,
	interval: 5000,
	clickable: false
	});

$('.images4').tabs('.images4 .img', {
	effect: 'slide',
	rotate: true
}).slideshow({
	autoplay: true,
	interval: 8000,
	clickable: false
	});

$('.images5').tabs('.images5 > div', {
	effect: 'fade',
	rotate: true
}).slideshow({
	autoplay: true,
	interval: 6000,
	clickable: false
	});

$('.frame a').bind('click', function() {
	window.open(this.href, '_self');
});

$('.images3 a').bind('click', function() {
	window.open(this.href, '_self');
});

$('.facebox').overlay ({
    top: 200,
	left: '30%', 
    mask: {
       color: '#fff',
       loadspeed: 200,
       opacity: 0.5
    },
    load: true
});
/*
$('.news .scaffold img').addClass('popup').attr('rel', '#big-img');
$('.news img').click(function() {
	var url = $(this).attr("src").replace("s", "l");
	$('.news .overlay img').attr('src', url);
});

$('.news img[rel]').overlay({
	top: '5',
	oneInstance: true,
	left: '33%',
	closeOnClick:false
});
*/

/* initialize scrollable with navigator plugin */

$('#scroll').scrollable({
	items: '#tools',
	circular: true
}).navigator().autoscroll({autoplay: true, interval: 5000});
/*
api.onBeforeSeek(function(e, i) {
	if(i) {
			$('#intro').fadeOut('slow');
			if($.browser.msie && $.browser.version < 8) {
					$('#intro').hide();
			}
	} else {
			$('#intro').fadeIn(1000);
	}
	$('#t0').toggleClass('active', i == 0);
	});

$('#t0').click(function() {
	$('#scroll').scrollable().begin();
});
*/

