// cc lightbox
function openBox(boxURL, boxWidth, shadow) {
	// magical math for finding the right margin
	var boxMargin = boxWidth/2 + 6;
	// set append as a string variable
	var append = "";
	// reverse the boxMargin
	boxMargin = -boxMargin;
	// get the distance from the top of the page
	var mTop = $(window).scrollTop();
	
	// set margins to place the box properly
	$("#dialogBox").width(boxWidth);
	$("#dialogBox").margin({left: boxMargin})
	$("#dialogBox").margin({top: mTop})
	// if the shadow variable is passed, show it with a black opacity background
	if (shadow == 1) { 
		append = ", #blackbox";
	} else {
		// or show a clear background
		append = ", #clearbox";
	}
	// fade in the dialog box
	$("#dialogBox"+append).fadeIn(300);
	$("#dialogBox").html('<div style="text-align:center; margin: 10px">Loading...<a href="#" onClick="closeBox()">(close)</a></div>').fadeIn(200);
	$.ajax({
        type: "GET",
        url: boxURL,
        success: function(conf) {
               $("#dialogBox").html(conf).fadeIn(200);
        }

        });    
}

function closeBox() { 
	$("#dialogBox").fadeOut(300);
	$("#clearbox, #blackbox").fadeOut(300);
	setTimeout(function() {$("#dialogBox").html("")} , 300);
	
}



