if (PlayOnce==0)
{
eraseCookie(location.href)
}

var x = readCookie(location.href)
// If the cookie does not exist, play the file
if (!x) {

// Strip .swf from Flashfile
var FlashFile = FlashFile.split('.swf');
var FlashFile = FlashFile[0];

        if (AC_FL_RunContent == 0) {
            alert("This page requires AC_RunActiveContent.js.");
        } else {
            AC_FL_RunContent(
                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                'width', '10%',
                'height', '10%',
				'src', FlashFile,
                'quality', 'high',
                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                'align', 'middle',
                'play', 'true',
                'loop', 'false',
                'scale', 'scale',
                'wmode', 'transparent',
                'devicefont', 'false',
                'id', 'nav',
                'bgcolor', '#fdfcfc',
                'name', 'nav',
                'menu', 'false',
                'allowFullScreen', 'false',
                'allowScriptAccess','sameDomain',
                'movie', FlashFile,
				'FlashVars', 'soundFile=' + AudioFile + '&amp;autoStart=yes&amp;loop=' + Loop,
                'salign', 'lt'
                ); //end AC code
        }

	// If PlayOnce is more than 0 (zero), then create a cookie
	if (PlayOnce>0)
	{
	createCookie(location.href,'Already Played',PlayOnce)		
	}
		
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function createCookie(name,value,hours) {
	if (hours) {
		var date = new Date();
		date.setTime(date.getTime()+(hours*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

//document.write('<a href="javascript:eraseCookie(\'BSS_SB\');">Erase cookie</a>');
