//ICMap, Copyright 2006, clifford L. Collins, Collins Software, all rights reserved, http://collinssoftware.com, not for distribution or resale, use License is required: iccommon var ic_background_window=null; var ic_first_message_001=false; function googleLat(y) { var l,h; var ty; ty=y/1048576; h=(2*Math.atan(Math.exp(ty)))-(Math.PI/2); ty=$67(h); return ty; } function googleLong(x) { var tx; tx=x/1048576; tx=$67(tx); return tx; } 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 $66(filename) { var fs; fs=new ActiveXObject("Scripting.FileSystemObject"); return(fs.FileExists(filename)); } function urlToStr_old(url) { try { ic_background_window=window.open(url,"icmap_retrieve_background","height=20,width=40,top=12000,status=yes,toolbar=no,menubar=no,location=no"); if(ic_background_window==null) { if(! ic_first_message_001)alert("%IC-E-PBE, pop-up blocker enabled - recommend adding site /www.collinssoftware.com/ to trusted list"); ic_first_message_001=true; return""; } return(ic_background_window.document.body.innerText); } catch(e){ return"" } } 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){ 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 $67(angle) { var degree; degree=(angle*180.0)/Math.PI; return degree; } function $68(angle) { var radian; radian=(angle/180.0)*Math.PI; return radian; } function $69(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 $70(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 $71(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 $72(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 $74(filename) { if(! $66(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=$75; this.write=$82; this.create=$76; this.openRead=$81; this.writeCommentLine=$82CommentLine; this.read=$80; } function $75() { if(! this.isOpen)return; this.isOpen=false; this.f.close(); this.f=null; } function $76(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=$752; this.write=$82; this.writeCommentLine=$82CommentLine; this.read=$80; this.f=new Object(); this.f.data=''; this.f.writeLine=$78; this.f.readLine=$77; 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 $77() { 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 $78(text) { if(! this.first)this.data=this.data+"\r\n"; this.first=false; this.data=this.data+text; } function $752() { var data; if(! this.isOpen)return""; this.isOpen=false; data=this.f.data; this.f=null; return data; } function $80() { var text; text=this.f.readLine(); return text; } function $81(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 $82(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 $82CommentLine(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; if(temp.indexOf(',')>=0)break; return temp; } temp=temp.replace(/\"/g,"\"\""); return"\""+temp+"\""; } function ic$csv() { this.data=''; this.first=true; this.add=$86; this.clear=$85; this.nextToken=$88; this.deleteColumn=$84; this.split=$87; } function $84(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); } function ic$field(name) { this.name=name.toLowerCase(); this.next=null; this.isKeep=false; if(this.name=='id')this.isKeep=true; this.value=$89; } function $89(value) { var id; var xin; var obj; xin=false; if($89.arguments.length >0)xin=true; id='icField_'+this.name; obj=getObject(id); if(!obj)return''; if(xin){obj.value=value.toString(); } else{ return(obj.value); } } function ic$table(parent) { this.parent=parent; this.topField=null; this.row=0; this.fields=0; this.selectedField=null; this.indexOf=$90; this.addField=$96; this.deleteField=$98; this.findField=$97; this.fieldExists=$99; this.findValue=$91; this.csv=$92; this.value=$93; this.html=$95; this.write=$94; } function $90(name) { var index; index=-1; fld=this.topField; while(fld) { index=index+1; if(fld.name==name)return index; fld=fld.next; } return-1; } function $91(name,icsv) { var fld,csv,text; fld=this.findField(name); if(!fld)return""; csv=new ic$csv(); csv.data=icsv; for(i=0; i 0)xin=true; csv=new ic$csv(); if(xin)csv.data=icsv; fld=this.topField; text=''; while(fld) { id='icField_'+fld.name; if(xin) { text=csv.nextToken(); fld.value(text); } else { csv.add(fld.value()); } fld=fld.next; } text=csv.data; if(! xin)return text; } function $93(name,value) { var text; var id; var xin; var f; xin=false; if($93.arguments.length >1)xin=true; f=this.findField(name); if(!f)return''; if(xin){ f.value(value); } else{ return(f.value())}; } function $94(fd) { var text,fld; text='*define:record, '+Q(this.parent.name)+' '; fld=this.topField; while(fld) { text=text+','+fld.name+':A2048'; fld=fld.next; } text=text+';'; fd.write(text); } function $95() { var text; var nam; var c,cs,cl; var d; var e; var f; var u; var value; var id; var A; var x,y; var hint1,hint2; if(! G.activeNode)return""; text=''; this.selectedField=null; nam=name.toLowerCase(); f=this.topField; while(f) { nam=f.name; id='icField_'+nam; ids='icFieldBox_'+nam; d=" onClick=\"G.selectField('"+f.name+"')\""; e=' style="cursor:pointer;"'; x=''; if(f.isLarge)x=' checked'; y=''; if(f.isKeep)y=' checked'; hint1=''; hint2=''; A=hint1+""+ hint2+""; value=f.value(); nam=""+nam+'  '; text=text+''; text=text+''+nam+''; text=text+''; f=f.next; } text=text+'
'; cs=" onChange=\"G.updateValue('"+f.name+"',this.value)\""; cl=" onChange=\"G.updateValue('"+f.name+"',this.innerText)\""; if(f.isLarge)text=text+''; else text=text+''; text=text+A+'
'; return text; } function $96(name) { var fld; var bot; this.fields=this.fields+1; fld=new ic$field(name); this.selectedField=fld; bot=this.topField; if(bot==null) { this.topField=fld; return fld; } while(bot.next)bot=bot.next; bot.next=fld; return fld; } function $97(name,excludeSelected) { var nam; var f; var check,col; nam=name.toLowerCase(); exclude=false; if(excludeSelected !=undefined)exclude=excludeSelected; col=0; f=this.topField; while(f) { col=col+1; f.column=col; check=true; if((f==this.selectedField)&& exclude)check=false; if(check&&(f.name==nam))return f; f=f.next; } return null; } function $98(name) { var nam; var fld; var prev; var col; nam=name.toLowerCase(); prev=null; col=0; fld=this.topField; while(fld) { col=col+1; if(fld.name==nam)break; prev=fld; fld=fld.next; } if(! fld)return false; this.parent.deleteColumn(col); if(prev) { prev.next=fld.next; if(fld.next){ this.selectedField=fld.next } else{ this.selectedField=prev } } else { this.topField=fld.next; this.selectedField=fld.next; } fld=null; return true; } function $99(name) { var f; f=this.findField(name); if(f)return true; return false; }