function setSessionCookie( name, value )
{
	document.cookie = name + "=" + value;	
}

function getCookieValue( name )
{
	cookies = document.cookie.split(';');
	
	for( i = 0; i < cookies.length; i++ )
	{
		curCookie = cookies[i].split('=');
		if ( curCookie[0].toLowerCase() == name.toLowerCase() )
			return curCookie[1];
	}
	
	return null;
}

function startFlash()
{
	obj = document.plugins.ad;
	
	if ( obj == null )
		obj = document.getElementById('ad');
	
	obj.TCallLabel("/","load");
}

function PassFlash()
{
	// Get the current value
	curVal = getCookieValue("flashPiece");
	
	if ( getCookieValue("flashPiece") == null )
		curVal = 0;
		
	if ( ++curVal > 9 )
		curVal = 1;
		
	setSessionCookie("flashPiece", curVal );
	
	obj = document.plugins.ad;
	
	if ( obj == null )
		obj = document.getElementById('ad');

	if ( obj != null )
	{
		obj.SetVariable("whichAd", curVal);
		obj.TGotoLabel("/", "loaded");
		obj.TPlay("/");

	}

}
