/* [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','9001',jdecode('Home'),jdecode(''), jdecode('%2F9001.html'), 'true',[],'',''],
	['PAGE','9022',jdecode('Rasse'),jdecode(''), jdecode('%2F9022.html'), 'true',[],'',''],
	['PAGE','9073',jdecode('wer+bin+ich'),jdecode(''), jdecode('%2F9073.html'), 'true',[],'',''],
	['PAGE','9115',jdecode('Photos+%26+Filme+'),jdecode(''), jdecode('%2F9115.html'), 'true',[],'',''],
	['PAGE','15801',jdecode('Photo+%26+Film+Archiv'),jdecode(''), jdecode('%2F15801.html'), 'true',[],'',''],
	['PAGE','9136',jdecode('Ausstellungen'),jdecode(''), jdecode('%2F9136.html'), 'true',[],'',''],
	['PAGE','9094',jdecode('meine+Welpen'),jdecode(''), jdecode('%2F9094.html'), 'true',[],'',''],
	['PAGE','9157',jdecode('Kontakt%2FLinks'),jdecode(''), jdecode('%2F9157.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Steps';
theSitetree.paletteFamily='315881';
theSitetree.keyvisualId='2287';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='369';
theSitetree.graphicsetId='419';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='315881';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2QE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Steps',
				paletteFamily: 	'315881',
				keyvisualId: 	'2287',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'369',
				graphicsetId: 	'419',
				contentColor: 	'FFFFFF',
				contentBGColor: '315881',
				a_color: 		'315881',
				b_color: 		'2985B5',
				c_color: 		'3366CC',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9022',
internalId:  '',
customField: '20110109-183941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9115',
internalId:  '',
customField: '20120222-023537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9001',
internalId:  '',
customField: '20120217-193535'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9136',
internalId:  '',
customField: '20100913-210424'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9073',
internalId:  '',
customField: '20110109-171834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9094',
internalId:  '',
customField: '20110317-101114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15801',
internalId:  '',
customField: '20110203-145733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9157',
internalId:  '',
customField: '20110313-105857'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW330INEO0K';
var companyName   = '++++Quaci%C3%ABndas+Aragon+Unique';
var htmlTitle	  = 'Barbet+Aragon+Quaci%C3%ABndas';
var metaKeywords  = '+Barbet%2CWasserhund%2C+%2C+Chien+deau%2C+le+barbe%2C+Aragon%2C+Familienhund%2C+Barbichons%2C+beau+chien%2C+dog%2C+le+barbet+est+un+chien+deau%2CWaterdog%2C+Perro+de+Aqua';
var metaContents  = 'Barbet%2C+Wasserhund%2Cchien+deau%2C++Aragon%2CWelpen%2C+Deckruede%2C+Hund%2C+Barbet%2C+Aragon%2C+Wasserhund%2C+Chien+deau%2CChien+deau%2C+Wasserhund%2C+Barbet%2C+Aragon%2C+Familienhund%2C+le+barbet%2C+beau+chien%2C+chien%2C+le+barbet+est+un+chien+deau%2C+Barbichons%2C+Rassehund%2C+Zucht%2C+Perro+de+Aqua';
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();
};

