2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 { //embedded in the doc
22 function checkBrowser(){
23 if (!document.getElementsByTagName){
32 function ndeSetTextSize(chgsize,rs)
42 startSize = parseInt(ndeGetDocTextSize());
52 newSize = startSize + 2;
56 newSize = startSize - 2;
60 if (rs) {newSize = rs;} else {newSize = 16;}
65 newSize = parseInt(ndeReadCookie("nde-textsize"));
71 if (!newSize || newSize == 'NaN')
86 document.getElementsByTagName('html')[0].style.fontSize = newSize;
87 document.getElementsByTagName('body')[0].style.fontSize = newSize;
89 ndeCreateCookie("nde-textsize", newSize, 365);
92 function ndeGetDocTextSize()
100 var body = document.getElementsByTagName('body')[0];
102 if (body.style && body.style.fontSize)
104 size = body.style.fontSize;
106 else if (typeof(getComputedStyle) != 'undefined')
108 size = getComputedStyle(body,'').getPropertyValue('font-size');
110 else if (body.currentStyle)
112 size = body.currentStyle.fontSize;
117 if(size.substring(size.length-1)=="%"){
129 function ndeCreateCookie(name,value,days)
131 var cookie = name + "=" + value + ";";
135 var date = new Date();
136 date.setTime(date.getTime()+(days*24*60*60*1000));
137 cookie += " expires=" + date.toGMTString() + ";";
141 document.cookie = cookie;
145 function ndeReadCookie(name)
147 var nameEQ = name + "=";
148 var ca = document.cookie.split(';');
151 for(var i = 0; i < ca.length; i++)
154 while (c.charAt(0) == ' ')
156 c = c.substring(1, c.length);
159 ctest = c.substring(0,name.length);
162 return c.substring(nameEQ.length,c.length);