var UseFlash = 1;
function cookieval (cookiename, cookiestring) 
{
  var startloc = cookiestring.indexOf(cookiename);
  if (startloc== -1) {
    return "1";
  }
  var seploc=cookiestring.indexOf("=",startloc);
  var endloc=cookiestring.indexOf(";",startloc);

  if (endloc== -1) {
    endloc= cookiestring.length;
  }
  return (cookiestring.substring(seploc+1, endloc));
}

var cookies=document.cookie;
var UseFlash=cookieval("UseFlash",cookies);


if (UseFlash == 1)
{
	$j(document).ready(function(){
		$j('.flash').flashembed({
			src: '/images/flash/uva-flash.swf?v=1',
			width: 831,
			height: 576,
			wmode: "transparent"
		},{
			version: [8]
		});
		$j('.flash').css("background","transparent")
	});
}

function FlashControl()
{
	if ( UseFlash==1 )
	{
		document.write('<a href="#" class="turn-flash" onClick="document.cookie=\'UseFlash = 0; path=/\'; document.location.href=\'/\';">выключить flash</a>');
	}
	else
	{
		document.write('<a href="#" class="turn-flash" onClick="document.cookie=\'UseFlash = 1; path=/\'; document.location.href=\'/\';">включить flash</a>');
	}
}