// IBAN calculator JavaScript - copyright 2005 Bernhard Barkow, creativeeyes.at
var whitespace=" \t\n\r", flTO=0, flCnt=0;
function chkForm(cv) {
	var b=true,f=document.forms[0];
	if (cv==0) {
		if (b) { b = !(isEmpty(f.iso.value)); if (!b) { alertDlg('a country'); } }
		if (b) { b = !(isEmpty(f.blz.value)); if (!b) { alertDlg('a bank identification'); } }
		if (b) { b = !(isEmpty(f.acc.value)); if (!b) { alertDlg('an account number'); } }
	} else if (cv==1) {
		if (b) { b = !(isEmpty(f.iban.value)); if (!b) { alertDlg('an IBAN'); } }
	}
	return b;
}
function isEmpty(t) { // true if string t is empty or whitespace
	var i,j=t.length;	for (i=0; i < j; i++) { if (whitespace.indexOf(t.charAt(i)) < 0) return false; } return true;
}
function alertDlg(t) { alert('Please enter '+t+'!'); }

function flashNote(s) {
	BB_swapFlash(s); if(flTO==0) { flTO=window.setInterval('BB_swapFlash("'+s+'")',500); }
}
function BB_swapFlash(s) {
	var o=document.getElementById(s); if(o!=null) {
		if(!RegExp(/\balert\b/).test(o.className)) o.className+=" alert"; 
		else { o.className=o.className.replace(/[\s]?alert\b/,"");
			flCnt++; if(flCnt>4) { clearInterval(flTO); flTO=0; flCnt=0; } } }
}

