<!--

function appAbout()
 {
   var MSG = "<center><b>Cotrans Online</b>";
   MSG+='<br>Coordinates Transformation<br><br>';
   MSG+='<br>Last update: Feb 14, 2010';
   MSG+='<br>(c) 2006-2010 Zonum Solutions</center>';
   zwin_msgbox("About",300,140,"","",MSG);
 }

 function app_onload()
  {
   
   if(zModule==4) {zFillCombo(document.frGeo.fUTMZone,1,1,61,"",11);}
   if(zModule==13) {zFillCombo(document.frGeo.fUTMZone,1,1,61,"UTM Zone ",11);}
   if(zModule==14) {zFillCombo(document.frGeo.fUTMZone_in,1,1,61,"UTM Zone ",11);}
   
  }

 function app_title(title)
  {
	 var cad='<font face="Arial" size="4"><br><center><b>'+title+'</b></center></font>';
	 if(es_MSI()) {cad='<fieldset style="width:550px;height:36px">'+cad+'</fieldset>';}
	 zset_innerHTML("mytitle", cad);
  }

 function app_comments()
  {
   zfr_comments('Coordtrans online');
  }

  
  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()
   {
    document.frGeo.datamemo.value="Some data..";
   }
   
   function app_run()
   {
     alert("Run Transformation");
   }
   
  function app_option(n)
   {
    window.location="cotrans.php?module="+n;
   }


 //Http request
 function WebGet(Url,Id)
 { var xmlHttp;
    try
       {  // Firefox, Opera 8.0+, Safari 
			  xmlHttp=new XMLHttpRequest(); 
			 }
        catch (e)
       {  // Internet Explorer
			   try
           {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
            catch (e)
            {    try
              {  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
                catch (e)
               { WebGet_Error(Id);
							   //alert("Your browser does not support AJAX!");  
							   return false; 
							  }
						 }
				}
      xmlHttp.onreadystatechange=function()
      {if(xmlHttp.readyState==4)
        {
         WebGet_Data(Id,xmlHttp.responseText);
        }
      }
   xmlHttp.open("GET",Url,true);
   xmlHttp.send(null);  
}




  //library calculations
  
  
  
  
  function do_test()
  {
   var cad="000123.456000";
   var cad1=trimLeft(cad,'0');
   var cad2=trimRight(cad,'0');
   var cad3=strRight(cad,'.');
   var cad4=strLeft(cad,'.');
   var cad5=trimzeros(cad);
   var msgx="cad="+cad+"\nNo Left="+cad1+"\nNo Right="+cad2+'\nRight='+cad3+'\nLeft='+cad4+'\nNoCeros='+cad5;
   
   alert(msgx);
  }
  
  
  function edit_getval(editcontrol)
  {
   var value =0;

   if(editcontrol.value=="") {value =0;}
   else {value = parseFloat(editcontrol.value);}
   
   return value
 }

 function dms2dd(deg,min,sec)
  {
   var sign=(deg<0);
   deg = (Math.abs(deg) + min/60 + sec/3600)*sign;
   
   return sign
  }


 function value2dd(value)
 {
  //input in dd or dms separated by space
  var deg=parseFloat(value);
  var tmp=value.split(" ");
  
  if(tmp.length>1) {
   deg = parseFloat(tmp[0]);
   var signo=Math.abs(deg)/deg;
	 var min=parseFloat(tmp[1]);
   var sec=0;
   if(tmp.length>2) {sec=parseFloat(tmp[2]);}
   
   deg=(deg+min/60+sec/3600)*signo;
  }
 
  return deg;
 }



 // Object definition ** BEGIN
 function ZDegree(deg,min,sec)
 {
   this.deg = deg;
   this.min = min;
   this.sec = sec;
   this.removezeros=true;
   
   this.set=zd_set_dms;
   this.get_dd=zd_get_dd;
   this.get_dm=zd_get_dm;
   this.fz=zd_formatzeros;
   this.format=zd_format;
   this.from_dd=zd_from_dd;
 }
 
 function zd_set_dms(deg,min,sec)
 {
   this.deg=deg;
   this.min=min;
   this.sec=sec;
 }

 function zd_get_dd()
 {
   var tmp=0;
   var signo=this.deg/Math.abs(this.deg);
   tmp = signo*(Math.abs(this.deg)+(this.min/60)+(this.sec/3600));
   
   return tmp
 }

 function zd_get_dm()
 {
  var tmp=this.min+(this.sec/60);
  
  return tmp
 }

 function zd_from_dd(value)
 {
   this.deg=parseInt(""+value);
   value = Math.abs((value-this.deg)*60);
   this.min = parseInt(""+value);
   this.sec = (value-this.min)*60;
 }

  function zd_formatzeros(value)
  {
   if(this.removezeros) {
    value = trimzeros(value);
    if(value.length==0) {value="0";}
   }
   
   return value
  }

  function zd_format(idformat,sepa,deci)
  {
   var cad="";
   var tmp=0;
   
    switch (idformat){
     case 0: //deg.deci
		        tmp=this.get_dd(); 
		        cad=""+this.fz(tmp.toFixed(deci)); break;
     case 1: //deg min sec.deci 
		        cad=""+this.deg+sepa+this.min+sepa+this.fz(this.sec.toFixed(deci)); break;
		 case 2: //deg min.deci 
		        tmp=this.get_dm();
		        cad=""+this.deg+sepa+this.fz(tmp.toFixed(deci)); break;
	
		 case 3: //deg min sec  with symbols
		        //cad=""+this.deg+"°&deg; "+this.min+"' "+this.sec.toFixed(deci)+"\""; break;
		        cad=""+this.deg+"° "+this.min+"' "+this.fz(this.sec.toFixed(deci))+"\""; break;
		 case 4: //deg min sec  with symbols
		        tmp=this.get_dm();
		        //cad=""+this.deg+"&deg; "+tmp.toFixed(deci)+"'"; break;
						cad=""+this.deg+"° "+this.fz(tmp.toFixed(deci))+"'"; break;												       
   }
   
   return cad
  }
  
  
 // Object definition ** END
  
  
 function zd_dd2dms(value)
  {
   var obj = new ZDegree(0,0,0);
   obj.from_dd(value);
  
   return obj
 } 
  
  
 
 function dms_format(deg,min,sec)
  {
   var cad = ""+deg+"&deg; "+min+"' "+sec+"\"";
   return cad
  }
  
  function dm_format(deg,min,sec)
  {
   min = parseFloat(min)+parseFloat(sec)/60;
   min= ""+min.toFixed(3);
   var cad = ""+deg+"&deg; "+min+"'";
   return cad
  }
  
  
    
  
  
 function dd2dms_sepa(value,sepa,deci)
 {
  var deg=zd_dd2dms(value);
  var value = deg.sec;
  
  value = ""+deg.deg+sepa+deg.min+sepa+value.toFixed(deci);
  
  return value
 } 
 
 

 function dd2dms(value)
 {
  value = dd2dms_sepa(value,",",3);
  return value
 }

 





-->
