/* [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','4201',jdecode('Service'),jdecode(''), jdecode('%2F4201.html'), 'true',[],'',''],
	['PAGE','48801',jdecode('Litigation+Copying'),jdecode(''), jdecode('%2F48801.html'), 'true',[],'',''],
	['PAGE','48822',jdecode('Copying+%2F+Paper'),jdecode(''), jdecode('%2F48822.html'), 'true',[],'',''],
	['PAGE','48864',jdecode('Printing+%2F+Typesetting'),jdecode(''), jdecode('%2F48864.html'), 'true',[],'',''],
	['PAGE','48843',jdecode('Finishing'),jdecode(''), jdecode('%2F48843.html'), 'true',[],'',''],
	['PAGE','53523',jdecode('Scanning+%2F+Faxing'),jdecode(''), jdecode('%2F53523.html'), 'true',[],'',''],
	['PAGE','57123',jdecode('Notary+Public'),jdecode(''), jdecode('%2F57123.html'), 'true',[],'',''],
	['PAGE','53544',jdecode('Computer+Rental'),jdecode(''), jdecode('%2F53544.html'), 'true',[],'',''],
	['PAGE','18201',jdecode('Contact+us'),jdecode(''), jdecode('%2F18201.html'), 'true',[],'',''],
	['PAGE','19401',jdecode('About+us'),jdecode(''), jdecode('%2F19401.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Trend';
theSitetree.paletteFamily='3F70CF';
theSitetree.keyvisualId='7939';
theSitetree.keyvisualName='kv_7939.jpg';
theSitetree.fontsetId='16910';
theSitetree.graphicsetId='12323';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Trend',
				paletteFamily: 	'3F70CF',
				keyvisualId: 	'7939',
				keyvisualName: 	'kv_7939.jpg',
				fontsetId: 		'16910',
				graphicsetId: 	'12323',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4201',
internalId:  '',
customField: '20110420-221426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18201',
internalId:  '',
customField: '20101116-181759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19401',
internalId:  '',
customField: '20110420-222422'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48801',
internalId:  '',
customField: '20110420-221534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48822',
internalId:  '',
customField: '20101116-173440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48843',
internalId:  '',
customField: '20101116-181306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48864',
internalId:  '',
customField: '20101116-173251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53544',
internalId:  '',
customField: '20100720-173755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53523',
internalId:  '',
customField: '20100910-145004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57123',
internalId:  '',
customField: '20100913-200042'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7CUT6';
var companyName   = 'COPYMAT+WALNUT+CREEK%2C+INC.';
var htmlTitle	  = 'COPYMAT+Walnut+Creek%2C+Inc.';
var metaKeywords  = 'copymat%2C+walnut+creek%2C+north+main+street%2C+litigation+copying%2C+full+and+self-service+copies%2C+xerox+docucolor+color+copier%2C+digital+printing+from+any+media%2C+printing%2C+business+cards%2C+letterhead%2C+envelopes%2C+typesetting%2C+oversize+and+blueprint+copies%2C+spiral+binding%2C+velo+binding%2C+coil+binding%2C+tape+binding%2C+lamination%2C+labeling%2C+exhibit+tabs%2C+computer+rental%2C+high+speed+internet+access%2C+fax+service%2C+scanning%2C+shrink+wrapping%2C+notary+public%2C+same+day+and+overnight+service%2C+commercial+accounts%2C+free+local+pickup+and+delivery+briefs%2C+pallets%2C+medical+records%2C+color+copying%2C+banker+boxes%2C+bate+stamp%2C+index+tabs%2C+black+and+white+copy%2C+color+copy%2C+rush+jobs%2C+briefs%2C+bates+stamp%2C+binding%2C+Farsi%2C+Persian';
var metaContents  = 'COPYMAT+is+a+full+service+copy+center+which+specializes+in+litigation+copying.+COPYMAT+offers+corporate+accounts+for+your+convenience.+COPYMAT+does+same+day+and+rush+jobs.+COPYMAT+is+proud+to+serve+Walnut+Creek+since+1994+at+the+same+location+and+same+ownership.';
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();
};

