/* [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','43',jdecode('home'),jdecode(''),'/43.html','true',[],''],
	['PAGE','2192',jdecode('press'),jdecode(''),'/2192.html','true',[],''],
	['PAGE','3663',jdecode('artworks'),jdecode(''),'/3663/index.html','true',[ 
		['PAGE','31701',jdecode('the+bather+series'),jdecode(''),'/3663/31701.html','true',[],''],
		['PAGE','31722',jdecode('a+fine+balance+series'),jdecode(''),'/3663/31722.html','true',[],''],
		['PAGE','33601',jdecode('neon+works'),jdecode(''),'/3663/33601.html','true',[],'']
	],''],
	['PAGE','2210',jdecode('products'),jdecode(''),'/2210/index.html','true',[ 
		['PAGE','17401',jdecode('upholstery+fabric'),jdecode(''),'/2210/17401.html','true',[],''],
		['PAGE','31743',jdecode('room+dividers'),jdecode(''),'/2210/31743.html','true',[],''],
		['PAGE','2219',jdecode('hangings'),jdecode(''),'/2210/2219.html','true',[],''],
		['PAGE','2237',jdecode('throws'),jdecode(''),'/2210/2237.html','true',[],''],
		['PAGE','4069',jdecode('rugs'),jdecode(''),'/2210/4069.html','true',[],'']
	],''],
	['PAGE','2532',jdecode('new+products'),jdecode(''),'/2532.html','true',[],''],
	['PAGE','2282',jdecode('exhibitions'),jdecode(''),'/2282.html','true',[],''],
	['PAGE','2264',jdecode('contact'),jdecode(''),'/2264.html','true',[],'']];
var siteelementCount=15;
theSitetree.topTemplateName='cutout';
theSitetree.paletteFamily='A1BCDD';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10611';
theSitetree.graphicsetId='10474';
theSitetree.contentColor='43637C';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'cutout',
				paletteFamily: 	'A1BCDD',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10611',
				graphicsetId: 	'10474',
				contentColor: 	'43637C',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1501']=webappMappings['1501-1403205']={
webappId:    '1501',
documentId:  '43',
internalId:  '1403205',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '43',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43',
internalId:  '',
customField: '20090929-045153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2192',
internalId:  '',
customField: '20081122-074953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2282',
internalId:  '',
customField: '20090914-044742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33601',
internalId:  '',
customField: '20090609-145749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3663',
internalId:  '',
customField: '20090609-064524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2210',
internalId:  '',
customField: '20090613-084329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17401',
internalId:  '',
customField: '20090517-063152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2219',
internalId:  '',
customField: '20090517-063229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31743',
internalId:  '',
customField: '20090609-114134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2237',
internalId:  '',
customField: '20060302-220256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31722',
internalId:  '',
customField: '20090609-112542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4069',
internalId:  '',
customField: '20090131-110727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31701',
internalId:  '',
customField: '20090609-113857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2532',
internalId:  '',
customField: '20090501-060540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2264',
internalId:  '',
customField: '20090517-063726'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050IN31GI';
var companyName   = 'sophie+hedderwick';
var htmlTitle	  = 'http%3A%2F%2Fwww.sophiehedderwick.co.uk';
var metaKeywords  = 'rugs%2C+hangings%2C+throws%2C+scarves%2C+cushions';
var metaContents  = 'contemporary+textiles%2C+luxury+yarns';
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();
};
