/* [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','52',jdecode('The+Collections'),jdecode(''),'/52.html','true',[],''],
	['PAGE','4041',jdecode('The+Registry+at+G%C3%A5va+'),jdecode(''),'/4041.html','true',[],''],
	['PAGE','7614',jdecode('The+Knitting+Room+at+G%C3%A5va+'),jdecode(''),'/7614.html','true',[],''],
	['PAGE','82',jdecode('Contact'),jdecode(''),'/82.html','true',[],''],
	['PAGE','7447',jdecode('Gift+Ideas'),jdecode(''),'/7447.html','true',[],'']];
var siteelementCount=5;
theSitetree.topTemplateName='Activate';
theSitetree.paletteFamily='1E3A6F';
theSitetree.keyvisualId='2026';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='338';
theSitetree.graphicsetId='396';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='1E3A6F';
var theTemplate={
				name: 			'Activate',
				paletteFamily: 	'1E3A6F',
				keyvisualId: 	'2026',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'338',
				graphicsetId: 	'396',
				contentColor: 	'FFFFFF',
				contentBGColor: '1E3A6F',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'1E3A6F',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '52',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-d897a63797bc6230e0acd893ac5a0185']={
webappId:    '7060',
documentId:  '7447',
internalId:  'd897a63797bc6230e0acd893ac5a0185',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52',
internalId:  '',
customField: '20091230-135604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4041',
internalId:  '',
customField: '20091129-120605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7614',
internalId:  '',
customField: '20091129-121033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '82',
internalId:  '',
customField: '20091129-120402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7447',
internalId:  '',
customField: '20091129-121122'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INX32Q';
var companyName   = 'exquisite+gifts';
var htmlTitle	  = 'Gava+-+Elegant%2C+Distinctive%2C+Exquisite+Gifts%2C+Crystal%2C+China+and+Yarn';
var metaKeywords  = 'gava%2C+Gava%2C+G%C3%83%C2%83%C3%82%C2%A5va%2C+gifts%2C+gift%2C+wedding%2C+registry%2C+corporate+gifts%2C+awards%2C+incentive%2C+crystal%2C+silver%2C+tableware%2C+dala+horse%2C+Dalahest%2C+dalahesten%2C+Swedish+gifts%2C+Norwegian+gifts%2C+Finnish+gifts%2C+Sweden%2C+Norway%2C+Finland%2C+Scandinavian%2C+handicraft%2C+hand-painted%2C+hand-made%2C+handmade%2C+quilts%2C+handmade+quilts%2C+Maleros%2C+Orrefors%2C+Kosta+Boda%2C+yarn%2C+knitting%2C+knitting+supplies%2C+crochet';
var metaContents  = 'Gava+presents+the+finest+selection+of+distinct+gift+ideas.++Our+gift+items+are+drawn+from+a+wide+range%2C+but+reflect+a+uniquely+Scandinavian+influence.++The+Knitting+Room+at+Gava+offers+the+finest+knitting+supplies+and+yarn.++Gava+is+happy+to+help+with+wedding+and+shower+registry+needs.++We+are+also+well+prepared+to+assist+with+corporate+gifts.';
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();
};
