/*
	/calendar/calendar.js:	This file includes all javascript specific to the calendar functions of the Kennedy Center website.

	MODIFICATIONS:
	9/29/05 - Lisa Haas - created
	2/7/08 - Joe Dickerson - added ajax functionality using YUI dialog box
*/

var loadingText = 'Loading...';

var mouseEvent;
var current_id;



/*
function openPriceWindow(url) {
	
	//	openPriceWindow:  opens a popup window to display pricing and section availability
	//	9/29/05 - Lisa Haas - created
	
	window.open(url,'pricing','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=450,height=300,left=565,top=412');
	return false;
}*/

function stateChange(_init)
{	

	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4) {
		// if "OK"
		if (xmlhttp.status==200) {
			var _id=xmlhttp.responseText.substring(0,xmlhttp.responseText.indexOf('|'));
			var _text = xmlhttp.responseText.substring(xmlhttp.responseText.indexOf('|')+1);
			document.getElementById(_id).innerHTML = _text;
			//placePricing(_id);
			
			if(_init){
				_init(); 	
			}
			
		} else {
			alert("Error retrieving pricing");
		}
	}
}



/*
 * 
 */
function showPrices(show){
	if(show){	
		YAHOO.pricing.pricing_dialog.show();	
	}else{
		YAHOO.pricing.pricing_dialog.hide();	
	}
}

function loadPrices(perf_no, venue,mos,dt,link,show_avail){
		var _id = 'perf_pricing';
		showPrices(true);
		if(perf_no != current_id){
			document.getElementById(_id).innerHTML = loadingText;
			var _link = '/calendar/dsp_perf_pricing.cfm?perf_no=' + perf_no + '&venue=' + venue + '&id=' + _id + '&mos=' + mos + '&dt=' + dt + '&purchase_link=' + link + '&show_avail=' + show_avail;
			loadXMLDoc(_link, stateChange);
			current_id = perf_no;
		}	
}

