//create unique id
var uid = new Date().getTime();
var flashProxy = new FlashProxy(uid, "JavaScriptFlashGateway.swf");

// general methods
function setCookie(name, value)
{
	var date = new Date(); 
	date.setTime(date.getTime() + (1*24*60*60*1000));
	document.cookie = name + "=" + value + "; expires=" + date.toGMTString();
}

function myTrace(message)
{
	alert(message);
}

function checkUnderage()
{
	var allCookies = document.cookie;
	var pos = allCookies.indexOf("GiftCardUnderage=");
	
	if(pos != -1)
	{
		var start = pos + 17;
		var end = allCookies.indexOf(";", start);
		
		if(end == -1)
		{
			end = allCookies.length;
		}
		
		var value = allCookies.substring(start, end);
		value = unescape(value);

		flashProxy.call("checkUnderageReturn", value.toLowerCase());
	}
	else
	{
		flashProxy.call("checkUnderageReturn", "none");
	}
}

function openURL(url)
{
	window.location = url;
}

function openNewWindow(url, windowName)
{
	window.open(url, windowName);
}

//Thanks deconcept (http://blog.deconcept.com/swfobject)

