Skip to content

Instantly share code, notes, and snippets.

@seedprod
Created June 8, 2010 20:23
Show Gist options
  • Save seedprod/430600 to your computer and use it in GitHub Desktop.
Save seedprod/430600 to your computer and use it in GitHub Desktop.
NY Phil Seatmap JS
var isHttps = false;
var yuiVersion = '2.5.2';
function includeJavaScript(jsFile)
{
document.write('<script type="text/javascript" src="'
+ jsFile + '"></script>');
}
function includeCSS(cssFile)
{
document.write('<link rel="stylesheet" type="text/css" href="'
+ cssFile + '" />');
}
if(isHttps == false) {
includeJavaScript('http://yui.yahooapis.com/' + yuiVersion + '/build/yahoo-dom-event/yahoo-dom-event.js');
includeJavaScript('http://yui.yahooapis.com/' + yuiVersion + '/build/connection/connection-min.js');
includeJavaScript('http://yui.yahooapis.com/' + yuiVersion + '/build/container/container.js');
includeJavaScript('http://yui.yahooapis.com/' + yuiVersion + '/build/json/json-min.js');
includeJavaScript('http://yui.yahooapis.com/' + yuiVersion + '/build/datasource/datasource-beta-min.js');
includeJavaScript('ayui/wz_jsgraphics.js');
includeCSS('http://yui.yahooapis.com/' + yuiVersion + '/build/container/assets/container.css');
}
else {
includeJavaScript('ayui/yahoo-dom-event.js');
includeJavaScript('ayui/connection-min.js');
includeJavaScript('ayui/container-min.js');
includeJavaScript('ayui/json-min.js');
includeJavaScript('ayui/datasource-beta-min.js');
includeJavaScript('ayui/wz_jsgraphics.js');
includeCSS('ayui/container.css');
}
// seatMap object
seatMap = function () {
YAHOO.namespace("html.container");
this.seatJSON = null;
this.statusJSON = null;
this.stateJSON = null;
this.sectionSeatJSON = null;
this.sectionStatusJSON = null;
this.sectionStateJSON = null;
this.sectionZoneSeatJSON = null;
this.spacePrioritySectionsJSON = null;
this.pricelevelSeatJSON = null;
this.pricelevelStatusJSON = null;
this.pricelevelStateJSON = null;
this.pricelevelZoneSeatJSON = null;
this.layoutJSON = null;
this.imageMapHover = new YAHOO.util.CustomEvent("imageMapHover");
this.imageMapHoverOut = new YAHOO.util.CustomEvent("imageMapHoverOut");
this.seatMapHover = new YAHOO.util.CustomEvent("seatMapHover");
this.seatMapHoverOut = new YAHOO.util.CustomEvent("seatMapHoverOut");
var currentSeats = new Array();
var seatHasStatus = null;
var seatIdToStatusName= new Object();
var mapId = 'seatMapObj' ;
var textFields = null;
var statusMap = null;
var wsUrl = null;
var overrideLayoutMapClickFunction = null;
var jg_doc = null;
var highlightColor = 'black';
var strokeSize = 4;
var useScaling = true;
var myTooltip = new Array();
var requestArea = null;
var requestLayout = null;
var requestAreaname = null;
var instanceName = null;
var parentWidth;
var areaCount = 0;
var areaImage = null; //areaImage
var areaWidth= 0; //areaWidth
var areaHeight = 0; //areaHeight
var layoutImage = null; //layoutImage
var layoutWidth = 0; //layoutWidth
var layoutHeight = 0; //layoutHeight
var $d = YAHOO.util.Dom;
var $e = YAHOO.util.Event;
var $l = YAHOO.lang;
var eventCode = 0;
var priceType = null;
var user = 0;
var mySeatCode = 0;
var availSeatCode = 0;
var htmlDescCache= new Object();
var currentHighlightId = '';
var bestSeatInPriceLevelID = '';
var bestSeatInPriceLevelQty = '';
var bestSeatInPriceLevelCallback = null;
var descriptionHTMLCallback = null;
var seatDescriptionHTMLCallback = null;
var renderSeatMapCallback = null;
var bestSeatInID = '';
var bestSeatInQty = '';
var bestSeatCallback = null;
var bestSpaceSeatInID = '';
var bestSpaceSeatInQty = '';
var bestSeatInName = '';
var bestSpaceSeatCallback = null;
var prioritySectionCount = 0;
var prioritySectionIndex = 0;
var priorityCode = null;
var arrAreas = new Array();
var arrOutlineImages = new Object();
var responseZones = null;
var mapWidth = null;
var seatToolTip = 'enabled';
var areaClick = 'enabled';
var areaToolTip = 'enabled';
var areaOutline = 'enabled';
var areaOutlineImage = 'enabled';
var sectionClick = 'enabled';
var sectionToolTip = 'enabled';
var sectionOutline = 'enabled';
var sectionOutlineImage = 'enabled';
var subsectionClick = 'enabled';
var subsectionToolTip = 'enabled';
var subsectionOutline = 'enabled';
var subsectionOutlineImage = 'enabled';
var pricelevelClick = 'enabled';
var pricelevelToolTip = 'enabled';
var pricelevelOutline = 'enabled';
var pricelevelOutlineImage = 'enabled';
var isRedraw = false;
var seatNameToId = new Object();
var seatNameToImageId = new Object();
var isGUID = true;
var requestComplete = null;
var myDate = new Date();
var doNotClearCanvas = 0;
var loadingHTML = 'Loading......';
// Start Handlers
this.seatHandler = function () {
var postData = 'method=get_seats&output=json&query=' + requestArea + '&event=' + this.getEvent() + '&user=' + this.getUser() + '&isGUID=' + isGUID;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.seatJSON = oResponse.results;
areaImage = oResponse.meta.areaImage;
areaWidth = oResponse.meta.areaWidth;
areaHeight = oResponse.meta.areaHeight;
textFields = oResponse.meta.areaText;
this.processSeatMap(3);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.seats",
fields: ["id",
"n",
"t",
//"m",
"w",
"h",
"i",
{key: "v", parser: YAHOO.util.DataSource.parseNumber} ,
{key: "hz", parser: YAHOO.util.DataSource.parseNumber}
],
metaFields : {
areaImage : 'response.i',
areaWidth : 'response.w',
areaHeight : 'response.h',
areaText : 'response.texts'
}
};
myDataSource.sendRequest(postData, oCallback);
}
this.sectionSeatHandler = function () {
var postData = 'method=get_seats&output=json&query=' + bestSeatInID + '&event=' + this.getEvent() + '&user=' + this.getUser() + '&isGUID=' + isGUID ;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.sectionSeatJSON = oResponse.results;
this.processBestSeats(3);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.seats",
fields: ["id",
"n",
"t",
//"m",
"w",
"h",
"i",
{key: "v", parser: YAHOO.util.DataSource.parseNumber} ,
{key: "hz", parser: YAHOO.util.DataSource.parseNumber}
],
metaFields : {
areaImage : 'response.i',
areaWidth : 'response.w',
areaHeight : 'response.h',
areaText : 'response.texts'
}
};
myDataSource.sendRequest(postData, oCallback);
}
this.pricelevelSeatHandler = function () {
var postData = 'method=get_seats&output=json&query=' + bestSeatInPriceLevelID + '&event=' + this.getEvent() + '&user=' + this.getUser() + '&isGUID=' + isGUID;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.pricelevelSeatJSON = oResponse.results;
this.processBestSeatsByPriceLevel(3);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.seats",
fields: ["id",
"n",
"t",
//"m",
"w",
"h",
"i",
{key: "v", parser: YAHOO.util.DataSource.parseNumber} ,
{key: "hz", parser: YAHOO.util.DataSource.parseNumber}
],
metaFields : {
areaImage : 'response.i',
areaWidth : 'response.w',
areaHeight : 'response.h',
areaText : 'response.texts'
}
};
myDataSource.sendRequest(postData, oCallback);
}
this.statusHandler = function () {
var postData = 'method=get_status&output=json&query=' + statusMap + '&event=' + this.getEvent() + '&user=' + this.getUser();
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.statusJSON = oResponse.results;
this.processSeatMap(3);
},
failure: function(oRequest,oResponse,oPayload) { // error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.statuscodes",
fields: ["n",
"c",
"i"
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.sectionStatusHandler = function () {
var postData = 'method=get_status&output=json&query=' + statusMap + '&event=' + this.getEvent() + '&user=' + this.getUser();
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.sectionStatusJSON = oResponse.results;
this.processBestSeats(3);
},
failure: function(oRequest,oResponse,oPayload) { // error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.statuscodes",
fields: ["n",
"c",
"i"
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.pricelevelStatusHandler = function () {
var postData = 'method=get_status&output=json&query=' + statusMap + '&event=' + this.getEvent() + '&user=' + this.getUser();
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.pricelevelStatusJSON = oResponse.results;
this.processBestSeatsByPriceLevel(3);
},
failure: function(oRequest,oResponse,oPayload) { // error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.statuscodes",
fields: ["n",
"c",
"i"
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.stateHandler = function () {
myDate = new Date();
var postData = 'method=get_state&output=json&area=' + requestArea + '&event=' + this.getEvent() + '&user=' + this.getUser() + '&ts=' + myDate.getTime();
var sUrl = mySeatMap.getWsUrl() + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.stateJSON = oResponse.results;
this.processSeatMap(4);
},
failure: function(oRequest,oResponse,oPayload) {
alert("error in state handler");
},
scope: this
};
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.responseSchema = {
resultsList: "response.state",
fields: [
"c",
"n",
"p"
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.changedStateHandler = function () {
myDate = new Date();
var postData = 'method=get_state&output=json&area=' + requestArea + '&event=' + this.getEvent() + '&user=' + this.getUser() + '&ts=' + myDate.getTime() ;
var sUrl = mySeatMap.getWsUrl() + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.stateJSON = oResponse.results;
this.processSeatMap(8);
},
failure: function(oRequest,oResponse,oPayload) {
alert("error in state handler");
},
scope: this
};
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.responseSchema = {
resultsList: "response.state",
fields: [
"c",
"n",
"p"
]
};
myDataSource.sendRequest(postData, oCallback);
}
// best space seats
this.getBestSpaceSeats = function (qty,callback) {
bestSeatInQty = qty;
bestSeatCallback = callback;
availableSeats= [];
requestComplete = false;
prioritySectionIndex =0;
this.processBestSeats(4);
}
// best seats
this.getBestSeats = function (id,qty,callback,name,isBestSpace) {
bestSeatInID = id;
bestSeatInQty = qty;
bestSeatCallback = callback;
bestSeatInName = name;
if(isBestSpace != 1){
availableSeats= [];
requestComplete = false;
prioritySectionCount = 0;
priorityCode = null;
}
this.processBestSeats(1);
}
// best seats by price level
this.getBestSeatsByPriceLevel = function (id,qty,callback,name) {
bestSeatInPriceLevelID = id;
bestSeatInPriceLevelQty = qty;
bestSeatInPriceLevelCallback = callback;
availableSeats= [];
requestComplete = false;
prioritySectionIndex =0;
this.processBestSeatsByPriceLevel(1);
}
this.loopPrioritySections = function(){
var prioritySection = this.spacePrioritySectionsJSON ;
if(prioritySectionCount == 0){
for (i in prioritySection) {
if( typeof(prioritySection[i]) != 'function' ) {
prioritySectionCount++;
}
}
}
if(requestComplete == false || requestComplete == null){
priorityCode = prioritySection[prioritySectionIndex].p;
this.getBestSeats(prioritySection[prioritySectionIndex].secid,bestSeatInQty,bestSeatCallback,prioritySection[prioritySectionIndex].sec,1);
}
}
this.getSectionSeatHandler = function () {
var postData = 'method=get_section_seats&output=json&query=' + bestSeatInID ;
var sUrl = wsUrl + '/asc_soap_parse_sync.php' ;
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.sectionSeatsJSON = oResponse.results;
this.processBestSeats(4);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.responseSchema = {
resultsList: "response.sectionSeats",
fields: ["id",
"name",
"s", // seat
"r" // row
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.sectionStateHandler = function(name){
this.sectionStateJSON = {
"response" : {
"state" : [
{ "seat":'LeftA1', "code":'Sold'},
{ "seat":'LeftA3', "code":'Sold'},
{ "seat":'LeftB1', "code":'Sold'}
]
}
}
this.processBestSeats(3);
}
this.pricelevelStateHandler = function(name){
this.pricelevelStateJSON = {
"response" : {
"state" : [
{ "seat":'LeftA1', "code":'Sold'},
{ "seat":'LeftA3', "code":'Sold'},
{ "seat":'LeftB1', "code":'Sold'}
]
}
}
this.processBestSeatsByPriceLevel(3);
}
this.getBestZonesInSectionHandler = function(){
var postData = 'method=get_section_zones&output=json&query=' + bestSeatInID +'&event=' + this.getEvent();
var sUrl = wsUrl + '/asc_soap_parse_sync.php' ;
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.sectionZoneSeatJSON = oResponse.results;
responseZones = oResponse.meta.responseZones;
this.processBestSeats(3);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.sectionZones",
fields: [//"sid", // seat id
"z", // zone
"p", // priority
"sn", // seat name
"s", // seat
"r" // row
] ,
metaFields : {
responseZones : 'response.zones'
}
};
myDataSource.sendRequest(postData, oCallback);
}
this.getBestZonesInPriceLevelHandler = function(){
var postData = 'method=get_pricelevel_zones&output=json&query=' + bestSeatInPriceLevelID +'&event=' + this.getEvent();
var sUrl = wsUrl + '/asc_soap_parse_sync.php' ;
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.pricelevelZoneSeatJSON = oResponse.results;
responseZones = oResponse.meta.responseZones;
this.processBestSeatsByPriceLevel(3);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.pricelevelZones",
fields: [//"sid", // seat id
"z", // zone
"p", // priority
"sn", // seat name
"s", // seat
"r" // row
] ,
metaFields : {
responseZones : 'response.zones'
}
};
myDataSource.sendRequest(postData, oCallback);
}
this.getBestZonesInSpaceHandler = function(){
var postData = 'method=get_space_zones&output=json&event=' + this.getEvent();
var sUrl = wsUrl + '/asc_soap_parse_sync.php' ;
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.spacePrioritySectionsJSON = oResponse.results;
this.processBestSeats(5);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.spacePrioritySections",
fields: [//"sid", // seat id
"p", // priority
"sec", // seat name
"secid"
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.mergeBestZoneSeats = function(){
// by zone priority
var sectionSeat = this.sectionSeatJSON;
var sectionStatus = this.sectionStatusJSON
var sectionState = this.sectionStateJSON;
var sectionZones = this.sectionZoneSeatJSON;
var seatStatusMerged = new Object();
var availableSeats = new Array();
var seatIndex = null;
var currentRow = '';
var lastRow = '';
// merge status
var x =0;
var j = sectionState.length-1;
var i = sectionSeat.length-1;
while(i >= 0 ) {
if( typeof(sectionSeat[i]) != 'function' ) {
while (j>=0 && sectionSeat[i].n <= sectionState[j].n) {
if (sectionSeat[i].n == sectionState[j].n ) {
//if(sectionState[j].c != availSeatCode){
for (k in sectionStatus) {
if( typeof(sectionStatus[k]) != 'function' ) {
if (sectionStatus[k].c == sectionState[j].c) {
seatStatusMerged[sectionSeat[i].n] = '1';
break;
}
}
}
// }
}
j--;
}
i--;
}
}
this.sectionSeatJSON = sectionSeat;
/*if(i != -1 || j != -1){
alert('An error has occurred, please ret );
}*/
for(s in sectionZones) {
if(s == 0){
break;
}
else{
sectionZones.reverse();
break;
}
}
for(s in responseZones) {
if(s == 0){
break;
}
else{
responseZones.reverse();
break;
}
}
// check the 1st priority zone then work your way up the priorities
for(l in responseZones){
if(priorityCode == responseZones[l].p || priorityCode == null ){
if(requestComplete != true){
if( typeof(responseZones[l]) != 'function' ) {
for(m in sectionZones){
if(requestComplete != true){
if( typeof(sectionZones[m]) != 'function' ) {
if(sectionZones[m].z == responseZones[l].z){
// if no status add
if($l.isValue(sectionZones[m])){
if($l.isValue(seatStatusMerged[sectionZones[m].sn]) == false) {
currentRow = sectionZones[m].r;
if(currentRow == lastRow || lastRow == ''){
lastRow = sectionZones[m].r;
availableSeats.push(eval({'sn':sectionZones[m].sn,'r':sectionZones[m].r,'s':sectionZones[m].s}));
}
else
{
lastRow = sectionZones[m].r;
availableSeats= [];
availableSeats.push(eval({'sn':sectionZones[m].sn,'r':sectionZones[m].r,'s':sectionZones[m].s}));
}
// check to see if we have the number of seat the user needs
if(bestSeatInQty == (availableSeats.length)){
bestSeatCallback(availableSeats);
bestSeatCallback = null;
this.sectionSeatJSON = null;
this.sectionStateJSON = null;
this.sectionZoneSeatJSON = null;
requestComplete = true;
availableSeats= [];
break;
}
}
else
{
availableSeats= [];
requestComplete = false;
}
}
seatIndex = null;
}
}
}
else
{
break;
}
}
}
}
else{
break;
}
}
}
// reset json
if(prioritySectionCount > 0)
{
this.sectionSeatJSON = null;
this.sectionStateJSON = null;
this.sectionZoneSeatJSON = null;
if(prioritySectionCount-1 == prioritySectionIndex && requestComplete == false){
availableSeats= [];
bestSeatCallback(availableSeats);
}
else{
prioritySectionIndex++;
this.processBestSeats(5);
//seatStatusMerged =[];
}
}else{
this.sectionSeatJSON = null;
this.sectionStateJSON = null;
this.sectionZoneSeatJSON = null;
availableSeats= [];
if(requestComplete == false) {
bestSeatCallback(availableSeats);
}
}
}
this.processBestSeats = function (phase) {
switch(phase)
{
case 1:
this.sectionSeatHandler();
if($l.isValue(this.sectionStatusJSON) == false){
this.sectionStatusHandler();
}
this.getBestZonesInSectionHandler();
if($l.isValue(bestSeatInName)){
this.sectionStateHandler(bestSeatInName);
}
else
{
this.sectionStateHandler();
}
break;
case 3:
if($l.isValue(this.sectionSeatJSON) && $l.isValue(this.sectionStatusJSON) && $l.isValue(this.sectionStateJSON) && $l.isValue(this.sectionZoneSeatJSON)) {
this.mergeBestZoneSeats();
}
break;
case 4:
//alert('Getting Zones');
// prioritySectionIndex = 0;
this.getBestZonesInSpaceHandler();
break;
case 5:
//alert('Getting Section ' + prioritySectionIndex);
this.loopPrioritySections();
break;
}
}
this.processBestSeatsByPriceLevel = function (phase) {
switch(phase)
{
case 1:
this.pricelevelSeatHandler();
if($l.isValue(this.pricelevelStatusJSON) == false){
this.pricelevelStatusHandler();
}
this.getBestZonesInPriceLevelHandler();
this.pricelevelStateHandler();
break;
case 3:
if($l.isValue(this.pricelevelSeatJSON) && $l.isValue(this.pricelevelStatusJSON) && $l.isValue(this.pricelevelStateJSON) && $l.isValue(this.pricelevelZoneSeatJSON)) {
this.mergeBestZoneSeatsByPriceLevel();
}
break;
case 4:
break;
case 5:
break;
}
}
this.mergeBestZoneSeatsByPriceLevel = function(){
// by zone priority
var pricelevelSeat = this.pricelevelSeatJSON;
var pricelevelStatus = this.pricelevelStatusJSON
var pricelevelState = this.pricelevelStateJSON;
var pricelevelZones = this.pricelevelZoneSeatJSON;
var seatStatusMerged = new Object();
var availableSeats = new Array();
var seatIndex = null;
var currentRow = '';
var lastRow = '';
// merge status
var x =0;
var j = pricelevelState.length-1;
var i = pricelevelSeat.length-1;
while(i >= 0 ) {
if( typeof(pricelevelSeat[i]) != 'function' ) {
while (j>=0 && pricelevelSeat[i].n <= pricelevelState[j].n) {
if (pricelevelSeat[i].n == pricelevelState[j].n ) {
//if(pricelevelState[j].c != availSeatCode){
for (k in pricelevelStatus) {
if( typeof(pricelevelStatus[k]) != 'function' ) {
if (pricelevelStatus[k].c == pricelevelState[j].c) {
seatStatusMerged[pricelevelSeat[i].n] = '1';
break;
}
}
}
// }
}
j--;
}
i--;
}
}
this.pricelevelSeatJSON = pricelevelSeat;
/*if(i != -1 || j != -1){
alert('Error - i:' + i + ' j:' + j );
}*/
for(s in pricelevelZones) {
if(s == 0){
break;
}
else{
pricelevelZones.reverse();
break;
}
}
for(s in responseZones) {
if(s == 0){
break;
}
else{
responseZones.reverse();
break;
}
}
// check the 1st priority zone then work your way up the priorities
for(l in responseZones){
if(priorityCode == responseZones[l].p || priorityCode == null ){
if(requestComplete != true){
if( typeof(responseZones[l]) != 'function' ) {
for(m in pricelevelZones){
if(requestComplete != true){
if( typeof(pricelevelZones[m]) != 'function' ) {
if(pricelevelZones[m].z == responseZones[l].z){
// if no status add
if($l.isValue(pricelevelZones[m])){
if($l.isValue(seatStatusMerged[pricelevelZones[m].sn]) == false) {
currentRow = pricelevelZones[m].r;
if(currentRow == lastRow || lastRow == ''){
lastRow = pricelevelZones[m].r;
availableSeats.push(eval({'sn':pricelevelZones[m].sn,'r':pricelevelZones[m].r,'s':pricelevelZones[m].s}));
}
else
{
lastRow = pricelevelZones[m].r;
availableSeats= [];
availableSeats.push(eval({'sn':pricelevelZones[m].sn,'r':pricelevelZones[m].r,'s':pricelevelZones[m].s}));
}
// check to see if we have the number of seat the user needs
if(bestSeatInPriceLevelQty == (availableSeats.length)){
bestSeatInPriceLevelCallback(availableSeats);
bestSeatInPriceLevelCallback = null;
this.pricelevelSeatJSON = null;
this.pricelevelStateJSON = null;
this.pricelevelZoneSeatJSON = null;
requestComplete = true;
availableSeats= [];
break;
}
}
else
{
availableSeats= [];
requestComplete = false;
}
}
seatIndex = null;
}
}
}
else
{
break;
}
}
}
}
else{
break;
}
}
}
// reset json
if(prioritySectionCount > 0)
{
this.pricelevelSeatJSON = null;
this.pricelevelStateJSON = null;
this.pricelevelZoneSeatJSON = null;
if(prioritySectionCount-1 == prioritySectionIndex && requestComplete == false){
availableSeats= [];
bestSeatInPriceLevelCallback(availableSeats);
}
else{
prioritySectionIndex++;
this.processBestSeats(5);
//seatStatusMerged =[];
}
}else{
this.pricelevelSeatJSON = null;
this.pricelevelStateJSON = null;
this.pricelevelZoneSeatJSON = null;
availableSeats= [];
if(requestComplete == false) {
bestSeatInPriceLevelCallback(availableSeats);
}
}
}
// end best seats
this.layoutHandler = function () {
var postData = 'method=get_layout&output=json&query=' + requestLayout + '&event=' + this.getEvent() + '&user=' + this.getUser();
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
this.layoutJSON = oResponse.results;
layoutImage = oResponse.meta.layoutImage;
layoutWidth = oResponse.meta.layoutWidth;
layoutHeight = oResponse.meta.layoutHeight;
this.processLayoutMap(5);
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.layout",
fields: ["divId",
"w",
"type",
"h",
"t",
"l",
"c",
"s",
"i",
"n"
],
metaFields : {
layoutImage : 'response.li',
layoutWidth : 'response.lw',
layoutHeight : 'response.lh'
}
};
myDataSource.sendRequest(postData, oCallback);
}
// End Handlers
this.mergeSeatMap = function (isRedraw) {
var seatObj = this.seatJSON;
var statusObj = this.statusJSON;
var stateObj = this.stateJSON;
var i = 0;
seatHasStatus = [];
//seatIdToStatusName = new Object();
var x =0;
if($l.isValue(stateObj)) {
var j = stateObj.length-1;
}else
{
var j = -1;
}
if (seatObj == null)
i = -1
else
i = seatObj.length-1;
while(i >= 0 ) {
if( typeof(seatObj[i]) != 'function' ) {
while (j>=0 && seatObj[i].n <= stateObj[j].n) {
if (seatObj[i].n == stateObj[j].n ) {
if(inArray(currentSeats,seatObj[i].n) === true) {
if (seatObj[i].old == null)
seatObj[i].old = seatObj[i].i;
stateObj[j].c = mySeatCode;
}
for (k in statusObj) {
if( typeof(statusObj[k]) != 'function' ) {
if (statusObj[k].c == stateObj[j].c ) {
seatObj[i].i = statusObj[k].i;
seatHasStatus.push(seatObj[i].n);
seatIdToStatusName[seatObj[i].id] = statusObj[k].n ;
break;
}
}
}
}
j--;
}
i--;
}
}
this.seatJSON = seatObj;
if(isRedraw == 1) {
this.processSeatMap(7);
}
else
{
this.processSeatMap(5);
}
}
this.processSeatMap = function (phase) {
switch(phase)
{
case 1:
this.seatHandler();
this.statusHandler();
break;
case 3:
if($l.isValue(this.seatJSON) && $l.isValue(this.statusJSON)) {
this.stateHandler();
}
break;
case 4:
this.mergeSeatMap();
//this.populateSeatMap(5);
break;
case 5:
this.populateSeatMap();
break;
case 6:
this.changedStateHandler();
break;
case 7:
this.redrawStatusSeatMap('add');
break;
case 8:
this.mergeSeatMap(1);
break;
}
}
this.processLayoutMap = function (phase) {
switch(phase)
{
case 1:
this.layoutHandler();
break;
case 5:
this.populateLayoutMap();
break;
}
}
// End Handlers
this.renderSeatMap = function (area, instance, name, isFromRenderLayoutMap) {
// 0 is not being called from layout map
// 1 is being called from layout map
// 2 is being called after page loads
isGUID = area.match(/^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}$/);
requestArea = area;
if(isFromRenderLayoutMap != 0){
this.seatJSON = null;
this.statusJSON = null;
this.stateJSON = null;
}
var arrRequestArea = requestArea.split("--");
requestArea = arrRequestArea[0];
instanceName = instance;
if(isFromRenderLayoutMap == 0){
mapId = mapId + '-' + instanceName;
}
requestAreaname = name;
if(isFromRenderLayoutMap == 0){
document.write('<div id="' + mapId + '" style="position:relative"></div>');
}
else if(isFromRenderLayoutMap == 2){
document.write('<div id="' + mapId + '" style="position:relative"></div>');
}
if (document.getElementById(mapId) != null)
document.getElementById(mapId).innerHTML = loadingHTML;
if(isFromRenderLayoutMap == 0){
parentWidth = document.getElementById(mapId).parentNode.width;
if(parentWidth.indexOf('%') < 0) {
parentWidth = parseInt(parentWidth);
}
}
if(isFromRenderLayoutMap != 2){
this.processSeatMap(1);
}
}
this.redrawStatusSeatMap = function (type) {
var arrSpaceObj = this.seatJSON;
var arrStateObj = this.stateJSON
var arrChangedSeats = new Object();
for(state in arrStateObj){
arrChangedSeats[arrStateObj[state].n] = arrStateObj[state].n;
}
for (seat in arrSpaceObj) {
if( typeof(arrSpaceObj[seat]) != 'function' ) {
if(arrSpaceObj[seat].n == arrChangedSeats[arrSpaceObj[seat].n] && seatNameToImageId[arrSpaceObj[seat].n] != arrSpaceObj[seat].i) {
var seatId = arrSpaceObj[seat].n;
var imageId = 'img-' + seatId;
var imageFileId = arrSpaceObj[seat].i;
seatNameToImageId[seatId] = imageFileId;
var swidth = arrSpaceObj[seat].w;
var sheight = arrSpaceObj[seat].h;
if($l.isValue(imageFileId)) {
var seatImg = document.getElementById(imageId);
if(inArray(currentSeats,seatId) === true) {
var oElement = document.getElementById(seatId);
function fnCallback66(e) { eval(instanceName).releaseSeatHandler(this.id); }
$e.on(oElement, "click", fnCallback66);
}
else{
if(type == 'add'){
if(inArray(seatHasStatus,seatId) === false) {
var oElement = document.getElementById(seatId);
function fnCallback55(e) { eval(instanceName).reserveSeatHandler(this.id); }
$e.on(oElement, "click", fnCallback55);
}
}
}
//else
//{
// $e.removeListener(seatId, "click");
//}
seatImg.setAttribute("src", wsUrl + '/outsidedownload.php?id=' + imageFileId + '&type=ImageRevisions');
seatImg.style.width = swidth;
seatImg.style.height = sheight ;
}
}
}
}
}
this.renderLayoutMap = function (instance) {
requestLayout = eventCode;
instanceName = instance;
mapId = mapId + '-' + instanceName;
document.write('<div id="' + mapId + '" style="position:relative">Loading...</div>');
/*var oElement = document.getElementById('img-'+mapId);
function fnCallback7(e) {eval(instanceName).clearPolygon(); }
$e.on(oElement, "mousemover", fnCallback7); */
parentWidth = document.getElementById(mapId).parentNode.width;
if(parentWidth.indexOf('%') < 0) {
parentWidth = parseInt(parentWidth);
}
this.processLayoutMap(1);
}
this.populateSeatMap = function () {
var arrSpaceObj = this.seatJSON;
var seatIds = [];
// mod bg and container
document.getElementById(mapId).innerHTML = '';
document.getElementById(mapId).style.width = areaWidth;
document.getElementById(mapId).style.height = areaHeight;
if($l.isValue(areaImage)) {
var bgimage = this.createElement(mapId,'img','img-' + mapId);
bgimage.setAttribute("src", wsUrl + '/outsidedownload.php?id=' + areaImage + '&type=ImageRevisions');
bgimage.style.width = areaWidth;
bgimage.style.height = areaHeight;
}
//http://localhost:8088/index.php?entryPoint=download&id=87c6812a-5a57-d138-6007-484455893dec&type=ImageRevisions
// create seats
for (seat in arrSpaceObj) {
if( typeof(arrSpaceObj[seat]) != 'function' ) {
var sugarId = arrSpaceObj[seat].id;
var seatId = arrSpaceObj[seat].n;
seatNameToId[seatId] = sugarId;
var imageId = 'img-' + seatId;
var imageFileId = arrSpaceObj[seat].i;
seatNameToImageId[seatId] = imageFileId;
if($l.isValue(arrSpaceObj[seat].w)){
var swidth = arrSpaceObj[seat].w;
}
else{
var swidth = 10;
}
if($l.isValue(arrSpaceObj[seat].h)){
var sheight = arrSpaceObj[seat].h;
}
else{
var sheight = 10;
}
//var msg = arrSpaceObj[seat].m;
// msg = (msg === null) ? '' : '<br />' + msg;
var x = arrSpaceObj[seat].hz;
var y = arrSpaceObj[seat].v;
var seatObj = this.createElement(mapId,'span',seatId);
//seatObj.title = arrSpaceObj[seat].n + msg; //here is the hover
seatObj.style.position = 'absolute';
seatObj.style.left = x + 'px';
seatObj.style.top = y + 'px';
$d.addClass(seatId, 'seat');
if(inArray(seatHasStatus,seatId) === false) {
var oElement = document.getElementById(seatId);
function fnCallback5(e) { eval(instanceName).reserveSeatHandler(this.id); }
$e.on(oElement, "click", fnCallback5);
}
else if(inArray(currentSeats,seatId) === true) {
var oElement = document.getElementById(seatId);
function fnCallback6(e) { eval(instanceName).releaseSeatHandler(this.id); }
$e.on(oElement, "click", fnCallback6);
}
if($l.isValue(imageFileId)) {
var seatImg = this.createElement(seatId,'img',imageId);
seatImg.setAttribute("src", wsUrl + '/outsidedownload.php?id=' + imageFileId + '&type=ImageRevisions');
seatImg.style.width = swidth;
seatImg.style.height = sheight ;
}
else {
seatObj.style.width = swidth;
seatObj.style.height = sheight;
}
seatIds.push(seatId);
// create hover
if(seatToolTip != 'disabled') {
/*YAHOO.html.container[seatId] = new YAHOO.widget.Overlay('overylay-'+seatId,
{ context:[seatId,"tl","br"],
visible:false,
width:"200px" } );
YAHOO.html.container[seatId].setHeader("");
YAHOO.html.container[seatId].setBody("");
YAHOO.html.container[seatId].setFooter("");
YAHOO.html.container[seatId].render(document.body); */
var toolTip = 1;
var oElement = document.getElementById(seatId);
function fnCallback43(e) {eval(instanceName).getSeatDescriptionHTML(this.id,instanceName,toolTip,instanceName);eval(instanceName).seatMapHover.fire(this.id); }
$e.on(oElement, "mouseover", fnCallback43);
//function fnCallback44(e) {eval(instanceName).clearSeatDescriptionHTML(this.id);//eval(instanceName).seatMapHoverOut.fire(this.id); }
function fnCallback44(e) {eval(instanceName).clearSeatDescriptionHTML(this.id,instanceName);}
$e.on(oElement, "mouseout", fnCallback44);
// create tooltips
// var myTooltip = new YAHOO.widget.Tooltip("myTooltip",{context:seatIds});
}
}
}
// loop text
for (textitem in textFields) {
if( typeof(textFields[textitem]) != 'function' ) {
var textId = 't-' + textitem;
var textObj = this.createElement(mapId,'span',textId);
textObj.innerHTML = textFields[textitem].t;
textObj.style.position = 'absolute';
textObj.style.left = textFields[textitem].h + 'px';
textObj.style.top = textFields[textitem].v + 'px';
$d.addClass(textId, 'statictext');
}
}
// rescale
if($l.isValue(parentWidth) && useScaling && (areaWidth != null || areaHeight != null)) {
this.scale('area');
}
if($l.isValue(renderSeatMapCallback)) {
renderSeatMapCallback(true);
}
}
this.redrawLayoutMap = function () {
// clear area tags
for (i in arrAreas) {
removeObject('layoutMap',arrAreas[i]);
$e.removeListener(arrAreas[i], "click");
$e.removeListener(arrAreas[i], "mouseover");
$e.removeListener(arrAreas[i], "mouseout");
isRedraw = true;
}
arrAreas = [];
this.processLayoutMap(5);
}
this.populateLayoutMap = function () {
var arrSpaceObj = this.layoutJSON;
if(isRedraw == false){
// mod bg and container
document.getElementById(mapId).innerHTML = '';
document.getElementById(mapId).style.width = layoutWidth;
document.getElementById(mapId).style.height = layoutHeight;
if($l.isValue(layoutImage)) {
var bgimage = this.createElement(mapId,'img','img-' + mapId);
bgimage.setAttribute("src", wsUrl + '/outsidedownload.php?id=' + layoutImage + '&type=ImageRevisions');
bgimage.style.width = layoutWidth;
bgimage.style.height = layoutHeight;
bgimage.useMap = '#layoutMap';
bgimage.border = '0';
}
}
if($l.isValue(areamapObj) == false){
var areamapObj = this.createElement(mapId,'map','layoutMap');
}
for (areamap in arrSpaceObj) {
if( typeof(arrSpaceObj[areamap]) != 'function' ) {
var divId = arrSpaceObj[areamap].divId;
var amWidth = arrSpaceObj[areamap].w;
var amHeight = arrSpaceObj[areamap].h;
var amTop = arrSpaceObj[areamap].t;
var amLeft = arrSpaceObj[areamap].l;
var amType = arrSpaceObj[areamap].type;
var amShape = arrSpaceObj[areamap].s;
var amCoords = arrSpaceObj[areamap].c;
amCoords = amCoords.replace(/\|/g, ",");
var amId = arrSpaceObj[areamap].i;
var amName = arrSpaceObj[areamap].n;
var areaID =amId+'--'+areaCount;
// create area tag
if (amType == 'area' && (areaClick != 'disabled' || areaOutline != 'disabled' || areaOutlineImage != 'disabled' || areaToolTip != 'disabled' ) ) {
var areaCoords = this.createElement('layoutMap','area',areaID);
areaCoords.title = amName;
areaCoords.shape = amShape;
areaCoords.coords = amCoords;
areaCoords.href = 'javascript:void(0)';
arrAreas.push(areaID);
}
if (amType == 'section' && (sectionClick != 'disabled' || sectionOutline != 'disabled' || sectionOutlineImage != 'disabled' || sectionToolTip != 'disabled' ) ) {
var areaCoords = this.createElement('layoutMap','area',areaID);
areaCoords.title = amName;
areaCoords.shape = amShape;
areaCoords.coords = amCoords;
areaCoords.href = 'javascript:void(0)';
arrAreas.push(areaID);
}
if (amType == 'subsection' && (subsectionClick != 'disabled' || subsectionOutline != 'disabled' || subsectionOutlineImage != 'disabled' || subsectionToolTip != 'disabled' ) ) {
var areaCoords = this.createElement('layoutMap','area',areaID);
areaCoords.title = amName;
areaCoords.shape = amShape;
areaCoords.coords = amCoords;
areaCoords.href = 'javascript:void(0)';
arrAreas.push(areaID);
}
if (amType == 'pricelevel' && (pricelevelClick != 'disabled' || pricelevelOutline != 'disabled' || pricelevelOutlineImage != 'disabled' || pricelevelToolTip != 'disabled' ) ) {
var areaCoords = this.createElement('layoutMap','area',areaID);
areaCoords.title = amName;
areaCoords.shape = amShape;
areaCoords.coords = amCoords;
areaCoords.href = 'javascript:void(0)';
arrAreas.push(areaID);
}
// create tooltip
YAHOO.html.container[areaID] = new YAHOO.widget.Overlay('overylay-'+areaID,
{ context:[mapId,"tr","tl"],
visible:false,
width:"260px",
height:"500px" } );
YAHOO.html.container[areaID].setHeader("");
YAHOO.html.container[areaID].setBody("");
YAHOO.html.container[areaID].setFooter("");
YAHOO.html.container[areaID].render(document.body);
var oElement = document.getElementById(areaID);
// add click events actions
if(amType == 'area' && areaClick != 'disabled' ){
if($l.isValue(overrideLayoutMapClickFunction)) {
var myFunction = overrideLayoutMapClickFunction;
function fnCallback1(e) {eval(instanceName).clearPolygon(); eval(myFunction)(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName); }
$e.on(oElement, "click", fnCallback1);
}
else {
function fnCallback2(e) {eval(instanceName).clearPolygon(); eval(instanceName).renderSeatMap(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName,'',1); }
$e.on(oElement, "click", fnCallback2);
}
}
if(amType == 'section' && sectionClick != 'disabled' ){
if($l.isValue(overrideLayoutMapClickFunction)) {
var myFunction = overrideLayoutMapClickFunction;
function fnCallback1(e) {eval(instanceName).clearPolygon(); eval(myFunction)(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName); }
$e.on(oElement, "click", fnCallback1);
}
else {
function fnCallback2(e) {eval(instanceName).clearPolygon(); eval(instanceName).renderSeatMap(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName,'',1); }
$e.on(oElement, "click", fnCallback2);
}
}
if(amType == 'subsection' && subsectionClick != 'disabled' ){
if($l.isValue(overrideLayoutMapClickFunction)) {
var myFunction = overrideLayoutMapClickFunction;
function fnCallback1(e) {eval(instanceName).clearPolygon(); eval(myFunction)(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName); }
$e.on(oElement, "click", fnCallback1);
}
else {
function fnCallback2(e) {eval(instanceName).clearPolygon(); eval(instanceName).renderSeatMap(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName,'',1); }
$e.on(oElement, "click", fnCallback2);
}
}
if(amType == 'pricelevel' && pricelevelClick != 'disabled' ){
if($l.isValue(overrideLayoutMapClickFunction)) {
var myFunction = overrideLayoutMapClickFunction;
function fnCallback1(e) {eval(instanceName).clearPolygon(); eval(myFunction)(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName); }
$e.on(oElement, "click", fnCallback1);
}
else {
function fnCallback2(e) {eval(instanceName).clearPolygon(); eval(instanceName).renderSeatMap(eval(instanceName).getAreaIdFromAreaTag(this.id),instanceName,'',1); }
$e.on(oElement, "click", fnCallback2);
}
}
var outLine = 0;
var toolTip = 0;
var outLineImage = 0;
if(amType == 'area' && areaOutline != 'disabled' && areaToolTip != 'disabled'){
outLine= 1;
toolTip = 1;
}
if(amType == 'area' && areaOutline != 'disabled' && areaToolTip == 'disabled'){
outLine= 1;
toolTip = 0;
}
if(amType == 'area' && areaOutline == 'disabled' && areaToolTip != 'disabled'){
outLine= 0;
toolTip = 1;
}
if(amType == 'area' && areaOutlineImage != 'disabled'){
outLineImage= 1;
}
if(amType == 'section' && sectionOutline != 'disabled' && sectionToolTip != 'disabled'){
outLine= 1;
toolTip = 1;
}
if(amType == 'section' && sectionOutline != 'disabled' && sectionToolTip == 'disabled'){
outLine= 1;
toolTip = 0;
}
if(amType == 'section' && sectionOutline == 'disabled' && sectionToolTip != 'disabled'){
outLine= 0;
toolTip = 1;
}
if(amType == 'section' && sectionOutlineImage != 'disabled'){
outLineImage= 1;
}
if(amType == 'subsection' && subsectionOutline != 'disabled' && subsectionToolTip != 'disabled'){
outLine= 1;
toolTip = 1;
}
if(amType == 'subsection' && subsectionOutline != 'disabled' && subsectionToolTip == 'disabled'){
outLine= 1;
toolTip = 0;
}
if(amType == 'subsection' && subsectionOutline == 'disabled' && subsectionToolTip != 'disabled'){
outLine= 0;
toolTip = 1;
}
if(amType == 'subsection' && subsectionOutlineImage != 'disabled'){
outLineImage= 1;
}
if(amType == 'pricelevel' && pricelevelOutline != 'disabled' && pricelevelToolTip != 'disabled'){
outLine= 1;
toolTip = 1;
}
if(amType == 'pricelevel' && pricelevelOutline != 'disabled' && pricelevelToolTip == 'disabled'){
outLine= 1;
toolTip = 0;
}
if(amType == 'pricelevel' && pricelevelOutline == 'disabled' && pricelevelToolTip != 'disabled'){
outLine= 0;
toolTip = 1;
}
if(amType == 'pricelevel' && pricelevelOutlineImage != 'disabled'){
outLineImage= 1;
}
// add outline events actions
if(amType == 'area') {
var outLine0 = outLine;
var toolTip0 = toolTip;
var outLineImage0 = outLineImage;
if(outLine0 == 1 || toolTip0 == 1 || outLineImage0 == 1) {
function fnCallback03(e) {eval(instanceName).getDescriptionHTML(this.id,instanceName,outLine0,toolTip0,'',outLineImage0);eval(instanceName).imageMapHover.fire(this.id); }
$e.on(oElement, "mouseover", fnCallback03);
function fnCallback04(e) {eval(instanceName).clearPolygon(this.id);eval(instanceName).imageMapHoverOut.fire(this.id);}
$e.on(oElement, "mouseout", fnCallback04);
}
}
if(amType == 'section') {
var outLine1 = outLine;
var toolTip1 = toolTip;
var outLineImage1 = outLineImage;
if(outLine1 == 1 || toolTip1 == 1 || outLineImage1 == 1) {
function fnCallback13(e) {eval(instanceName).getDescriptionHTML(this.id,instanceName,outLine1,toolTip1,'',outLineImage1);eval(instanceName).imageMapHover.fire(this.id); }
$e.on(oElement, "mouseover", fnCallback13);
function fnCallback14(e) {eval(instanceName).clearPolygon(this.id);eval(instanceName).imageMapHoverOut.fire(this.id); }
$e.on(oElement, "mouseout", fnCallback14);
}
}
if(amType == 'subsection') {
var outLine2 = outLine;
var toolTip2 = toolTip;
var outLineImage2 = outLineImage;
if(outLine2 == 1 || toolTip2 == 1 || outLineImage2 == 1) {
function fnCallback23(e) {eval(instanceName).getDescriptionHTML(this.id,instanceName,outLine2,toolTip2,'',outLineImage2);eval(instanceName).imageMapHover.fire(this.id); }
$e.on(oElement, "mouseover", fnCallback23);
function fnCallback24(e) {eval(instanceName).clearPolygon(this.id);eval(instanceName).imageMapHoverOut.fire(this.id); }
$e.on(oElement, "mouseout", fnCallback24);
}
}
if(amType == 'pricelevel') {
var outLine3 = outLine;
var toolTip3 = toolTip;
var outLineImage3 = outLineImage;
if(outLine3 == 1 || toolTip3 == 1 || outLineImage3 == 1) {
function fnCallback33(e) {eval(instanceName).getDescriptionHTML(this.id,instanceName,outLine3,toolTip3,'',outLineImage3);eval(instanceName).imageMapHover.fire(this.id); }
$e.on(oElement, "mouseover", fnCallback33);
function fnCallback34(e) {eval(instanceName).clearPolygon(this.id);eval(instanceName).imageMapHoverOut.fire(this.id); }
$e.on(oElement, "mouseout", fnCallback34);
}
}
areaCount++;
}
}
// create canvas
jg_doc = new jsGraphics(mapId);
// rescale
if($l.isValue(parentWidth) && useScaling && (layoutWidth != null || layoutHeight != null)) {
this.scale('layout');
}
}
this.releaseSeatHandler = function(id) {
//alert('fired');
myDate = new Date();
var postData = 'method=set_state&output=json&query=' + id + '&action=-1' + '&event=' + this.getEvent() + '&user=' + this.getUser() + '&ts=' + myDate.getTime();
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
if(oResponse.results[0].c == '1') {
this.removeSeat(id);
this.processSeatMap(6);
}
else
{
alert('Could not Save Seat');
}
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.state2",
fields: [
"c"
]
};
myDataSource.sendRequest(postData, oCallback);
$e.removeListener(id, "click");
}
this.reserveSeatHandler = function(id) {
//alert('fired');
myDate = new Date();
var postData = 'method=set_state&output=json&query=' + id + '&action=1' + '&event=' + this.getEvent() + '&user=' + this.getUser() + '&ts=' + myDate.getTime();
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
if(oResponse.results[0].c == '1') {
this.addSeat(id);
this.processSeatMap(6);
}
else
{
alert('Could not Save Seat');
}
},
failure: function(oRequest,oResponse,oPayload) {
// error handler
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.state2",
fields: [
"c"
]
};
myDataSource.sendRequest(postData, oCallback);
$e.removeListener(id, "click");
}
this.drawPolygon = function(id,isExternal) {
if (YAHOO.env.ua.ie == 0 ) {
if(isExternal != 1) {
//currentHighlightId= id;
}
}
var arrSpaceObj = this.layoutJSON;
var xPoints = new Array();
var yPoints = new Array();
for (areamap in arrSpaceObj) {
if( typeof(arrSpaceObj[areamap]) != 'function' ) {
if(arrSpaceObj[areamap].i == id ) {
var arrpolygon = new Array();
var polygon = arrSpaceObj[areamap].c;
arrpolygon = polygon.split('|');
for(i in arrpolygon){
if( typeof(arrpolygon[i]) != 'function' ) {
if(i != 'indexOf') {
var tempcoordstr = arrpolygon[i];
var tempcoords = tempcoordstr.split(',');
xPoints.push(parseInt(tempcoords[0]));
yPoints.push(parseInt(tempcoords[1]));
}
}
}
jg_doc.setStroke(strokeSize);
jg_doc.setColor(highlightColor);
jg_doc.drawPolygon(xPoints,yPoints);
jg_doc.paint();
xPoints = new Array();
yPoints = new Array();
}
}
}
}
this.clearPolygon = function(id) {
if($l.isValue(jg_doc)){
document.getElementById('img-' + mapId).setAttribute("src", wsUrl + '/outsidedownload.php?id=' + layoutImage + '&type=ImageRevisions');
jg_doc.clear();
if($l.isValue(id)){
try{
tid = id.replace(/-/g,"_");
tempStr = eval('tt_'+tid);
clearTimeout(tempStr);
}
catch(err){
}
if(YAHOO.html.container[id] != null) {
htmlDescCache[id] = eval({'state':'mouseout','html':htmlDescCache[id].html});
YAHOO.html.container[id].hide() ;
}
for(x in YAHOO.html.container){
YAHOO.html.container[x].hide();
}
}
else{
for(x in YAHOO.html.container){
YAHOO.html.container[x].hide();
}
}
}
}
this.getDescriptionHTMLRaw = function(id,callback) {
var postData = 'method=get_desc_html&output=json&query=' + id ;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
callback(oResponse.results);//oResponse.results;
},
failure: function(oRequest,oResponse,oPayload) {
callback(false);
},
scope: this ,
callback:callback
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.descHtml",
fields: ["html" // html
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.getDescriptionHTML = function(id,isExternalCall,outLine,toolTip,type,outLineImage) {
var amType = type
if(amType == 'area' && areaOutline != 'disabled' && areaToolTip != 'disabled'){
outLine= 1;
toolTip = 1;
}
if(amType == 'area' && areaOutline != 'disabled' && areaToolTip == 'disabled'){
outLine= 1;
toolTip = 0;
}
if(amType == 'area' && areaOutline == 'disabled' && areaToolTip != 'disabled'){
outLine= 0;
toolTip = 1;
}
if(amType == 'area' && areaOutlineImage != 'disabled'){
outLineImage= 1;
}
if(amType == 'section' && sectionOutline != 'disabled' && sectionToolTip != 'disabled'){
outLine= 1;
toolTip = 1;
}
if(amType == 'section' && sectionOutline != 'disabled' && sectionToolTip == 'disabled'){
outLine= 1;
toolTip = 0;
}
if(amType == 'section' && sectionOutline == 'disabled' && sectionToolTip != 'disabled'){
outLine= 0;
toolTip = 1;
}
if(amType == 'section' && sectionOutlineImage != 'disabled'){
outLineImage= 1;
}
if(amType == 'subsection' && subsectionOutline != 'disabled' && subsectionToolTip != 'disabled'){
outLine= 1;
if (toolTip != 0)
toolTip = 1;
}
if(amType == 'subsection' && subsectionOutline != 'disabled' && subsectionToolTip == 'disabled' ){
outLine= 1;
toolTip = 0;
}
if(amType == 'subsection' && subsectionOutline == 'disabled' && subsectionToolTip != 'disabled'){
outLine= 0;
if (toolTip != 0)
toolTip = 1;
}
if(amType == 'subsection' && subsectionOutlineImage != 'disabled'){
outLineImage= 1;
}
if(amType == 'pricelevel' && pricelevelOutline != 'disabled' && pricelevelToolTip != 'disabled'){
outLine= 1;
toolTip = 1;
}
if(amType == 'pricelevel' && pricelevelOutline != 'disabled' && pricelevelToolTip == 'disabled'){
outLine= 1;
toolTip = 0;
}
if(amType == 'pricelevel' && pricelevelOutline == 'disabled' && pricelevelToolTip != 'disabled'){
outLine= 0;
toolTip = 1;
}
if(amType == 'pricelevel' && pricelevelOutlineImage != 'disabled'){
outLineImage= 1;
}
if(currentHighlightId != this.getAreaIdFromAreaTag(id) || isExternalCall == 1){
//if( isExternalCall == 1){
if(outLine != 0){
this.drawPolygon(this.getAreaIdFromAreaTag(id),isExternalCall);
}
if(outLineImage != 0){
if($l.isValue(arrOutlineImages[this.getAreaIdFromAreaTag(id)])) {
document.getElementById('img-' + mapId).setAttribute("src", wsUrl + '/outsidedownload.php?id=' + arrOutlineImages[this.getAreaIdFromAreaTag(id)] + '&type=ImageRevisions');
}
}
if($l.isValue(htmlDescCache[id])) {
htmlDescCache[id] = eval({'state':'mouseover','html':'notloaded'});
}
else
{
htmlDescCache[id] = eval({'state':'mouseover','html':'notloaded'});
}
var postData = 'method=get_desc_html&output=json&query=' + this.getAreaIdFromAreaTag(id) ;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
var oHtml = oResponse.results;
var isFrom = oResponse.meta.isFrom;
if($l.isValue(descriptionHTMLCallback)){
oHtml[0].html = descriptionHTMLCallback('pre',isFrom,oHtml[0].html);
}
oHtml[0].html = this.mergeClientSideVariables(oHtml[0].html,this.getAreaIdFromAreaTag(id));
if($l.isValue(descriptionHTMLCallback)){
oHtml[0].html = descriptionHTMLCallback('post',isFrom,oHtml[0].html);
}
if(isExternalCall == 1) {
htmlDescCache[id] = eval({'state':htmlDescCache[id].state,'html':oHtml[0].html});
for(i in YAHOO.html.container){
var tempId = this.getAreaIdFromAreaTag(i);
if(tempId == id){
YAHOO.html.container[i].setBody(oHtml[0].html);
tempStr = 'tt_'+id.replace(/-/g, "_") +' = setTimeout("' + instanceName + '.showLayoutTT(\''+ i +'\')",1000);';
eval(tempStr);
}
}
}
else
{
htmlDescCache[id] = eval({'state':htmlDescCache[id].state,'html':oHtml[0].html});
YAHOO.html.container[id].setBody(oHtml[0].html);
if(htmlDescCache[id].state == 'mouseover') {
tempStr = 'tt_'+id.replace(/-/g, "_") +' = setTimeout("' + instanceName + '.showLayoutTT(\''+ id +'\')",1000);';
eval(tempStr);
}
}
},
failure: function(oRequest,oResponse,oPayload) {
//
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.descHtml",
fields: ["html"
],
metaFields : {
isFrom : 'response.isFrom'
}
};
// if not in cache go get description
if(toolTip != 0){
if(htmlDescCache[id].html == 'notloaded' ){
myDataSource.sendRequest(postData, oCallback);
}
// if it does get description
else
{
if(isExternalCall == 1) {
for(i in YAHOO.html.container){
var tempId = this.getAreaIdFromAreaTag(i);
if(tempId == id){
YAHOO.html.container[i].show();
}
}
}
else
{
tempStr = 'tt_'+id.replace(/-/g, "_") +' = setTimeout("' + instanceName + '.showLayoutTT(\''+ id +'\')",1000);';
eval(tempStr);
}
}
}
}
}
this.showLayoutTT = function(id) {
YAHOO.html.container[id].show();
}
this.clearSeatDescriptionHTML = function(id,instanceName) {
if($l.isValue(id)){
tempStr = eval('tt_'+id);
clearTimeout(tempStr);
// console.log('destroying ' + id);
this.destroyTooltip(id);
tempStr = 'setTimeout("' + instanceName + '.destroyTooltip(\''+ id +'\')",500);';
eval(tempStr);
// this.destroyTooltip(id);
}
}
this.getSeatDescriptionHTML = function(id,isExternalCall,toolTip,instanceName,renderOnId) {
tempStr = 'tt_'+id +' = setTimeout("' + instanceName + '.getSeatDescriptionHTML2(\''+ id +'\',\''+ isExternalCall +'\',\''+ toolTip +'\',\''+ renderOnId +'\')",500);';
eval(tempStr);
}
this.mergeClientSideVariables = function(html,query){
// find client status
var tempBody = html;
var statusName = seatIdToStatusName[query];
tempBody = tempBody.replace(/\$Client.status_name\$/g, statusName)
return tempBody;
}
this.getSeatDescriptionHTML2 = function(id,isExternalCall,toolTip,renderOnId) {
var cached, show_delay;
if($l.isValue(htmlDescCache[id]))
htmlDescCache[id] = eval({'state':'mouseover','html':'notloaded'});
else
htmlDescCache[id] = eval({'state':'mouseover','html':'notloaded'});
var query;
if(isExternalCall == '1')
query = id;
else
query = seatNameToId[id];
myDate = new Date();
var postData = 'method=get_seat_desc_html&output=json&query=' + query + '&event=' + this.getEvent() + '&pricetype_name=' + this.getPriceType() ;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
var oHtml = oResponse.results;
var isFrom = oResponse.meta.isFrom;
show_delay = 100;
if($l.isValue(seatDescriptionHTMLCallback)){
oHtml[0].html = seatDescriptionHTMLCallback('pre',isFrom,oHtml[0].html);
}
oHtml[0].html = this.mergeClientSideVariables(oHtml[0].html,query);
if($l.isValue(seatDescriptionHTMLCallback)){
oHtml[0].html = seatDescriptionHTMLCallback('post',isFrom,oHtml[0].html);
}
if(isExternalCall == 1) {
var xpos = YAHOO.util.Dom.getX(id);
var ypos = YAHOO.util.Dom.getY(id);
if($l.isValue(renderOnId)) {
tempid =renderOnId;
}
else{
tempid = id;
}
myTooltip[tempid] = new YAHOO.widget.Tooltip("myTooltip" + tempid,{
context:tempid,
showDelay:show_delay,
text:oHtml[0].html,
x:xpos + 20,
y:ypos + 20,
autodismissdelay:15000,
hideMacGeckoScrollbars:true,
width:100,
hieght:150
});
myTooltip[tempid].doShow();
htmlDescCache[id] = eval({'state':htmlDescCache[id].state,'html':'notloaded'});
}
else
{
if(renderOnId != 'undefined') {
var xpos = YAHOO.util.Dom.getX(renderOnId) +60;
var ypos = YAHOO.util.Dom.getY(renderOnId) -50 ;
tempid =renderOnId;
myTooltip[tempid] = new YAHOO.widget.Tooltip("myTooltip" + tempid,{
context:tempid ,
showDelay:show_delay,
text:oHtml[0].html,
x:xpos,
y:ypos,
hideMacGeckoScrollbars:true,
preventoverlap:true,
width:200,
hieght:200,
autodismissdelay:15000
});
myTooltip[tempid].doShow();
}
else{
var xpos = YAHOO.util.Dom.getX(id);
var ypos = YAHOO.util.Dom.getY(id);
if (xpos > 500)
xpos = xpos - 265;
else
xpos = xpos + 25;
if (ypos > 1000)
ypos = ypos - 75;
else
ypos = ypos + 10;
tempid = id;
if(myTooltip[tempid] != null)
{
myTooltip[tempid].destroy();
myTooltip[tempid] = null
}
if(myTooltip[tempid] == null)
{
myTooltip[tempid] = new YAHOO.widget.Tooltip("myTooltip" + tempid,{
context:tempid,
preventoverlap:true,
text:oHtml[0].html,
showDelay:show_delay,
autodismissdelay:10000,
hideMacGeckoScrollbars:true,
x:xpos,
y:ypos,
width:200,
hieght:200
}
);
myTooltip[tempid].doShow(null,tempid);
}
}
htmlDescCache[id] = eval({'state':htmlDescCache[id].state,'html':'notloaded'});
}
},
failure: function(oRequest,oResponse,oPayload) {
//
},
scope: this
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.descHtml",
fields: ["html"
],
metaFields : {
isFrom : 'response.isFrom'
}
};
// if not in cache go get description
if(toolTip != 0){
if(htmlDescCache[id].html == 'notloaded' ){
myDataSource.sendRequest(postData, oCallback);
}
}
}
// public function return json of areas
this.getAreas = function(callback){
var postData = 'method=get_areas&query=' + eventCode + '&priceType=' + priceType;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
callback(oResponse.results);//oResponse.results;
for(i in oResponse.results) {
if( typeof(oResponse.results[i]) != 'function' ) {
arrOutlineImages[oResponse.results[i].id] = oResponse.results[i].oi;
}
}
},
failure: function(oRequest,oResponse,oPayload) {
callback(false);
},
scope: this ,
callback:callback
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.areas",
fields: ["id", // SugarID
"n", // name
"kc", // Key Color
"pmin", // Price Min
"pmax", // Price Max
"sos", //Sold Our status
"oi" //Outline Image
]
};
myDataSource.sendRequest(postData, oCallback);
}
// public function return json od sections
this.getSections = function(callback){
var postData = 'method=get_sections&query=' + eventCode + '&priceType=' + priceType;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
callback(oResponse.results);//oResponse.results;
for(i in oResponse.results) {
if( typeof(oResponse.results[i]) != 'function' ) {
arrOutlineImages[oResponse.results[i].id] = oResponse.results[i].oi;
}
}
},
failure: function(oRequest,oResponse,oPayload) {
callback(false);
},
scope: this,
callback:callback
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.sections",
fields: ["id", // SugarID
"n", // name
"kc", // Key Color
"pmin", // Price Min
"pmax", // Price Max
"sos", //Sold Our status
"oi" //Outline Image
]
};
myDataSource.sendRequest(postData, oCallback);
}
// public function return json of subsections
this.getSubSections = function(callback){
var postData = 'method=get_subsections&query=' + eventCode + '&priceType=' + priceType;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
callback(oResponse.results);//oResponse.results;
for(i in oResponse.results) {
if( typeof(oResponse.results[i]) != 'function' ) {
arrOutlineImages[oResponse.results[i].id] = oResponse.results[i].oi;
}
}
},
failure: function(oRequest,oResponse,oPayload) {
callback(false);
},
scope: this ,
callback:callback
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.subsections",
fields: ["id", // SugarID
"n", // name
"kc", // Key Color
"pmin", // Price Min
"pmax", // Price Max
"sos", //Sold Our status
"oi" //Outline Image
]
};
myDataSource.sendRequest(postData, oCallback);
}
// public function return json of pricelevels
this.getPriceLevels = function(callback){
var postData = 'method=get_pricelevels&query=' + eventCode + '&priceType=' + priceType;
var sUrl = wsUrl + '/asc_soap_parse_sync.php'
var oCallback = {
success: function(oRequest,oResponse,oPayload) {
callback(oResponse.results);//oResponse.results;
for(i in oResponse.results) {
if( typeof(oResponse.results[i]) != 'function' ) {
arrOutlineImages[oResponse.results[i].id] = oResponse.results[i].oi;
}
}
},
failure: function(oRequest,oResponse,oPayload) {
callback(false);
},
scope: this ,
callback:callback
}
var myDataSource = new YAHOO.util.DataSource(sUrl + '?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
//myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultsList: "response.pricelevels",
fields: ["id", // SugarID
"n", // name
"kc", // Key Color
"img", // Pricemap Image
"pmin", // Price Min
"pmax", // Price Max
"sos", //Sold Our status
"oi" //Outline Image
]
};
myDataSource.sendRequest(postData, oCallback);
}
this.createElement = function(parentElement,tag,id) {
var oInput = document.createElement(tag);
oInput.setAttribute("name", id );
oInput.setAttribute("id", id);
return eval(document.getElementById(parentElement).appendChild(oInput));
}
this.scale = function(type) {
if(type == 'area') {
if($isValue(mapWidth)){
var percentage = mapWidth/ areaWidth;
}
else
{
var percentage = parentWidth / areaWidth;
}
}
else
{
if($isValue(mapWidth)){
var percentage = mapWidth / layoutWidth;
}
else
{
var percentage = parentWidth / layoutWidth;
}
}
document.getElementById(mapId).style.width = parentWidth;
document.getElementById(mapId).style.height = Math.round(parseInt(document.getElementById(mapId).style.height) * percentage);
if($l.isValue(areaImage) || $l.isValue(layoutImage)) {
document.getElementById('img-' + mapId).style.width = parentWidth;
document.getElementById('img-' + mapId).style.height = Math.round(parseInt(document.getElementById('img-'+mapId).style.height) * percentage);
}
if(type == 'area') {
var arrAllSeats = $d.getElementsByClassName('seat');
var arrAllText = $d.getElementsByClassName('statictext');
for (seat in arrAllSeats) {
if( typeof(arrAllSeats[seat]) != 'function' ) {
var id = arrAllSeats[seat].id;
document.getElementById(id).style.top = Math.round(parseInt(document.getElementById(id).style.top) * percentage);
document.getElementById(id).style.left = Math.round(parseInt(document.getElementById(id).style.left) * percentage);
document.getElementById('img-'+id).style.width = Math.round(parseInt(document.getElementById('img-'+id).style.width) * percentage);
document.getElementById('img-'+id).style.height = Math.round(parseInt(document.getElementById('img-'+id).style.height) * percentage);
}
}
for (text in arrAllText) {
if( typeof(arrAllText[text]) != 'function' ) {
var id = arrAllText[text].id;
document.getElementById(id).style.top = Math.round(parseInt(document.getElementById(id).style.top) * percentage);
document.getElementById(id).style.left = Math.round(parseInt(document.getElementById(id).style.left) * percentage);
}
}
}
else if(type == 'layout') {
var arrCoords2 = '';
for (i in arrAreas){
var strCoords = document.getElementById(arrAreas[i]).coords;
var arrCoords = strCoords.split(',');
for(c in arrCoords) {
if( typeof(arrCoords[c]) != 'function' ) {
arrCoords[c] = Math.round(arrCoords[c] * percentage);
}
}
document.getElementById(arrAreas[i]).coords = arrCoords.toString();
for(d in arrCoords){
if( typeof(arrCoords[d]) != 'function' ) {
if(strCoords2 != ''){
if(d % 2 == 0) {
strCoords2 += '|';
}
else{
strCoords2 += ',';
}
}
strCoords2 += arrCoords[d];
}
}
for (areamap in arrSpaceObj) {
if(arrSpaceObj[areamap].i == this.getAreaIdFromAreaTag(arrAreas[i])) {
arrSpaceObj[areamap].c = strCoords2;
}
}
}
}
}
this.getAreaIdFromAreaTag = function(id) {
var areaSugarId = id;
var arrAreaSugarId = areaSugarId.split("--");
var outAreaSugarId = arrAreaSugarId[0];
return outAreaSugarId;
}
// internal function to check if a value is in an array
// returns boolean
var inArray = function(arr, val) {
if ($l.isArray(arr)) {
for (var i = (arr.length -1); i >= 0; i--) {
if (arr[i] === val) {
return true;
}
}
}
return false;
}
var removeObject = function(Parent,id) {
try{
var p = document.getElementById(Parent);
var el = document.getElementById(id);
p.removeChild(el);
}
catch(error){
//alert(error);
}
}
// Getters & Setters
this.setAreaClick = function (input) {areaClick = input;}
this.getAreaClick = function () {return areaClick;}
this.setAreaToolTip = function (input) {areaToolTip = input;}
this.getAreaToolTip = function () {return areaToolTip;}
this.setAreaOutline = function (input) {areaOutline = input;}
this.getAreaOutline = function () {return areaOutline;}
this.setAreaOutlineImage = function (input) {areaOutlineImage = input;}
this.getAreaOutlineImage = function () {return areaOutlineImage;}
this.setSectionClick = function (input) {sectionClick = input;}
this.getSectionClick = function () {return sectionClick;}
this.setSectionToolTip = function (input) {sectionToolTip = input;}
this.getSectionToolTip = function () {return sectionToolTip;}
this.setSectionOutline = function (input) {sectionOutline = input;}
this.getSectionOutline = function () {return sectionOutline;}
this.setSectionOutlineImage = function (input) {sectionOutlineImage = input;}
this.getSectionOutlineImage = function () {return sectionOutlineImage;}
this.setSubSectionClick = function (input) {subsectionClick = input;}
this.getSubSectionClick = function () {return subsectionClick;}
this.setSubSectionToolTip = function (input) {subsectionToolTip = input;}
this.getSubSectionToolTip = function () {return subsectionToolTip;}
this.setSubSectionOutline = function (input) {subsectionOutline = input;}
this.getSubSectionOutline = function () {return subsectionOutline;}
this.setSubSectionOutlineImage = function (input) {subsectionOutlineImage = input;}
this.getSubSectionOutlineImage = function () {return subsectionOutlineImage;}
this.setPriceLevelClick = function (input) {pricelevelClick = input;}
this.getPriceLevelClick = function () {return pricellevelClick;}
this.setPriceLevelToolTip = function (input) {pricelevelToolTip = input;}
this.getPriceLevelToolTip = function () {return pricellevelToolTip;}
this.setPriceLevelOutline = function (input) {pricelevelOutline = input;}
this.getPriceLevelOutline = function () {return pricelevelOutline;}
this.setPriceLevelOutlineImage = function (input) {pricelevelOutlineImage = input;}
this.getPriceLevelOutlineImage = function () {return pricelevelOutlineImage;}
this.setSeatToolTip = function (input) {seatToolTip = input;}
this.getSeatToolTip = function () {return seatToolTip;}
this.setStatusMap = function (input) {statusMap = input;}
this.getStatusMap = function () {return statusMap;}
this.setUseScaling = function (input) {useScaling = input;}
this.getUseScaling = function () {return useScaling;}
this.setMapWidth = function (input) {mapWidth = input;}
this.getMapWidth = function () {return mapWidth;}
this.setDoNotClearCanvas = function (input) {doNotClearCanvas = input;}
this.getDoNotClearCanvas = function () {return doNotClearCanvas ;}
this.setHighlightColor = function (input) {highlightColor = input;}
this.getHighlightColor = function () {return highlightColor;}
this.setCurrentHighlightId = function (input) {currentHighlightId = input;}
this.getCurrentHighlightId = function () {return currentHighlightId;}
this.setRenderSeatMapCallback = function (input) {renderSeatMapCallback = input;}
this.getRenderSeatMapCallback = function () {return renderSeatMapCallback ;}
this.setLoadingHTML = function(input) {loadingHTML=input;}
this.getLoadingHTML = function() {return loadingHTML;}
this.setStrokeSize = function (input) {strokeSize = input;}
this.getStrokeSize = function () {return strokeSize;}
this.setOverrideLayoutMapClickFunction = function (input) {overrideLayoutMapClickFunction = input;}
this.getOverrideLayoutMapClickFunction = function () {return overrideLayoutMapClickFunction;}
this.setSeatDescriptionHTMLCallback = function (input) {seatDescriptionHTMLCallback = input;}
this.getSeatDescriptionHTMLCallback = function () {return seatDescriptionHTMLCallback;}
this.setWsUrl = function (input) {wsUrl = input;}
this.getWsUrl = function () {return wsUrl;}
this.setCurrentSeats = function (input) {currentSeats = input;}
this.getCurrentSeats = function () {return currentSeats;}
this.getRequestArea = function() {return requestArea;}
this.getRequestAreaName = function() {return requestAreaname;}
//set for Customers Unique Codes of 'My Seat', 'Available Seat'
this.setMySeatCode = function(input) {mySeatCode = input;}
this.setAvailSeatCode = function(input) {availSeatCode = input;}
this.setEvent = function(input) {eventCode = input;}
this.getEvent = function() {return eventCode;}
this.setMapId = function(input) {mapId = input;}
this.getMapId = function() {return mapId;}
this.setPriceType = function(input) {priceType = input;}
this.getPriceType = function() {return priceType;}
this.setUser = function(input) {user = input;}
this.getUser = function() {return user;}
this.destroyTooltip = function(id) {
try{
if (myTooltip[id] != undefined && myTooltip[id] != null)
{
// console.log(myTooltip[id].pageX);
myTooltip[id].hide();
//myTooltip[id].cfg.setProperty("showDelay",2000);
myTooltip[id].contextMouseOverEvent.subscribe
(
function(type, args)
{
return false;
}
);
//myTooltip[id].destroy();
}
}
catch(e) {
//handle issues with YUI
}
}
this.addSeat = function (newSeat)
{
currentSeats.push(newSeat);
currentSeats = currentSeats;
//x = currentSeats.length;
//currentSeats[x] = newSeat;
//currentSeats[x].code = newCode;
}
this.removeSeat = function (removeSeat)
{
var seatObj = this.seatJSON;
var tempSeats = new Array();
if (seatObj != null){
for (i in seatObj) {
if( typeof(seatObj[i]) != 'function' ) {
if (seatObj[i].n == removeSeat ) {
seatObj[i].i = seatObj[i].old
}
}
}
for (i in currentSeats)
{
if( typeof(currentSeats[i]) != 'function' ) {
if(currentSeats[i] != removeSeat)
{
seatObj[i].i = seatObj[i].old
tempSeats.push (currentSeats[i])
}
}
}
}
else{
// this is done if the user has a seatmap which is not populated but is using it to manage current seats
for (i in currentSeats)
{
if( typeof(currentSeats[i]) != 'function' ) {
if(currentSeats[i] != removeSeat)
tempSeats.push (currentSeats[i])
}
}
}
currentSeats = tempSeats;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment