var server = null;
var application = null;

var presentationPlayerConfiguration = {
		plugins: {
			controls: {
				autoHide: true,
				play: true,
				volume: false,
				fullscreen: false,
				time: false,
				mute: true,
				pause: true,
				scrubber: false
			}
		},
	    clip: {
	        autoPlay: true,
	        autoBuffering: true
	    }
	};

var LayerBackgroundActivateEvent = function(){
	$('#image_losdinzel').click(function(){window.location = 'home.php';});

	var topValue = ($(document).height() - $('#fondo_general_pane').height());
	var leftValue = ($(document).width() - $('#fondo_general_pane').width());
	$('#main').css('top',Math.round(topValue * 0.5) +'px');
	$('#main').css('left',Math.round(leftValue * 0.5) +'px');

	$('#player_video_presentacion').attr('href','application/resources/presentacion/los_dinzel.flv');
	$('#player_video_presentacion').width(640);
	$('#player_video_presentacion').height(400);
	var leftValue = ($('#layer_index').width() - $('#player_video_presentacion').width());
	$('#player_video_presentacion').css('left', Math.round(leftValue * 0.5) +'px');
	$('#player_video_presentacion').flowplayer('application/libs/flowplayer/flowplayer-3.2.2.swf',presentationPlayerConfiguration);
};

$(document).ready(function (){
	server = new ManagerServer();
	application = new Application();
	
	LayerBackgroundActivateEvent();	
	
	var layerIndex = new Layer('layer_index');
	layerIndex.setEventActivate(LayerIndexActivateEvent);
	application.addLayer(layerIndex);
	application.show('layer_index');
	
	var layerHome = new LayerProxy('layer_home','home/layer.php');
	layerHome.setEventActivate(LayerHomeActivateEvent);
	application.addLayer(layerHome);

	var layerSeccionFotos = new LayerProxy('layer_seccion_fotos','seccionFotos/layer.php');
	layerSeccionFotos.setEventActivate(LayerSeccionFotosActivateEvent);
	application.addLayer(layerSeccionFotos);

	var layerSeccionVideos = new LayerProxy('layer_seccion_videos','seccionVideos/layer.php');
	layerSeccionVideos.setEventActivate(LayerSeccionVideosActivateEvent);
	application.addLayer(layerSeccionVideos);

	var layerSeccionContacto = new LayerProxy('layer_seccion_contacto','seccionContacto/layer.php');
	layerSeccionContacto.setEventActivate(LayerSeccionContactoActivateEvent);
	application.addLayer(layerSeccionContacto);

	var layerSeccionHistoria = new LayerProxy('layer_seccion_historia','seccionHistoria/layer.php');
	layerSeccionHistoria.setEventActivate(LayerSeccionHistoriaActivateEvent);
	application.addLayer(layerSeccionHistoria);

	var layerSeccionCV = new LayerProxy('layer_seccion_cv','seccionCV/layer.php');
	layerSeccionCV.setEventActivate(LayerSeccionCVActivateEvent);
	application.addLayer(layerSeccionCV);

});


