/* [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','4301',jdecode('Glenorchy+Fur+products'),jdecode(''), jdecode('%2F4301.html'), 'true',[],'',''],
	['PAGE','4373',jdecode('Fur+Bedspreads'),jdecode(''), jdecode('%2F4373.html'), 'true',[],'',''],
	['PAGE','4415',jdecode('Possum+fur+hats'),jdecode(''), jdecode('%2F4415.html'), 'true',[],'',''],
	['PAGE','4394',jdecode('Possum+vests'),jdecode(''), jdecode('%2F4394.html'), 'true',[],'',''],
	['PAGE','4457',jdecode('Women%26%23x27%3Bs+Fashion'),jdecode(''), jdecode('%2F4457.html'), 'true',[],'',''],
	['PAGE','4436',jdecode('Hand+and+foot+items'),jdecode(''), jdecode('%2F4436.html'), 'true',[],'',''],
	['PAGE','4499',jdecode('Other+products'),jdecode(''), jdecode('%2F4499.html'), 'true',[],'',''],
	['PAGE','18201',jdecode('Colour+choice'),jdecode(''), jdecode('%2F18201.html'), 'true',[],'',''],
	['PAGE','11222',jdecode('Order'),jdecode(''), jdecode('%2F11222.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Favor';
theSitetree.paletteFamily='D2BD84';
theSitetree.keyvisualId='7354';
theSitetree.keyvisualName='kv_7354.jpg';
theSitetree.fontsetId='16467';
theSitetree.graphicsetId='12160';
theSitetree.contentColor='323232';
theSitetree.contentBGColor='F1EEDB';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp32-tnz',
  product: 'WSCVWLSSSLYTC2IW'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Favor',
				paletteFamily: 	'D2BD84',
				keyvisualId: 	'7354',
				keyvisualName: 	'kv_7354.jpg',
				fontsetId: 		'16467',
				graphicsetId: 	'12160',
				contentColor: 	'323232',
				contentBGColor: 'F1EEDB',
				a_color: 		'000000',
				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:  '4301',
internalId:  '',
customField: '20110704-230250'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18201',
internalId:  '',
customField: '20110709-195849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4373',
internalId:  '',
customField: '20110702-012251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4457',
internalId:  '',
customField: '20110705-013110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4415',
internalId:  '',
customField: '20110719-233955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4394',
internalId:  '',
customField: '20110503-054318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4436',
internalId:  '',
customField: '20110719-234356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4499',
internalId:  '',
customField: '20110503-055609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11222',
internalId:  '',
customField: '20101001-231743'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4301',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-8119150']={
webappId:    '1501',
documentId:  '4301',
internalId:  '8119150',
customField: '1501'
};
webappMappings['1501']=webappMappings['1501-8119155']={
webappId:    '1501',
documentId:  '4301',
internalId:  '8119155',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-20171']={
webappId:    '7008',
documentId:  '11222',
internalId:  '20171',
customField: 'language:en;country:US;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I71835';
var companyName   = 'Glenorchy+Fur+Products';
var htmlTitle	  = 'Glenorchy+Fur+Products';
var metaKeywords  = 'Possum+fur%2C+Australian+brush+tailed+possum%2C+possum+fur+bedspreads%2C+bedspreads%2C+throw+rugs%2C++possum+fur+hats%2C++accessories%2C+Glenorchy%2C+Queenstown%2C+Lake+Wakatipu%2C+Southern+Lakes%2C+New+Zealand%2C+New+Zealand+possum%2C+New+Zealand+shop%2C+New+Zealand+products%2C+possums+in+New+Zealand%2C+Possum+skin%2C+possum%2C+possums%2C+brush+tailed+possum%2C+possum+fur+clothing%2C+possum+fur+nz%2C+nz+possum+fur%2C+';
var metaContents  = 'We+manufacture+and+sell+possum+fur+products.+All+our+products+are+made+locally+in+Glenorchy+and+sourced+only+from+within+New+Zealand.+We+specialise+in+possum+fur+bedspreads+and+manufacture+hats+and+jackets+fully+lined+with+brush+tailed+possum+fur+at+our+Glenorchy+shop.%0D%0A%0D%0A%0D%0A%0D%0AWe+are+located+just+45+minutes+from+Queenstown+along+the+scenic+highway+at+the+Head+of+Lake+Wakatipu.';
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();
};

