/* [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 theSitetree=[ 
	['PAGE','9201',jdecode('Home'),jdecode(''),'/9201.html','true',[],''],
	['PAGE','17201',jdecode('Training+Services'),jdecode(''),'/17201.html','true',[],''],
	['PAGE','17222',jdecode('Boarding'),jdecode(''),'/17222.html','true',[],''],
	['PAGE','17264',jdecode('Dog+Trainers+School'),jdecode(''),'/17264.html','true',[],''],
	['PAGE','17327',jdecode('Our+Dogs%2FPuppies'),jdecode(''),'/17327.html','true',[],''],
	['PAGE','17306',jdecode('Photo+Gallery'),jdecode(''),'/17306.html','true',[],''],
	['PAGE','34801',jdecode('K9+Detection'),jdecode(''),'/34801.html','true',[],''],
	['PAGE','17285',jdecode('Testimonials'),jdecode(''),'/17285.html','true',[],''],
	['PAGE','17348',jdecode('Interesting+Links'),jdecode(''),'/17348.html','true',[],''],
	['PAGE','19301',jdecode('Contact+Us'),jdecode(''),'/19301.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='C5A858';
theSitetree.keyvisualId='6899';
theSitetree.keyvisualName='kv_6899.jpg';
theSitetree.fontsetId='11211';
theSitetree.graphicsetId='12034';
theSitetree.contentColor='64511A';
theSitetree.contentBGColor='DABB67';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Angkor',
				paletteFamily: 	'C5A858',
				keyvisualId: 	'6899',
				keyvisualName: 	'kv_6899.jpg',
				fontsetId: 		'11211',
				graphicsetId: 	'12034',
				contentColor: 	'64511A',
				contentBGColor: 'DABB67',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'DABB67',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9201',
internalId:  '',
customField: '20100405-085713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17201',
internalId:  '',
customField: '20100202-100236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34801',
internalId:  '',
customField: '20090721-122120'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17306',
internalId:  '',
customField: '20090812-115856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17222',
internalId:  '',
customField: '20090708-190859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17264',
internalId:  '',
customField: '20090812-100922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17285',
internalId:  '',
customField: '20090410-092209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17348',
internalId:  '',
customField: '20100118-112421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17327',
internalId:  '',
customField: '20090812-121525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19301',
internalId:  '',
customField: '20090623-115652'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9201',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-33d3a5810f7be2bb0e2eea0d86bb92bc']={
webappId:    '7060',
documentId:  '17306',
internalId:  '33d3a5810f7be2bb0e2eea0d86bb92bc',
customField: 'language:en;country:US;'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH010INXVD2';
var companyName   = 'Olympus+Dog+Training+Academy';
var htmlTitle	  = 'Olympus+Dog+Training';
var metaKeywords  = 'dog+training%2Cgerman+shepherd%2Cpuppies%2Cguard+dogs%2Cprotection%2Cschutzhund%2Cpolice+dogs%2Cdetection+dogs%2Cobedience%2Ck9+behaviour%2Ccanine+behaviour%2Cdog+boarding';
var metaContents  = 'Breeding+the+total+German+Shepherd.++Truly+a+must+see+training+and+breeding+facility.++905-458-7556+ext.4101.++K9+behaviour+specialists%21';
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();
};
