/* [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 theSitetree=[ 
	['PAGE','4601',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/4601.html','true',[],''],
	['PAGE','5001',jdecode('Oferta'),jdecode(''),'/5001.html','true',[],''],
	['PAGE','5022',jdecode('Regulamin'),jdecode(''),'/5022.html','true',[],''],
	['PAGE','5043',jdecode('Cennik'),jdecode(''),'/5043.html','true',[],''],
	['PAGE','5064',jdecode('Wsp%C3%B3%C5%82praca'),jdecode(''),'/5064.html','true',[],''],
	['PAGE','5085',jdecode('Zam%C3%B3wienie'),jdecode(''),'/5085.html','true',[],'']];
var siteelementCount=6;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='003390';
theSitetree.keyvisualId='1738';
theSitetree.keyvisualName='boerse.jpg';
theSitetree.fontsetId='26898';
theSitetree.graphicsetId='353';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='003390';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'003390',
				keyvisualId: 	'1738',
				keyvisualName: 	'boerse.jpg',
				fontsetId: 		'26898',
				graphicsetId: 	'353',
				contentColor: 	'FFFFFF',
				contentBGColor: '003390',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003390',
				b_color: 		'000000',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-4208']={
webappId:    '7008',
documentId:  '5085',
internalId:  '4208',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4601',
internalId:  '',
customField: '20090815-174818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20090815-181217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5022',
internalId:  '',
customField: '20090815-181217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5043',
internalId:  '',
customField: '20090815-181217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5064',
internalId:  '',
customField: '20090815-181217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5085',
internalId:  '',
customField: '20090815-181217'
};
var canonHostname = 'wsc0.home.net.pl';
var accountId     = 'AHPL10INFGBI';
var companyName   = 'autorzy.info';
var htmlTitle	  = 'prace+magisterskie%2C+dyplomowe%2C+opracowania+-+autorzy.Info';
var metaKeywords  = 'prace+magisterskie%2C+licencjackie%2C+dyplomowe%2C+praca+magisterska%2C+licencjacka%2C+dyplomowa%2C+pisanie+prac+magisterskich%2C+licnecjackich%2C+dyplomowych%2C+pracy+magisterskiej%2C+dyplomowej%2C+licencjackiej%2C+magister%2C+licencjat%2C+dyplom%2C+pisanie%2C+napisanie%2C+prace%2C+prac%2C+pracami%2C+praca%2C+pomoc%2C+magisterska%2C+magisterskich%2C+licencjackie%2C+licencjacka%2C+licencjackich%2C+zaliczeniowa%2C+zaliczeniowych%2C+dyplomowych%2C+napisana%2C+opracowanie%2C+opracowania%2C+licencjaty%2C+prace+na+zam%C3%B3wienie%2C+pomoc+w+pisaniu';
var metaContents  = 'Oferujemy+prace+dyplomowe%2C+magisterskie+i+licencjackie+oraz+pisanie+prac+na+zlecenie%2C+a+tak%C5%BCe+prace+przyk%C5%82adowe+i+konsultacje.+Pomoc+merytoryczna+i+techniczno-edytorska.+Zapraszamy+do+kontaktu+i+skorzystania+z+naszych+us%C5%82ug.+Ka%C5%BCdego+klienta+traktujemy+indywidualnie.';
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();
};

