//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;
}

//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( isEmpty( form.apellido ) ) {
		document.getElementById('apellido').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('apellido').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";
    }
    if( form.recipient.value == 0 ) {
		document.getElementById('recipient').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('recipient').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 ));
}
//

//Function cuenta regresiva de actualizacion

function countdown(yr,m,d,h,min,sec){
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")	
theyear=yr;themonth=m;theday=d;thehour=h;theminute=min;thesecond=sec
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[m-1]+" "+d+", "+yr+" "+h+":"+min+":"+sec
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
if(dday==0&&dhour==0&&dmin==0&&dsec==1){
document.forms.count.count2.value=current
return
}
else
//document.forms.count.count2.value="Próxima Actualización "+dday+ " dias, "+dhour+":"+dmin+":"+dsec
//document.div.count2.value="Próxima Actualización "+dday+ " dias, "+dhour+":"+dmin+":"+dsec
//document.getElementById("count").innerHTML="Próxima Actualización "+dday+ " dias, "+dhour+":"+dmin+":"+dsec
//setTimeout("countdown(theyear,themonth,theday,thehour,theminute,thesecond)",1000)
}


