var fi = {};

function initpage(){
	var numOfTsEntries = 6;
	fi.base = new Base(numOfTsEntries);
	fi.fashionShow = new ComponentGallery("compGallery");
	fi.formValidator = new FormValidator();
	if ($$('#projectNavigation').length){
		fi.projectNavigation = new TabView("projectNavigation");	
	}
	
	if (window.videoExists == 1) {
		
		var vidHeight = swfHeight - 2;
		
		if (swfHeight == 380){
			
			var so = new SWFObject('/swf/videoplayer2011.swf', 'videoMain', swfWidth, swfHeight, '0', '#000000');
			var fv = $H(window.projectFlashVars);
			fv.each(function(item){
				so.addVariable(item.key, item.value);
			});
			so.addVariable('vHeight', vidHeight);
			so.addParam('salign','tl');
			so.addParam('wmode','opaque');
			so.write($('feature'));
			
			var player = document.getElementById('videoMain');
			var playBtn = new Element('a', {
				'href': '#',
				'class': 'initialPlayButton',
				'id': 'playButtonOverlay',
				'style': 'display:none'
			});
			$(playBtn).observe('click', function(){
				player.startVideo();
				$(this).hide();
				return false;
			});
			$('feature').insert(playBtn);
			
		} else {
			
			var so = new SWFObject('/swf/videoPlayer.swf', 'videoMain', swfWidth, swfHeight, '0', '#000000');
			var fv = $H(window.projectFlashVars);
			fv.each(function(item){
				so.addVariable(item.key, item.value);
			});
			so.addVariable('vHeight', vidHeight);
			so.addParam('salign','tl');
			so.addParam('wmode','opaque');
			so.write($('feature'));
			
		}
	}
	
}

function showPlayButton(){
	$('playButtonOverlay').show();
}

function hidePlayButton(){
	$('playButtonOverlay').hide();
}

document.observe("dom:loaded",initpage);
