/* [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','701',jdecode('Home'),jdecode(''), jdecode('%2F701%2Findex.html'), 'true',[ 
		['PAGE','5401',jdecode('Ausstattung'),jdecode(''), jdecode('%2F701%2F5401.html'), 'true',[],'','']
	],'',''],
	['PAGE','13801',jdecode('S+H+O+P'),jdecode(''), jdecode('%2F13801.html'), 'true',[],'',''],
	['PAGE','2464',jdecode('Wo+zu+kaufen+%3F'),jdecode(''), jdecode('%2F2464.html'), 'true',[],'',''],
	['PAGE','2401',jdecode('Historie'),jdecode(''), jdecode('%2F2401%2Findex.html'), 'true',[ 
		['PAGE','2422',jdecode('Medizinischer+Bericht'),jdecode(''), jdecode('%2F2401%2F2422.html'), 'true',[],'',''],
		['PAGE','28601',jdecode('Tips...........'),jdecode(''), jdecode('%2F2401%2F28601.html'), 'true',[],'',''],
		['PAGE','2485',jdecode('Gr%C3%B6%C3%9Fentabelle'),jdecode(''), jdecode('%2F2401%2F2485.html'), 'true',[],'',''],
		['PAGE','2506',jdecode('France%2C+Italy....'),jdecode(''), jdecode('%2F2401%2F2506.html'), 'true',[],'','']
	],'',''],
	['PAGE','6001',jdecode('Hundestaffel'),jdecode(''), jdecode('%2F6001%2Findex.html'), 'true',[ 
		['PAGE','2443',jdecode('CAN-Rettungshunde'),jdecode(''), jdecode('%2F6001%2F2443.html'), 'true',[],'','']
	],'',''],
	['PAGE','2590',jdecode('Galerie'),jdecode(''), jdecode('%2F2590.html'), 'true',[],'',''],
	['PAGE','2611',jdecode('SF2%2FKonsum+TV'),jdecode(''), jdecode('%2F2611.html'), 'true',[],'',''],
	['PAGE','2695',jdecode('Kontakt+%2F+e-mail'),jdecode(''), jdecode('%2F2695.html'), 'true',[],'',''],
	['PAGE','2674',jdecode('AGB%C2%B4s+%2F+Impressum'),jdecode(''), jdecode('%2F2674.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Optic';
theSitetree.paletteFamily='4A8853';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10508';
theSitetree.graphicsetId='11052';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='51915A';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Optic',
				paletteFamily: 	'4A8853',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10508',
				graphicsetId: 	'11052',
				contentColor: 	'FFFFFF',
				contentBGColor: '51915A',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'C8C7C7',
				e_color: 		'C8C7C7',
				f_color: 		'C8C7C7',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '13801',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-1558']={
webappId:    '7008',
documentId:  '2695',
internalId:  '1558',
customField: 'language:de;country:CH;'
};
webappMappings['4001']=webappMappings['4001-16015609']={
webappId:    '4001',
documentId:  '13801',
internalId:  '16015609',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20110409-124730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20080812-081626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13801',
internalId:  '',
customField: '20110409-124618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2464',
internalId:  '',
customField: '20110316-161457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20070814-174904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2422',
internalId:  '',
customField: '20080715-194339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28601',
internalId:  '',
customField: '20110316-161603'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2485',
internalId:  '',
customField: '20110316-161642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2506',
internalId:  '',
customField: '20070812-121528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20110409-125008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2443',
internalId:  '',
customField: '20070812-072613'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2590',
internalId:  '',
customField: '20080104-111640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2611',
internalId:  '',
customField: '20070816-111135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2695',
internalId:  '',
customField: '20070808-194422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2674',
internalId:  '',
customField: '20111117-121522'
};
webappMappings['1501']=webappMappings['1501-15900597']={
webappId:    '1501',
documentId:  '13801',
internalId:  '15900597',
customField: '1501'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2ZMV';
var companyName   = 'S+c+h+u+t+z+b+r+i+l+l+e+n+++f%C3%BCr+Hunde';
var htmlTitle	  = 'Schutzbrillen+f%C3%BCr+Hunde+verschiedener+Rassen+und+Gr%C3%B6%C3%9Fen';
var metaKeywords  = 'HUNDEBRILLEN%2CHundebrille%2Cdog-goes%2Cdoggles%2CSchutzbrillen+f%C3%BCr+Hunde%2CRettugshunde%2CSuchhunde%2CSchutzhunde%2CRettungshundestaffel%2CSuchhundestaffel%2CChiemgau%2CSonnenbrillen%2CRettungshund%2CSuchhund%2C';
var metaContents  = 'HUNDEBRILLEN%2CHundebrille%2Cdog-goes%2Cdoggles%2CSchutzbrillen+f%C3%BCr+Hunde%2CRettugshunde%2CSuchhunde%2CSchutzhunde%2CRettungshundestaffel%2CSuchhundestaffel%2CChiemgau%2CSonnenbrillen%2CRettungshund%2CSuchhund%2C';
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();
};

