var core = {
	swfObjects: [],
	containerCheck: function (id) {
		if (typeof id == 'string' && document.getElementById(id)) {
			this.swfObjects.push(id);
		}
		return true;
	},
	agentCheck: function () {
        var ua = navigator.userAgent.toLowerCase();
        var ua_type;
        if (/chrome/.test(ua) || (/mozilla/.test(ua) && !/(compatible|webkit)/.test(ua))) {
            ua_type = 0;
        } else if (/opera/.test(ua)) {
            ua_type = 1;
        } else {
            ua_type = 2;
        }
        return ua_type;
	},
	callMovies: function () {
	    for (var i = 0; i < this.swfObjects.length; i++) {
	        var movie = swfobject.getObjectById(this.swfObjects[i]);
	        if (movie && movie.unloadInit) {
    			movie.unloadInit();
    		}
	    }
	}
};
window.onbeforeunload = function() {
	core.callMovies();
}