function embedFlv(thumb, videofile, videoid, containerid, vidwidth, vidheight) {
	var flashvars = {
		imagePath: thumb,
		videoPath: videofile,
		autoStart: "false",
		autoHide: "true",
		autoHideTime: "2",
		hideLogo: "true",
		volAudio: "60",
		newWidth: vidwidth,
		newHeight: vidheight,
		disableMiddleButton: "true",
		playSounds: "false",
		soundBarColor: "0x3F3F3F",
		barColor: "0x3F3F3F",
		barShadowColor: "0x5C5C5C",
		subbarColor: "0x8C8C8C"
	};
	var params = {
		allowFullScreen: "true"
	};
	var attributes = {
		id: videoid,
		name: videoid
	};

	swfobject.embedSWF("/inc/flash/flvPlayer.swf", containerid, vidwidth, vidheight, "9.0.0", '', flashvars, params, attributes);
}

function playvideo(videoid) {
	//$(element).is(":visible")
	if ($("#video_"+videoid).is(":visible")) {
		document.getElementById('video_'+videoid).play();
	} else {
		document.getElementById(videoid).jsStartVideo();
	}
}

function showMedia(id, index) {
	currentIndex = index;
	$(".media").hide();
	$("#mediaContainer #media"+id).show();
	refreshVideo();
}

function prevMedia() {
	currentIndex--;
	if (currentIndex < 0) currentIndex = mediaIds.length - 1;
	showMedia(mediaIds[currentIndex], currentIndex);
	refreshVideo();
}

function nextMedia() {
	currentIndex++;
	if (currentIndex > (mediaIds.length - 1)) currentIndex = 0;
	showMedia(mediaIds[currentIndex], currentIndex);
	refreshVideo();
}

function openCleanWindow(url, width, height) {
	window.open(url, 'HunterGatherer', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height+'');
}

function openWindow(url) {
	window.open(url);
}

function playwebvideo() {
	
}