var exhibitionist_vi_videoObject = function(){
	this.init = function(mainClass,aligner,itemArray){
		this.mainClass = mainClass;
		this.aligner = aligner;
		this.itemArray = itemArray;
	}
	this.getImageCopy = function(){
		var copy = {
			image:document.createElement("video"),
			imageWidth:0,
			imageHeight:0,
			alignedWidth:0,
			alignedHeight:0
		};
		copy.play = function(){
			if (typeof(copy.image.play) == 'function'){
				copy.image.play();
			};
		};
		copy.stop = function(){
			if (typeof(copy.image.pause) == 'function'){
				copy.image.pause();
			};
		};
		copy.image.innerHTML="<b>Your browser does not support HTML5 video tag.</b>";
		copy.image.setAttribute("controls","controls");
		//add the video player to see what size it is without the video
		this.mainClass.object.appendChild(copy.image);
		copy.imageWidth = copy.image.offsetWidth;
		copy.imageHeight = copy.image.offsetHeight;
		this.mainClass.object.removeChild(copy.image);
		//add the source video
		copy.image.setAttribute("src",this.itemArray['url']);
		//wait for video to be loaded before aligning it with the other images or videos
		copy.aligner = this.aligner;
		copy.waitForSizeLoop = function(objectCopy){
			setTimeout(function(objectCopy){
				return function(){
					if ((objectCopy.image.offsetWidth == 0) || (objectCopy.image.offsetHeight == 0)){
						objectCopy.waitForSizeLoop();
					}else{
						if ((objectCopy.imageWidth == objectCopy.image.offsetWidth) && (objectCopy.imageHeight == objectCopy.image.offsetHeight)){
							objectCopy.waitForSizeLoop();
						}else{
							//alert(objectCopy.image.offsetWidth+" "+objectCopy.image.offsetHeight);
							objectCopy.imageWidth = objectCopy.image.offsetWidth;
							objectCopy.imageHeight = objectCopy.image.offsetHeight;
							objectCopy.aligner.setAlignment(objectCopy);
						}
					}
				}
			}(copy),1);
		}
		copy.waitForSizeLoop(copy);
		return copy;
	}
}