/* [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','1801',jdecode('Home'),jdecode(''),'/1801.html','true',[],'',''],
	['PAGE','6001',jdecode('Our+Products'),jdecode(''),'/6001.html','true',[],'',''],
	['PAGE','2501',jdecode('On-Line+Shop'),jdecode(''),'/2501.html','true',[],'',''],
	['PAGE','9812',jdecode('Dog+Food'),jdecode(''),'/9812/index.html','true',[ 
		['PAGE','10712',jdecode('Premium+Puppy'),jdecode(''),'/9812/10712.html','true',[],'',''],
		['PAGE','10738',jdecode('Premium+Junior'),jdecode(''),'/9812/10738.html','true',[],'',''],
		['PAGE','10764',jdecode('Premium+Agility'),jdecode(''),'/9812/10764.html','true',[],'',''],
		['PAGE','10790',jdecode('Premium+Poultry+%26+Rice'),jdecode(''),'/9812/10790.html','true',[],'',''],
		['PAGE','12712',jdecode('Premium+Small+Breed'),jdecode(''),'/9812/12712.html','true',[],'',''],
		['PAGE','10816',jdecode('Cold+Pressed+Chicken+%26+Rice'),jdecode(''),'/9812/10816.html','true',[],'',''],
		['PAGE','10842',jdecode('Cold+Pressed+Lamb+%26+Potato'),jdecode(''),'/9812/10842.html','true',[],'','']
	],'',''],
	['PAGE','5101',jdecode('Contact+Us'),jdecode(''),'/5101.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Displace';
theSitetree.paletteFamily='2E2E2E';
theSitetree.keyvisualId='11075';
theSitetree.keyvisualName='kv_11075.jpg';
theSitetree.fontsetId='31958';
theSitetree.graphicsetId='13798';
theSitetree.contentColor='D8D8D5';
theSitetree.contentBGColor='2E2E2E';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Displace',
				paletteFamily: 	'2E2E2E',
				keyvisualId: 	'11075',
				keyvisualName: 	'kv_11075.jpg',
				fontsetId: 		'31958',
				graphicsetId: 	'13798',
				contentColor: 	'D8D8D5',
				contentBGColor: '2E2E2E',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20100920-191809'
};
webappMappings['4001']=webappMappings['4001-3670659']={
webappId:    '4001',
documentId:  '2501',
internalId:  '3670659',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20110204-225623'
};
webappMappings['7008']=webappMappings['7008-5089']={
webappId:    '7008',
documentId:  '5101',
internalId:  '5089',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20110109-112114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10712',
internalId:  '',
customField: '20110109-115055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20100920-191933'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9812',
internalId:  '',
customField: '20110109-121805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10738',
internalId:  '',
customField: '20110109-115104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10764',
internalId:  '',
customField: '20110109-111624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10790',
internalId:  '',
customField: '20110109-111719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10816',
internalId:  '',
customField: '20110109-111850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10842',
internalId:  '',
customField: '20110109-111924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12712',
internalId:  '',
customField: '20110109-111801'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wc1.hosting.digiweb.ie';
var accountId     = 'AGW010IN2DED';
var companyName   = 'Hollybarn+Pet+Products+Ireland';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = 'Hollybarn+Pet+Products+only+sell+the+very+highest+quality+dog+and+puppy+training+and+behaviour+products+that+we+ourselves+have+tried%2C+tested+and+use+in+our+everyday+dog+and+puppy+training+and+behaviour+sessions.+We+sell+DAP+Diffuser%2C+DAP+Collar%2C+Gentle+Leader%2C+Best+for+my+Dog+Dogfood%2C+The+Company+of+Animals%2C+Clix%2C+Halti%2C+Kong%2C+Savic%2C+training+and+behaviour+aids.';
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();
};

