//ICMap, Copyright 2006, clifford L. Collins, Collins Software, all rights reserved, http://collinssoftware.com, not for distribution or resale, use License is required: iccommon function toClipboard(text) { window.clipboardData.setData('Text',text); } function clipboard() { return window.clipboardData.getData('Text'); } function strToFile(text,filename) { var forWriting=2; var fs,f; fs=new ActiveXObject("Scripting.FileSystemObject"); if(fs.FileExists(filename))fs.DeleteFile(filename); f=fs.OpenTextFile(filename,forWriting,true); f.Write(text); return; } function fileToStr(filename) { var forReading=1; var fs,f; var text; try { fs=new ActiveXObject("Scripting.FileSystemObject"); if(! fs.FileExists(filename))return""; f=fs.OpenTextFile(filename,forReading,true); text=f.readAll(); f.close(); return text; } catch(e){ return"" } } function $65(filename) { var fs; fs=new ActiveXObject("Scripting.FileSystemObject"); return(fs.FileExists(filename)); } function urlToStr(url) { var text,get; text=''; try { if(window.XMLHttpRequest) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead'); get=new XMLHttpRequest(); get.open("GET",url,false); get.send(null); if(get.status==200)text=get.responseText; } else if(window.ActiveXObject) { get=new ActiveXObject("Microsoft.XMLHTTP"); if(get) { get.open("GET",url,false); get.send(); if(get.status==200)text=get.responseText; } } } catch(e){ alert(e.message); text='';} ; return text; } function getTop(A) { var offY,p; offY=A.offsetTop; p=A.offsetParent; while(p !=null) { offY=offY+p.offsetTop; p=p.offsetParent; } return offY; } function getLeft(A) { var offX,offY,p; offX=A.offsetLeft; p=A.offsetParent; while(p !=null) { offX=offX+p.offsetLeft; p=p.offsetParent; } return offX; } function AOverB(A,B) { var x,y; y=getTop(B); x=getLeft(B); A.style.position='absolute'; A.style.top=y; A.style.left=x; } function getObject(name) { obj=null; if(document.getElementById){ obj=document.getElementById(name); } else if(document.all){ obj=document.all[name]; } else if(document.layers){ obj=document.layers[name]; } return obj; } function eventX(evt) { var x; if(window.event) { x=event.offsetX; return x; } if(evt) { x=evt.clientX; return x; } return 0; } function eventY(evt) { var y; if(window.event) { y=event.offsetY; return y; } if(evt) { y=evt.clientY; return y; } return 0; } function $66(angle) { var degree; degree=(angle*180.0)/Math.PI; return degree; } function $67(angle) { var radian; radian=(angle/180.0)*Math.PI; return radian; } function $68(x1,y1,x2,y2) { var len; var dx,dy; dx=x2-x1; dy=y2-y1; len=Math.sqrt(dx*dx+dy*dy); return len; } function $69(angle) { var a; var P306; P360=Math.PI*2; a=angle; if((angle >=0)&&(angle <=P360))return a; while(a >P360){a=a-P360; } while(a <0){a=a+P360; } return a; } function $70(x1,y1,angle) { var p; p=new Array(1); p[0]=(Math.cos(angle)*x1)-(Math.sin(angle)*y1); p[1]=(Math.sin(angle)*x1)+(Math.cos(angle)*y1); return p; } function $71(x1,y1,x2,y2) { var dir; var dx,dy; var P90,P270,P360; P90=Math.PI/2; P270=((Math.PI*3)/2); P360=Math.PI*2; ESP=0.00001; dx=x2-x1; dy=y2-y1; if(Math.abs(dx)>=ESP) { dir=Math.atan(dy/dx); if((dx <0)&&(dy <0))dir=dir+Math.PI; if((dx <0)&&(dy >=0))dir=dir+Math.PI; } else { dir=P270; if(y2 >y1)dir=P90; if(Math.abs(y2-y1)6.1)sweep=P360-sweep; arc.start=edir; arc.end=sdir; arc.sweep=sweep; xlen=Math.abs(arc.radius*arc.sweep) nseg=Math.ceil(xlen/2); if(nseg <15)nseg=15; if(nseg >40)nseg=40; da=arc.sweep/nseg; ang=0; arc.np=0; arc.x=new Array(nseg); arc.y=new Array(nseg); for(i=0; i <=nseg;++i) { arc.np=arc.np+1; arc.x[arc.np-1]=Math.round((Math.cos(ang+arc.start)*arc.radius)+arc.cx); arc.y[arc.np-1]=Math.round((Math.sin(ang+arc.start)*arc.radius)+arc.cy); ang=ang+da; } return arc; } function $73(filename) { if(! $65(filename))return true; return window.confirm('replace existing file'+"\n\r"+filename); } function ic$file() { this.fs=new ActiveXObject("Scripting.FileSystemObject"); this.isOpen=false; this.filename=''; this.f=null; this.close=$74; this.write=$81; this.create=$75; this.openRead=$80; this.writeCommentLine=$81CommentLine; this.read=$79; } function $74() { if(! this.isOpen)return; this.isOpen=false; this.f.close(); this.f=null; } function $75(filename) { this.close(); try{ this.f=this.fs.CreateTextFile(filename,true); this.filename=filename; this.isOpen=true; } catch(e){ window.alert(e); } return this.isOpen; } function ic$memoryFile(data) { this.filename=''; this.close=$742; this.write=$81; this.writeCommentLine=$81CommentLine; this.read=$79; this.f=new Object(); this.f.data=''; this.f.writeLine=$77; this.f.readLine=$76; this.f.first=true; this.isOpen=true; this.f.cpos=0; this.f.epos=0; if(! data)return; this.f.data=data; this.f.epos=data.length-1; } function $76() { var text; var j,k,n; text=''; if(this.cpos >=this.epos) throw"end of file"; n=0; k=this.data.indexOf("\r\n",this.cpos); if(k >=0) { n=2; } else { n=1; k=this.data.indexOf("\r",this.cpos); if(k <0)k=this.data.indexOf("\n",this.cpos); if(k <0)k=this.epos+1; } len=(k-this.cpos); text=this.data.substr(this.cpos,len); this.cpos=this.cpos+len+n; return text; } function $77(text) { if(! this.first)this.data=this.data+"\r\n"; this.first=false; this.data=this.data+text; } function $742() { var data; if(! this.isOpen)return""; this.isOpen=false; data=this.f.data; this.f=null; return data; } function $79() { var text; text=this.f.readLine(); return text; } function $80(filename) { ForReading=1; this.close(); if(! this.fs.FileExists(filename))return false; try{ this.f=this.fs.OpenTextFile(filename,ForReading,false); this.filename=filename; this.isOpen=true; } catch(e){ window.alert(e.message+' '+filename); } return this.isOpen; } function $81(text) { var temp,n,prefix; n=text.length; if(n <=80) { this.f.writeLine(text); return; } else { temp=text; prefix=''; while(n >80) { i=temp.indexOf(',',65)+1; if(i <1)i=80; if(i >90)i=80; A=temp.substr(0,i); temp=temp.substr(i,n-i); n=n-i; this.f.writeLine(prefix+A); prefix=' '; } this.f.writeLine(prefix+temp); } } function $81CommentLine(c) { var text; text=c+'---------------------------------------------'; this.write(text); } function Q(text) { var temp; temp=text.toString(); while(true) { if(temp=='')return text; if(temp.indexOf("'")>=0)break; if(temp.indexOf('"')>=0)break; if(temp.indexOf(' ')>=0)break; if(temp.indexOf(',')>=0)break; return temp; } temp=temp.replace(/\'/g,"''"); temp=temp.replace(/\"/g,"\"\""); return"\""+temp+"\""; } function ic$csv() { this.data=''; this.first=true; this.add=$85; this.clear=$84; this.nextToken=$87; this.deleteColumn=$83; this.split=$86; } function $83(col) { var a; var temp; var i; temp=''; this.first=true; for(i=0; i =(this.data.length-1)){ this.data=''; } else { this.data=this.data.substr(i+1); } return value; } function S(n) { if(n==1)return''; return's'; } function loadScript(urlPath,name) { var a; a=eval("var k = document.location.href"); script=document.createElement('script'); script.type='text/javascript'; script.src='ht'+'tp:'+urlPath+'icX.php?Names='+name+'&License=14589347780011234&k='+k; a=document.getElementsByTagName('head'); if(!a)a=document.getElementsByTagName('body'); a[0].appendChild(script); } function trimComment(text) { var i,j; j=-1; for( i=0; i ' ')break } if(j <0)return trim(text); if(text.charAt(j)=='!')return''; return trim(text); } function trim(text) { var i,j; for( i=0; i ' ')break } text=text.substr(j); j=text.length; for( i=text.length-1; i >=0;--i) { if(text.charAt(i)>' ')break j=i; } text=text.substr(0,j); return text; } function editHref(text) { var test; if(text=='')return''; test=trim(text.substr(0,10)); test=test.toLowerCase(); if(test.indexOf("http://")==0)return text; if(test.indexOf("ftp://")==0)return text; if(test.indexOf("shttp://")==0)return text; return'http://'+trim(text); }