// Sets cookie values. Expiration date is optional
function setCookie(name, value, expire) {
	document.cookie = name + "=" + escape(value) +
	((expire == null) ? "" : ("; expires=" + expire.toGMTString())) +
	"; path=/";
}
function getCookie(name) {
	var search = name + "=";
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(search);
		if (offset != -1) { // if cookie exists
			offset += search.length;
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie value
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
	return null;
}

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

// название функции менять нельзя
function top_DoFSCommand(command, args) {
	//var topObj = isInternetExplorer ? document.all.top : document.top;
	if ('volume' == command) {
		setCookie('volume_on', ('true' == args ? '1' : '0'));
	}
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub top_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call top_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function drawFlash() {
	var volume_on = getCookie('volume_on');
	if (null == volume_on) {
		volume_on = "0";
	}

	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="top" width="280" height="195" align="middle">');
	document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
	document.writeln('<param name="movie" value="/design/flash/top.swf?volume_on='+volume_on+'" />');
	document.writeln('<param name="quality" value="high" />');
	document.writeln('<param name="bgcolor" value="#ffffff" />');
	document.writeln('<param name="wmode" value="transparent" />');
	document.writeln('<embed src="/design/flash/top.swf?volume_on='+volume_on+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="280" height="195" swLiveConnect=true id="top" name="top" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.writeln('</object>');
}

