//var valordolar = DolarAcuerdo.replace(/[^\d]/g, '');

var valordolar = 582;

$(document).ready(function(){

		$('.slideToggle').click(function(){

			$($(this).attr('href')).slideToggle();
			if($(this).hasClass('self')) $(this).slideToggle();
			return false;

		});


});

function CalcularValor(form){
	var cifra = form.cifra.value*1; // lo multiplicamos por uno para que sea un integer
	if(cifra == '' || typeof(cifra) != 'number') {
		alert('Necesitas ingresar un valor!');
	} else{
		if(form.direccion[0].checked){
			$('#resultado').html('US$ '+ cifra + ' = Ch$ ' + cifra*valordolar);
		} else{
			$('#resultado').html('Ch$ '+ cifra + ' = US$ ' + cifra/valordolar);
		}
	}
	return false;
}

function showOverlay(){

	var closeable = arguments[0] || true;

	// the opacity thingy doesn't work well on firefox and camino on mac, so we have to use a PNG background
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('mac') != -1 && (ua.indexOf('firefox')!=-1 || ua.indexOf('camino')!=-1)) {
		$('#overlay').removeClass('opacity').addClass('macffhack');
	}

	$('#overlay').show().next().show();

	if(closeable){
		// close it on click outside the box content
		$('#overlay').click(function(){ hideOverlay(); });
		// close it on ESC keypress if the overlay is visible
		$(document).keyup(function(e) {
			var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
			if (key == 27 && $('#overlay').is(':visible')) {
				hideOverlay();
			}
		});
	}
	return false;
};

function hideOverlay(){
	$('#overlay').hide().next().hide();
};
