/* [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.html'), 'true',[],'',''],
	['PAGE','20501',jdecode('Our+team+%26+great+customers'),jdecode(''), jdecode('%2F20501.html'), 'true',[],'',''],
	['PAGE','11001',jdecode('History'),jdecode(''), jdecode('%2F11001.html'), 'true',[],'',''],
	['PAGE','18901',jdecode('Paul+Bunyan%26%23x27%3Bs+History'),jdecode(''), jdecode('%2F18901.html'), 'true',[],'',''],
	['PAGE','5173',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F5173.html'), 'true',[],'',''],
	['PAGE','5215',jdecode('Our+service'),jdecode(''), jdecode('%2F5215.html'), 'true',[],'',''],
	['PAGE','5299',jdecode('Call+in+orders'),jdecode(''), jdecode('%2F5299.html'), 'true',[],'',''],
	['PAGE','11022',jdecode('Guestbook'),jdecode(''), jdecode('%2F11022.html'), 'true',[],'',''],
	['PAGE','26701',jdecode('Special+order+bakery+items'),jdecode(''), jdecode('%2F26701.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Welcome';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='9178';
theSitetree.keyvisualName='kv_9178.jpg';
theSitetree.fontsetId='10364';
theSitetree.graphicsetId='10524';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='AC0A16';
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: 			'Welcome',
				paletteFamily: 	'990000',
				keyvisualId: 	'9178',
				keyvisualName: 	'kv_9178.jpg',
				fontsetId: 		'10364',
				graphicsetId: 	'10524',
				contentColor: 	'FFFFFF',
				contentBGColor: 'AC0A16',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D6AAAA',
				e_color: 		'DC6C70',
				f_color: 		'68070E',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20111007-194247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5173',
internalId:  '',
customField: '20100603-122531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5299',
internalId:  '',
customField: '20110118-110251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5194',
internalId:  '',
customField: '20110728-184200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11022',
internalId:  '',
customField: '20100701-010615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5215',
internalId:  '',
customField: '20110511-152509'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26701',
internalId:  '',
customField: '20101012-142633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18901',
internalId:  '',
customField: '20110728-184954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20501',
internalId:  '',
customField: '20110511-153942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20100701-002708'
};
webappMappings['1002']=webappMappings['1002-11022ahw050inziqp']={
webappId:    '1002',
documentId:  '11022',
internalId:  '11022ahw050inziqp',
customField: 'icq=false'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTCPH7']={
webappId:    '5003',
documentId:  '5101',
internalId:  'tid:1;pid:WSCSYSSSSLYTCPH7',
customField: 'en:US::;language:en;country:US;'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INZIQP';
var companyName   = 'Hot+Rod+Cafe';
var htmlTitle	  = 'Hot+Rod+Cafe+Tucso+Breakfast+Lunch+Cafe+Open+8%3A30+-2%3A30';
var metaKeywords  = 'Hot+Rod+Cafe%2C+Tucson%2C+Breakfast%2C+Lunch%2C+Food%2C+Menu%2C+Soups%2C+Sandwiches%2C+Cakes%2C+Muffins%2C+Bakery%2C+Car+shows%2C+Rod+runs%2C+Street+Rods%2C+Business+networking%2C+parties%2C+graduations%2C+weddings%2C+anniversarys%2C+commitment+ceremonies%2C+linen+rentals%2C+flower+rentals%2C+cetnerpieces%2C+party+supplies';
var metaContents  = 'Hot+Rod+Cafe+-+Breakfast+%26+Lunch%2C++Tucson%27s+tribute+to+racing+fans+and+gearheads.+';
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();
};

