/* [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','2601',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/2601.html','true',[],'',''],
	['PAGE','2736',jdecode('Polityka+jako%C5%9Bci'),jdecode(''),'/2736.html','true',[],'',''],
	['PAGE','2652',jdecode('Zam%C3%B3w+online'),jdecode(''),'/2652.html','true',[],'',''],
	['PAGE','3801',jdecode('Zapytanie+ofertowe'),jdecode(''),'/3801.html','true',[],'',''],
	['ITEM','3701',jdecode('Cenniki'),jdecode(''),'http://prosper.com.pl/cennik/00.htm','true',[],'','_blank'],
	['PAGE','2673',jdecode('Cenniki+-+pobierz'),jdecode(''),'/2673.html','true',[],'',''],
	['PAGE','2715',jdecode('Kontakt'),jdecode(''),'/2715.html','true',[ 
		['ITEM','5401',jdecode('Jak+do+nas+trafi%C4%87'),jdecode(''),'http://maps.google.pl/maps?f=q&source=s_q&hl=pl&geocode=&q=sosnowiec,+b%C4%99dzi%C5%84ska+15&sll=50.291368,19.132476&sspn=0.020975,0.055575&ie=UTF8&hq=&hnear=B%C4%99dzi%C5%84ska+15,+Sosnowiec,+%C5%9Al%C4%85skie&ll=50.292547,19.135866&spn=0.010487,0.027788&z=16&iwloc=r0','true',[],'','_blank']
	],'',''],
	['PAGE','7301',jdecode('Promocje'),jdecode(''),'/7301.html','true',[],'',''],
	['ITEM','8301',jdecode('KATALOGI'),jdecode(''),'http://www.prosper.com.pl/katalog/katalog.html','true',[],'','_blank']];
var siteelementCount=10;
theSitetree.topTemplateName='Bow';
theSitetree.paletteFamily='0086C2';
theSitetree.keyvisualId='12026';
theSitetree.keyvisualName='kv_12026.jpg';
theSitetree.fontsetId='36225';
theSitetree.graphicsetId='14115';
theSitetree.contentColor='333333';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Bow',
				paletteFamily: 	'0086C2',
				keyvisualId: 	'12026',
				keyvisualName: 	'kv_12026.jpg',
				fontsetId: 		'36225',
				graphicsetId: 	'14115',
				contentColor: 	'333333',
				contentBGColor: 'FFFFFF',
				a_color: 		'F2F5F8',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2601',
internalId:  '',
customField: '20091119-100000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2652',
internalId:  '',
customField: '20091007-231045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2673',
internalId:  '',
customField: '20091108-204313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2715',
internalId:  '',
customField: '20091109-210235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2736',
internalId:  '',
customField: '20091109-210258'
};
webappMappings['1501']=webappMappings['1501-13559658']={
webappId:    '1501',
documentId:  '2601',
internalId:  '13559658',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7301',
internalId:  '',
customField: '20091018-235227'
};
webappMappings['7008']=webappMappings['7008-4733']={
webappId:    '7008',
documentId:  '2652',
internalId:  '4733',
customField: 'language:pl;country:PL;'
};
webappMappings['7008']=webappMappings['7008-4734']={
webappId:    '7008',
documentId:  '3801',
internalId:  '4734',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20091007-231017'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INP4YV';
var companyName   = 'P.P.H.U.+PROSPER+Sp.+z+o.o.';
var htmlTitle	  = 'P.P.H.U.+PROSPER+SP.+Z+O.O.+';
var metaKeywords  = 'BEZPOL%2C+RAYCHEM%2C+BELOS%2C+PROSPER%2C+3M%2C+TELEFONIKA%2C+BARNIER%2C+NOWA+PLUS%2C+RADPOL%2C+SCOTCH%2C+TEMFLEX%2C+NK%2C+ENSTO%2C+PRZY%C5%81%C4%84CZE%2C+INCOBEX%2C+Z%C5%81%C4%84CZA%2C+O%C5%9AWIETLENIE%2C+SZAFA%2C+BRILUX%2C+ROSA%2C+O%C5%9AWIETLENIE';
var metaContents  = 'HURTOWNIA+ELEKTROENERGETYCZNA+PROSPER+SP.+Z+O.O.++BEZPOL%2C+RAYCHEM%2C+ROSA%2C+BELOS%2C+3M%2C+BARNIER%2C+NOWA+PLUS%2C+RADPOL%2C+ENSTO%2C+INCOBEX...';
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();
};

