/* [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','22',jdecode('Home'),jdecode(''), jdecode('%2F22.html'), 'true',[],'',''],
	['PAGE','1074',jdecode('Products'),jdecode(''), jdecode('%2F1074%2Findex.html'), 'true',[ 
		['PAGE','1083',jdecode('Circulars'),jdecode(''), jdecode('%2F1074%2F1083.html'), 'true',[],'',''],
		['PAGE','1092',jdecode('Flyers'),jdecode(''), jdecode('%2F1074%2F1092.html'), 'true',[],'',''],
		['PAGE','3223',jdecode('Window+Posters'),jdecode(''), jdecode('%2F1074%2F3223.html'), 'true',[],'',''],
		['PAGE','1101',jdecode('Banners'),jdecode(''), jdecode('%2F1074%2F1101.html'), 'true',[],'',''],
		['PAGE','4358',jdecode('More'),jdecode(''), jdecode('%2F1074%2F4358.html'), 'true',[],'','']
	],'',''],
	['PAGE','1110',jdecode('Offers'),jdecode(''), jdecode('%2F1110.html'), 'true',[],'',''],
	['PAGE','1056',jdecode('About+us'),jdecode(''), jdecode('%2F1056%2Findex.html'), 'true',[ 
		['PAGE','1065',jdecode('Founder+and+CEO'),jdecode(''), jdecode('%2F1056%2F1065.html'), 'true',[],'',''],
		['PAGE','3232',jdecode('President'),jdecode(''), jdecode('%2F1056%2F3232.html'), 'true',[],'',''],
		['PAGE','4376',jdecode('Sales'),jdecode(''), jdecode('%2F1056%2F4376.html'), 'true',[],'',''],
		['PAGE','4385',jdecode('Pre+Press'),jdecode(''), jdecode('%2F1056%2F4385.html'), 'true',[],'',''],
		['PAGE','4394',jdecode('Plant+Manager'),jdecode(''), jdecode('%2F1056%2F4394.html'), 'true',[],'',''],
		['PAGE','4880',jdecode('Production+Manager'),jdecode(''), jdecode('%2F1056%2F4880.html'), 'true',[],'','']
	],'',''],
	['PAGE','1128',jdecode('Contact'),jdecode(''), jdecode('%2F1128.html'), 'true',[],'',''],
	['PAGE','2162',jdecode('Directions'),jdecode(''), jdecode('%2F2162.html'), 'true',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Easy';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='49';
theSitetree.graphicsetId='51';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'optimum',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Easy',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'49',
				graphicsetId: 	'51',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'FFFFFF',
				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['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2162',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '22',
internalId:  '1006',
customField: '1006'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC245']={
webappId:    '5003',
documentId:  '22',
internalId:  'tid:1;pid:WSCSYSSSSLYTC245',
customField: 'en:US:'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22',
internalId:  '',
customField: '20080327-055733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1128',
internalId:  '',
customField: '20120201-122338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1074',
internalId:  '',
customField: '20080219-150031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1083',
internalId:  '',
customField: '20080219-191321'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1092',
internalId:  '',
customField: '20080219-153747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3223',
internalId:  '',
customField: '20080218-194944'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1101',
internalId:  '',
customField: '20080218-195007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4358',
internalId:  '',
customField: '20080219-153833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1110',
internalId:  '',
customField: '20080206-171650'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1056',
internalId:  '',
customField: '20080219-192419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1065',
internalId:  '',
customField: '20080219-191903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3232',
internalId:  '',
customField: '20120201-122428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4376',
internalId:  '',
customField: '20080219-192250'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4385',
internalId:  '',
customField: '20120201-122517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4394',
internalId:  '',
customField: '20080219-194634'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4880',
internalId:  '',
customField: '20080219-194322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2162',
internalId:  '',
customField: '20080219-162130'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3LV2';
var companyName   = 'VIP+Advertising';
var htmlTitle	  = 'VIP+Advertising+The+Circular+Specialists';
var metaKeywords  = 'Printing+Printer+Print+Circulars+Flyers+Web-Offset+Design+Advertising+Brochures+Computer+Digital+CTP+Delivery+Distribution+Customer+Service+Grocery+Supermarket+Commerce+VIP+Desktop+Publishing+Calendars+Posters+Business+Accuracy+Quality+Efficiency+Quick+Turnaround+pre-press+Economical+newspaper+inserts+professional+drug+store+pharmacy+deliveries+newsprint+layout+services';
var metaContents  = 'Printing+Printer+Print+Circulars+Flyers+Web-Offset+Design+Advertising+Brochures+Computer+Digital+CTP+Delivery+Distribution+Customer+Service+Grocery+Supermarket+Commerce+VIP+Desktop+Publishing+Calendars+Posters+Business+Accuracy+Quality+Efficiency+Quick+Turnaround+pre-press+Economical+newspaper+inserts+professional+drug+store+pharmacy+deliveries+newsprint+layout+services';
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();
};

