var wnd = null;
function open_window(page_url, wid, hei)
{
	var wnd_height = (hei) ? hei : 600;
	var wnd_width = (wid) ? wid : 500;
	var wnd_left = (screen.width - wnd_width)/2;
	var wnd_top = (screen.height - wnd_height)/2;
	if(wnd)
	{
		wnd = window.open(page_url, "preview_wnd", "location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,width="+wnd_width+",height="+wnd_height+",left="+wnd_left+",top="+wnd_top);
		wnd.focus();
	}
	else
	{
		wnd = window.open(page_url, "preview_wnd", "location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,width="+wnd_width+",height="+wnd_height+",left="+wnd_left+",top="+wnd_top);
	}
}

function initCookie() {
	setCookie('playintro','1');
	sendflash('playintro',c);
	if (s!=null) sendflash('shutup',s);
}

function sendflash (n,v)
{

if (v!=null) {head.setVariable(n, v)}
}


function setCookie(name, value)

  {
  document.cookie = name+"="+value+";path="+escape('/')+";expires=Mon, 14-Sep-2015 13:13:13 GMT";

  }
  
function getCookieVal (offset)

  {

  var endstr = document.cookie.indexOf (";", offset);

  if (endstr == -1)

  endstr = document.cookie.length;

  return unescape(document.cookie.substring(offset, endstr));

  }

function GetCookie (name)

  {

  var arg = name + "=";

  var alen = arg.length;

  var clen = document.cookie.length;

  var i = 0;

  while (i < clen) {

  var j = i + alen;

  if (document.cookie.substring(i, j) == arg)

  return getCookieVal (j);

  i = document.cookie.indexOf(" ", i) + 1;

  if (i == 0) break;

  }

  return null;

  }
var c=GetCookie('playintro');
var s=GetCookie('shutup');


function fscom(command,args) {
if(command=='shutup')
	{
	setCookie('shutup','yes');
//	sendflash('shutup','yes');
	}
	if (command=='sound')
	{
	setCookie('shutup','no');
//	sendflash('shutup','no');
	}

}
