/* ---------------- */
/* GLOBAL FUNCTIONS */
/* ---------------- */


function open_panel(panelName, w, h) { 
	$("#overlay").show(); 
	mt = Math.round(h / 2) * -1 - 25; 
	ml = Math.round(w / 2) * -1;
	w = w - 20;
	h = h - 20; 
	$("#"+panelName).css( { 'width' : w + 'px', 'height' : h + 'px', 'margin-top' : mt + 'px', 'margin-left' : ml +'px'});
	$("#"+panelName).fadeIn(); 
}


function open_panel2(panelName, w, h) { 
	$("#overlay2").show(); 
	mt = Math.round(h / 2) * -1 - 25; 
	ml = Math.round(w / 2) * -1;
	w = w - 20;
	h = h - 20; 
	$("#"+panelName).css( { 'width' : w + 'px', 'height' : h + 'px', 'margin-top' : mt + 'px', 'margin-left' : ml +'px'});
	$("#"+panelName).fadeIn(); 
}

function close_panel() {
	$(".overlay-panel").hide(); 
	$("#overlay").fadeOut(); 
	$("#youtube_video").html("");
}


function close_panel2() {
	$(".overlay-panel2").hide(); 
	$("#overlay2").fadeOut(); 
}

$(document).ready(function() { 
	$('#overlay').click(function() {
		close_panel();
	}); 
	//open_panel('activation-panel', 500, 580);
	$(document).keypress(function(event) {
		if(event.keyCode == 27) {
			close_panel(); 
		}
		
	});     
});



