
/**
 * @object heavy
 * IE fix: hide all the video embeds before unloading, otherwise there's a long series of errors.
 */
var heavy={
	addEvent: function(obj, evType, fn){
		if (obj.addEventListener){
			obj.addEventListener(evType, fn, true);
			return true;
		} else if (obj.attachEvent){
			var r = obj.attachEvent("on"+evType, fn);
			return r;
		} else {
			return false;
		}
	},
	holder: {},
	init: function(){
		this.holder.embeds 	= document.getElementsByTagName('embed') || false;
		this.holder.objects = document.getElementsByTagName('object') || false; 
	},
	
	
	unload: function(){
		if (
			!this.holder.embeds || this.holder.embeds === false || !this.holder.objects || this.holder.objects === false
		) { return false; }
		
		var lenE = this.holder.embeds.length;
		var lenO = this.holder.objects.length;
		
		for (var i=0; i<lenE; i++){
			this.holder.embeds[i].style.display = 'none';
		}
		for (var i=0; i<lenO; i++){
			this.holder.objects[i].style.display = 'none';
		}
	}
	
}; /* end obj heavy */

heavy.addEvent(window,'load', function(){ heavy.init(); });
heavy.addEvent(window,'unload', function(){ heavy.unload(); });
