/* [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','32',jdecode('About+us'),jdecode(''), jdecode('%2F32.html'), 'true',[],'',''],
	['PAGE','41',jdecode('Home'),jdecode(''), jdecode('%2F41.html'), 'true',[],'',''],
	['PAGE','52712',jdecode('Guestbook'),jdecode(''), jdecode('%2F52712.html'), 'true',[],'',''],
	['PAGE','62',jdecode('Products'),jdecode(''), jdecode('%2F62.html'), 'true',[],'',''],
	['PAGE','899',jdecode('Newsletter'),jdecode(''), jdecode('%2F899.html'), 'true',[],'',''],
	['PAGE','1000',jdecode('Events'),jdecode(''), jdecode('%2F1000.html'), 'true',[],'',''],
	['PAGE','89',jdecode('Contact'),jdecode(''), jdecode('%2F89%2Findex.html'), 'true',[ 
		['PAGE','98',jdecode('Adresses'),jdecode(''), jdecode('%2F89%2F98.html'), 'true',[],'',''],
		['PAGE','107',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F89%2F107.html'), 'true',[],'','']
	],'',''],
	['PAGE','1103',jdecode('Directions'),jdecode(''), jdecode('%2F1103.html'), 'true',[],'',''],
	['PAGE','1556',jdecode('Pics'),jdecode(''), jdecode('%2F1556.html'), 'true',[],'',''],
	['PAGE','1675',jdecode('Class+Calendar'),jdecode(''), jdecode('%2F1675.html'), 'true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Draft';
theSitetree.paletteFamily='2E5D32';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10399';
theSitetree.graphicsetId='10612';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='2E5D32';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Draft',
				paletteFamily: 	'2E5D32',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10399',
				graphicsetId: 	'10612',
				contentColor: 	'FFFFFF',
				contentBGColor: '2E5D32',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'92BD96',
				e_color: 		'BFA45F',
				f_color: 		'BFA45F',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '1103',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['1002']=webappMappings['1002-52712ahw050inx2sr']={
webappId:    '1002',
documentId:  '52712',
internalId:  '52712ahw050inx2sr',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '41',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-cb4131f2475af569db702d6e01e1af45']={
webappId:    '7060',
documentId:  '1556',
internalId:  'cb4131f2475af569db702d6e01e1af45',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20101012-201311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41',
internalId:  '',
customField: '20111007-193808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62',
internalId:  '',
customField: '20111007-204420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '899',
internalId:  '',
customField: '20111230-111222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1000',
internalId:  '',
customField: '20111230-111606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89',
internalId:  '',
customField: '20100820-233442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98',
internalId:  '',
customField: '20101202-182708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107',
internalId:  '',
customField: '20080222-063602'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1103',
internalId:  '',
customField: '20100410-215827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1556',
internalId:  '',
customField: '20101202-192017'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1675',
internalId:  '',
customField: '20111230-111625'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52712',
internalId:  '',
customField: '20100424-110108'
};
webappMappings['1501']=webappMappings['1501-114129']={
webappId:    '1501',
documentId:  '41',
internalId:  '114129',
customField: '1501'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INX2SR';
var companyName   = 'Richland+Sewing+Center';
var htmlTitle	  = 'RICHLAND+SEWING+CENTER';
var metaKeywords  = 'DALLAS%2C+FORT+WORTH%2C+HURST%2C+TEXAS%2CHUSQVARNA+VIKING%2C+SINGER%2C+BROTHER%2C+JANOME%2C+HANDIQUILTER%2C+HQ+16%2C+PFAFF%2C+HORN%2C+CABINETS%2C+SEWING%2C+QUILTING%2C+EMBROIDERY+MACHINES%2C+OESD%2C+DAKOTA%2C+RICHLAND+SEWING%2C+SEWING+MACHINE+SERVICE+AND+REPAIR%2C+CLASSES%2C+HORN%2C+SEWING+ACCESSORIES%2C+QUILTING+FABRICS%2C+DFW%2C+Mid-cities%2C+Anita+Goodesign+';
var metaContents  = 'SALES+AND+SERVICE+OF+SEWING+MACHINES%2C+QULTING+AND+QUILTING+MACHINES%2C++EMBROIDERY+MACHINES%2C+FELTING+MACHINES%2C+SEWING+CABINETS%2C+SEWING+MACHINE+PARTS%2C+SEWING+MACHINE+ACCESSORIES%2C+EMBROIDERY+DESIGNS%2C+EMBROIDERY+THREAD+AND+SUPPLIES%2C+QUILTING+FABRIC+AND+FAT+QUARTERS%2C+REPAIRS.+WE+ARE+THE+LARGEST+SEWING+SUPER+STORE+IN+THE+DALLAS+AND+FORT+WORTH+TEXAS+AREA.+LOCATED+IN+THE+MID+CITIES+AREA+IN+HURST.';
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();
};

