<!--
//(c) Zonum Solutions
//March 20, 2008


 function app_onload()
  {

  }

 function app_comments()
  {
   zfr_comments('xy2CAD');
  }

 function app_about()
  {
   var MSG = "<br><center><b>xy2CAD</b>";
   MSG+="<br>Create DXF files from XY data<br><br>(c) 2006-2008 Zonum Solutions</center>";
   zwin_msgbox("About",300,110,"","",MSG);
  }
  
  function app_clear()
  {
   document.frGeo.datamemo.value ="";
  }
  
  function app_Hint()
  {
   var cad="By using the 'TAB' format; you could copy/paste from/to Excel";
   alert(cad);
  }
  
  function hide_dialogo()
 {
   var fr=document.getElementById('divframe');
   fr.style.visibility="hidden";
 }

 function app_loadfile()
 {
  var fr=document.getElementById('divframe');
  fr.style.visibility="visible";
  window.frames['fr2'].location ="../lib/LoadFile.php?TipoFile=CSV/TXT";
 }
 
  function Link_Parent_Close(DataList)
 {
   document.frGeo.datamemo.value = DataList;
   hide_dialogo(); 
 }
  
 function Send_Result()
 {
  myWin = window.open("result.php","result","width=490,height=440,scrollbars");
  if(myWin) {
   if (myWin.focus) {myWin.focus();} 
  }
 } 
 
 function Send_ResultWindow()
 {
  myWin = window.open("_blank","result","width=490,height=440,scrollbars");
  if(myWin) {
   if (myWin.focus) {myWin.focus();} 
  }
 }
 
  
 function Link_Parent_data()
 {
    web_resultado();
  } 
  
  
  function app_example()
  {
   var cad="330702.199,3745246.931\n317465.545,3848203.15\n371467.95,3897214.177";
   cad+="\n461984.09,3778158.9\n411207.306,3653670\n371510.8,3599819.99";
   cad+="\n290502.06,3673883.34\n468895.9,3723534.16";
	 
   var fr = document.frGeo;
	 fr.datamemo.value = cad;
	 zweb_setindex(fr.fcols_in,0);
   zweb_setindex(fr.fseparator_in,0);
   changecols();
   fr.fcheck1.checked=true;
   fr.fcheck2.checked=true;
   fr.fcheck3.checked=false;
  } 
  
  function hasElev_3D()
  {
   var fr = document.frGeo;
   var colsIn = zweb_listIndex(fr.fcols_in);
   var hasElev=(colsIn==2 || colsIn==3 || colsIn==6 || colsIn==7);
   fr.fcheck3d.disabled=(hasElev==false);
   if(hasElev==false) {fr.fcheck3d.checked=false;}
  
   return hasElev
  }
  
  function changecols()
 {
   var a=hasElev_3D();
 }
   
   function app_run()
  {
   var fr =document.frGeo;
   var colsIn = zweb_listIndex(fr.fcols_in);
   var sepaIn =  zget_arrayval(",| |\t",',',zweb_listIndex(fr.fseparator_in));
   var check1= zgechecked_01(fr.fcheck1);
   var check2= zgechecked_01(fr.fcheck2);
   var check3= zgechecked_01(fr.fcheck3);
   var check3D= zgechecked_01(fr.fcheck3d);
   var label = zweb_listIndex(fr.flabel);
   
   xdata = fr.datamemo.value;
   if(xdata.length>3  && xdata!="Upload a file or copy/paste your data here!") {
     xdata="";
     var isOK=true;
     var hasElev=hasElev_3D();
     
     if(label==2 && colsIn<4) {label=0;}   
     if(label==3 && hasElev==false) {label=0;}
     
     if(!ZIsNumeric(fr.fheight.value)) {fr.fheight.value="0.2";}
     if(!ZIsNumeric(fr.frotation.value)) {fr.frotation.value="0";}
     fr.flayer.value=trimLeft(fr.flayer.value," ");
     if(check1=="0" && check2=="0" && check3=="0") {check1="1"; fr.fcheck1.checked=true;}
     
     fr.zin.value=""+colsIn+"|"+sepaIn+"|"+check1+"|"+check2+"|"+check3+"|"+check3D+"|"+label;
     Send_ResultWindow();
     fr.submit();
    //xdata = xdata.replace(/(\r\n|\r|\n)/g, '\n');
    //xdata = xdata.split('\n');
    //web_resultado(sepaIn,sepaOut);
   
   } else {alert("No data to process was found.");}
	 xdata=""; 
  } 
-->
