<!--
//# (c)2009 Zonum Solutions
//# zonums.js for every tool
//# Last modified: March 19, 2009
//# NO PART may be reproduced without author's permission

 function zget_winsize() {
  var myWidth = 0;
	var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  this.clientHeight = myHeight;
  this.clientWidth = myWidth;
}

function zmoveto(obj,left,top)
 {
   obj.style.position = "absolute";
   obj.style.left = left +"px";
   obj.style.top = top +"px";
 }
  
//@ This function will not be variable-changed  
function zset_resize(objId, width,height)
 {
  var obj = document.getElementById(objId);
   obj.style.width = width +"px";
   obj.style.height = height + "px";
 }


 function Is_MSIE()
 {
   var isX = false;
   if (navigator.appVersion.indexOf("MSIE")!=-1) {isX=true;}

   return isX; 
 }
 
 function zjump2URL(url)
 {
  window.location=url;
 }

 function zas(n)
 {
  var cad="";
  for(i=1; i<n; i++) {
    cad+="&nbsp;";
  }
  return cad;
 }

 function zget_byID(objId)
 {
   return document.getElementById(objId);
 }
 
 function zset_inner(objId, Texto)
 {
  document.getElementById(objId).innerHTML = Texto;  
 }

 function zif(condition,cadtrue,cadfalse)
 {
  if(condition==true) {return cadtrue;} else {return cadfalse;}
 }

 function strcad(myvar, ndeci)
  {  
   var value = parseFloat(myvar);
   value = "" + value.toFixed(ndeci);
   return value;
  }

 function zget_selIndex(obj)
  {
   return obj.options.selectedIndex;
  }
  
 function zset_selIndex(ComboList,index)
 {
   ComboList.options.selectedIndex = index;
 } 

 function zget_radiolist_index( Options)
 {
   var option_selected = 0;
   
   for(i=0;i<Options.length;i++){
    if(Options[i].checked){option_selected = i+1;}
   }
  return option_selected
 }

 function zFillCombo(ComboList,IStart,IStep,N,Cad,Index)
 {
   var SubCad = "" + IStart;
   for (i=1; i<N; i++){
   if(Cad!="") {SubCad = Cad+SubCad;}
   ComboList.options[ComboList.options.length]=new Option(SubCad,"item"); 
   SubCad = "" + (IStart + (IStep*i));
  }
  ComboList.options.selectedIndex = Index;
 }

 function mystr_filter(xtext,filter)
  {
   var subcad="";
	 for(var i=0; i<xtext.length; i++) {
    var cad=xtext.charAt(i);
    if(filter.indexOf(cad)>-1) {
     subcad+=cad;
    }
   }
   
   return subcad;
  }

 function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
 }
 function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
 }
 function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
 }

 function getinput_int(text)
  {
	 var value=mystr_filter(text,"-0123456789");
	 if(value.length=0) {value=null;}
	 return value; 
	}	 

 function getinput_float(text)
  {
	 var value=mystr_filter(text,"-.0123456789");
	 if(value.length=0) {value=null;}
	 
	 return value; 
	}


 function myErrorCad(condition,newtext,text)
 {
  if(condition==true) {if(text=="") {text=newtext;} else {text+="\n"+newtext;}}
  return text;
 }
 
 function myErrorCad_Show(text)
 {
  if(text.length>0) {alert(text);}
 }
 
 
 function ZAppendObj(id)
 	 {
 	   var newdiv = document.createElement('div');
     newdiv.id = id;
     document.body.appendChild(newdiv);
     return document.getElementById(id);
 	 }
 	 
 	 function ZRemoveObj(id)
 	 {
	  var obj = document.getElementById(id);
	  if(obj) {document.body.removeChild(obj);}
 	 }
 	 
  function isMouseLeaveOrEnter(e, handler) 
		{
		 if (e.type != 'mouseout' && e.type != 'mouseover') return false;
		  var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;
			 while (reltg && reltg != handler) reltg = reltg.parentNode;
			 return (reltg != handler);
	  }
 	 
 	 function ZPopMenu(winID,x,y,width,loptions,func)
 	 {
 	   if(func===undefined) {func="";}
 	   //winID="MenuID-"+winID;
 	   winID="popMenu74"
 	   ZZClosePop();
     var newdiv = ZAppendObj(winID);
     /*var newdiv = document.createElement('div');
     newdiv.id = winID;
     document.body.appendChild(newdiv);
     */
     newdiv.style.position="absolute";
     newdiv.style.left=x+"px";
     newdiv.style.top=y+"px";
		 newdiv.style.width=width+"px";
		 newdiv.style.height="20px";
		 newdiv.style.zIndex=1000;
		 
    var tmpcad='<div class="zmenu" style="position:relative;left:0px; top:0px;width:'+width+'px;font-family:Arial;font-size:12px;"';
	   tmpcad+=" onmouseout=\"ZClosePop(event,this,'"+winID+"');\"><center>";
	   loptions=loptions.split("\n");
	   var txtfun="";
	   var optionfunc="";
	   var tmpoption=0;
	   for(var i=0; i<loptions.length; i++) {
	    var line=loptions[i];
	     if(line=="--") {line='<hr>';} else
			 { 
			  tmpoption++;
			  optionfunc=line.split("|")[1];
			  line=line.split("|")[0];
			  var fl=line.substr(0,1);
			  if(fl!="*") {
			    if(optionfunc) {txtfun=optionfunc;} else {txtfun=(func.length>0)? func+tmpoption+");ZZClosePop()":"ZZClosePop()";}
	        if(txtfun.length>0) {txtfun=' onclick="'+txtfun+'"';}
	      } else {
	       line=line.substr(1);
	       txtfun="color:green; ";
	       line='<i><font color="silver">'+line+'</font></i>';
	      }
	      line='<div style="width:'+(width-4)+'px" '+txtfun+'>&nbsp;&nbsp;'+line+'</div>';
	      
	     }
			 tmpcad+=line;
	   }
	   tmpcad+='</center></div>';
     newdiv.innerHTML=tmpcad;
 	 }
 	 
 	 function ZZClosePop()
 	 {
 	   ZRemoveObj("popMenu74");
 	   var obj=window.zmenu;
 	   if(obj) {clearInterval(obj);}
 	 }
 	 
 	 function ZClosePop(e,a)
 	 {
 	  if(isMouseLeaveOrEnter(e,a)) {window.zmenu=setInterval('ZZClosePop()',500);}
 	 }	 
 	 

 function zopen_window(url,name,props,isresize)
 {
  if(url=="") {url="_blank";}
  if (isresize === undefined ) {isresize=true;}
  if(isresize==true) {isresize=",resizable=yes";} else {isresize="";}
  if(props=="") {props="width=490,height=440,scrollbars";}
  myWin = window.open(url,name,props+isresize);
  if(myWin) {
   if (myWin.focus) {myWin.focus();} 
  }
 }

function get_disclaimerTXT()
  {
  var cadena ='BY <b>USING THE SOFTWARE, YOU ';
  cadena +='ARE AGREEING </b>TO BECOME BOUND BY THE TERMS OF THIS AGREEMENT. IF ';
  cadena +='YOU DO NOT AGREE TO THE TERMS OF THE AGREEMENT, DO NOT USE THE ';
  cadena +='SOFTWARE.<br><br>';

cadena +='YOU ACKNOWLEDGE AND AGREE <b>THAT THE SOFTWARE IS PROVIDED "AS IS" ';
cadena +='AND WITHOUT WARRANTY OF ANY KIND.</b>  ALL WARRANTIES, CONDITIONS, ';
cadena +='REPRESENTATIONS, INDEMNITIES AND GUARANTEES WITH RESPECT TO THE ';
cadena +='SOFTWARE, WHETHER EXPRESS OR IMPLIED, ARISING BY LAW, CUSTOM,';
cadena +='PRIOR ORAL OR WRITTEN STATEMENTS BY ZONUMS (ZONUM SOLUTIONS) OR '; 
cadena +='OTHERWISE (INCLUDING, BUT NOT LIMITED TO WARRANTIES THAT THE CODE IS '; 
cadena +='FREE OF DEFECTS, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, '; 
cadena +='COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL '; 
cadena +='DAMAGES OR LOSSES, MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS '; 
cadena +='FOR PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT) ARE HEREBY '; 
cadena +='OVERRIDDEN, EXCLUDED AND DISCLAIMED.<br><br>';

cadena +='UNDER NO CIRCUMSTANCES WILL ZONUMS BE LIABLE TO YOU FOR ANY ';
cadena +='DIRECT, CONSEQUENTIAL, INDIRECT OR SPECIAL, PUNITIVE OR INCIDENTAL '; 
cadena +='DAMAGES, WHETHER FORESEEABLE OR UNFORESEEABLE, BASED ON YOUR '; 
cadena +='CLAIMS OR THE CLAIMS OF ANY THIRD PARTY, WHETHER BASED ON THIS '; 
cadena +='AGREEMENT, ANY COMMITMENT PERFORMED OR UNDERTAKEN UNDER ON OR '; 
cadena +='IN CONNECTION WITH THIS AGREEMENT OR OTHERWISE.<br><br>';

cadena +='<b>ANY PERSON WHO USES THIS PRODUCT DOES SO AT HIS/HERS SOLE RISK AND ';
cadena +='WITHOUT LIABILITY TO ZONUMS.</b><br><br><br>';
   return cadena;
  }
  
 function get_commentsCODE(SoftwareTool)
 {
  var cad ='<div style="position:absolute; left:5px; top:2px; width:370px; height:150px;font-family: Arial, Helvetica, sans-serif; font-size: 9pt"/>';
  cad +='<form name="frComment">';
  //cadena += 'email:<input type="text" name="email" style="width: 145px">(optional)<br>';
  cad += '<textarea name="datamemo" rows="5" cols="20" style="width:360px; height:140px"></textarea>';
  //cadena +=' <input type="submit" name="but1" value="Send">';
  cad +=' <input type="button" name="php" value="Send..." onclick="zfr_sendphp()">&nbsp;&nbsp;&nbsp;&nbsp;If you want feed back, please include email.';
  cad +='<input TYPE="hidden" NAME="softool" VALUE="'+SoftwareTool+'"></form></div>';
  
  return cad;
 } 
  
  function zDonate(id)
  {
   zopen_window("http://www.zonums.com/donate.php?id="+id,"help","");
  }
  
  function zhelp_UTM()
  {
   zopen_window("http://www.zonums.com/library/utmgrid.html","help","");
  }
 --> 



