/*
*	Load the Flash video
*/

jQuery(document).ready(function() {
	if($('.flashVideo').size() > 0){
		$('.flashVideo').css('display', 'block');

		var flashHeight;
		var flashWidth;
		
		var i=0;
		
		$('.flashVideo').each(function(i){
			
			switch($(this).find('p').attr('class')){
				case 'widescreen' :
					flashHeight = 220;
					flashWidth = 535;
				break;
				case 'halfwidth':
					flashHeight = 220;
					flashWidth = 255;
				break;
				default:
					flashHeight = 380;
					flashWidth = 535;
				break;
			}
			
			var flashElementDiv = $(this).attr('id');
			
			$(flashElementDiv).css('height', flashHeight);
			$(flashElementDiv).css('width', flashWidth);
			
			var videoName = $(this).find('p').attr('id');
			
			var so = new SWFObject("../swf/"+videoName+'.swf', "sotester", flashWidth, flashHeight, "9");
			so.useExpressInstall('../swf/expressinstall.swf');
			so.addParam("wmode", "opaque");
			so.write(flashElementDiv);
		});
	}
});
