/* [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','3201',jdecode('Home'),jdecode(''),'/3201/index.html','true',[ 
		['PAGE','9127',jdecode('Our+Blog'),jdecode(''),'/3201/9127.html','true',[],'']
	],''],
	['PAGE','3252',jdecode('Pricing+and+Sizing'),jdecode(''),'/3252.html','true',[],''],
	['PAGE','3330',jdecode('Samples'),jdecode(''),'/3330.html','true',[],''],
	['PAGE','41901',jdecode('Old+Photo+to+Oil+Samples'),jdecode(''),'/41901.html','true',[],''],
	['PAGE','3304',jdecode('Gift+Ideas'),jdecode(''),'/3304.html','true',[],''],
	['PAGE','41927',jdecode('Pet+Portrait+Samples'),jdecode(''),'/41927.html','true',[],''],
	['PAGE','41953',jdecode('Wedding+%26+Occasion+Samples'),jdecode(''),'/41953.html','false',[],''],
	['PAGE','3278',jdecode('Order+Your+Painting'),jdecode(''),'/3278.html','true',[],''],
	['PAGE','50001',jdecode('Outlets+in+your+area'),jdecode(''),'/50001.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Palette';
theSitetree.paletteFamily='CC0000';
theSitetree.keyvisualId='9342';
theSitetree.keyvisualName='kv_9342.jpg';
theSitetree.fontsetId='17396';
theSitetree.graphicsetId='12795';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Palette',
				paletteFamily: 	'CC0000',
				keyvisualId: 	'9342',
				keyvisualName: 	'kv_9342.jpg',
				fontsetId: 		'17396',
				graphicsetId: 	'12795',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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['7008']=webappMappings['7008-1240']={
webappId:    '7008',
documentId:  '3278',
internalId:  '1240',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3201',
internalId:  '',
customField: '20080916-224348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3278',
internalId:  '',
customField: '20080923-084051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3330',
internalId:  '',
customField: '20080916-231456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3252',
internalId:  '',
customField: '20080923-084732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3304',
internalId:  '',
customField: '20081201-102639'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9127',
internalId:  '',
customField: '20080630-185249'
};
webappMappings['7050']=webappMappings['7050-1134']={
webappId:    '7050',
documentId:  '9127',
internalId:  '1134',
customField: 'language:en;country:GB;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50001',
internalId:  '',
customField: '20080918-124717'
};
webappMappings['1501']=webappMappings['1501-583051']={
webappId:    '1501',
documentId:  '3201',
internalId:  '583051',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-1359']={
webappId:    '7008',
documentId:  '3201',
internalId:  '1359',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-1263']={
webappId:    '7008',
documentId:  '3304',
internalId:  '1263',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '50001',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3278',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '41953',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41901',
internalId:  '',
customField: '20080811-225945'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41927',
internalId:  '',
customField: '20081013-105313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41953',
internalId:  '',
customField: '20080811-142211'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '41927',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3304',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '41901',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3330',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3252',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9127',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3201',
internalId:  '',
customField: 'language:en;country:GB;'
};
var canonHostname = 'wc1.hosting.digiweb.ie';
var accountId     = 'AGW010INXLFP';
var companyName   = 'Oil+Paint+My+Photograph';
var htmlTitle	  = 'Oil+Paint+My+Photograph%2C+Quality+photo-to-oil+paintings%2C+Gift+Vouchers%2C+Portraits+Pets+And+Landscapes+Tralee%2C+Co.Kerry';
var metaKeywords  = 'christmas+gift+ideas%2C+picture+to+painting%2C+pet+portraits%2C+landscape+portraits%2Cpainting+from+photo%2C+photo+to+painting%2C+oil+portrait%2C+portrait+painters%2C+painted+portraits%2C+photo+to+canvas%2C+tralee%2C+kerry%2C+gallery%2C+cars+paintings%2C+boats+paintings%2C+gifts%2C+gift+vouchers';
var metaContents  = 'oil+paintings+from+photographs%2CTralee%2C+Co+Kerry.We+offer+unrivaled+quality+photo-to-oil+paintings+to+our+customer.+All+our+commisioned+oil+paintings+are+unique+and+our+customer+or+gift+voucher+recipient+decides+what+they+want+us+to+paint.+Our+award+winning+gift+voucher+makes+an+ideal+gift.';
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();
};
