main.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. <!--
  2. var fixupPos = false;
  3. var canMove = false;
  4. var leftLeaning = 0;
  5. //异步上传缩略图相关变量
  6. var nForm = null;
  7. var nFrame = null;
  8. var picnameObj = null;
  9. var vImg = null;
  10. function $Nav()
  11. {
  12. if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE';
  13. else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF';
  14. else return "OT";
  15. }
  16. function $Obj(objname)
  17. {
  18. return document.getElementById(objname);
  19. }
  20. //旧的颜色选择框(已经过期)
  21. /*
  22. function ShowColor()
  23. {
  24. var fcolor=showModalDialog("images/color.htm?ok",false,"dialogWidth:106px;dialogHeight:110px;status:0;dialogTop:"+(+120)+";dialogLeft:"+(+120));
  25. if(fcolor!=null && fcolor!="undefined") document.form1.color.value = fcolor;
  26. }
  27. */
  28. function ColorSel(c, oname)
  29. {
  30. var tobj = $Obj(oname);
  31. if( !tobj ) tobj = eval('document.form1.' + oname);
  32. if( !tobj )
  33. {
  34. $Obj('colordlg').style.display = 'none';
  35. return false;
  36. }
  37. else
  38. {
  39. tobj.value = c;
  40. $Obj('colordlg').style.display = 'none';
  41. return true;
  42. }
  43. }
  44. function ShowColor(e, o)
  45. {
  46. LoadNewDiv(e, 'images/colornew.htm', 'colordlg');
  47. }
  48. function ShowHide(objname)
  49. {
  50. var obj = $Obj(objname);
  51. if(obj.style.display != "none" ) obj.style.display = "none";
  52. else obj.style.display = "block";
  53. }
  54. function ShowHideT(objname)
  55. {
  56. var obj = $Obj(objname);
  57. if(obj.style.display != "none" ) obj.style.display = "none";
  58. else obj.style.display = ($Nav()=="IE" ? "block" : "table");
  59. }
  60. function ShowObj(objname)
  61. {
  62. var obj = $Obj(objname);
  63. if(obj == null) return false;
  64. obj.style.display = ($Nav()=="IE" ? "block" : "table");
  65. }
  66. function ShowObjRow(objname)
  67. {
  68. var obj = $Obj(objname);
  69. obj.style.display = ($Nav()=="IE" ? "block" : "table-row");
  70. }
  71. function AddTypeid2()
  72. {
  73. ShowObjRow('typeid2tr');
  74. //$Obj('typeid2ct').innerHTML = $Obj('typeidct').innerHTML.replace('typeid','typeid2');
  75. }
  76. function HideObj(objname)
  77. {
  78. var obj = $Obj(objname);
  79. if(obj == null) return false;
  80. obj.style.display = "none";
  81. }
  82. function ShowItem1()
  83. {
  84. ShowObj('needset'); ShowObj('head1'); HideObj('head2'); HideObj('adset');ShowObj('votehead');
  85. }
  86. function ShowItem2()
  87. {
  88. ShowObj('head2'); ShowObj('adset'); HideObj('voteset');HideObj('head1'); HideObj('needset');HideObj('votehead');
  89. }
  90. function SeePic(img,f)
  91. {
  92. if( f.value != '' ) img.src = f.value;
  93. }
  94. function SeePicNew(f, imgdid, frname, hpos, acname)
  95. {
  96. var newobj = null;
  97. if(f.value=='') return ;
  98. vImg = $Obj(imgdid);
  99. picnameObj = document.getElementById('picname');
  100. nFrame = $Nav()=='IE' ? eval('document.frames.'+frname) : $Obj(frname);
  101. nForm = f.form;
  102. //修改form的action等参数
  103. if(nForm.detachEvent) nForm.detachEvent("onsubmit", checkSubmit);
  104. else nForm.removeEventListener("submit", checkSubmit, false);
  105. nForm.action = 'archives_do.php';
  106. nForm.target = frname;
  107. nForm.dopost.value = 'uploadLitpic';
  108. nForm.submit();
  109. picnameObj.value = '';
  110. newobj = $Obj('uploadwait');
  111. if(!newobj)
  112. {
  113. newobj = document.createElement("DIV");
  114. newobj.id = 'uploadwait';
  115. newobj.style.position = 'absolute';
  116. newobj.className = 'uploadwait';
  117. newobj.style.width = 120;
  118. newobj.style.height = 20;
  119. newobj.style.top = hpos;
  120. newobj.style.left = 100;
  121. newobj.style.display = 'block';
  122. document.body.appendChild(newobj);
  123. newobj.innerHTML = '<img src="images/loadinglit.gif" width="16" height="16" alit="" />上传中...';
  124. }
  125. newobj.style.display = 'block';
  126. //提交后还原form的action等参数
  127. nForm.action = acname;
  128. nForm.dopost.value = 'save';
  129. nForm.target = '';
  130. nForm.litpic.disabled = true;
  131. //nForm.litpic = null;
  132. //if(nForm.attachEvent) nForm.attachEvent("onsubmit", checkSubmit);
  133. //else nForm.addEventListener("submit", checkSubmit, true);
  134. }
  135. function SelectFlash()
  136. {
  137. if($Nav()=='IE'){ var posLeft = window.event.clientX-300; var posTop = window.event.clientY; }
  138. else{ var posLeft = 100; var posTop = 100; }
  139. window.open("../include/dialog/select_media.php?f=form1.flashurl", "popUpFlashWin", "scrollbars=yes,resizable=yes,statebar=no,width=500,height=350,left="+posLeft+", top="+posTop);
  140. }
  141. function SelectMedia(fname)
  142. {
  143. if($Nav()=='IE'){ var posLeft = window.event.clientX-200; var posTop = window.event.clientY; }
  144. else{ var posLeft = 100;var posTop = 100; }
  145. window.open("../include/dialog/select_media.php?f="+fname, "popUpFlashWin", "scrollbars=yes,resizable=yes,statebar=no,width=500,height=350,left="+posLeft+", top="+posTop);
  146. }
  147. function SelectSoft(fname)
  148. {
  149. if($Nav()=='IE'){ var posLeft = window.event.clientX-200; var posTop = window.event.clientY-50; }
  150. else{ var posLeft = 100; var posTop = 100; }
  151. window.open("../include/dialog/select_soft.php?f="+fname, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
  152. }
  153. function SelectImage(fname,stype,imgsel)
  154. {
  155. if($Nav()=='IE'){ var posLeft = window.event.clientX-100; var posTop = window.event.clientY; }
  156. else{ var posLeft = 100; var posTop = 100; }
  157. if(!fname) fname = 'form1.picname';
  158. if(imgsel) imgsel = '&noeditor=yes';
  159. if(!stype) stype = '';
  160. window.open("../include/dialog/select_images.php?f="+fname+"&noeditor=yes&imgstick="+stype+imgsel, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=650,height=400,left="+posLeft+", top="+posTop);
  161. }
  162. function imageCut(fname)
  163. {
  164. if($Nav()=='IE'){ var posLeft = window.event.clientX-100; var posTop = window.event.clientY; }
  165. else{ var posLeft = 100; var posTop = 100; }
  166. if(!fname) fname = 'picname';
  167. file = document.getElementById(fname).value;
  168. if(file == '') {
  169. alert('请先选择网站内已上传的图片');
  170. return false;
  171. }
  172. window.open("imagecut.php?f="+fname+"&file="+file, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left="+posLeft+", top="+posTop);
  173. }
  174. function SelectImageN(fname,stype,vname)
  175. {
  176. if($Nav()=='IE'){ var posLeft = window.event.clientX-100; var posTop = window.event.clientY; }
  177. else{ var posLeft = 100; var posTop = 100; }
  178. if(!fname) fname = 'form1.picname';
  179. if(!stype) stype = '';
  180. window.open("../include/dialog/select_images.php?f="+fname+"&imgstick="+stype+"&v="+vname, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
  181. }
  182. function SelectKeywords(f)
  183. {
  184. if($Nav()=='IE'){ var posLeft = window.event.clientX-350; var posTop = window.event.clientY-200; }
  185. else{ var posLeft = 100; var posTop = 100; }
  186. window.open("article_keywords_select.php?f="+f, "popUpkwWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=450,left="+posLeft+", top="+posTop);
  187. }
  188. function InitPage()
  189. {
  190. var selsource = $Obj('selsource');
  191. var selwriter = $Obj('selwriter');
  192. var titlechange = $Obj('title');
  193. var colorbt = $Obj('color');
  194. if(selsource){ selsource.onmousedown=function(e){ SelectSource(e); } }
  195. if(selwriter){ selwriter.onmousedown=function(e){ SelectWriter(e); } }
  196. if(titlechange){ titlechange.onchange=function(e){ TestHasTitle(e); } }
  197. if(colorbt){ colorbt.onmousedown=function(e){ ShowColor2(e); } }
  198. }
  199. function OpenMyWin(surl)
  200. {
  201. window.open(surl, "popUpMyWin", "scrollbars=yes,resizable=yes,statebar=no,width=500,height=350,left=200, top=100");
  202. }
  203. function OpenMyWinCoOne(surl)
  204. {
  205. window.open(surl, "popUpMyWin2", "scrollbars=yes,resizable=yes,statebar=no,width=700,height=450,left=100,top=50");
  206. }
  207. function PutSource(str)
  208. {
  209. var osource = $Obj('source');
  210. if(osource) osource.value = str;
  211. $Obj('mysource').style.display = 'none';
  212. ChangeFullDiv('hide');
  213. }
  214. function PutWriter(str)
  215. {
  216. var owriter = $Obj('writer');
  217. if(owriter) owriter.value = str;
  218. $Obj('mywriter').style.display = 'none';
  219. ChangeFullDiv('hide');
  220. }
  221. // 增加选择投票内容
  222. function PutVote(str)
  223. {
  224. var ovote = $Obj('voteid');
  225. if(ovote)
  226. {
  227. ovote.value = str;
  228. tb_remove(false);
  229. } else {
  230. parent.document.form1.voteid.value=str;
  231. tb_remove(true);
  232. }
  233. }
  234. function ClearDivCt(objname)
  235. {
  236. if(!$Obj(objname)) return;
  237. $Obj(objname).innerHTML = '';
  238. $Obj(objname).style.display = 'none';
  239. ChangeFullDiv("hide");
  240. }
  241. function ChangeFullDiv(showhide,screenheigt)
  242. {
  243. var newobj = $Obj('fullpagediv');
  244. if(showhide=='show')
  245. {
  246. if(!newobj)
  247. {
  248. newobj = document.createElement("DIV");
  249. newobj.id = 'fullpagediv';
  250. newobj.style.position='absolute';
  251. newobj.className = 'fullpagediv';
  252. newobj.style.height=screenheigt + 'px';
  253. document.body.appendChild(newobj);
  254. }
  255. else
  256. {
  257. newobj.style.display = 'block';
  258. }
  259. }
  260. else
  261. {
  262. if(newobj) newobj.style.display = 'none';
  263. }
  264. }
  265. function SelectSource(e)
  266. {
  267. LoadNewDiv(e,'article_select_sw.php?t=source&k=8&rnd='+Math.random(), 'mysource');
  268. //ChangeFullDiv('show');
  269. }
  270. function SelectWriter(e)
  271. {
  272. LoadNewDiv(e,'article_select_sw.php?t=writer&k=8&rnd='+Math.random(), 'mywriter');
  273. //ChangeFullDiv('show');
  274. }
  275. function LoadNewDiv(e,surl,oname)
  276. {
  277. var pxStr = '';
  278. if($Nav()=='IE')
  279. {
  280. var posLeft = window.event.clientX-20;
  281. var posTop = window.event.clientY-30;
  282. // IE下scrollTop的兼容性问题
  283. var scrollTop = document.documentElement.scrollTop || window.pageYOffset;
  284. if(typeof(scrollTop) == 'undefined') scrollTop = document.body.scrollTop;
  285. posTop += scrollTop;
  286. }
  287. else
  288. {
  289. var posLeft = e.pageX-20;
  290. var posTop = e.pageY-30;
  291. pxStr = 'px';
  292. }
  293. posLeft = posLeft - 100;
  294. var newobj = $Obj(oname);
  295. if(!newobj){
  296. newobj = document.createElement("DIV");
  297. newobj.id = oname;
  298. newobj.style.position = 'absolute';
  299. newobj.className = oname;
  300. newobj.className += ' dlgws';
  301. newobj.style.top = posTop + pxStr;
  302. newobj.style.left = posLeft + pxStr;
  303. document.body.appendChild(newobj);
  304. }
  305. else{
  306. newobj.style.display = "block";
  307. }
  308. if(newobj.innerHTML.length<10){
  309. var myajax = new DedeAjax(newobj);
  310. myajax.SendGet(surl);
  311. }
  312. }
  313. function TestHasTitle(e)
  314. {
  315. LoadNewDiv2(e,'article_test_title.php?t='+$Obj('title').value,'mytitle',"dlgTesttitle");
  316. }
  317. function LoadNewDiv2(e,surl,oname,dlgcls)
  318. {
  319. var posLeft = 300;
  320. var posTop = 50;
  321. var newobj = $Obj(oname);
  322. if(!newobj)
  323. {
  324. newobj = document.createElement("DIV");
  325. newobj.id = oname;
  326. newobj.style.position='absolute';
  327. newobj.className = dlgcls;
  328. newobj.style.top = posTop;
  329. newobj.style.left = posLeft;
  330. newobj.style.display = 'none';
  331. document.body.appendChild(newobj);
  332. }
  333. newobj.innerHTML = '';
  334. var myajax = new DedeAjax(newobj);
  335. myajax.SendGet2(surl);
  336. if(newobj.innerHTML=='') newobj.style.display = 'none';
  337. else newobj.style.display = 'block';
  338. jQuery(newobj).css('top', '50px').css('left', '300px');
  339. DedeXHTTP = null;
  340. }
  341. function ShowUrlTr()
  342. {
  343. var jumpTest = $Obj('flagsj');
  344. var jtr = $Obj('redirecturltr');
  345. var jf = $Obj('redirecturl');
  346. if(jumpTest.checked) jtr.style.display = "block";
  347. else{
  348. jf.value = '';
  349. jtr.style.display = "none";
  350. }
  351. }
  352. function ShowUrlTrEdit()
  353. {
  354. ShowUrlTr();
  355. var jumpTest = $Obj('isjump');
  356. var rurl = $Obj('redirecturl');
  357. if(!jumpTest.checked) rurl.value="";
  358. }
  359. function CkRemote()
  360. {
  361. document.getElementById('picname').value = '';
  362. }
  363. //载入指定宽高的AJAX窗体
  364. function LoadQuickDiv(e, surl, oname, w, h)
  365. {
  366. if($Nav()=='IE')
  367. {
  368. if(window.event)
  369. {
  370. var posLeft = window.event.clientX - 20;
  371. var posTop = window.event.clientY - 30;
  372. }
  373. else
  374. {
  375. var posLeft = e.clientX - 20;
  376. var posTop = e.clientY + 30;
  377. }
  378. }
  379. else
  380. {
  381. var posLeft = e.pageX - 20;
  382. var posTop = e.pageY - 30;
  383. }
  384. posTop += MyGetScrollTop();
  385. posLeft = posLeft - 400;
  386. //固定位置的高度
  387. if(fixupPos)
  388. {
  389. posLeft = posTop = 50;
  390. }
  391. var newobj = $Obj(oname);
  392. if(!newobj)
  393. {
  394. newobj = document.createElement("DIV");
  395. newobj.id = oname;
  396. newobj.style.position = 'absolute';
  397. newobj.className = 'pubdlg';
  398. newobj.style.width = w;
  399. newobj.style.height = h;
  400. document.body.appendChild(newobj);
  401. }
  402. if(posTop > 500) posTop = 500;
  403. if(posLeft < 50) posLeft = 50;
  404. newobj.style.top = posTop+"px";
  405. newobj.style.left = posLeft+"px";
  406. newobj.innerHTML = '<div style="margin-top:10px;margin-left:10px;"><img src="images/loadinglit.gif" /> Loading...</div>';
  407. newobj.style.display = 'block';
  408. var myajax = new DedeAjax(newobj);
  409. myajax.SendGet(surl);
  410. fixupPos = false;
  411. }
  412. function MyGetScrollTop()
  413. {
  414. return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  415. }
  416. //通用事件获取接口
  417. function getEvent()
  418. {
  419. if($Nav()=='IE') return window.event;
  420. func=getEvent.caller;
  421. while(func!=null)
  422. {
  423. var arg0 = func.arguments[0];
  424. if(arg0)
  425. {
  426. if((arg0.constructor==Event || arg0.constructor ==MouseEvent)
  427. || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation))
  428. {
  429. return arg0;
  430. }
  431. }
  432. func=func.caller;
  433. }
  434. return null;
  435. }
  436. //模拟ondrop事件相关代码
  437. /*----------------------------
  438. leftLeaning = 300;
  439. 如果对象内容固定,用onmousedown=DropStart去除底下的DropStop
  440. newobj.ondblclick = DropStart;
  441. newobj.onmousemove = DropMove;
  442. newobj.onmousedown = DropStop;
  443. ----------------------------*/
  444. function DropStart()
  445. {
  446. this.style.cursor = 'move';
  447. }
  448. function DropStop()
  449. {
  450. this.style.cursor = 'default';
  451. }
  452. function DropMove()
  453. {
  454. if(this.style.cursor != 'move') return;
  455. var event = getEvent();
  456. if($Nav()=='IE')
  457. {
  458. var posLeft = event.clientX-20;
  459. var posTop = event.clientY-30;
  460. posTop += document.body.scrollTop;
  461. }
  462. else
  463. {
  464. var posLeft = event.pageX-20;
  465. var posTop = event.pageY-30;
  466. }
  467. this.style.top = posTop;
  468. this.style.left = posLeft-leftLeaning;
  469. }
  470. //对指定的元素绑定move事件
  471. /*-----------------------------
  472. onmousemove="DropMoveHand('divname', 225);"
  473. onmousedown="DropStartHand();"
  474. onmouseup="DropStopHand();"
  475. -----------------------------*/
  476. function DropStartHand()
  477. {
  478. canMove = (canMove ? false : true);
  479. }
  480. function DropStopHand()
  481. {
  482. canMove = false;
  483. }
  484. function DropMoveHand(objid, mleftLeaning)
  485. {
  486. var event = getEvent();
  487. var obj = $Obj(objid);
  488. if(!canMove) return;
  489. if($Nav()=='IE')
  490. {
  491. var posLeft = event.clientX-20;
  492. var posTop = event.clientY-20;
  493. posTop += window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;
  494. }
  495. else
  496. {
  497. var posLeft = event.pageX-20;
  498. var posTop = event.pageY-20;
  499. }
  500. obj.style.top = posTop+"px";
  501. obj.style.left = posLeft - mleftLeaning+"px";
  502. }
  503. //复制内容到剪切板
  504. function copyToClipboard(txt)
  505. {
  506. if(txt==null || txt=='') {
  507. alert("没有选择任何内容!");
  508. return;
  509. }
  510. if(window.clipboardData)
  511. {
  512. window.clipboardData.clearData();
  513. window.clipboardData.setData("Text", txt);
  514. }
  515. else if(navigator.userAgent.indexOf('Opera') != -1)
  516. {
  517. window.location = txt;
  518. }
  519. else
  520. {
  521. try {
  522. netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  523. } catch (e) {
  524. alert("被浏览器拒绝!\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
  525. }
  526. var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
  527. if (!clip) return;
  528. var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
  529. if (!trans) return;
  530. trans.addDataFlavor('text/unicode');
  531. var str = new Object();
  532. var len = new Object();
  533. var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
  534. var copytext = txt;
  535. str.data = copytext;
  536. trans.setTransferData("text/unicode",str,copytext.length*2);
  537. var clipid = Components.interfaces.nsIClipboard;
  538. if (!clip) return false;
  539. clip.setData(trans,null,clipid.kGlobalClipboard);
  540. }
  541. }
  542. function getSelTxt()
  543. {
  544. var g, r;
  545. if(document.all){
  546. g = document.selection.createRange().text;
  547. }else{
  548. g = document.getSelection();
  549. }
  550. return g;
  551. }
  552. //显示栏目Map地图
  553. function ShowCatMap(e, obj, cid, targetId, oldvalue)
  554. {
  555. fixupPos = true;
  556. LoadQuickDiv(e, 'archives_do.php?dopost=getCatMap&targetid='+targetId+'&channelid='+cid+'&oldvalue='+oldvalue+'&rnd='+Math.random(), 'getCatMap', '700px', '500px');
  557. ChangeFullDiv('show');
  558. }
  559. function getSelCat(targetId)
  560. {
  561. var selBox = document.quicksel.seltypeid;
  562. var targetObj = $Obj(targetId);
  563. var selvalue = '';
  564. //副栏目(多选)
  565. if(targetId=='typeid2')
  566. {
  567. var j = 0;
  568. for(var i=0; i< selBox.length; i++)
  569. {
  570. if(selBox[i].checked) {
  571. j++;
  572. if(j==10) break;
  573. selvalue += (selvalue=='' ? selBox[i].value : ','+selBox[i].value);
  574. }
  575. }
  576. if(targetObj) targetObj.value = selvalue;
  577. }
  578. //主栏目(单选)
  579. else
  580. {
  581. if(selBox)
  582. {
  583. for(var i=0; i< selBox.length; i++)
  584. {
  585. if(selBox[i].checked) selvalue = selBox[i].value;
  586. }
  587. }
  588. if(selvalue=='')
  589. {
  590. alert('你没有选中任何项目!');
  591. return ;
  592. }
  593. if(targetObj)
  594. {
  595. for(var j=0; j < targetObj.length; j++)
  596. {
  597. op=targetObj.options[j];
  598. if(op.value==selvalue) op.selected=true;
  599. }
  600. }
  601. }
  602. HideObj("getCatMap");
  603. ChangeFullDiv("hide");
  604. }
  605.   function getElementLeft(element){
  606.     var actualLeft = element.offsetLeft;
  607.     var current = element.offsetParent;
  608.     while (current !== null){
  609.       actualLeft += current.offsetLeft;
  610.       current = current.offsetParent;
  611.     }
  612.     return actualLeft;
  613.   }
  614.   function getElementTop(element){
  615.     var actualTop = element.offsetTop;
  616.     var current = element.offsetParent;
  617.     while (current !== null){
  618.       actualTop += current.offsetTop;
  619.       current = current.offsetParent;
  620.     }
  621.     return actualTop;
  622.   }
  623. -->