/* [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','1701',jdecode('Home'),jdecode(''),'/1701.html','true',[],''],
	['PAGE','6701',jdecode('Our+service'),jdecode(''),'/6701/index.html','true',[ 
		['PAGE','17401',jdecode('Clearances'),jdecode(''),'/6701/17401.html','true',[],''],
		['PAGE','6753',jdecode('Removal+Service'),jdecode(''),'/6701/6753.html','true',[],''],
		['PAGE','16701',jdecode('Deliveries'),jdecode(''),'/6701/16701.html','true',[],''],
		['PAGE','6727',jdecode('Packaging'),jdecode(''),'/6701/6727.html','true',[],'']
	],''],
	['PAGE','16901',jdecode('Important'),jdecode(''),'/16901.html','true',[],''],
	['PAGE','19201',jdecode('Prices'),jdecode(''),'/19201.html','true',[],''],
	['PAGE','6805',jdecode('Contact'),jdecode(''),'/6805.html','true',[],''],
	['PAGE','16927',jdecode('Terms+and+Conditions'),jdecode(''),'/16927.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Valiant';
theSitetree.paletteFamily='D43F3F';
theSitetree.keyvisualId='9814';
theSitetree.keyvisualName='kv_9814.jpg';
theSitetree.fontsetId='17626';
theSitetree.graphicsetId='13031';
theSitetree.contentColor='D43F3F';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Valiant',
				paletteFamily: 	'D43F3F',
				keyvisualId: 	'9814',
				keyvisualName: 	'kv_9814.jpg',
				fontsetId: 		'17626',
				graphicsetId: 	'13031',
				contentColor: 	'D43F3F',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20080521-154259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6701',
internalId:  '',
customField: '20080415-204124'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6727',
internalId:  '',
customField: '20080413-183506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6753',
internalId:  '',
customField: '20080415-093600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6805',
internalId:  '',
customField: '20090606-192755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19201',
internalId:  '',
customField: '20080416-212328'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16701',
internalId:  '',
customField: '20080415-093618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16901',
internalId:  '',
customField: '20080412-211142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16927',
internalId:  '',
customField: '20080416-082918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17401',
internalId:  '',
customField: '20090718-202949'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2TWK';
var companyName   = 'Kwik+Removals+Edinburgh+%26+Lothians';
var htmlTitle	  = 'Edinburgh+removals++Van+plus+man+removals+and+clearances+House+Garden+in+Edinburgh+also+National+Removals';
var metaKeywords  = 'edinburgh+removals%2Cclearances%2Cpick+ups%2Cdeliveries%2C+friendly%2Cman+van%2C+national%2C+Lothian%2C+Fife%2C+short+notice%2C+quick%2C+kwik%2C+small+removals%2C+big+removals%2C+good%2C+fast%2C+fair%2C+honest%2C+best%2C+';
var metaContents  = 'Edinburgh+removals%2C+clearances%2Cpick+ups%2Cshop+deliveries.Friendly%2Ccompetetive+services+by+man+with+van+.House++flats+removals+in+Edinburgh%2C+house+clearances+in+Edinburgh.+Cheap+Van+man+services.+National+removals.';
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();
};
