/* [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','10201',jdecode('Home'),jdecode(''),'/10201.html','true',[],'',''],
	['PAGE','11101',jdecode('Location'),jdecode(''),'/11101.html','true',[],'',''],
	['PAGE','11301',jdecode('Hours+Open'),jdecode(''),'/11301.html','true',[],'',''],
	['PAGE','11122',jdecode('People+and+Technology+'),jdecode(''),'/11122.html','true',[],'',''],
	['PAGE','10315',jdecode('General+X-ray'),jdecode(''),'/10315.html','true',[],'',''],
	['PAGE','10336',jdecode('Immigration'),jdecode(''),'/10336.html','true',[],'',''],
	['PAGE','10357',jdecode('Patient+Bookings'),jdecode(''),'/10357.html','true',[],'',''],
	['PAGE','10378',jdecode('Referrral+Form'),jdecode(''),'/10378.html','true',[],'',''],
	['PAGE','10399',jdecode('Contact+and+Feedback'),jdecode(''),'/10399.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Profile';
theSitetree.paletteFamily='336699';
theSitetree.keyvisualId='1271';
theSitetree.keyvisualName='cd_einlegen.jpg';
theSitetree.fontsetId='190';
theSitetree.graphicsetId='230';
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: 			'Profile',
				paletteFamily: 	'336699',
				keyvisualId: 	'1271',
				keyvisualName: 	'cd_einlegen.jpg',
				fontsetId: 		'190',
				graphicsetId: 	'230',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'336699',
				b_color: 		'336699',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-14983']={
webappId:    '7008',
documentId:  '10357',
internalId:  '14983',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-14984']={
webappId:    '7008',
documentId:  '10378',
internalId:  '14984',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-14985']={
webappId:    '7008',
documentId:  '10399',
internalId:  '14985',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20100222-185751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20100216-151105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11301',
internalId:  '',
customField: '20100222-190329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11122',
internalId:  '',
customField: '20100222-172102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10315',
internalId:  '',
customField: '20100217-165506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10336',
internalId:  '',
customField: '20100217-164913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10357',
internalId:  '',
customField: '20100216-172131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10378',
internalId:  '',
customField: '20100222-182548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10399',
internalId:  '',
customField: '20100216-171446'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '10201',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7CQ0S';
var companyName   = 'General+and+Immigration+X-rays';
var htmlTitle	  = '';
var metaKeywords  = 'X-ray%2C+xray%2C+xrays%2C+x-rays%2C+immigration+chest+x-rays%2C+general+x-rays%2C+clinical+x-rays%2C+referral+x-rays%2C+immigration+x-rays%2C+Northcote%2C+North+Shore+x-rays%2C+Auckland+x-rays';
var metaContents  = 'X-rays+-+general+and+immigration+-+Northcote%2C+North+Shore%2C+Auckland%0D%0A%0D%0AFREE+ACC+X-rays%0D%0A%0D%0AFast+-+Affordable+-+Friendly';
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();
};

