/* [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','1801',jdecode('Home'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','1852',jdecode('Services'),jdecode(''), jdecode('%2F1852.html'), 'true',[],'',''],
	['PAGE','1873',jdecode('About+Us'),jdecode(''), jdecode('%2F1873.html'), 'true',[],'',''],
	['PAGE','1894',jdecode('Contact+Us'),jdecode(''), jdecode('%2F1894.html'), 'true',[],'',''],
	['PAGE','1915',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F1915.html'), 'true',[],'',''],
	['PAGE','1936',jdecode('Brands'),jdecode(''), jdecode('%2F1936.html'), 'true',[],'',''],
	['PAGE','1999',jdecode('Photo+Gallery'),jdecode(''), jdecode('%2F1999.html'), 'true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Chaste';
theSitetree.paletteFamily='DFBB74';
theSitetree.keyvisualId='11550';
theSitetree.keyvisualName='kv_11550.jpg';
theSitetree.fontsetId='33239';
theSitetree.graphicsetId='13965';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
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: 			'Chaste',
				paletteFamily: 	'DFBB74',
				keyvisualId: 	'11550',
				keyvisualName: 	'kv_11550.jpg',
				fontsetId: 		'33239',
				graphicsetId: 	'13965',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'DFBB74',
				b_color: 		'846A36',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20110520-131938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20110607-172953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1873',
internalId:  '',
customField: '20110520-131512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1894',
internalId:  '',
customField: '20110310-173210'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1915',
internalId:  '',
customField: '20110520-131626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1936',
internalId:  '',
customField: '20110310-170253'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1801',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1999',
internalId:  '',
customField: '20110310-172056'
};
webappMappings['7008']=webappMappings['7008-23231']={
webappId:    '7008',
documentId:  '1894',
internalId:  '23231',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1852',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1873',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1894',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1915',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1936',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1999',
internalId:  '',
customField: 'language:en;country:US;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7KQG3';
var companyName   = 'Dr.+Barry+August%2C+Optometrist';
var htmlTitle	  = 'Dr.+Barry++August%2C+Optometrist';
var metaKeywords  = 'eye+glasses%2C+optometrist%2C+Bloomfield+hills%2C+brand+name+eye+glasses%2C+polo%2C+Versace%2C+DKNY%2C+Revlon%2C+Ray+Ban%2C+Vogue%2C+Dr.+Barry+August%2C+PC%2C+EZ+Clip%2C+eye+exam%2C+eye+examination%2C+optical%2C+eyes%2C+new+glasses%2C+eye+check%2C+yearly+eye+examination%2C+sun+glasses%2C+transitions%2C+transition+sun+glasses%2C+brand+name+transition+sun+glasses%2C+lasik%2C+pre+and+post+operative+lasik%2C+eye+exam%2C+vision%2C+clinic%2C+practitioner%2C+united+states%2C+clinton+township%2C+wixom%2C+optometry%2C+eye+exam+insurance%2C+blue+cross%2C+G.M.%2C+VSP%2C+dr+august+accepts+most+insurance%2C+designer+frames%2C+experienced+optometrist';
var metaContents  = 'Dr.+Barry+P.+August%2C+P.C.%2C+offers+full-service%2C+personalized+vision+care+in+a+convenient%2C+local+setting.+He+offers+a+whole+range+of+professional+services+for+optometric+concerns%2C+from+the+treatment+of+external+eye+diseases+and+injuries+to+hard-to-fit+contact+lenses.+Dr.+Barry+P.+August%2C+P.C.%2C+upholds+a+tradition+of+quality+that+has+made+him+the+industry+leader+for+over+30+years.+He+also+offers+FREE+Lasik+consultations+for+patients+who+are+ready+to+correct+their+vision+problems+permanently%21+When+you+come+to+Dr.+Barry+P.+August%2C+P.C.%2C+you+know+you%E2%80%99re+getting+specialized%2C+professionally+trained+service+from+a+doctor+you+can+trust.';
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();
};

