/* [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','401',jdecode('HOME'),jdecode(''),'/401.html','true',[],''],
	['PAGE','452',jdecode('SUBLIMATION'),jdecode(''),'/452.html','true',[],''],
	['PAGE','22101',jdecode('FEATURED+PRODUCTS'),jdecode(''),'/22101.html','true',[],''],
	['PAGE','11601',jdecode('ABOUT+US'),jdecode(''),'/11601.html','true',[],''],
	['PAGE','578',jdecode('CONTACT+%26+ORDERS'),jdecode(''),'/578.html','true',[],''],
	['PAGE','473',jdecode('PRODUCTS'),jdecode(''),'/473/index.html','true',[ 
		['PAGE','494',jdecode('CUPS%2C+MUGS+%26+STEINS'),jdecode(''),'/473/494.html','true',[],''],
		['PAGE','21101',jdecode('NOVELTIES'),jdecode(''),'/473/21101.html','true',[],''],
		['PAGE','536',jdecode('GIFTS'),jdecode(''),'/473/536.html','true',[],''],
		['PAGE','6501',jdecode('CAN+COOLERS+%26+WATER+BOTTLES'),jdecode(''),'/473/6501.html','true',[],'']
	],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Metal';
theSitetree.paletteFamily='C6E5F6';
theSitetree.keyvisualId='798';
theSitetree.keyvisualName='auge.jpg';
theSitetree.fontsetId='143';
theSitetree.graphicsetId='159';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Metal',
				paletteFamily: 	'C6E5F6',
				keyvisualId: 	'798',
				keyvisualName: 	'auge.jpg',
				fontsetId: 		'143',
				graphicsetId: 	'159',
				contentColor: 	'DDDDDD',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'C6E5F6',
				b_color: 		'A4BDCC',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-619']={
webappId:    '7008',
documentId:  '578',
internalId:  '619',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090320-092558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20080618-130817'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22101',
internalId:  '',
customField: '20090320-092735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20080707-164028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20090116-102939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6501',
internalId:  '',
customField: '20090112-094958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21101',
internalId:  '',
customField: '20080707-164300'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20080707-164338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20071112-153633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20080707-164906'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10IN3PWR';
var companyName   = 'Mug-rageous%2C+cups%2C+mugs+much+more';
var htmlTitle	  = 'Mug-Rageous+customized+photography+and+personalized+mugs+and+stuff+serving+Barrie%2C+Orillia+and+Simoce+County';
var metaKeywords  = 'barrie%2C+Barrie%2C+Collingwood%2C+Simcoe%2C+Orillia%2C+mug-rageous%2C+rageous%2C+Mug-Rageous%2C+cups%2C+mugs%2C+travel+cups%2C+can+coolers%2C+printing%2C+sublimation%2C+novelity%2C+novelities%2C+gifts%2C+promotional%2C+personalized%2C+customized%2C+impression%2C+ceramic%2C+fundraisers%2C+births%2C+graduation%2C+weddings%2C+memorials%2C+imprintables%2C+heat+press%2C+canada%2C+ontario%2C+photo%2C+mug-shot+';
var metaContents  = 'Mug-Rageous+personalized%2C+customized+mugs+and+cups+for+all+occasions.+Whether+a+wedding%2C+fundraiser%2C+birth+and+gifts+of+all+kinds%2C+you+can+customized+a+varitey+of+products+to+suit.+';
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();
};
