Display.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. var numdivs=3
  2. var IE5=NN4=NN6=false
  3. if(document.all)IE5=true
  4. else if(document.layers)NN4=true
  5. else if(document.getElementById)NN6=true
  6. function copyParentStylesToEditor(editor)
  7. {
  8. var theIFrame = document.getElementById("RadEContentIframe" + editor.Id);
  9. var theMainEditorTable = document.getElementById("RadEWrapper" + editor.Id);
  10. var theParentEl = theMainEditorTable.parentNode.parentNode;
  11. var theContentArea = editor.GetContentArea();
  12. if (document.all)
  13. {
  14. for (var attr in theParentEl.currentStyle)
  15. {
  16. var strStyle = "" + attr;
  17. // Style Overflow don't be change otherwise Scroll dispear in Raeditor in Big document
  18. if ( ( strStyle != "overflow" ) && ( strStyle != "overflowX" ) && ( strStyle != "overflowY" ) )
  19. {
  20. theContentArea.style[attr] = theParentEl.currentStyle[attr];
  21. }
  22. }
  23. }
  24. else //Firefox
  25. {
  26. theContentArea.style.background = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("background");
  27. theContentArea.style.backgroundAttachment = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("background-attachment");
  28. theContentArea.style.backgroundColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("background-color");
  29. theContentArea.style.backgroundImage = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("background-image");
  30. theContentArea.style.backgroundPosition = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("background-position");
  31. theContentArea.style.backgroundRepeat = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("background-repeat");
  32. theContentArea.style.border = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border");
  33. theContentArea.style.borderBottom = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-bottom");
  34. theContentArea.style.borderBottomColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-bottom-color");
  35. theContentArea.style.borderBottomStyle = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-bottom-style");
  36. theContentArea.style.borderBottomWidth = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-bottom-width");
  37. theContentArea.style.borderColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-color");
  38. theContentArea.style.borderLeft = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-left");
  39. theContentArea.style.borderLeftColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-left-color");
  40. theContentArea.style.borderLeftStyle = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-left-style");
  41. theContentArea.style.borderLeftWidth = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-left-width");
  42. theContentArea.style.borderRight = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-right");
  43. theContentArea.style.borderRightColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-right-color");
  44. theContentArea.style.borderRightStyle = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-right-style");
  45. theContentArea.style.borderRightWidth = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-right-width");
  46. theContentArea.style.borderStyle = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-style");
  47. theContentArea.style.borderTop = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-top");
  48. theContentArea.style.borderTopColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-top-color");
  49. theContentArea.style.borderTopStyle = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-top-style");
  50. theContentArea.style.borderTopWidth = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-top-width");
  51. theContentArea.style.borderWidth = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("border-width");
  52. theContentArea.style.captionSide = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("caption-side");
  53. theContentArea.style.clear = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("clear");
  54. theContentArea.style.clip = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("clip");
  55. theContentArea.style.color = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("color");
  56. theContentArea.style.cursor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("cursor");
  57. theContentArea.style.direction = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("direction");
  58. theContentArea.style.display = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("display");
  59. theContentArea.style.emptyCells = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("empty-cells");
  60. theContentArea.style.float = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("float");
  61. theContentArea.style.font = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("font");
  62. theContentArea.style.fontFamily = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("font-family");
  63. theContentArea.style.fontSize = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("font-size");
  64. theContentArea.style.fontStretch = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("font-stretch");
  65. theContentArea.style.fontStyle = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("font-style");
  66. theContentArea.style.fontVariant = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("font-variant");
  67. theContentArea.style.fontWeight = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("font-weight");
  68. theContentArea.style.height = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("height");
  69. theContentArea.style.left = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("left");
  70. theContentArea.style.letterSpacing = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("letter-spacing");
  71. theContentArea.style.lineHeight = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("line-height");
  72. theContentArea.style.listStyle = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("list-style");
  73. theContentArea.style.listStyleImage = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("list-style-image");
  74. theContentArea.style.listStylePosition = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("list-style-position");
  75. theContentArea.style.listStyleType = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("list-style-type");
  76. theContentArea.style.margin = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("margin");
  77. theContentArea.style.marginBottom = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("margin-bottom");
  78. theContentArea.style.marginLeft = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("margin-left");
  79. theContentArea.style.marginRight = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("margin-right");
  80. theContentArea.style.marginTop = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("margin-top");
  81. theContentArea.style.maxHeight = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("max-height");
  82. theContentArea.style.maxWidth = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("max-width");
  83. theContentArea.style.minHeight = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("min-height");
  84. theContentArea.style.minWidth = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("min-width");
  85. // Style Overflow don't be change otherwise Scroll dispear in Raeditor in Big document
  86. //theContentArea.style.overflow = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("overflow");
  87. theContentArea.style.padding = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("padding");
  88. theContentArea.style.paddingBottom = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("padding-bottom");
  89. theContentArea.style.paddingLeft = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("padding-left");
  90. theContentArea.style.paddingRight = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("padding-right");
  91. theContentArea.style.paddingTop = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("padding-top");
  92. theContentArea.style.pageBreakAfter = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("page-break-after");
  93. theContentArea.style.pageBreakBefore = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("page-Break-Before");
  94. theContentArea.style.position = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("position");
  95. theContentArea.style.right = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("right");
  96. theContentArea.style.scrollbar3dLightColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-3d-light-color");
  97. theContentArea.style.scrollbarArrowColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-arrow-color");
  98. theContentArea.style.scrollbarBaseColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-base-color");
  99. theContentArea.style.scrollbarDarkshadowColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-darkshadow-color");
  100. theContentArea.style.scrollbarFaceColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-face-color");
  101. theContentArea.style.scrollbarHighlightColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-highlight-color");
  102. theContentArea.style.scrollbarShadowColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-shadow-color");
  103. theContentArea.style.scrollbarTrackColor = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("scrollbar-track-color");
  104. theContentArea.style.tableLayout = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("table-layout");
  105. theContentArea.style.textAlign = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("text-align");
  106. theContentArea.style.textDecoration = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("text-decoration");
  107. theContentArea.style.textIndent = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("text-indent");
  108. theContentArea.style.textTransform = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("text-transform");
  109. theContentArea.style.top = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("top");
  110. theContentArea.style.verticalAlign = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("vertical-align");
  111. theContentArea.style.visibility = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("visibility");
  112. theContentArea.style.width = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("width");
  113. theContentArea.style.wordSpacing = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("word-spacing");
  114. theContentArea.style.zIndex = document.defaultView.getComputedStyle(theParentEl, '').getPropertyValue("z-index");
  115. }
  116. }
  117. function copyParentStylesToEditor_Old(editor)
  118. {
  119. if (NN6) {
  120. return CopyStylesToEditorHelper(editor);
  121. }
  122. else {
  123. var theIFrame = document.getElementById("RadEContentIframe" + editor.Id);
  124. var theMainEditorTable = document.getElementById("RadEWrapper" + editor.Id);
  125. var theParentEl = theMainEditorTable.parentNode.parentNode;
  126. var theContentArea = editor.GetContentArea();
  127. for (var attr in theParentEl.currentStyle)
  128. {
  129. theContentArea.style[attr] = theParentEl.currentStyle[attr];
  130. }
  131. }
  132. }
  133. function CopyStylesToEditorHelper(element)
  134. {
  135. if (element.currentStyle) // Handle IE
  136. return element.currentStyle;
  137. else // Handle Others
  138. return document.defaultView.getComputedStyle(element,null);
  139. return null;
  140. }
  141. function CopyStylesToEditor(editor)
  142. {
  143. var theIFrame = document.getElementById("RadEContentIframe" + editor.Id);
  144. var theDocBody = editor.Document.body;
  145. var IFrameCompStyle = copyParentStylesToEditor(theIFrame);
  146. if (IFrameCompStyle != null)
  147. {
  148. theDocBody.style.fontFamily = IFrameCompStyle.fontFamily;
  149. theDocBody.style.fontSize = IFrameCompStyle.fontSize;
  150. theDocBody.style.fontWeight = IFrameCompStyle.fontWeight;
  151. theDocBody.style.lineHeight = IFrameCompStyle.lineHeight;
  152. }
  153. }
  154. function DisplayTab(tab, ens) {
  155. if (document.getElementById){
  156. document.cookie = tab + ' = ' + (document.getElementById(ens + 'tab'+tab).style.display==''?0:1);
  157. if (document.getElementById(ens + 'tab'+tab).style.display == ''){
  158. document.getElementById(ens + 'tab'+tab).style.display = 'none';
  159. document.getElementById('Expand'+tab).style.display = '';
  160. document.getElementById('Collapse'+tab).style.display = 'none';
  161. } else {
  162. document.getElementById(ens + 'tab'+tab).style.display = '';
  163. document.getElementById('Collapse'+tab).style.display = '';
  164. document.getElementById('Expand'+tab).style.display = 'none';
  165. }
  166. } else if (document.all) {
  167. document.cookie = tab + ' = ' + (document.all(ens + 'tab'+tab).style.display==''?0:1);
  168. if (document.all(ens + 'tab'+tab).style.display == ''){
  169. document.all(ens + 'tab'+tab).style.display = 'none';
  170. document.all('expand'+tab).style.display = '';
  171. document.all('collapse'+tab).style.display = 'none';
  172. } else {
  173. document.all(ens + 'tab'+tab).style.display = '';
  174. document.all('collapse'+tab).style.display = '';
  175. document.all('expand'+tab).style.display = 'none';
  176. }
  177. }
  178. }
  179. function loadTabState(tab, ens)
  180. {
  181. var cookieValue = readCookie(tab);
  182. if(cookieValue == null)
  183. {
  184. cookieValue = 1;
  185. }
  186. if (cookieValue == 0)
  187. {
  188. document.getElementById(ens + 'tab'+tab).style.display = 'none';
  189. document.getElementById('Expand'+tab).style.display = '';
  190. document.getElementById('Collapse'+tab).style.display = 'none';
  191. }
  192. else
  193. {
  194. document.getElementById(ens + 'tab'+tab).style.display = '';
  195. document.getElementById('Collapse'+tab).style.display = '';
  196. document.getElementById('Expand'+tab).style.display = 'none';
  197. }
  198. }
  199. function readCookie(name)
  200. {
  201. var nameEQ = name + "=";
  202. var ca = document.cookie.split(';');
  203. for(var i=0;i < ca.length;i++)
  204. {
  205. var c = ca[i];
  206. while (c.charAt(0)==' ') c = c.substring(1,c.length);
  207. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  208. }
  209. return null;
  210. }
  211. function DisplayAllTab(listOfTab,action){
  212. var arrOfTab = listOfTab.split(',');
  213. for (var i=0; i < arrOfTab.length; i++) {
  214. if (document.getElementById){
  215. if(action=='collapse'){
  216. document.getElementById('tab'+arrOfTab[i]).style.display = 'none';
  217. document.getElementById('expand'+arrOfTab[i]).style.display = '';
  218. document.getElementById('collapse'+arrOfTab[i]).style.display = 'none';
  219. } else {
  220. document.getElementById('tab'+arrOfTab[i]).style.display = '';
  221. document.getElementById('expand'+arrOfTab[i]).style.display = 'none';
  222. document.getElementById('collapse'+arrOfTab[i]).style.display = '';
  223. }
  224. } else if (document.all) {
  225. if(action=='collapse'){
  226. document.all('tab'+arrOfTab[i]).style.display = 'none';
  227. document.all('expand'+arrOfTab[i]).style.display = '';
  228. document.all('collapse'+arrOfTab[i]).style.display = 'none';
  229. } else {
  230. document.all('tab'+arrOfTab[i]).style.display = '';
  231. document.all('expand'+arrOfTab[i]).style.display = 'none';
  232. document.all('collapse'+arrOfTab[i]).style.display = '';
  233. }
  234. }
  235. }
  236. }
  237. function ResizeDiv(td_id,div_id){
  238. if (document.getElementById)
  239. document.getElementById(div_id).style.height = document.getElementById(td_id).offsetHeight;
  240. else if (document.all)
  241. document.all(div_id).style.height = document.all(td_id).offsetHeight;
  242. else
  243. alert('error resizing content');
  244. }
  245. var OpenWindow;
  246. function PrintContent(rootfolder){
  247. //document.getElementById("table_frame").className = "ONLYSCREEN";
  248. //document.getElementById("div_print").innerHTML = document.getElementById("div_content").innerHTML;
  249. //document.getElementById("div_print").className = "PRINTER HIDDEN";
  250. //window.print();
  251. OpenWindow=window.open(rootfolder+"Common/blank.htm", "printscreen", "height=600, width=800, left=20, top=20, " +
  252. "location=no, menubar=no, resizable=yes, " +
  253. "scrollbars=yes, titlebar=no, toolbar=no", true);
  254. return;
  255. }
  256. function CloseWindowFromPopupScreen()
  257. {
  258. OpenWindow.close();
  259. }
  260. // redirection after 20 minutes
  261. var time1;
  262. function timer() {
  263. time1=window.setTimeout("redirect()",1200000);
  264. }
  265. function redirect() {
  266. window.location = "\\";
  267. }
  268. function detime() {
  269. window.clearTimeout(time1);
  270. timer();
  271. }
  272. function sendMailCoded (addressStart, addressEnd)
  273. {
  274. document.location.href="mailto:"+addressStart+'@'+addressEnd;
  275. }
  276. function modifyRadEditorIcon(theID)
  277. {
  278. var tableSplit=theID.split('#');
  279. for (var i=0;i<tableSplit.length;i++)
  280. {
  281. try
  282. {
  283. var placeholder = document.getElementById(tableSplit[i] + '_wrapper');
  284. var images = placeholder.getElementsByTagName('img');
  285. var image = images[0];
  286. if(image.src.indexOf('editor.gif')>0)
  287. image.style.position = 'absolute';
  288. }
  289. catch(e){}
  290. }
  291. //image.style.top = '100px';
  292. //image.style.left = '100px';
  293. }