// JavaScript Document
//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

function showpopup(title, embed) {
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	//centering
	t = windowHeight/2-popupHeight/2;
	l =windowWidth/2-popupWidth/2;

	//if (t < 20){ t = 50; }	
	//ssif (l < 20){ l = 50; }
	
	$("#popupContact").css({
//		"position": "fixed",
		"_position":"absolute",
		"top": t,
		"left": l
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"_position":"absolute",
		"height": windowHeight
	});	
	
	//load popup
	if(popupStatus==0){
		$("#backgroundPopup").css({
//			"position": "fixed",
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupContact").fadeIn("slow");
		document.getElementById('pre_player_head').innerHTML = title;
		document.getElementById('pre_player').innerHTML ='<embed src="'+embed+'" allowfullscreen="true" allowScriptAccess="always" allowNetworking="all" width="425" height="320" /></embed>';		
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablepopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		$("#pre_player > embed").remove();
		popupStatus = 0;
	}
}