/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','48101',jdecode('Shop+Here'),jdecode(''),'/48101.html','true',[],'',''],
	['PAGE','1901',jdecode('Cuddle+Buddy'),jdecode(''),'/1901/index.html','true',[ 
		['PAGE','27501',jdecode('Colours'),jdecode(''),'/1901/27501.html','true',[],'','']
	],'',''],
	['PAGE','18801',jdecode('Pillows+-+bed+'),jdecode(''),'/18801.html','true',[],'',''],
	['PAGE','40101',jdecode('Stoneline'),jdecode(''),'/40101.html','true',[],'',''],
	['PAGE','17601',jdecode('Snapper+Clips'),jdecode(''),'/17601.html','true',[],'',''],
	['PAGE','1943',jdecode('Crocs'),jdecode(''),'/1943/index.html','true',[ 
		['PAGE','33401',jdecode('Styles'),jdecode(''),'/1943/33401.html','true',[],'',''],
		['PAGE','36501',jdecode('Sizing+Info'),jdecode(''),'/1943/36501.html','true',[],'','']
	],'',''],
	['PAGE','41301',jdecode('Wholesale'),jdecode(''),'/41301/index.html','true',[ 
		['PAGE','42701',jdecode('Contact'),jdecode(''),'/41301/42701.html','true',[],'',''],
		['PAGE','42722',jdecode('CB+Order'),jdecode(''),'/41301/42722.html','true',[],'',''],
		['PAGE','42764',jdecode('Memory+Foam+Order'),jdecode(''),'/41301/42764.html','true',[],'','']
	],'',''],
	['PAGE','2006',jdecode('Contact'),jdecode(''),'/2006/index.html','true',[ 
		['PAGE','1985',jdecode('Contact+Details'),jdecode(''),'/2006/1985.html','true',[],'',''],
		['PAGE','2027',jdecode('Retail+Outlets'),jdecode(''),'/2006/2027.html','true',[],'','']
	],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10892';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10892',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'555454',
				e_color: 		'555454',
				f_color: 		'555454',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-4893']={
webappId:    '7008',
documentId:  '2006',
internalId:  '4893',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-4895']={
webappId:    '7008',
documentId:  '42701',
internalId:  '4895',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-4896']={
webappId:    '7008',
documentId:  '42722',
internalId:  '4896',
customField: 'language:en;country:US;'
};
webappMappings['4001']=webappMappings['4001-6245096']={
webappId:    '4001',
documentId:  '48101',
internalId:  '6245096',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20091214-183425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20090714-035010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48101',
internalId:  '',
customField: '20081115-201056'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27501',
internalId:  '',
customField: '20090714-035054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18801',
internalId:  '',
customField: '20091204-175801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40101',
internalId:  '',
customField: '20090714-042425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17601',
internalId:  '',
customField: '20070829-055935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1943',
internalId:  '',
customField: '20091204-180056'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33401',
internalId:  '',
customField: '20091204-180412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36501',
internalId:  '',
customField: '20091204-180508'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41301',
internalId:  '',
customField: '20090714-040013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42701',
internalId:  '',
customField: '20070806-051600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42722',
internalId:  '',
customField: '20070806-060140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42764',
internalId:  '',
customField: '20070806-060240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2006',
internalId:  '',
customField: '20070605-053729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1985',
internalId:  '',
customField: '20100225-150740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2027',
internalId:  '',
customField: '20100225-151037'
};
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INEIZZ';
var companyName   = 'The+Comfort+Zone';
var htmlTitle	  = '';
var metaKeywords  = 'RC+WAll+Climbing+Car%2C+cuddle+buddy%2C+cuddle%2C+pillows%2C+thecomfortzone%2C+the+comfort+zone%2C+www.cuddlebuddy.com.au%2C+www.cuddlebuddies.co.nz%2C+cuddlebuddie%2C+cuddlebuddy%2C+cudle+budy%2C+Cuddle+buddys%2C+cuddle+buddies%2C+www.cuddlebuddy.com%2C++stonedine%3Dstoneline%2C+stonedine+cookware%2C+stoneline+cookware%2C+stonedine+pots+and+pans%2C+potware%2C+stone+cookware%2C+wall+climbing+car%2C+climbing+car%2C+g+car%2C+j+car%2C+climbing+wall+car%2C+remote+control+wall+car%2C+remote+control+climbing+ca%2C+rc+wall+climbing%2C+remote+control+car%2C+rc+car+nz%2C+rc+car+new+zealand';
var metaContents  = 'RC+toys%2C+RC+Wall+Climbing+Car%2C+cuddle+buddy%2C+cuddle+buddies%2C+bed+pillows%2C+memory+foam%2C+crocs%2C+shaker+torches%2C+comfort%2C+comfort+zone%2C+cuddle%2C+pillows%2C+retail+outlets%2C+ps+marketing%2C+www.thecomfortzone.co.nz%2C+northlands+mall%2C+the+comfort+zone%2C+stone%2C+stoneline%2C+cookware%2C+cook+ware%2C+www.cuddlebuddy.com.au%2C+www.cuddlebuddies.co.nz%2C+www.cuddlebuddy.co.nz%2C+cuddlebuddie%2C+massage+chairs%2C+massagechair%2C+www.massagechair.co.nz%2C+cuddlebuddy%2C+cudle+budy%2C+Cuddle+buddys%2C+cuddle+buddies%2C+stonedine%3Dstoneline%2C+stonedine+cookware%2C+stoneline%2Cwall+climbing+car%2C+climbing+car%2C+g+car%2C+j+car%2C+climbing+wall+car%2C+rc+wall+climbing%2C+remote+control+car%2C+rc+car+nz%2C+rc+car+new+zealand';
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();
};
