
var intPlay = 0;
var intAuswahl = 0;
var strPage = "";
var intNewsID = "";
var strNewsCom = "";
var strNewsBackSeite = "";
var strNewsPageview = "";
var strNavigation = "";

$(document).ready(function() {

	intPlay = $('#playImages').html();
	intAuswahl = $('#auswahlImage').html();
	strPage = $('#playPage').html();
	intNewsID = $('#newsSystemID').html();
	strNewsCom = $('#newsCom').html();
	strNewsBackSeite = $('#newsBackSeite').html();
	strNewsPageview = $('#newsPageview').html();
	strNavigation = $('#navigation').html();
	
	if (intPlay == '')
		intPlay = 0;
	
	$('.media-db-gallery .buttons .play').click(function() {
	
		if (intPlay == 0) {
			intPlay = 1;
			autoPlay();
		} else {
			intPlay = 0;
		}
	});
});

function autoPlay() {
	
	if (intPlay == 1) {
		
		var strURL = window.location.href;
		arrayURL = strURL.split("?");
		intAuswahl++;
		strURL = arrayURL[0]+'?seite='+strPage+'&play=1&auswahl='+intAuswahl+'&navigation='+strNavigation;
		if (intNewsID > 0) {
			strURL += "&system_id="+intNewsID;
			strURL += "&com="+strNewsCom;
			strURL += "&back_seite="+strNewsBackSeite;
		}
		if (strNewsPageview != '')
			strURL += "&pageview="+strNewsPageview;
		location.replace(strURL)
	}
}

window.setInterval("autoPlay()", 3000);
