/* [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','2101',jdecode('Home'),jdecode(''), jdecode('%2F2101.html'), 'true',[],'',''],
	['PAGE','7601',jdecode('Why+We+Patently+Different'),jdecode(''), jdecode('%2F7601%2Findex.html'), 'true',[ 
		['PAGE','23001',jdecode('The+Team'),jdecode(''), jdecode('%2F7601%2F23001.html'), 'true',[],'',''],
		['PAGE','23901',jdecode('South+African+IP+Legal+Precedents'),jdecode(''), jdecode('%2F7601%2F23901.html'), 'true',[],'','']
	],'',''],
	['PAGE','5001',jdecode('Intellectual+Property'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','4801',jdecode('Services'),jdecode(''), jdecode('%2F4801.html'), 'true',[],'',''],
	['PAGE','20901',jdecode('Agent+IP+Porfolio+Management+%28APM%29'),jdecode(''), jdecode('%2F20901.html'), 'true',[],'',''],
	['PAGE','10101',jdecode('E-mail+enquiry'),jdecode(''), jdecode('%2F10101.html'), 'true',[],'',''],
	['PAGE','10401',jdecode('Contact'),jdecode(''), jdecode('%2F10401%2Findex.html'), 'true',[ 
		['PAGE','33422',jdecode('Contact+the+Courts'),jdecode(''), jdecode('%2F10401%2F33422.html'), 'true',[],'','']
	],'',''],
	['PAGE','12101',jdecode('ARCHIVED+ARTICLES'),jdecode(''), jdecode('%2F12101.html'), 'false',[],'',''],
	['PAGE','11101',jdecode('Map'),jdecode(''), jdecode('%2F11101.html'), 'false',[],'',''],
	['PAGE','13001',jdecode('Information+on+Patents'),jdecode(''), jdecode('%2F13001.html'), 'false',[],'',''],
	['PAGE','13022',jdecode('Information+on+Trade+Marks'),jdecode(''), jdecode('%2F13022.html'), 'false',[],'',''],
	['PAGE','13043',jdecode('Information+on+Copyright'),jdecode(''), jdecode('%2F13043.html'), 'false',[],'',''],
	['PAGE','15901',jdecode('Information+on+Registered+Designs'),jdecode(''), jdecode('%2F15901.html'), 'false',[],'',''],
	['PAGE','17201',jdecode('Links'),jdecode(''), jdecode('%2F17201.html'), 'true',[],'',''],
	['PAGE','22801',jdecode('Patently+Different+Blog'),jdecode(''), jdecode('%2F22801.html'), 'true',[],'',''],
	['PAGE','24701',jdecode('KIRSTEN-LEE+DINNES'),jdecode(''), jdecode('%2F24701.html'), 'false',[],'',''],
	['PAGE','29101',jdecode('DR+SAMANTHA+GREGORY'),jdecode(''), jdecode('%2F29101.html'), 'false',[],'',''],
	['PAGE','32201',jdecode('SPHIWE+NZIMANDE'),jdecode(''), jdecode('%2F32201.html'), 'false',[],'',''],
	['PAGE','34701',jdecode('THABO+MOLOI'),jdecode(''), jdecode('%2F34701.html'), 'false',[],'',''],
	['PAGE','35101',jdecode('GARETH+GREGORY'),jdecode(''), jdecode('%2F35101.html'), 'false',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Qben';
theSitetree.paletteFamily='92AA38';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='17182';
theSitetree.graphicsetId='12658';
theSitetree.contentColor='2E2E2E';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hetzner',
  product: 'WSCSYSSSSLY0XKDS'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Qben',
				paletteFamily: 	'92AA38',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'17182',
				graphicsetId: 	'12658',
				contentColor: 	'2E2E2E',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'FFFFFF',
				d_color: 		'39E094',
				e_color: 		'9DCB6E',
				f_color: 		'DC9E3C',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20110912-115310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4801',
internalId:  '',
customField: '20080806-153134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20080807-161012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20110909-105607'
};
webappMappings['7008']=webappMappings['7008-801']={
webappId:    '7008',
documentId:  '10101',
internalId:  '801',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20080805-143954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20101103-131721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20080805-170359'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12101',
internalId:  '',
customField: '20080805-171630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13001',
internalId:  '',
customField: '20080811-122707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13043',
internalId:  '',
customField: '20080807-155256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13022',
internalId:  '',
customField: '20110908-164019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15901',
internalId:  '',
customField: '20080807-160255'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17201',
internalId:  '',
customField: '20101103-131800'
};
webappMappings['1501']=webappMappings['1501-13105718']={
webappId:    '1501',
documentId:  '2101',
internalId:  '13105718',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20901',
internalId:  '',
customField: '20110907-143140'
};
webappMappings['7050']=webappMappings['7050-989']={
webappId:    '7050',
documentId:  '22801',
internalId:  '989',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22801',
internalId:  '',
customField: '20110907-152514'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23001',
internalId:  '',
customField: '20111007-160655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23901',
internalId:  '',
customField: '20110908-160907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29101',
internalId:  '',
customField: '20110909-114034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24701',
internalId:  '',
customField: '20111007-154306'
};
webappMappings['1003']=webappMappings['1003-ahtz10inxl7v1324d280978']={
webappId:    '1003',
documentId:  '23901',
internalId:  'ahtz10inxl7v1324d280978',
customField: 'en:US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32201',
internalId:  '',
customField: '20111007-154442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33422',
internalId:  '',
customField: '20110920-115626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34701',
internalId:  '',
customField: '20111007-155701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35101',
internalId:  '',
customField: '20111007-160932'
};
var webAppHostname = 'sitebuilder.host-h.net:80';
var canonHostname = 'sitebuilder1.jnb2.host-h.net';
var accountId     = 'AHTZ10INXL7V';
var companyName   = 'DR+Samantha+Gregory+Attorneys';
var htmlTitle	  = 'PATENTLY+DIFFERENT';
var metaKeywords  = 'patent%2C+patent+attorney%2C+intellectual+property+trade+mark%2C+trademark%2C+copyright%2C+mark%2C+registrar+fo+trade+marks%2C+registrar+of+patents%2C+patents+office%2C+agent%2C+agent+filing%2C+Agent+Intellectual+Property+Portfolio+Management%2C+APM';
var metaContents  = 'Professional+Patent+Attorney+%28South+Africa%29%2C+intellectual+property+%2C+a+general+name+for+property%2C+such+as+patents%2C+trademarks%2C+and+copyright+material%2C+which+is+the+product+of+invention+or+creativity%2C+and+which+does+not+exist+in+a+tangible%2C+physical+form.+%5BOED+Oxford+University+Press+2008+http%3A%2F%2Fwww.oed.com%2F%5D';
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();
};

