/* [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','501',jdecode('Inicio+'),jdecode(''),'/501.html','true',[],''],
	['PAGE','552',jdecode('Quienes+Somos'),jdecode(''),'/552/index.html','true',[ 
		['PAGE','16501',jdecode('D%C3%B3nde+encontrarnos'),jdecode(''),'/552/16501.html','true',[],'']
	],''],
	['PAGE','573',jdecode('Servicios'),jdecode(''),'/573/index.html','true',[ 
		['PAGE','16522',jdecode('Embobinado'),jdecode(''),'/573/16522.html','true',[],''],
		['PAGE','16543',jdecode('Balanceo'),jdecode(''),'/573/16543.html','true',[],''],
		['PAGE','17501',jdecode('Maquinados'),jdecode(''),'/573/17501.html','true',[],'']
	],''],
	['PAGE','17522',jdecode('Reparacion+VS.+nuevo'),jdecode(''),'/17522.html','true',[],''],
	['PAGE','16564',jdecode('Mtto.+Predictivo'),jdecode(''),'/16564.html','true',[],''],
	['PAGE','16585',jdecode('Promociones'),jdecode(''),'/16585/index.html','true',[ 
		['PAGE','18301',jdecode('Promoci%C3%B3n+2009'),jdecode(''),'/16585/18301.html','true',[],'']
	],''],
	['PAGE','17543',jdecode('Motores+a+venta'),jdecode(''),'/17543.html','true',[],''],
	['PAGE','594',jdecode('Cont%C3%A1ctanos'),jdecode(''),'/594.html','true',[],''],
	['PAGE','18801',jdecode('Encuesta'),jdecode(''),'/18801.html','true',[],''],
	['PAGE','18822',jdecode('FORO'),jdecode(''),'/18822.html','true',[],'']];
var siteelementCount=15;
theSitetree.topTemplateName='Cogwheel';
theSitetree.paletteFamily='3370CC';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10398';
theSitetree.graphicsetId='10603';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				name: 			'Cogwheel',
				paletteFamily: 	'3370CC',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10398',
				graphicsetId: 	'10603',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'3370CC',
				e_color: 		'9E9D9D',
				f_color: 		'9E9D9D',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20090625-165158'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-5529305']={
webappId:    '1501',
documentId:  '501',
internalId:  '5529305',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-8545']={
webappId:    '7008',
documentId:  '594',
internalId:  '8545',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20090625-170550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20061220-100626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20090625-171414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16585',
internalId:  '',
customField: '20090625-174513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16501',
internalId:  '',
customField: '20090625-171047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16522',
internalId:  '',
customField: '20090612-172700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16543',
internalId:  '',
customField: '20090612-172700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17501',
internalId:  '',
customField: '20090625-164916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17522',
internalId:  '',
customField: '20090625-164916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16564',
internalId:  '',
customField: '20090612-172700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17543',
internalId:  '',
customField: '20090625-164916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18301',
internalId:  '',
customField: '20090625-174443'
};
webappMappings['7005']=webappMappings['7005-823']={
webappId:    '7005',
documentId:  '18801',
internalId:  '823',
customField: 'language:es;country:ES;'
};
webappMappings['1003']=webappMappings['1003-avec10iner7712294e71b96']={
webappId:    '1003',
documentId:  '18822',
internalId:  'avec10iner7712294e71b96',
customField: 'es:ES'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INER77';
var companyName   = 'Embobinados+GALCA%2C+S.A.+de+C.V.';
var htmlTitle	  = 'GALCA%2C+motores+electricos';
var metaKeywords  = 'motor%2Cmotores%2Celectrico%2Celectricos%2Cmotores+electricos%2Cmotor+electrico%2CAC%2CDC%2Ccorriente+alterna%2Cconrriente+directa%2Creparacion%2Ctaller%2Cmonterrey%2Cnuevo+leon%2Cmexico%2Cbalanceo%2Cbobina%2Cbobinas%2Cembobinar%2Cembobinados%2Creparar%2Creconstruir%2Cbalero%2Cbaleros%2Cnorte%2Ccoahuila%2Ctamaulipas%2Ctranformador%2Ctransformadores%2C+bombas%2Cbombas+de+agua%2Cmantenimiento';
var metaContents  = 'Reparaci%C3%B3n+y+mantenimiento+de+motores+el%C3%A9ctricos+de+todo+tipo.';
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();
};
