var index = -1;
function flv(file, width, height, autostart, id, image, urlpath)
{
	var version = "9.0.115";
	var flashvars = { file:urlpath + file, autostart:autostart, repeat:"always"};
	var params = {allowfullscreen:"true", allowscriptaccess:"always"};
	var attributes = { id:id,  name:id};
	if(autostart == "false")
	{
		flashvars.image = urlpath + image;
	}
	if(file.substr(file.length - 3) == "flv")
	{
		version = "8";
	}
	swfobject.embedSWF(urlpath + "player.swf", id, width, height + 20, version, urlpath + "expressInstall.swf", flashvars, params, attributes);
}
function audio(file)
{
	insertSWF("audio.swf?file=" + file, 527, 40, "#FFFFFF");
}
function insertSWF(swf, width, height, bgcolor)
{
	document.write(swftag(swf, width, height, bgcolor));
}
function swftag(swf, width, height, bgcolor)
{
	var s = "";
	s = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\""+width+"\" height=\""+height+"\" id=\"main\" align=\"middle\">";
	s += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	s += "<param name=\"movie\" value=\""+swf+"\" />";
	s += "<param name=\"quality\" value=\"high\" />";
	s += "<param name=\"bgcolor\" value=\""+bgcolor+"\" />";
	s += "<embed src=\""+swf+"\" quality=\"high\" bgcolor=\""+bgcolor+"\" width=\""+width+"\" height=\""+height+"\" name=\"main\" align=\"middle\" allowscriptaccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></embed>";
	s += "</object>";
	return s;
}
function clear()
{
	if(index != -1)
	{
		var o = getobj('m' + index);
		o.innerHTML = '';
	}
}
function play(newindex)
{
	clear();
	index = newindex;
	var o = getobj('m' + index);
	o.innerHTML = '<br>' + swftag("audio.swf?auto=true&file=" + am[index], 597, 40, "#FFFFFF");
}
function next()
{
	clear();
	if((index + 1) == numsong)
	{
		play(0);
	}
	else
	{
		play(++index);
	}
}
function shuffle()
{
	clear();
	index = Math.floor(Math.random()* numsong);
	play(index);
}
function getobj(name)
{
	var o;
	if(document.getElementById)
	{
		o = document.getElementById(name);
	}
	else
	{
		o = eval( "document.all." + name); 
	}
	return o;
}
function showhide(layer_ref, state) { 
	if (state == 'hide') { 
		state = 'none'; 
	} 
	if (state == 'show') { 
		state = 'block'; 
	} 
	if (document.all) {
		eval( "document.all." + layer_ref + ".style.display = state"); 
	} 
	if (document.layers) { 
		document.layers[layer_ref].display = state; 
	} 
	if (document.getElementById &&!document.all) { 
		hza = document.getElementById(layer_ref); 
		hza.style.display = state; 
	} 
}
function highlight(field) {
	field.focus();
	field.select();
}