/* [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('Books'),jdecode(''),'/32.html','true',[],'',''],
	['PAGE','53',jdecode('eBooks'),jdecode(''),'/53.html','true',[],'',''],
	['PAGE','9348',jdecode('How+to+Buy'),jdecode(''),'/9348/index.html','true',[ 
		['PAGE','11101',jdecode('Chanda+Books+Store'),jdecode(''),'/9348/11101.html','true',[],'',''],
		['PAGE','11122',jdecode('Volume+Discount'),jdecode(''),'/9348/11122.html','true',[],'','']
	],'',''],
	['PAGE','2180',jdecode('Authors'),jdecode(''),'/2180.html','true',[],'',''],
	['PAGE','9390',jdecode('Resources'),jdecode(''),'/9390/index.html','true',[ 
		['PAGE','12101',jdecode('Our+Approach'),jdecode(''),'/9390/12101.html','true',[],'',''],
		['PAGE','9369',jdecode('Tips+For+Parents'),jdecode(''),'/9390/9369.html','true',[],'',''],
		['PAGE','12122',jdecode('Related+Links'),jdecode(''),'/9390/12122.html','true',[],'',''],
		['PAGE','12143',jdecode('FAQs'),jdecode(''),'/9390/12143.html','true',[],'','']
	],'',''],
	['PAGE','116',jdecode('Contact+us'),jdecode(''),'/116.html','true',[],'',''],
	['PAGE','2472',jdecode('Guestbook'),jdecode(''),'/2472/index.html','true',[ 
		['PAGE','2471',jdecode('Read+Guestbook'),jdecode(''),'/2472/2471.html','false',[],'','']
	],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Blossom';
theSitetree.paletteFamily='AC2E53';
theSitetree.keyvisualId='7103';
theSitetree.keyvisualName='kv_7103.jpg';
theSitetree.fontsetId='16395';
theSitetree.graphicsetId='12128';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E5E2E2';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Blossom',
				paletteFamily: 	'AC2E53',
				keyvisualId: 	'7103',
				keyvisualName: 	'kv_7103.jpg',
				fontsetId: 		'16395',
				graphicsetId: 	'12128',
				contentColor: 	'000000',
				contentBGColor: 'E5E2E2',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53',
internalId:  '',
customField: '20080701-220806'
};
webappMappings['1002']=webappMappings['1002-2472AHW050IN23WR']={
webappId:    '1002',
documentId:  '2472',
internalId:  '2472AHW050IN23WR',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20090508-073110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2180',
internalId:  '',
customField: '20080702-060138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9348',
internalId:  '',
customField: '20080711-202030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9369',
internalId:  '',
customField: '20080711-202030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9390',
internalId:  '',
customField: '20080711-202030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '116',
internalId:  '',
customField: '20080701-221119'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2472',
internalId:  '',
customField: '20060916-104519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2471',
internalId:  '',
customField: '20060916-104519'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN23WR';
var companyName   = 'Chanda+Books';
var htmlTitle	  = 'Chanda+Books';
var metaKeywords  = 'Hindi%2C+Verma%2C+NRI%2C+learning+Hindi%2C+foreign+languages%2C+languages%2C+India%2C+South+Asia%2C+kids%2C+Children%2C+books%2C+easy+learner%2C+activity+book%2C+work+book%2C+devnagiri%2C+devanagiri%2C+';
var metaContents  = 'Hindi%2C+Verma%2C+NRI%2C+learning+Hindi%2C+foreign+languages%2C+languages%2C+India%2C+South+Asia%2C+kids%2C+Children%2C+books%2C+easy+learner%2C+activity+book%2C+work+book%2C+devnagiri%2C+devanagiri%2C+Indian%2C+workbook';
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();
};

