$(document).ready(function() {
	
	//$('div.png_fix').pngFix();
	$('.png_fix').supersleight();

});
function showVideo(videoFilename, subtitleFilename, closeText) {
	// update download link
	$("#downloadVideo").attr("href", videoFilename);
	
	so = new SWFObject('/flash/shared/player-licensed.swf','mpl','530','350','9');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	if (subtitleFilename) {
		so.addParam('flashvars','&file=' + videoFilename + '&autostart=true&skin=/flash/shared/stylish.swf');
		so.addParam('flashvars','&file=' + videoFilename + '&captions=' + subtitleFilename + '&skin=/flash/shared/stylish.swf&plugins=accessibility');
	} else {		
		so.addParam('flashvars','&file=' + videoFilename + '&autostart=true&skin=/flash/shared/stylish.swf');
	}
	
	so.addParam("wmode", "transparent");
	
	var api = $("#overlay_conatiner").overlay({ 
		 
	    close: '.right_container .close',
	 
	    // some expose tweaks suitable for facebox-looking dialogs 
	    expose: { 
	 
	        // you might also consider a "transparent" color for the mask 
	        color: '#000', 
	 
	        // load mask a little faster 
	        loadSpeed: 200, 
	 
	        // highly transparent 
	        opacity: 0.7 
	    }, 
	 
	    // disable this for modal dialog-type of overlays 
	    closeOnClick: false, 
	 
	    // we want to use the programming API 
	    api: true 
	 
	// load it immediately after the construction 
	}).load();
	
	so.write('overlay_conatiner');
 
	$('#overlay_conatiner').prepend('<div class="close_button close"><p class="button"><a href="javascript:;">'+closeText+'</a></p></div>');
	
	$(".close").click(function () {
		api.close();
		$('#overlay_conatiner').empty();
	});
	
	$('.png_fix').supersleight();
	
	return false;
	
}

function technologyVideo( videoFilename, subtitleFilename, div, textDiv){
	
	$('#'+div).empty();
	so = new SWFObject('/flash/shared/player-licensed.swf','mpl','530','350','9');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	if (subtitleFilename) {
		so.addParam('flashvars','&file=' + videoFilename + '&autostart=true&skin=/flash/shared/stylish.swf');
		so.addParam('flashvars','&file=' + videoFilename + '&captions=' + subtitleFilename + '&skin=/flash/shared/stylish.swf&plugins=accessibility');
	} else {		
		so.addParam('flashvars','&file=' + videoFilename + '&autostart=true&skin=/flash/shared/stylish.swf');
	}
	
	so.addParam("wmode", "transparent");
	so.write(div);
	
	if( textDiv != null ){
		switchText( textDiv );
	}

}
function technologyImage( imagePathName, div, textDiv){
	
	$('#'+div).empty();
	
	$('<img src="'+imagePathName+'" />').appendTo('#'+div);
	
	if( textDiv != null ){
		switchText( textDiv );
	}
	
}
function switchText( textDiv ){
	
	if( $('#'.textDiv).length != 0 ){
		
		var children = $("#overlay_text").children();
		
		children.each(function (i) {

			$(this).hide();
		});
		
		$('#'+textDiv).show();
		
	}

}

