var IE=(navigator.appName=="Microsoft Internet Explorer")?1:0;var sel1="#D3D3D3";var sel2="#FFFBDD";var sel3="#FFF9BB";var row1="#F9F9F9";var new1="#DDEEDD";var colorS="#0033FF";var colorU="#003366";function setLevel(){return(top.window.folderView||!opener)?top.window:opener.window}var dw;function getDw(){dw=document.width?document.width:document.documentElement.offsetWidth-25}function setw(eName, width){if(!document.getElementById(eName)){alert(eName);return}document.getElementById(eName).style.width=width}function setWinH(mainName){var winH=self.innerHeight?self.innerHeight:document.body.offsetHeight;var tabH=document.getElementById(mainName).offsetHeight;if(tabH>(.75 * screen.height))tabH=parseInt(.75 * screen.height);if(tabH<250)tabH=250;var diff=tabH-winH+4;self.resizeBy(0,diff)}function selRowPop(e){e=e?e:window.event;var cell=e.target?e.target:e.srcElement;while(cell.tagName!='TD')cell=cell.parentNode;var row=cell.parentNode;if(!row.id)return;if(cell.className=='emailCell'){emailMO(cell)}else if(cell.className=='subjCell'){selMO(cell)}if(row.id==top.window.realCurr)return;row.style.backgroundColor=sel1;row.onmouseout=function(){colPop(row)}}function selRow(e){var e=e?e:window.event;var el=e.target?e.target:e.srcElement;while(el.tagName!='TD')el=el.parentNode;row=el;while(row.tagName!='TR')row=row.parentNode;if(!row.id)return;var rs=row.style;row._oldColor=rs.backgroundColor;rs.backgroundColor=sel1;if(el.id=='X')rs.color=colorS;row.onmouseout=function(){row.onmouseout=null;rs.backgroundColor=row._oldColor;rs.color=colorU}}function selMO(el){el.style.color=colorS;el.onmouseout=function(){el.style.color=colorU}}function emailMO(el){var row=el.parentNode;while(row.tagName!='TR')row=row.parentNode;var email=row.getElementsByTagName('TD')[0].id;window.status=email;el.style.color=colorS;el.onmouseout=function(){window.status='';el.style.color=colorU}}function genericRow(){var cells=new Array();for(i=0;i<6;i++){cells[i]=document.createElement('TD')}cells[0].innerHTML='1';cells[0].style.textAalign="center";cells[2].className="emailCell";cells[3].className="popCellL";cells[4].className="subjCell";cells[5].className="popCellR";genRow=document.createElement('TR');for(i=0;i<6;i++){genRow.appendChild(cells[i])}genRow.style.cursor="default"}function addHelpDiv(hname,htext){var hdiv=document.createElement('DIV');hdiv.id='popup'+hname;hdiv.className='divcss';hdiv.innerHTML=htext;document.body.appendChild(hdiv)}function addNewMail(folder,MID,email,bg,d1,d2,d3,d4,d5){read=0;newRow=genRow.cloneNode(true);newRow.id=MID;newRow.className=read?"row1":"new1";cells=newRow.getElementsByTagName('TD');cells[0].id=email;cells[1].innerHTML=d1;cells[1].style.backgroundColor=bg;cells[1].id=read;cells[2].innerHTML=d2;cells[3].innerHTML=d3;cells[4].innerHTML=d4;if(!read)cells[4].style.fontWeight="bold";cells[5].innerHTML=d5;var rows=document.getElementById('folderTable').getElementsByTagName('TR');var firstRow=rows[0];var firstMsg=rows[1];var table=firstRow.parentNode;if(firstMsg){table.insertBefore(newRow,firstMsg)}else table.appendChild(newRow)}function nextRange(dir){pForm=document.popForm;if(dir==1){pForm.msg_start.value=parseInt(pForm.msg_end.value)+1}else pForm.msg_start.value-=pForm.msg_disp.value;top.window.rePop("",1)}function emailMD(e){e=e?e:event;var elOrig=e.target?e.target:e.srcElement;el=elOrig;while(el.tagName!='TD')el=el.parentNode;var row=el.parentNode;if(!row.id)return;cells=row.getElementsByTagName('TD');var email=cells[0].id;whichBut=e.which?e.which:e.button;if(whichBut!=1){el.oncontextmenu=new Function("return false");if(0&&IE){contextMenu(e,row.id,email)}else{el.onmouseup=function(){el.onmouseup=null;contextMenu(e,row.id,email)}}}}function colPop(row){if(row.id==top.window.realCurr)return;row.style.backgroundColor=row.chk?sel2:((row.getElementsByTagName('TD')[1].id==0)?new1:row1)}function Chk_all(val){pForm=top.window.folderView.document.popForm;if(!pForm.MID){pForm.chkItAll.checked=0;return}var rows=top.window.folderView.document.getElementById('folderTable').getElementsByTagName('TR');for(i=0;i<rows.length;i++){if(!rows[i].id)continue;rows[i].getElementsByTagName('INPUT')[0].checked=val;rows[i].chk=val;colPop(rows[i])}pointArrow()}function showHead(e){var el=e.target?e.target:e.srcElement;while(el.tagName!='TD')el=el.parentNode;var row=el.parentNode;if(!row.id)return;if(!el.id)return;readMess('h'+row.id,0)}function popDblClick(e){alert(e.type);return;var el=e.target?e.target:e.srcElement;if(elOrig.tagName=='IMG')return;}function popClick(e){var elOrig=e.target?e.target:e.srcElement;if(elOrig.tagName=='IMG')return;el=elOrig;while(el.tagName!='TD')el=el.parentNode;var row=el.parentNode;if(!row.id)return;var dcl=(e.type=='dblclick')?1:0;if(elOrig.tagName=='INPUT'){if(dcl)return;row.chk=elOrig.checked;pointArrow();colPop(row);return}cells=row.getElementsByTagName('TD');var email=cells[0].id;if(el.className=='emailCell'){if(dcl)return;GlobalCompose(email)}else if(el.className=='subjCell'){readMess(row.id,dcl);}}function GlobalCompose(to,cc,bcc){to=to?to:'';cc=cc?cc:'';bcc=bcc?bcc:'';setLevel().Compose(to,cc,bcc)}var hideCntxTimer;function contextMenu(e,MID,email){hideCntx();top.cntxMID=MID;top.cntxEmail=email;var emailEsc=email.replace(/>/g,'&gt;');emailEsc=emailEsc.replace(/</g,'&lt;');var d=top.document.getElementById('cntxTab');d.getElementsByTagName('TD')[0].innerHTML="Email:"+emailEsc;var cw=d.offsetWidth;var ch=d.offsetHeight;var frameWidth=getFrameWidth();var maxX=frameWidth-cw-20;if(e.clientX>maxX){var dsl=e.clientX-cw+127; d.style.left=((dsl<0)?e.clientX+135:dsl)+"px";}else d.style.left=e.clientX+135+"px";var frameHeight=top.window.getFrameHeight();var maxY=getFrameHeight-ch-20;if(e.clientY>maxY){d.style.top=maxY+2+"px"}else d.style.top=e.clientY+2+"px";d.style.visibility="visible";sf=top.window.document.getElementById('storeFoc');sf.focus();sf.onblur=function(){hideCntxTimer=setTimeout('hideCntx()',200)}}function hideCntx(){clearTimeout(hideCntxTimer);top.window.document.getElementById('storeFoc').onblur=null;top.document.getElementById("cntxTab").style.visibility="hidden"}function getFrameHeight(){return self.innerHeight?self.innerHeight:document.body.offsetHeight-4}function getFrameWidth(){var frameWidth;if(self.innerWidth){frameWidth=self.innerWidth}else if(document.documentElement&&document.documentElement.clientWidth){frameWidth=document.documentElement.clientWidth}else if(document.body){frameWidth=document.body.clientWidth}return frameWidth}function calClick(e){var el=e.target?e.target:e.srcElement;while(el.tagName!='TD')el=el.parentNode;date=el.id;if(!date)return;lTask(date)}function calMO(e){var el=e.target?e.target:e.srcElement;while(el.tagName!='TD')el=el.parentNode;date=el.id;if(!date)return;el._oldBg=el.style.backgroundColor;el.style.backgroundColor="#FFFFFF";if(document.getElementById('popup'+date)){showPosPop(e,date);el.onmouseout=function(){el.style.backgroundColor=el._oldBg;document.getElementById('popup'+date).style.visibility='hidden'}}else{el.onmouseout=function(){el.style.backgroundColor=el._oldBg}}}function elLeft(eElement){var nLeftPos=eElement.offsetLeft;var eParElement=eElement.offsetParent;while(eParElement!=null){nLeftPos+=eParElement.offsetLeft;eParElement=eParElement.offsetParent}return nLeftPos}function elTop(eElement){if(!eElement&&this){eElement=this}var nTopPos=eElement.offsetTop;var eParElement=eElement.offsetParent;while(eParElement!=null){nTopPos+=eParElement.offsetTop;eParElement=eParElement.offsetParent}return nTopPos}function getScroll(){if(document.body.scrollTop!=undefined){var ieBox=document.compatMode!="CSS1Compat";var cont=ieBox?document.body:document.documentElement;return{x:cont.scrollLeft, y:cont.scrollTop}}else{return{x:window.pageXOffset, y:window.pageYOffset}}}function hideIt(el){document.getElementById('popup'+el.name).style.visibility='hidden';el.onblur=null;el.onmouseout=null}function DetailDiv(e){e=e?e:window.event;var el=e.target?e.target:e.srcElement;if(e.type=='click'){while(el.tagName!="A")el=el.parentNode;el.onblur=function(){hideIt(el)}}else{while(el.tagName!="IMG"&&el.tagName!="DIV")el=el.parentNode;el.onmouseout=function(){hideIt(el)}}var index=el.name;showPosPop(e,index)}function showPosPop(e,index){var scroll=getScroll();var thisdiv=document.getElementById('popup'+index);if(thisdiv.offsetWidth>300)thisdiv.style.width=300;getDw();if(e.clientX>dw-thisdiv.offsetWidth){thisdiv.style.left=dw-thisdiv.offsetWidth+scroll.x+"px";}else;thisdiv.style.left=e.clientX-2+scroll.x+"px";thisdiv.style.top=e.clientY+25+scroll.y+"px";thisdiv.style.visibility="visible"}function Void(){return}function WinCal(calHead){window.open("calendar.cgi?calHead="+calHead,"cal","height=200,width=330,left=200,top=200,scrollbars=no,resizable=yes")}function fixLongTask(){getDw();subEl=document.getElementById('taskSubj');nw=dw-elLeft(subEl)-40;if(nw<100)return;setw('taskSubj', nw);setw('taskDetail', nw)}function fixShortTask(){getDw();var subEl=document.getElementById('taskSubj');var l_edge=elLeft(subEl);var table=subEl.parentNode;while(table.tagName!="TABLE")table=table.parentNode;var tl=elLeft(table);var maxW=table.offsetWidth>dw-tl?dw-tl:table.offsetWidth;nw=maxW+tl-l_edge-175;if(nw<100)return;setw('taskSubj', nw);setw('taskDetail', nw)}function setTaskEnd(){sel=etf.taskLength;tLen=sel.options[sel.selectedIndex].value;var advance=tLen.split(':');hrsel=etf.hourSel;begHr=hrsel.options[hrsel.selectedIndex].value;minsel=etf.minSel;begMin=minsel.options[minsel.selectedIndex].value;endMin=-(-begMin-advance[1]);var hrCar=0;if(endMin>59){endMin-=60;hrCar=1}endHr=-(-begHr-advance[0]-hrCar);if(endHr>11&&begHr!=12){if(endHr!=12)endHr-=12;if(etf.AMPM.value==etf.endAMPM.value){switchPM("end")}}else{if(begHr==12&&endHr!=12)endHr-=12;if(etf.AMPM.value!=etf.endAMPM.value){switchPM("end")}}etf.endHourSel.options[endHr-1].selected=1;endIndex=endMin/5;etf.endMinSel.options[endIndex].selected=1;sel.options[0].selected=1;SetEndTime()}function lTask(date){tf.start_date.value=date;tf.end_date.value='';tf.submit()}function FlipCB(fName){ncb=eval('etf.'+fName);ncb.checked=!ncb.checked}function viewOther(){vo=prompt('Enter the ATPmail user name to view.','');if(vo==''||vo==null){return}winTaskOther2(vo)}function copyTask(index){if(!confirm('Click OK to copy task to your calendar.')){return}subTask("copyTask",index)}function AddOrFull(index){if(etf.addDetail&&etf.addDetail.checked){subTask("addTaskDetail",index)}else{FullTask(index)}}function delTask(taskIndex){if(confirm('You are about to delete a task.'))subTask("delTask",taskIndex)}function delTaskRepeat(taskIndex){if(confirm('This task repeats. This will delete all occurences of this task.'))subTask("delTask",taskIndex)}function enterTask(){if(etf.taskSubj.value==""||subClr){alert('You need to give the task a subject.');return false}if(detClr)etf.taskDetail.value='';subTask("enterTask","");return false}function clrSub(){if(subClr){etf.taskSubj.value='';subClr=0}}function clrDet(){if(detClr){etf.taskDetail.value='';detClr=0}}function WinCalSet(which,calHead){whichOne=which;WinCal(calHead)}function setTaskDate(mon,mday,year){td=mday+'.'+mon+'.'+year;if(whichOne==0){etf.daySel.options[--mday].selected=true;etf.monthSel.options[mon].selected=true;etf.yearSel.value=year;etf.setDate.checked=true}if(whichOne==1){lTask(td)}if(whichOne==2){tf.start_date.value=td;WinCalSet(3,"Enter_the_last_date.");return 1}if(whichOne==3){tf.end_date.value=td;tf.submit()}}function addNewGroup(index,gname,cnt){var oldRow;while(oldRow=document.getElementById(index))oldRow.parentNode.removeChild(oldRow);var newRow=genGroupRow.cloneNode(true);newRow.style.backgroundColor=sel3;newRow.id=index;var cells=newRow.getElementsByTagName('TD');cells[0].id=gname;cells[3].innerHTML=gname;cells[4].innerHTML=cnt;if(index.match(/^g/)){newRow.getElementsByTagName('DIV')[2].className="ng";newRow.getElementsByTagName('DIV')[1].className="vg"}var rows=document.getElementById('groupDiv').getElementsByTagName('TR');var firstRow=rows[2];var firstAddr=rows[3];var table=firstRow.parentNode;if(firstAddr){table.insertBefore(newRow,firstAddr)}else table.appendChild(newRow)}function addNewAddr(mailn,nickn,lfname,flname,email,index,cat,more){var oldRow;while(oldRow=document.getElementById(index))oldRow.parentNode.removeChild(oldRow);var newRow=genAddrRow.cloneNode(true);newRow.style.backgroundColor=sel3;newRow.id=index;var cells=newRow.getElementsByTagName('TD');cells[0].id=mailn;if(!cat)cat=0;cells[0].style.backgroundColor=catCol[cat];cells[3].innerHTML=nickn;cells[4].innerHTML=(document.addressForm.sortby.value==3)?flname:lfname;cells[5].innerHTML=email;newRow.getElementsByTagName('DIV')[2].className=index.match(/^g/)?"ec3":(more?"ec2":"ec1");var rows=document.getElementById('mainContacts').getElementsByTagName('TR');var firstRow=rows[1];var firstAddr=rows[2];var table=firstRow.parentNode;if(firstAddr){table.insertBefore(newRow,firstAddr)}else table.appendChild(newRow);document.body.scrollTop=0}function divPop(e,el){el.name=el.className;el.onmouseout=function(){hideIt(el)};showPosPop(e,el.className)}function selAddrRow(e){var el=e.target?e.target:e.srcElement;if(el.tagName=="DIV")divPop(e,el);while(el.tagName!='TD')el=el.parentNode;row=el;while(row.tagName!='TR')row=row.parentNode;if(!row.id)return;var rs=row.style;rs.backgroundColor=sel1;if(el.id=='X')rs.color=colorS;row.onmouseout=function(){rs.backgroundColor=row.chk?sel2:row1;rs.color=colorU}}function addrAct(e){var el=e.target?e.target:e.srcElement;ecl=el.className;row=el.parentNode;while(row.tagName!='TR')row=row.parentNode;if(!row.id)return;if(el.tagName=='INPUT'){var cbs=row.getElementsByTagName('INPUT');for(i=0;i<cbs.length;i++){if(cbs[i]!=el)cbs[i].checked=0}markRow(row);return}contId=row.id;cells=row.getElementsByTagName('TD');info=cells[0].id;if(ecl=='vc'){top.window.opener.top.window.ViewContact(row.id,document.addressForm.globalBook.value)}else if(ecl=='rc'){cRemove(row.id)}else if(ecl=='ec1'||ecl=='ec2'){addrOtherLoad("ContactForm",row.id,"")}else if(ecl=='ec3'){cEditNn(row.id,info)}else if(ecl=='eg'){addrOtherLoad("editGroup",row.id,"")}else if(ecl=='vg'){top.window.opener.top.window.ViewContact(row.id,document.addressForm.globalBook.value)}else if(ecl=='rg'){gRemove(row.id,info)}else if(ecl=='atg'){addToGroup(row.id)}else if(ecl=='ng'){gEditNn(row.id,info)}else{while(el.tagName!='TD')el=el.parentNode;if(el.id=='X'){var cbs=row.getElementsByTagName('INPUT');if(cbs[0].checked){cbs[0].checked=0; cbs[1].checked=1;}else if(cbs[1].checked){cbs[1].checked=0; cbs[2].checked=1;}else if(cbs[2].checked){cbs[2].checked=0;}else cbs[0].checked=1;markRow(row)}}}function cRemove(index){if(!confirm('You are about to delete a contact.  Do you want to continue?'))return;while(oldRow=document.getElementById(index))oldRow.parentNode.removeChild(oldRow);top.window.addrActSub("delContacts",index)}function gRemove(groupindex,groupname){if(!confirm('You are about to delete the group-'+groupname+'-. Do you want to continue?'));return;var gRow=document.getElementById(groupindex);gRow.parentNode.removeChild(gRow);top.window.addrActSub("gRemove",groupindex)}function newCat2(){nc=prompt('Enter the new Category name.','');if(!nc)return;catf=document.catForm;catf.GOTO.value='newCat';catf.newCat.value=nc;catf.submit()}function renameCat(index,oldname){nc=prompt('Enter the new name for the Category.',oldname);if(!nc)return;catf=document.catForm;catf.GOTO.value='renameCat';catf.indexCat.value=index;catf.newCat.value=nc;catf.submit()}function remCat(index,oldname){if(!confirm('Really delete Category?'))return;catf=document.catForm;catf.GOTO.value='delCat';catf.indexCat.value=index;catf.submit()}function addrSort(num){var aForm=document.addressForm;if(aForm.sortby.value==num){aForm.sortdir.value=1-aForm.sortdir.value}else{aForm.sortby.value=num;aForm.sortdir.value=0}aForm.submit()}function markRow(el){row=el;while(row.tagName!='TR')row=row.parentNode;var cbs=row.getElementsByTagName('INPUT');row.chk=0;for(var i=0;i<cbs.length;i++){if(cbs[i].checked)row.chk=i+1}var rs=row.style;rs.backgroundColor=row.chk?sel2:row1}var addrSrchTimeout;function addrSrchSoon(string,global){clearTimeout(addrSrchTimeout);if(!string||string.length<2){switchSrchView(1,global);return}var csc=top.document.getElementById('clrSrchCell');csc.innerHTML="<b style='padding-left:20px'>Searching</b>";addrSrchTimeout=setTimeout('addrSearch("'+string+'",'+global+')',300)}var lastSrch;function addrSearch(string,global){var ab=global?addrOtherView:addrBodyView;var searchTable=ab.document.getElementById('searchTable');var searchRows=searchTable.getElementsByTagName("TR");searchTable=searchRows[0].parentNode;var reg=new RegExp(string,'i');var numFound=0;if(lastSrch&&string.match("^"+lastSrch)){for(i=searchRows.length-1;i>1;i--){var cells=searchRows[i].getElementsByTagName("TD");var k;for(k=3;k<6;k++){if(reg.test(cells[k].innerHTML)){numFound++;k=7}}if(k==6){searchTable.removeChild(searchRows[i])}}}else{for(i=searchRows.length;i>2;i--)searchTable.removeChild(searchRows[i-1]);if(!string||string.length<2){switchSrchView(1,global);return}switchSrchView(0,global);mainRows=ab.document.getElementById('mainContacts').getElementsByTagName('TR');for(i=0;i<mainRows.length;i++){if(!mainRows[i].id)continue;var cells=mainRows[i].getElementsByTagName("TD");for(k=3;k<6;k++){if(reg.test(cells[k].innerHTML)){var found=mainRows[i].cloneNode(true);searchTable.appendChild(found);numFound++;k=6}}}}searchRows[0].getElementsByTagName('TD')[0].innerHTML="Search Results("+numFound+" Found)";lastSrch=string;var csc=top.document.getElementById('clrSrchCell');csc.innerHTML="<INPUT TYPE='button' VALUE='Clear Search' onclick='clearSearch()'>";ab.document.body.scrollTop=0}function addToGroup(index){var chkdAddr=top.CheckAddrSel();if(!chkdAddr)return;addrActSub("addToGroup",index,"",chkdAddr)}function addrActSub(GOTO,val,nname,info){actForm=top.document.addrActForm;actForm.GOTO.value=GOTO;actForm.EditIndex.value=val;actForm.newName.value=nname;actForm.info.value=info;actForm.submit()}function show(id){document.getElementById(id).style.visibility="visible"}function hide(id){document.getElementById(id).style.visibility="hidden"}function SetCheckedAddr(global){var screen=global?addrOtherView:addrBodyView;var whDiv=whichSrchView?screen.document.getElementById('mainBook'):screen.document.getElementById('addrSearchDiv');var rows=whDiv.getElementsByTagName('TR');var to='';var cc='';var bcc='';for(i=0;i<rows.length;i++){if(rows[i].chk){var email=rows[i].getElementsByTagName('TD')[0].id;if(!email)continue;if(rows[i].chk==1){to+=', '+email}else if(rows[i].chk==2){cc+=', '+email}else if(rows[i].chk==3)bcc+=', '+email}}return{to:to,cc:cc,bcc:bcc}}function addIf(cb){if(cb.checked){cb.checked=0;trans=Convert_email(cb.value);if(trans)return ', '+trans}return ""}function Convert_email(indexSel){cid=addrBodyView.document.getElementById(indexSel);var email=cid.getElementsByTagName('TD')[0].id;return email?email:''}function AddrCompose(global){var to;var cc;var bcc;chkd=SetCheckedAddr(global);var to=chkd.to;var cc=chkd.cc;var bcc=chkd.bcc;oForm=top.window.opener.document.compForm;if(oForm){if(oForm.to.value==''){to=to.substring(2, to.length)}oForm.to.value+=to;if(oForm.cc.value==''){cc=cc.substring(2, cc.length)}oForm.cc.value+=cc;if(oForm.bcc.value==''){bcc=bcc.substring(2, bcc.length)}oForm.bcc.value+=bcc;top.window.opener.focus();top.window.close();return}if(to)to=to.substring(2, to.length);if(cc)cc=cc.substring(2, cc.length);if(bcc)bcc=bcc.substring(2, bcc.length);GlobalCompose(to,cc,bcc);setAllAddr(0,global)}function changeNn(index,nn){clearSearch();addrSearch('',0);var row=top.window.addrBodyView.document.getElementById(index);var cells=row.getElementsByTagName('TD');if(cells[0].id)cells[0].id=nn;cells[3].innerHTML=nn}function cEditNn(index,nn){nnn=prompt('Enter the new nickname:',nn);if(!nnn||nnn==nn)return;addrActSub('EditNn',index,nnn)}function gEditNn(index,nn){nnn=prompt('Enter the new group name:',nn);if(!nnn||nnn==nn)return;addrActSub('gEditNn',index,nnn)}function addrOtherLoad(GOTO,index,MID){aForm=top.window.document.addrOtherForm;aForm.GOTO.value=GOTO;aForm.index.value=index;aForm.MID.value=MID;aForm.submit()}function groupFormGo(){var aForm=addrOtherView.document.addressForm;var gName=aForm.groupname.value;var gIndex=aForm.group_index.value;inOpts=aForm.in_group.options;var conts='';for(var i=0;i<inOpts.length;i++){conts+=inOpts[i].value+','}addrActSub('enterGroup',gIndex,gName,conts)}function CheckAddrSel(){var whDiv=(whichSrchView==1)?addrBodyView.document.getElementById('mainContacts'):addrBodyView.document.getElementById('addrSearchDiv');var rows=whDiv.getElementsByTagName('TR');var something='';for(i=0;i<rows.length;i++){if(rows[i].chk)something+=','+rows[i].id}if(!something){alert('No contacts selected.')}something=something.replace(/^,/,'');return something}function CopyGlobal(){var whDiv=(whichSrchView==1)?addrOtherView.document.getElementById('mainBook'):addrOtherView.document.getElementById('addrSearchDiv');var rows=whDiv.getElementsByTagName('TR');var something='';for(i=0;i<rows.length;i++){if(rows[i].chk)something+=','+rows[i].id}if(!something){alert('Nothing selected.');return}addrActSub('copyGlobal',something);return;something=something.replace(/^,/,'');if(!CheckAddrSel()) return;aForm=(whichSrchView==1)?addrBodyView.document.addressForm:addrBodyView.document.addrSearchForm;aForm.GOTO.value='CopyGlobal';aForm.globalBook.value='';aForm.submit()}function DelContacts(){aForm=(whichSrchView==1)?addrBodyView.document.addressForm:addrBodyView.document.addrSearchForm;var chkdAddr=CheckAddrSel();if(!chkdAddr)return;chkArr=chkdAddr.split(',');var nums=chkArr.length;var plural=(nums==1)?'':'s';if(!confirm('You are about to delete '+nums+' contact'+plural+'.'))return;addrActSub('delContacts',chkdAddr);for(i=0;i<chkArr.length;i++){var index=chkArr[i];while(gRow=addrBodyView.document.getElementById(index))gRow.parentNode.removeChild(gRow)}}function setAllAddr(chk,global){var screen=global?addrOtherView:addrBodyView;var whDiv=whichSrchView?screen.document.getElementById('mainContacts'):screen.document.getElementById('addrSearchDiv');var rows=whDiv.getElementsByTagName('TR');for(var i=0;i<rows.length;i++){if(rows[i].id){var cbs=rows[i].getElementsByTagName('INPUT');cbs[2].checked=0;cbs[1].checked=0;cbs[0].checked=chk;markRow(rows[i])}}}function AddrOtherGOTO(GOTO){aForm=top.window.addrOtherView.document.addressForm;aForm.GOTO.value=GOTO;aForm.submit()}function NewGroup(){aForm=top.window.addrBodyView.document.addressForm;var chkdAddr=top.window.CheckAddrSel();if(!chkdAddr)return;nf=window.prompt('Please enter a name for your group.','');if(!nf)return;top.window.addrActSub('enterGroup',0,nf,chkdAddr)}function goOpts(){var pf=document.prefForm;var optSel=pf.optMenu;var GOTO=optSel.options[optSel.selectedIndex].value;pf.GOTO.value=GOTO;pf.submit()}function switchCompView(which){if(which){document.body.style.overflowY="hidden";document.getElementById('compDiv').style.visibility='hidden';document.getElementById('spellFrame').style.visibility='visible';document.getElementById('spellFrame').style.left='0px';spellFrame.focus()}else{document.body.style.overflowY="auto";document.getElementById('compDiv').style.visibility='visible';document.getElementById('spellFrame').style.visibility='hidden';document.getElementById('spellFrame').style.left='-2000px'}}function checkSpell(){copyBody();var sf=document.spellForm;sf.spellBody.value=cf.compBody.value;sf.submit()}function SubDraft(which){dsel=cf.draftSel;if(dsel.options[dsel.selectedIndex].value==""){alert('No draft selected.');return}if(which==1){cf.GOTO.value='GetDraft'}else{cf.GOTO.value='DelDraft'}bodyUnc();cf.submit()}function SendMail(){if(cf.submitted.value==1){return}if(cf.to.value==''&&cf.cc.value==''&&cf.bcc.value==''){alert('You have not listed anyone to send this to.');cf.to.focus();return}if(cf.subject.value==''){if(!confirm('You have no Subject. Do you want to continue?')){cf.subject.focus();return}}cf.submitted.value=1;bodyUnc();cf.submit()}function AddSig(){acc=cf.account;account=acc.options[acc.selectedIndex].value;sig=Sigs[account];if(sig==''){alert('no signature for that account');return}if(cf.rtf_mode.value){bDoc().body.innerHTML=sig+bDoc().body.innerHTML}else{cf.compBody.value=sig+cf.compBody.value;cf.compBody.focus()}}function fixSig(){if(bodyC())return;var accId=cf.account.value;if(!accId)return;cf.compBody.value=Sigs[accId]+origBody;copyForm();bodyUnc()}function NewFile(){cf.GOTO.value='NewFile';cf.submitted.value=1;bodyUnc();cf.submit()}function AddAttach(filename){as=cf.attachments;al=as.length;if(as.options[0].value==''){as.options[0].value=filename;as.options[0].text=filename}else{as.options[al]=new Option(filename)}cf.attach_list.value=cf.attach_list.value+filename+',';return 1}function ClearAttach(){as=cf.attachments;al=as.length;for(i=al-1;i>0;i--){as.options[i]=null}as.options[0].value='';as.options[0].text='--Click to Add Files.--';cf.attach_list.value=''}function startNew(){return(confirm('Start a new message?'))}function srchAB(field){var nc=prompt("Enter a partial email address or name to search for.","");if(!nc)return;var posx=(window.screenX?window.screenX:window.screenLeft)+50;var posy=(window.screenY?window.screenY:window.screenTop)+170;window.open("","compSrch","left="+posx+",top="+posy+",width=300,height=300,scrollbars=yes,resizable=yes");var abf=document.compSrchForm;abf.srchStr.value=nc;abf.field.value=field;abf.submit()}function compClose(){if(!bodyC())return;var sdf=opener.document.savedraftForm;for(var i=0;i<sdf.elements.length;i++){var en=sdf.elements[i].name;if(en=='frameId'||en=='GOTO')continue;var cfe=eval('cf.'+en);sdf.elements[i].value=cfe?cfe.value:""}opener.compSave()}function fixCompW(){var dw2=self.innerWidth?self.innerWidth:document.body.offsetWidth;toEl=document.getElementById('to');var fw=dw2-elLeft(toEl)-40;setw('to',fw);setw('subject',fw);setw('compBody',fw+10);nw=(fw-50)/2;setw('cc',nw);setw('bcc',nw)}function compLogOut(){if(cf.compBody){SubmitIt("compLogOut")}}var colArr=[['000000','111111','2d2d2d','434343','5b5b5b','737373','8b8b8b','a2a2a2','b9b9b9','d0d0d0','e6e6e6','ffffff'],['7f7f00','bfbf00','ffff00','ffff40','ffff80','ffffbf','525330','898a49','aea945','c3be71','e0dcaa','fcfae1'],['407f00','60bf00','80ff00','a0ff40','c0ff80','dfffbf','3b5738','668f5a','7f9757','8a9b55','b7c296','e6ebd5'],['007f40','00bf60','00ff80','40ffa0','80ffc0','bfffdf','033d21','438059','7fa37c','8dae94','acc6b5','ddebe2'],['007f7f','00bfbf','00ffff','40ffff','80ffff','bfffff','033d3d','347d7e','609a9f','96bdc4','b5d1d7','e2f1f4'],['00407f','0060bf','0080ff','40a0ff','80c0ff','bfdfff','1b2c48','385376','57708f','7792ac','a8bed1','deebf6'],['00007f','0000bf','0000ff','4040ff','8080ff','bfbfff','212143','373e68','444f75','585e82','8687a4','d2d1e1'],['40007f','6000bf','8000ff','a040ff','c080ff','dfbfff','302449','54466f','655a7f','726284','9e8fa9','dcd1df'],['7f007f','bf00bf','ff00ff','ff40ff','ff80ff','ffbfff','4a234a','794a72','936386','9d7292','c0a0b6','ecdae5'],['7f003f','bf005f','ff007f','ff409f','ff80bf','ffbfdf','451528','823857','a94a76','bc6f95','d8a5bb','f7dde9'],['800000','c00000','ff0000','ff4040','ff8080','ffc0c0','441415','82393c','aa4d4e','bc6e6e','d8a3a4','f8dddd'],['7f3f00','bf5f00','ff7f00','ff9f40','ffbf80','ffdfbf','482c1b','855a40','b27c51','c49b71','e1c4a8','fdeee0']];function compResize(){fixCompW();fixCompH()}function fixCompH(){var nowH=getFrameHeight();var bodyEl=document.getElementById('compBody');var compH=document.getElementById('mainComp').offsetHeight;var bodyH=bodyEl.offsetHeight;var newH;if((compH>origH+4)&&nowH>origH){origH=nowH;if(compH>nowH){return}else{newH=bodyH+nowH-compH}}else{newH=nowH-origH+bodyH;origH=nowH}if(cf.rtf_mode.value)newH-=2;if(newH<100){bodyEl.style.height='100px';clearTimeout(resizeTimer);resizeTimer=setTimeout('Swh()',1000)}else bodyEl.style.height=newH+'px';origH=nowH}function Swh(){onresize=new Function("return false");setWinH("mainComp");origH=getFrameHeight();onresize=compResize}function viewHTML(tmode){textMode=tmode;if(textMode){putText(bDoc().body.innerHTML)}else{bDoc().body.innerHTML=getText()}}function putText(newTxt){if(IE){bDoc().body.innerText=newTxt}else{var html=document.createTextNode(newTxt);bDoc().body.innerHTML="";bDoc().body.appendChild(html)}}function getText(){if(IE)return bDoc().body.innerText;var html=bDoc().body.ownerDocument.createRange();html.selectNodeContents(bDoc().body);return html.toString()}function noEd(){if(textMode){alert('You must uncheck "View HTML" to use the formatting toolbar.');return 1}}function newLink(){if(noEd())return;var nl=prompt('Enter URL(e.g. http://www.atpmail.com)','http://');if(!nl||nl=='http://')return;bDoc().execCommand('CreateLink',false,nl)}function callFormat(fmt){if(noEd())return;bDoc().execCommand(fmt,false,false);bfoc()}function copyBody(){if(cf.rtf_mode.value){cf.compBody.value=textMode?getText():bDoc().body.innerHTML}}function copyForm(){if(!cf.rtf_mode.value)return;if(textMode){putText(cf.compBody.value);cf.compBody.value=getText()}else{bDoc().body.innerHTML=cf.compBody.value;cf.compBody.value=bDoc().body.innerHTML}}function bodyUnc(){bodyChanged=0;copyBody();lastBody=cf.compBody.value}function bodyC(){copyBody();if(bodyChanged)return 1;return(cf.compBody.value!=lastBody)}function initRtf(){bDoc().designMode="On";bDoc().open();bDoc().write("");bDoc().close();fillCol();if(IE){for(var i=0;i<document.all.length;i++)document.all[i].unselectable="on";var sels=new Array('to','subject','cc','bcc','compBody');for(i=0;i<sels.length;i++)document.getElementById(sels[i]).unselectable="off"}copyForm()}function bDoc(iid){var iid='compBody';if(document.getElementById(iid).contentDocument){return document.getElementById(iid).contentDocument}else{return document.frames[iid].document}}function setBody(newBody){cf.compBody.value=newBody;copyForm()}function resetComp(){bodyUnc();document.resetForm.submit()}function showFdd(fimg,ptn){var ftab=fimg.name;ptn='sel'+(ptn?ptn:ftab);clearTimeout(fTimer[ptn]);var pt=document.getElementById(ptn);pt.style.left=elLeft(fimg)+'px';pt.style.top=elTop(fimg)+fimg.offsetHeight+'px';pt.style.visibility='visible';stf.focus();stf.onblur=function(){clearTimeout(blurTimer);fTimer[ptn]=setTimeout("hide('"+ptn+"')",300)}}function showCol(fimg,whTab){clearTimeout(blurTimer);whCol=whTab;showFdd(fimg,"ColTab")}function fmtSel(e,cmd){clearTimeout(blurTimer);var el=e.target?e.target:e.srcElement;while(el.tagName!='TD')el=el.parentNode;if(!el.id)return;var els=el.style;el._oldColor=els.backgroundColor;els.backgroundColor=sel1;el.onmousedown=function(){selFor(cmd,el.id)};el.onmouseout=function(){els.backgroundColor=el._oldColor;els.color=colorU;stfBlur()};el.onmouseup=bfoc}function bfoc(){bodyFrame.focus()}var blurTimer;function stfBlur(e,tab){blurTimer=setTimeout('stf.blur()',1500)}function colMO(e){clearTimeout(blurTimer);var cell=e.target?e.target:e.srcElement;while(cell.tagName!='TD'){if(cell.parentNode){cell=cell.parentNode}else return}cell.style.border="1px inset black";cell.onmouseout=function(){cell.style.border="1px solid #FFF";stfBlur()};cell.onmousedown=function(event){if(!IE){event.preventDefault()}selFor(whCol,cell.style.backgroundColor)};cell.onmouseup=bfoc}function selColor(e){var cell=e.target?e.target:e.srcElement;while(cell.tagName!='TD'){if(cell.parentNode){cell=cell.parentNode}else return}var col=cell.style.backgroundColor;selFor(whCol,col)}function selFor(cmd,val){stf.blur();clearTimeout(blurTimer);bfoc();bDoc().execCommand(cmd,false,val)}var inTimer=new Array();function fmtMO(e){var img=e.target?e.target:e.srcElement;if(img.tagName!='IMG')return;stf.blur();var icn=img.className;if(!icn)return;var imgN=img.name;if(imgN){showPosPop2(img);inTimer[imgN]=setTimeout('hideIt2("'+imgN+'")',1500)}if(icn=='but0'){img.className="but1";img.onmouseup=function(){img.className="but1"};img.onmouseout=function(){img.className="but0";if(imgN)hideIt2(imgN)};img.onmousedown=function(event){if(!IE){event.preventDefault()}img.className="but2";if(imgN)hideIt2(imgN)}}else if(icn=='but3'){img.onmouseup=function(){img.className="but3"};img.onmouseout=function(){img.className="but3";if(imgN)hideIt2(imgN)};img.onmousedown=function(event){if(!IE){event.preventDefault()}img.className="but4";if(imgN)hideIt2(imgN)}}}function fmtMD(e){var img=this;if(!IE)e.preventDefault();var imgN=img.name;if(icn=='but1'){img.className="but2";if(imgN)hideIt2(imgN)}else if(icn=='but3'){img.className="but4";if(imgN)hideIt2(imgN)}}function hideIt2(imgN){clearTimeout(inTimer[imgN]);document.getElementById('popup'+imgN).style.visibility='hidden'}function showPosPop2(el){var thisdiv=document.getElementById('popup'+el.name);thisdiv.style.left=elLeft(el)+5+'px';thisdiv.style.top=elTop(el)+el.offsetHeight+'px';thisdiv.style.visibility='visible'}