function setupAlternateDates(JSONString) {
  
  var obj = JSONString.evalJSON();
	
	if (obj.alternates.length == 0) return;
	
	var element = new Element("div");
	
	if (obj.alternates.length == 1) {
	  element.update("Viewing availability for " + obj.alternates[0].display);
	} else {
	  var dateOrPackage = (obj.pType == "pkg") ? ["package", "packages"] : ["date", "dates"];
	  
    var select = new Element("select", {"id":"SYOSDateSelect", "onchange":"dropDownItemSelected(this)"});
    for (var i = 0; i < obj.alternates.length; i++) {
      var option = new Element("option", {value:obj.alternates[i].value }).update(obj.alternates[i].display);
      select.insert(option);
      if (obj.initID == obj.alternates[i].value) {
        option.setAttribute("selected", "");
      }
	  }
	  
	  element.insert({
	    top: new Element("div", {id:"syosDateSwitchText"}).update("<b>Not finding the seats you’re looking for? Try a different date.</b><br>Note that changing dates will clear any seat selection you have made.").setStyle({cssFloat:"left"}),
	    bottom: new Element("div", {id:"syosDateSwitchContainer"}).setStyle({cssFloat:"right"}).insert({
	      top: new Element("span").update("Currently viewing availability for:<br>"),
	      bottom: select
	    })
    });
    
    element.insert({bottom:new Element("div").addClassName("clearFloat")});
	  
	}
  
  $("SYOSDateSelectionDiv").update(element);
  
  lDialogs.lastDialog.resize();
}

		
function dropDownItemSelected(dropDownSelect) {
	dropDownSelect.disable();
	$("syosFlash").changePID(dropDownSelect.value);
}

function releaseDropDownBlock() {
	$("SYOSDateSelect").enable();
}

function showDateSelection() {
	$("SYOSDateSelectionDiv").setStyle({visibility:"visible"});
}



function doSYOSEmbed(houseId, type, id, isnfs) {
  
  //baseURL, houseID, pType, pID
  //"{baseURL:'/main.taf?p=1,25,4', houseId:'lauraTurnerClassical', pType:'perf', pId:'2599'}"
  
  lDialogs.lastDialog.elementContent.setStyle({width:null});
  lDialogs.lastDialog.resize();
  
  houseId = houseId || "warMemorialOperaHouse";
  type    = type || "pkg";
  id      = id || "316";
  
  var flashvars = {};
  flashvars.isLive       = "true";
  flashvars.baseURL      = "/h/cart/";  
  flashvars.addtlURLParams = escape("&") + escape(getNFSParamString());  
  flashvars.houseID      = houseId;
  flashvars.pType        = type;
  flashvars.pID          = id;
  flashvars.houseDataURL = pRube.modulePath + "syos/" + houseId + "Config.json";
  flashvars.houseURL     = pRube.modulePath + "syos/" + houseId + ".swf";
  flashvars.isErube1     = "false";
  
  //flashvars.showPhotoPreviewPlot = "true";
  
  var params = {};
  params.allowscriptaccess = "always";
  
  var attributes = {};
  attributes.id = "syosFlash";
  
  swfobject.embedSWF(pRube.modulePath + "syos/syosFrame.swf", "flashSyosDiv", "900", "500", "9.0.0", false, flashvars, params, attributes, doSYOSEmbedComplete);
}
function doSYOSEmbedComplete(e) {
  //lDialogs.lastDialog.resize();
}

