function setupAlternateDates(JSONString) {
	
	obj = eval("(" + JSONString + ")");
	var htmlStr;
	
	if (obj.alternates.length == 0) {
		return;
	} else if (obj.alternates.length == 1) {
		
		// Show single line
		htmlStr = "<div>Viewing availability for " + obj.alternates[0].display + "</div>";
		
	} else {
		
		$("SYOSContainerDiv").setStyle({marginTop:"-15px"});
  	
		// Create the drop down
		var dateOrPackage = (obj.pType == "pkg") ? ["package", "packages"] : ["date", "dates"] ;
		
		
		htmlStr = '\
		<div>\
			<div style="float:left;">\
				<p style="line-height:17px;"><span style="font-weight:bold">Not finding the seats you&rsquo;re looking for? Try a different ' + dateOrPackage[0] + '.</span><br>Note that changing ' + dateOrPackage[1] + ' will clear any seat selection you have made.</p>\
			</div>\
			<div style="float:right;">\
				<p style="margin-bottom:3px; padding-left:3px;"><b>Currently viewing availability for:</b></p>\
				<form action="#">\
					<select id="SYOSDateSelect" onchange="dropDownItemSelected(this)">';
		
		for (var i = 0; i < obj.alternates.length; i++) {
			if (obj.initID == obj.alternates[i].value) {
				htmlStr += '<option selected value="' + obj.alternates[i].value + '">' + obj.alternates[i].display + '</option>';
			} else {
				htmlStr += '<option value="' + obj.alternates[i].value + '">' + obj.alternates[i].display + '</option>';
			}
		}
		
		htmlStr += '\
					</select>\
				</form>\
			</div>\
			<div class="clearFloat"></div>\
		</div>';
	}
	
	var target = document.getElementById("SYOSDateSelectionDiv");
	target.innerHTML = htmlStr;
}

		
function dropDownItemSelected(dropDownSelect) {
	dropDownSelect.disabled = true;
	//alert(dropDownSelect.value);
	var syos = document.getElementById("syosFlash");
	syos.changePID(dropDownSelect.value);
}

function releaseDropDownBlock() {
	var target = document.getElementById("SYOSDateSelect");
	target.disabled = false;
}

function showDateSelection() {
	var target = document.getElementById("SYOSDateSelectionDiv");
	target.style.visibility = "visible";
}



function doSYOSEmbed(houseID, pType, pID) {
  
  /*
  House Ids:
  StateTheatreVic
  OperaTheatreNSW
  ConcertHallNSW
  */
  
  var flashvars = {};
  flashvars.isLive               = "true";
  flashvars.baseURL              = escape("/h/tessitura/");
  flashvars.addtlURLParams       = ""; // eg, "&foo=bar"
  flashvars.houseID              = houseID;
  flashvars.pType                = pType;
  flashvars.pID                  = pID;
  flashvars.houseDataURL         = escape("/modules/syos/" + houseID + "Config.json");
  flashvars.houseURL             = escape("/modules/syos/" + houseID + ".swf");
  //flashvars.showPhotoPreviewPlot = "true";
  
  var params = {};
  params.allowscriptaccess = "always";
  
  var attributes = {};
  attributes.id = "syosFlash";
  
  swfobject.embedSWF("/modules/syos/syosFrame.swf", "flashSyosDiv", "860", "523", "9.0.0", false, flashvars, params, attributes);
}







