var play_short_fnc = true;
var old_file_short_fnc = "";

function trackIncrement(type_tbl, id) {
	document.getElementById('form_play_qty_type_tbl').value = type_tbl;
	document.getElementById('form_play_qty_id').value = id;
	document.getElementById('form_play_qty').submit();
	setTimeout("stopTrackIncrement()", 2000);
}

function stopTrackIncrement() {
	document.getElementById('frame_play_qty').src = "";
}



function videoIncrement(type_tbl, id) {
	document.getElementById('video_increment_type_tbl').value = type_tbl;
	document.getElementById('video_increment_id').value = id;
	document.getElementById('form_video_increment').submit();
	setTimeout("stopVideoIncrement()", 2000);
}

function stopVideoIncrement() {
	document.getElementById('frame_video_increment').src = "#";
}


function playShortMusic(id, type_tbl) {
	var file = id;
	
	if (old_file_short_fnc != file) {
		//alert(old_file_short_fnc);
		play_short_fnc = true;
		if (old_file_short_fnc) back30sec(old_file_short_fnc);
		change30sec(id, type_tbl);
	}
	else {
		play_short_fnc = false;
		back30sec(id);
	}
	
	if (play_short_fnc) {
		if (browser_type == "firefox") {
			window.document.part_s_mp3_player.SetVariable("nTrack",id);
		}
		else {
			document.getElementById('part_s_mp3_player').SetVariable("nTrack", id);
		}
		play_short_fnc = false;

	}
	else {
		if (browser_type == "firefox") {
			window.document.part_s_mp3_player.SetVariable("nStop", "true");
		}
		else {
			document.getElementById('part_s_mp3_player').SetVariable("nStop", "true");
		}
		
		play_short_fnc = true;
	}
	
	if (play_short_fnc == false) old_file_short_fnc = file;
	else old_file_short_fnc = "";
	
}

function back30sec(id) {
	document.getElementById('short_ico_track_'+id).innerHTML = '<img src="/images/019.gif" width="15" height="15" style="cursor:pointer">';
}


function change30sec(id, type_tbl) {
	trackIncrement(type_tbl, id);
	document.getElementById('short_ico_track_'+id).innerHTML = "30";
	
	setTimeout("increment30sec("+id+")", 1000);
}

function increment30sec(id) {
	var currentInt = parseInt(document.getElementById('short_ico_track_'+id).innerHTML);
	
	if (currentInt > 1) {
		document.getElementById('short_ico_track_'+id).innerHTML = currentInt - 1;
		setTimeout("increment30sec("+id+")", 1000);
	}
	else if (currentInt == 1) {
		playShortMusic(id);
	}
}