/* [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','9301',jdecode('Home'),jdecode(''), jdecode('%2F9301%2Findex.html'), 'true',[ 
		['PAGE','9352',jdecode('Locations+Served'),jdecode(''), jdecode('%2F9301%2F9352.html'), 'true',[],'',''],
		['PAGE','9373',jdecode('About+Us'),jdecode(''), jdecode('%2F9301%2F9373.html'), 'true',[],'',''],
		['PAGE','9394',jdecode('Contact+Us'),jdecode(''), jdecode('%2F9301%2F9394.html'), 'true',[],'',''],
		['PAGE','11201',jdecode('Our+Technology'),jdecode(''), jdecode('%2F9301%2F11201.html'), 'true',[],'',''],
		['PAGE','11222',jdecode('Our+Service'),jdecode(''), jdecode('%2F9301%2F11222.html'), 'true',[],'','']
	],'',''],
	['PAGE','14311',jdecode('Vending+101'),jdecode(''), jdecode('%2F14311.html'), 'true',[],'',''],
	['PAGE','9415',jdecode('Vending+Machines'),jdecode(''), jdecode('%2F9415%2Findex.html'), 'true',[ 
		['PAGE','9436',jdecode('Cold+Drink+Machines'),jdecode(''), jdecode('%2F9415%2F9436.html'), 'true',[],'',''],
		['PAGE','9478',jdecode('Snack+Machines'),jdecode(''), jdecode('%2F9415%2F9478.html'), 'true',[],'',''],
		['PAGE','9457',jdecode('Coffee+Machines'),jdecode(''), jdecode('%2F9415%2F9457.html'), 'true',[],'',''],
		['PAGE','9499',jdecode('Food+Machines'),jdecode(''), jdecode('%2F9415%2F9499.html'), 'true',[],'','']
	],'',''],
	['PAGE','9520',jdecode('Product+Selection'),jdecode(''), jdecode('%2F9520.html'), 'true',[],'',''],
	['PAGE','9688',jdecode('Healthy+Vending'),jdecode(''), jdecode('%2F9688.html'), 'true',[],'',''],
	['PAGE','9709',jdecode('Vending+for+Schools'),jdecode(''), jdecode('%2F9709.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Roundabout';
theSitetree.paletteFamily='CC6633';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='208';
theSitetree.graphicsetId='253';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLY0XNM4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Roundabout',
				paletteFamily: 	'CC6633',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'208',
				graphicsetId: 	'253',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				a_color: 		'CC6633',
				b_color: 		'993333',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11222',
internalId:  '',
customField: '20110415-144823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9301',
internalId:  '',
customField: '20110926-133636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9373',
internalId:  '',
customField: '20110415-184902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9394',
internalId:  '',
customField: '20110415-185042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9709',
internalId:  '',
customField: '20110926-135803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9688',
internalId:  '',
customField: '20110415-172823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9520',
internalId:  '',
customField: '20110415-190525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9352',
internalId:  '',
customField: '20110415-184931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20110926-135527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9415',
internalId:  '',
customField: '20110415-185822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9436',
internalId:  '',
customField: '20110415-185914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9478',
internalId:  '',
customField: '20110415-190018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9457',
internalId:  '',
customField: '20110415-180145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9499',
internalId:  '',
customField: '20110415-175811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14311',
internalId:  '',
customField: '20110415-185337'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INF4WM';
var companyName   = 'Service+%26+Integrity+Vending';
var htmlTitle	  = 'Service+and+Integrity+Vending%3A+Service+you+can+count+on.+Integrity+you+can+trust.';
var metaKeywords  = '%22vending+machines%22%0A%22vending+machine%22%0Asnack+and+soda+vending+machine%0Aschool+vending+machines+%0Avending+machines%0Avending+machines+sale%0Avending+equipment%0Avending+machine+companies%0Avending+service%0Acandy+vending+machines%0Avending+machines+nj%0Avending+machine+NJ%0A%22soda+vending+machines%22%0ACheap+vending+machines%0Avending+candy%0Asoda+vending+machines%0Aused+soda+vending+machines%0Abuy+vending+machine%0Avending+machines+to+buy%0Avending+companies%0Avending+machine+company%0Abuy+a+vending+machine%0ACheap+vending+machine%0Avending+machine+locations%0Avending+machines+prices%0ANew+Jersey+vending+machine%0Aused+snack+vending+machine%0Abuying+a+vending+machine%0Avending+machine+in+school%0Avending+supply%0Acheap+used+vending+machines%0Awater+vending+machines%0Avending+machine+prices%0Avending+machine+price%0Alease+vending+machine%0Aschool+vending%0Asnack+vending+machines%0Avending+machine+service%0Acheap+candy+vending+machine%0Acheap+vending+machines+soda%0Aold+vending+machine%0Ahealthy+vending+machine%0Avending+machine+leasing%0A%22soda+vending+machine%22%0A%22snack+vending+machines%22%0Aget+vending+machine%0Aschool+vending+machines%0Aused+vending+machine%0A%22healthy+vending+machines%22%0Avending+machines+for+schools%0Aused+soda+vending+machine%0A%22coffee+vending%22%0Avending+machine+services%0Avending+machines+sales%0Aget+a+vending+machine%0Acan+vending+machines%0Abottled+water+vending+machine%0Avending+machine+placement%0Acoffee+vending+machines%0Abeverage+vending+machines%0Afood+vending+machines%0A%22coffee+vending+machines%22%0A%22snack+vending%22%0Apurchase+vending+machines%0Asnack+drink+vending+machines%0Aschool+vending+machine%0Ahealthy+vending+machines+in+schools%0Aused+candy+vending+machines%0A%22cheap+vending+machines%22%0Ahealthy+vending%0Ahealth+food+vending+machines%0Adrink+vending+machines%0Abuying+vending+machines';
var metaContents  = 'Service+and+Integrity+Vending+is+a+full+service+local+vending+machine+company+servicing+Northern+and+Central+New+Jersey+and+Manhattan.+We+offer+free+consulting%2C+delivery%2C+installation%2C+and+service.+Whether+you+need+snacks%2C+candy%2C+water%2C+sodas%2C+cold+or+frozen+food%2C+or+coffee+and+tea+service%2C+we%27ll+get+it+to+you+quickly.++Offering+the+latest+in+vending+technology+and+reporting.';
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();
};

