function programPop(popTrigger, popCont, popContCode, ajaxCont, ajaxContCode, cbCode, showXHTML) {
	var currIndex = null;
	var currID;

	$(popTrigger).each(function(index) {
	    $(this).click(function(e) {
	        if (index != currIndex) {
	            var $popCont = $(popCont);
	            $popCont.remove();
	            currIndex = index;
	            $(popContCode).appendTo("body");
	            $(ajaxContCode).appendTo(popCont);
	            $(cbCode).prependTo(popCont).click(function() {
	                $(popCont).remove();
	                currIndex = null;
	            });
	            var leftMarg = e.pageX;
	            var topMarg = e.pageY - 5;
	            var $ajaxCont = $(ajaxCont);
	            switch ($(this).parent().hasClass("PopupRight")) {
	                case true:
	                    $(popCont).css({
	                        left: (leftMarg + 10) + "px",
	                        top: topMarg + "px"
	                    });
	                    $(popCont + " img.closeButton").css("left", "10px");
	                    break;
	                case false:
	                    $(popCont).css({
	                        left: ((leftMarg - $ajaxCont.width()) - 30) + "px",
	                        top: topMarg + "px"
	                    });
	                    $(popCont + " img.closeButton").css("left", "199px");
	                    break;
	            }
	            $ajaxCont.load(showXHTML + $(this).attr('id')).css("backgroundImage", "none");
	        }
	        return false;
	    });
	});
}
$(document).ready(function() {
	/*
		popTrigger is the CSS path to the <a> element(s) that spawn 
		the inline pop-ups.
	*/
	var popTrigger = "div.programTablesCont table tbody tr td a";
	/*
		popCont is the CSS path to the <div> element(s) that will position 
		the Ajax container.
	*/
	var popCont = "div.programPop";
	/*
		popContCode is the XHTML code that will create popCont.
	*/
	var popContCode = "<div class='programPop'></div>";
	/*
		ajaxCont is the CSS path to the <div> element(s) that will 
		contain the Ajax-loaded external files.
	*/
	var ajaxCont = "div.popupProgram";
	/*
		ajaxContCode is the XHTML code that will create ajaxCont.
	*/
	var ajaxContCode = "<div class='PopupProgram-CON popupProgram Wrapper'></div>";
	/*
		cbCode is the XHTML code that will create popCont's close button. 
		It's highly recommended that <img>'s class be written as "closeButton", 
		otherwise you might need to change the classname in line 31 for this 
		script to perform properly.
	*/
	var cbCode = "<a href='javascript:void(0);' title='Close window'><img src='/Station_Includes/Images/button_popUp_close.gif' alt='Close button' width='15' height='15' class='closeButton' /></a>";
	/*
		showXHTML is the suffix of the external XHTML file that will load 
		into ajaxCont when popTrigger is clicked.
	*/
	var showXHTML = "/Station_Components/ProgramSchedule/Lists/SchedulePopUp.aspx?ShowID=";
	programPop(popTrigger, popCont, popContCode, ajaxCont, ajaxContCode, cbCode, showXHTML);
}); 
