function openEditor() {
	var link = $("<a href=\"editor.php?iframe&"+Math.random()+"\"></a>");
	
	link.fancybox({
		frameWidth: 825,
		frameHeight: 530,
		padding: 0,
		callbackOnShow: function () {
			jQuery("#fancy_overlay, #fancy_wrap").unbind("click", null);
			
		}
	});
	
	link.click();
}

function animateToPlayer(entryId) {
	jQuery("#fancy_frame")[0].src = "about:blank";

	var width = Number(jQuery("#fancy_outer").css("width").replace("px", ""));
	var height = Number(jQuery("#fancy_outer").css("height").replace("px", ""));
	var newWidth = 740;
	var newHeight = 440;
	var leftOffset = (width - newWidth) / 2;
	var topOffset = (height - newHeight) / 2;
	
	jQuery("#fancy_outer").animate({
		width: newWidth+"px",
		left: "+="+leftOffset+"px",
		height: newHeight+"px",
		top: "+="+topOffset+"px"
	},{
		duration: "slow",
		complete: function() {
			jQuery("#fancy_frame")[0].src = "player.php?iframe&"+Math.random()+"&id="+entryId;
		}
	})
}

function animateToEditor(entryId) {
	jQuery("#fancy_frame")[0].src = "about:blank";

	var width = Number(jQuery("#fancy_outer").css("width").replace("px", ""));
	var height = Number(jQuery("#fancy_outer").css("height").replace("px", ""));
	var newWidth = 825;
	var newHeight = 530;
	var leftOffset = (width - newWidth) / 2;
	var topOffset = (height - newHeight) / 2;
	
	jQuery("#fancy_outer").animate({
		width: newWidth+"px",
		left: "+="+leftOffset+"px",
		height: newHeight+"px",
		top: "+="+topOffset+"px"
	},{
		duration: "slow",
		complete: function() {
			jQuery("#fancy_frame")[0].src = "editor.php?iframe&"+Math.random()+"&id="+entryId;
		}
	})
}

function animateToUpdateName(entryId) {
	jQuery("#fancy_frame")[0].src = "about:blank";

	var width = Number(jQuery("#fancy_outer").css("width").replace("px", ""));
	var height = Number(jQuery("#fancy_outer").css("height").replace("px", ""));
	var newWidth = 360;
	var newHeight = 130;
	var leftOffset = (width - newWidth) / 2;
	var topOffset = (height - newHeight) / 2;
	
	jQuery("#fancy_outer").animate(
		{
			width: newWidth+"px",
			left: "+="+leftOffset+"px",
			height: newHeight+"px",
			top: "+="+topOffset+"px"
		},
		{
			duration: "slow",
			complete: function() {
				jQuery("#fancy_frame")[0].src = "update_name.php?iframe&"+Math.random()+"&id="+entryId;
			}
		}
	)
}