/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var POS_TARGET=8;
var theSitetree=[ 
	['PAGE','5101',jdecode('Home'),jdecode(''), jdecode('%2F5101.html'), 'true',[],'',''],
	['PAGE','5194',jdecode('Menu'),jdecode(''), jdecode('%2F5194%2Findex.html'), 'true',[ 
		['PAGE','37401',jdecode('Lunch+%26+Dinner'),jdecode(''), jdecode('%2F5194%2F37401.html'), 'true',[],'',''],
		['PAGE','37422',jdecode('Desserts+and+drinks'),jdecode(''), jdecode('%2F5194%2F37422.html'), 'true',[],'','']
	],'',''],
	['PAGE','10101',jdecode('Services+%26+Contact'),jdecode(''), jdecode('%2F10101%2Findex.html'), 'true',[ 
		['PAGE','10122',jdecode('Catering+service'),jdecode(''), jdecode('%2F10101%2F10122.html'), 'true',[],'',''],
		['PAGE','10143',jdecode('Reservations'),jdecode(''), jdecode('%2F10101%2F10143.html'), 'true',[],'','']
	],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Atmosphere';
theSitetree.paletteFamily='003366';
theSitetree.keyvisualId='134';
theSitetree.keyvisualName='meerblick.jpg';
theSitetree.fontsetId='7';
theSitetree.graphicsetId='9';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'qwest',
  product: 'WSCSYSSSSLYTCPH7'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Atmosphere',
				paletteFamily: 	'003366',
				keyvisualId: 	'134',
				keyvisualName: 	'meerblick.jpg',
				fontsetId: 		'7',
				graphicsetId: 	'9',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'003366',
				b_color: 		'0066CC',
				c_color: 		'000000',
				d_color: 		'',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-3437544d05dc1a3dc8bf56b0fcf0fde5']={
webappId:    '7060',
documentId:  '5194',
internalId:  '3437544d05dc1a3dc8bf56b0fcf0fde5',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20110208-174103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10122',
internalId:  '',
customField: '20100503-213714'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5194',
internalId:  '',
customField: '20100505-092934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37401',
internalId:  '',
customField: '20111008-182008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20110321-224156'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTCPH7']={
webappId:    '5003',
documentId:  '5101',
internalId:  'tid:1;pid:WSCSYSSSSLYTCPH7',
customField: 'en:US::;language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10143',
internalId:  '',
customField: '20100524-175904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37422',
internalId:  '',
customField: '20111008-182039'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INZJ96';
var companyName   = 'Santorini%3A+Greek++%26++Mediterranean+';
var htmlTitle	  = 'Santorini+Authentic+Greek+and+Mediterranean+Cuisine.';
var metaKeywords  = 'Greek+Food%2C+Greek+Restaurant%2C+Lebanese+Restaurant%2C+Arabic+Restaurant%2C+in+las+cruces+new+mexico%2C+hummus%2C+baba+ghanoush%2C+chich+taouk%2C+chicken+taouk%2C+falafel%2C+tzaziki+';
var metaContents  = 'Lebanese+Food+Greek+Food+Maghli+Ashta+Gyros+Chicken+Taouk+Chich+Taouk+hummus+Bakalava%2C+baklawa';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};

