/* [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','601',jdecode('HOME+-++HISTORY'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','59601',jdecode('STYLES'),jdecode(''),'/59601/index.html','true',[ 
		['PAGE','59622',jdecode('TRANSITIONAL'),jdecode(''),'/59601/59622.html','true',[],'',''],
		['PAGE','59643',jdecode('MODERN'),jdecode(''),'/59601/59643.html','true',[],'',''],
		['PAGE','59664',jdecode('TRADITIONAL'),jdecode(''),'/59601/59664.html','true',[],'',''],
		['PAGE','59685',jdecode('SLIPCOVERED'),jdecode(''),'/59601/59685.html','true',[],'','']
	],'',''],
	['PAGE','64801',jdecode('CONFIGURATIONS'),jdecode(''),'/64801.html','true',[],'',''],
	['PAGE','59727',jdecode('FABRICS+%26+LEATHERS'),jdecode(''),'/59727.html','true',[],'',''],
	['PAGE','72901',jdecode('QUALITY+%26+OPTIONS'),jdecode(''),'/72901.html','true',[],'',''],
	['PAGE','93716',jdecode('NATIONWIDE+SHIPPING'),jdecode(''),'/93716.html','true',[],'',''],
	['PAGE','90433',jdecode('TESTIMONIALS'),jdecode(''),'/90433.html','true',[],'',''],
	['PAGE','92920',jdecode('CELEBRITY+CLIENTS'),jdecode(''),'/92920.html','true',[],'',''],
	['PAGE','64201',jdecode('CONTACT'),jdecode(''),'/64201.html','true',[],'',''],
	['PAGE','89155',jdecode('SALE'),jdecode(''),'/89155.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10556';
theSitetree.graphicsetId='10892';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10556',
				graphicsetId: 	'10892',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'555454',
				e_color: 		'555454',
				f_color: 		'555454',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '64201',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20100529-094122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89155',
internalId:  '',
customField: '20100529-094904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59601',
internalId:  '',
customField: '20100529-094356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59622',
internalId:  '',
customField: '20100529-094419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72901',
internalId:  '',
customField: '20100529-094651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64801',
internalId:  '',
customField: '20100529-094610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59643',
internalId:  '',
customField: '20100529-094446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59664',
internalId:  '',
customField: '20100529-094527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59685',
internalId:  '',
customField: '20100529-094548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59727',
internalId:  '',
customField: '20100529-094634'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64201',
internalId:  '',
customField: '20100529-094843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90433',
internalId:  '',
customField: '20100529-094745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '92920',
internalId:  '',
customField: '20100202-114116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93716',
internalId:  '',
customField: '20100529-094721'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INXEM9';
var companyName   = 'Quality+%26+Excellence+Since+1965';
var htmlTitle	  = 'SOFA+CRAFT+-+Quality+%26+Excellence+Since+1965';
var metaKeywords  = 'affordable+custom+sofa+%2C+upholstered+custom+sofa+%2C+slipcovered+custom+sofa+%2C+hand+made+custom+sofa+%2C+contemporary+custom+sofa+%2C+modern+custom+sofa+%2C+transitional+custom+sofa+%2C+beautiful+custom+sofa+%2C+comfortable+custom+sofa+%2C+orange+county+custom+sofa+%2C+affordable+custom+sectional+%2C+upholstered+custom+sectional+%2C+slipcovered+custom+sectional+%2C+hand+made+custom+sectional+%2C+contemporary+custom+sectional+%2C+modern+custom+sectional+%2C+transitional+custom+sectional+%2C+beautiful+custom+sectional+%2C+comfortable+custom+sectional+%2C+orange+county+custom+sectional+%2C+affordable+custom+couch+%2C+upholstered+custom+couch+%2C+slipcovered+custom+couch+%2C+hand+made+custom+couch+%2C+contemporary+custom+couch+%2C+modern+custom+couch+%2C+transitional+custom+couch+%2C+beautiful+custom+couch+%2C+comfortable+custom+couch+%2C+orange+county+custom+couch';
var metaContents  = 'SOFA+CRAFT+HAS+CUSTOM+SOFAS++CUSTOM+SECTIONALS++CUSTOM+COUCHES+AT+THE+LOWEST+PRICES+GUARANTEED%21+A+CUSTOM+SECTIONAL+CUSTOM+SOFA+OR+CUSTOM+COUCH+IS+OUR+SPECIALTY.+SOFA+CRAFTS+CUSTOM+SOFA++CUSTOM+SECTIONAL++CUSTOM+COUCH+SHOWROOM+SHIPS+NATIONWIDE.+EVERY+CUSTOM+SOFA++CUSTOM+SECTIONAL++CUSTOM+COUCH+IS+HAND+MADE+BY+EXPERT+CRAFTSMEN.+COME+VISIT+OUR+CUSTOM+SOFA++CUSTOM+SECTIONAL++CUSTOM+COUCH+SHOWROOM+TODAY.';
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();
};
