/* [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','5001',jdecode('Home'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','7822',jdecode('New+Fabrics+%26+Samples'),jdecode(''), jdecode('%2F7822.html'), 'true',[],'',''],
	['PAGE','7843',jdecode('Notions'),jdecode(''), jdecode('%2F7843.html'), 'true',[],'',''],
	['PAGE','6201',jdecode('News'),jdecode(''), jdecode('%2F6201.html'), 'true',[],'',''],
	['PAGE','142101',jdecode('Block+of+the+Month'),jdecode(''), jdecode('%2F142101.html'), 'true',[],'',''],
	['PAGE','69001',jdecode('Pictures'),jdecode(''), jdecode('%2F69001.html'), 'true',[],'',''],
	['PAGE','9201',jdecode('Class+Schedules'),jdecode(''), jdecode('%2F9201%2Findex.html'), 'true',[ 
		['PAGE','133901',jdecode('February+2012+thru+April+2012+Class+Schedules'),jdecode(''), jdecode('%2F9201%2F133901.html'), 'true',[],'','']
	],'',''],
	['PAGE','31101',jdecode('Archives'),jdecode(''), jdecode('%2F31101%2Findex.html'), 'true',[ 
		['PAGE','147101',jdecode('September+2011+Newsletter'),jdecode(''), jdecode('%2F31101%2F147101.html'), 'true',[],'',''],
		['PAGE','148901',jdecode('October+2011+Newsletter'),jdecode(''), jdecode('%2F31101%2F148901.html'), 'true',[],'',''],
		['PAGE','151101',jdecode('November+2011+Newsletter'),jdecode(''), jdecode('%2F31101%2F151101.html'), 'true',[],'',''],
		['PAGE','152501',jdecode('December+2011+Newsletter'),jdecode(''), jdecode('%2F31101%2F152501.html'), 'true',[],'',''],
		['PAGE','154201',jdecode('January+2012+Newsletter'),jdecode(''), jdecode('%2F31101%2F154201.html'), 'true',[],'','']
	],'',''],
	['PAGE','10701',jdecode('Contact+Us'),jdecode(''), jdecode('%2F10701.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Party';
theSitetree.paletteFamily='458966';
theSitetree.keyvisualId='3519';
theSitetree.keyvisualName='kv_3519.jpg';
theSitetree.fontsetId='10441';
theSitetree.graphicsetId='10805';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='458966';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Party',
				paletteFamily: 	'458966',
				keyvisualId: 	'3519',
				keyvisualName: 	'kv_3519.jpg',
				fontsetId: 		'10441',
				graphicsetId: 	'10805',
				contentColor: 	'FFFFFF',
				contentBGColor: '458966',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'E6FFAB',
				e_color: 		'E6FFAB',
				f_color: 		'E6FFAB',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20120103-121750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7822',
internalId:  '',
customField: '20111203-133145'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20120103-121546'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7843',
internalId:  '',
customField: '20100114-101421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10701',
internalId:  '',
customField: '20100122-114231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9201',
internalId:  '',
customField: '20101030-095538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31101',
internalId:  '',
customField: '20090730-165208'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69001',
internalId:  '',
customField: '20110419-161657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '142101',
internalId:  '',
customField: '20110605-130236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '148901',
internalId:  '',
customField: '20111104-111539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '151101',
internalId:  '',
customField: '20111203-115030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '147101',
internalId:  '',
customField: '20111003-111828'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '133901',
internalId:  '',
customField: '20120103-124936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '152501',
internalId:  '',
customField: '20120103-120941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '154201',
internalId:  '',
customField: '20120203-164631'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHC3J';
var companyName   = 'Lost+Pines+Quilt+Shop';
var htmlTitle	  = 'Lost+Pines+Quilt+Shop';
var metaKeywords  = '';
var metaContents  = '';
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();
};

