// Start jQuery Cookie - Requires jQuery!

jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

var before = {
    setup: function () {
        cookies = document.cookie.split('; ')
        for (var i = 0, c; (c = (cookies)[i]) && (c = c.split('=')[0]); i++) {
            document.cookie = c + '=; expires=' + new Date(0).toUTCString();
        }
    }
};

// END jQuery Cookie


 // Create Function to Remove The Video
function removeFlash(id) {
	if (document.getElementById) {
		var flashObj = document.getElementById(id);
		while (flashObj.hasChildNodes()) {
		flashObj.removeChild(flashObj.firstChild);
		 $("#walk-on").remove(); // Removes the whole div via jQuery
		}
	 }
}
if ($.cookie('hood_mart') != null) // Checks for existing cookie
{
	// The Cookie Exists, Don't Play Movie, Reset Cookie
	$.cookie('hood_mart', '1', { expires: 1 });
}
else

{
// The Cookie was not Set - SET COOKIE, Play Movie
	$.cookie('hood_mart', '1', { expires: 1 });

// Create the Script Object
var script = document.createElement('script');
script.src = 'http://media.newimagemedia.com/hoodmart/AC_RunActiveContent.js';
script.type = 'text/javascript';
script.defer = true;
script.id = 'active'; // This will help us in referencing the object later for removal
// Insert the created object to the html head element
var head = document.getElementsByTagName('head').item(0);
head.appendChild(script);

// This Adds the HTML code to the page
document.write('<div id="walk-on" style="position: fixed;bottom: -10px;right: 0px;width: 448px;height: 336px;z-index: 99999 !important;">');
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="448" height="336" id="AlphaFLV" align="middle">');
document.write('<param name="allowScriptAccess" value="always" />');
document.write('<param name="allowFullScreen" value="false" />');
document.write('<param name="movie" value="http://media.newimagemedia.com/hoodmart/HoodMartHomePage.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="wmode" value="transparent">');
document.write('<embed src="http://media.newimagemedia.com/hoodmart/HoodMartHomePage.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="448" height="336" name="AlphaFLV" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
document.write('</div>');

}
