//convierte a formato de monedas
function money(amount) {
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}


/*
Script coloca fecha actual en el sitio en formato 'Guatemala dia de mes año hora'
Live Date Script- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
visit http://www.dynamicdrive.com
*/

   
function getthedate(idio){
   if(idio == '1'){	
      var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
      var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
   }else{
      var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
      var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")	   
   }
   
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
//var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
if(idio == '1'){
   var cdate="Guatemala "+daym+" de "+montharray[month]+" "+year+", "+hours+":"+minutes+":"+seconds+" "+dn
+""
}else{
   if(daym==01){
	   daym = daym+"st"
   } 
   if(daym==02){
	   daym = daym+"nd"
   }
   if(daym==03){
	   daym = daym+"rd"
   }   
   if(daym > 03){
	   daym = daym+"th"	   
   }
   var cdate="Guatemala, "+montharray[month]+" "+daym+", "+year+", "+hours+":"+minutes+":"+seconds+" "+dn
+""	
}
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate(idio)
function goforit(idioma){
  if(idioma==''){
  if (document.all||document.getElementById)
  setInterval("getthedate(1)",1000)
  }else{
  if (document.all||document.getElementById)
  setInterval("getthedate(0)",1000)
  }

}

/*Fin script de hora*/

//valida formulario de contacto
function checkForm( form ) {
 var errorCount = 0;
// If the form is empty, display message
    if( isEmpty( form.nombre ) ) {
		document.getElementById('nombre').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('nombre').className = "formCaption";
    }	
// If the email address is not 'valid' display a message
    if( notValidEmail( form.correo1 ) ) {
		document.getElementById('correo1').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('correo1').className = "formCaption";
    }	

// Otherwise, if everything is ok...return true and let the email send.
	if (errorCount) return false;
		else return true;
}
// Checks to see if form element is empty
function isEmpty( str) {
    strRE = new RegExp( );
    strRE.compile( '^[s ]*$', 'gi' );
    return strRE.test( str.value );
}
// Checks to see if email address is 'valid'
function notValidEmail( str ) {
    mailRE = new RegExp( );
    mailRE.compile( '^[._a-z0-9-]+@[.a-z0-9-]+[.]{1}[a-z]{2,4}$', 'gi' );
    return !(mailRE.test( str.value ));
}
//
