/* [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','801',jdecode('Home'),jdecode(''), jdecode('%2F801.html'), 'true',[],'',''],
	['PAGE','9401',jdecode('Services'),jdecode(''), jdecode('%2F9401.html'), 'true',[],'',''],
	['PAGE','2922',jdecode('Gallery'),jdecode(''), jdecode('%2F2922.html'), 'true',[],'',''],
	['PAGE','38017',jdecode('Guestbook'),jdecode(''), jdecode('%2F38017%2Findex.html'), 'true',[ 
		['PAGE','38012',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F38017%2F38012.html'), 'false',[],'','']
	],'',''],
	['PAGE','55612',jdecode('Videos'),jdecode(''), jdecode('%2F55612.html'), 'true',[],'',''],
	['PAGE','57812',jdecode('News%2FEvents'),jdecode(''), jdecode('%2F57812.html'), 'false',[],'',''],
	['PAGE','67512',jdecode('Client+Area'),jdecode(''), jdecode('%2F67512.html'), 'true',[],'',''],
	['PAGE','2943',jdecode('Links'),jdecode(''), jdecode('%2F2943.html'), 'true',[],'',''],
	['PAGE','56712',jdecode('Contact+Us'),jdecode(''), jdecode('%2F56712.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'brinkster',
  product: 'WSCSYSSSSLYTCVUR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20111011-130627'
};
webappMappings['1002']=webappMappings['1002-38017abri10inxx9n']={
webappId:    '1002',
documentId:  '38017',
internalId:  '38017abri10inxx9n',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '801',
internalId:  '',
customField: '20111003-064158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2922',
internalId:  '',
customField: '20111011-123758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2943',
internalId:  '',
customField: '20110928-045622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38017',
internalId:  '',
customField: '20100817-125152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38012',
internalId:  '',
customField: '20071223-145259'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '801',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9401',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2922',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2943',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '38017',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '38012',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57812',
internalId:  '',
customField: '20100817-135903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55612',
internalId:  '',
customField: '20110914-132257'
};
webappMappings['7008']=webappMappings['7008-1310']={
webappId:    '7008',
documentId:  '56712',
internalId:  '1310',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56712',
internalId:  '',
customField: '20110225-040327'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '55612',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '57812',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '56712',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67512',
internalId:  '',
customField: '20111021-083043'
};
var webAppHostname = 'wsc.brinkster.com:80';
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INXX9N';
var companyName   = 'Stephen+Allard+Photography+UK';
var htmlTitle	  = 'Stephen+Allard+Manchester%2FSalford+Mobile+Studio+Photographer';
var metaKeywords  = 'stephen+allard%2Cphotography%2Cmanchester%2Csalford%2Cmobile+studio%2Cmobile+photo+studio%2Cportraits%2Cwedding+photographer%2Cevents+photographer%2Cnorth+west%2Cuk+photographer%2Cbuxton+photographer%2Cmanchester%2Csalford%2Cstockport%2Cmacclesfield+photographer+bury%2Cwhitefield%2Cdisley+photographer%2Cproduct+photo%2Cproduct+photography%2Clancashire%2Cordsall+photographer%2Cwedding+photos%2Canimal+photography%2Csalford+triathlon%2Cworld+cup%2Cdragon+boat+race%2Cchild+portrait%2Cchildren+photography%2Cphotographer%2Cphotography%2Cnorth%2Cwest%2Clancashire%2Cmanchester%2Cengland%2Cuk%2Ceu%2Ceurope%2Cbritain%2Cpr%2Cpublic%2Crelations%2Ceditorial%2Ccreative%2Cpress%2Cregional%2Clocal%2Cdigital%2Cflowers%2Cgardens%2Cillustrated%2Cmagazine%2Ccity%2Ccorporate';
var metaContents  = 'Based+in+Salford%2FManchester+Stephen+Allard+Photography+covers+most+of+the+North+West+with+his+Mobile+Photo+Studio+and+Wedding+services.Allard+Photography+-+Friendly++fun%2C+inobtrusive%2C+informal++relaxed+and+ideal+for+those+that+hate+posing%21++Please+feel+free+to+ask+any+questions+about+our+services.';
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();
};

