function setCookie(name, value)
{
  var cookie = name + "=" + escape (value) + "; path=/;";
  document.cookie = cookie;
}

function getCookie(name)
{
  var results = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');

  if (results) return (unescape(results[2]));
  else return null;
}

function openFlashSite()
{
	setCookie("noflash", false);
	document.location = document.location;
}

function delayOpenWindow(url)
{
	window.setTimeout("openWindow(" + url + ")", 500);
}

function openWindow(url) 
{
	if (url == "http://bedrinkaware.com.au/")
	{
		window.open("http://bedrinkaware.com.au/", "bedrinkaware")
	}
	else if (url == "/history/make-contact/")
	{
		document.location = url;
	}
	else if (url == "/legal/unsubscribe.html")
	{
		newWindow(url, "legals", 316, 400, 'yes');
	}
	else
	{
		newWindow(url, "legals", 500, 600, 'yes');
	}
}

function newWindow(url, name, width, height, scrollbars)
{
	left = (screen.width) ? (screen.width - width) * 0.5 : 0;
	top = (screen.height) ? (screen.height - height) * 0.5 : 0;
	settings = 'height=' + height + ',width=' + width + ',top=' + top + ',left=' + left + ',scrollbars=' + scrollbars + ',resizable';
	
	window.open(url, name, settings);
}