/* [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','1001',jdecode('Home'),jdecode(''),'/1001.html','true',[],''],
	['PAGE','1178',jdecode('Contato'),jdecode(''),'/1178.html','true',[],'']];
var siteelementCount=2;
theSitetree.topTemplateName='Cook';
theSitetree.paletteFamily='684A34';
theSitetree.keyvisualId='11564';
theSitetree.keyvisualName='kv_11564.jpg';
theSitetree.fontsetId='32892';
theSitetree.graphicsetId='13970';
theSitetree.contentColor='713b32';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				name: 			'Cook',
				paletteFamily: 	'684A34',
				keyvisualId: 	'11564',
				keyvisualName: 	'kv_11564.jpg',
				fontsetId: 		'32892',
				graphicsetId: 	'13970',
				contentColor: 	'713b32',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FDF1D6',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20090330-191845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1178',
internalId:  '',
customField: '20090331-232950'
};
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INPDM7';
var companyName   = '';
var htmlTitle	  = 'Vera+Madeira++++L%C2%B4art+in+dolce';
var metaKeywords  = 'bolo%3Bcake%3Bcup+cake%3Bdoce%3Bdoces%3Bfestas%3Bfesta%3Banivers%C3%A1rio%3Bcasamento%3Bvera+madeira%3Bveramadeira%3Bcake+designer%3Bpersonalizado%3Bpersonalizados%3Bnatal%3Bboloesculpido%3Bp%C3%A1scoa%3Bpresente%3Blembrancinha%3Btopode+bolo%3Bbiscuit%3Bgingerbread%3Bchocolate%3Bchantilly%3Bmousse+suflair%3Bbolo+decorado%3Banivers%C3%A1rio%3Bbolo+de+anivers%C3%A1rio%3Barte+comest%C3%ADvel%3Bgingerbread%3Bp%C3%A1scoa%3Bnatal%3Bpapai+noel%3Bpres%C3%A9pio%3Bbatman%3B';
var metaContents  = 'Visite+nosso+cantinho%21%21%21++Aqui+voc%C3%AA+encontrar%C3%A1+bolos+tem%C3%A1ticos+e+esculpidos+em+pasta+americana.++Bolos%2C+doces+e+bem+casados+personalizados+para+o+natal+e+p%C3%A1scoa.++Conhe%C3%A7a+nossa+linha+infantil+e+a+parte+de+modelagem+com+fadas+e+topos+de+bolos%2C+feito+com+a%C3%A7%C3%BAcar+ou+biscuit%21++Sua+presen%C3%A7a+%C3%A9+mais+do+que+bem+vinda%21++Obrigada++Vera+Madeira++';
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();
};
