/* [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','4301',jdecode('Home'),jdecode(''), jdecode('%2F4301.html'), 'true',[],'',''],
	['PAGE','4352',jdecode('Fotos'),jdecode(''), jdecode('%2F4352.html'), 'true',[],'',''],
	['PAGE','4373',jdecode('Kontakt'),jdecode(''), jdecode('%2F4373.html'), 'true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Urban';
theSitetree.paletteFamily='4189EB';
theSitetree.keyvisualId='12173';
theSitetree.keyvisualName='kv_12173.jpg';
theSitetree.fontsetId='33331';
theSitetree.graphicsetId='14202';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'DE'
};
var prodDef={
  wl_name: 'alfahosting',
  product: 'WSCSYSSSSLY0XNIF'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Urban',
				paletteFamily: 	'4189EB',
				keyvisualId: 	'12173',
				keyvisualName: 	'kv_12173.jpg',
				fontsetId: 		'33331',
				graphicsetId: 	'14202',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-2d52b29a5e2d7be6b6ead797ce8d28a8']={
webappId:    '7060',
documentId:  '4352',
internalId:  '2d52b29a5e2d7be6b6ead797ce8d28a8',
customField: 'language:de;country:DE;'
};
webappMappings['7008']=webappMappings['7008-10201']={
webappId:    '7008',
documentId:  '4373',
internalId:  '10201',
customField: 'language:de;country:DE;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4301',
internalId:  '',
customField: '20111213-001337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4352',
internalId:  '',
customField: '20111213-001337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4373',
internalId:  '',
customField: '20111213-001337'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4301',
internalId:  '1006',
customField: '1006'
};
var webAppHostname = 'cgi-wsc.alfahosting.de:80';
var canonHostname = 'wsc.alfahosting.de';
var accountId     = 'AAHS10INEQBL';
var companyName   = 'PK-Video24.de';
var htmlTitle	  = 'Privat+Kino+-+VIDEO+24+pk-video24.de';
var metaKeywords  = 'Privatkino%2C+Heimkino%2C+Filme%2C+24+Stunden%2C+online%2C+offline%2C+Videothek%2C+Videos%2C+Neuheiten%2C+Charts%2C+Demn%C3%A4chst';
var metaContents  = 'Privatkino%2C+Heimkino%2C+alte+und+neue+Filme+-+Neuheiten+-+Charts+-+Demn%C3%A4chst%2C+24+Stunden+online-+und+offline+Videothek.+Kostenlose+Videos+non+stop+-+pk-video24.de';
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();
};

