function newImage (arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


function preValve() {
	if (document.images) {
		lv = newImage ('pix/instruments/lvalve-over');
		sv = newImage ('pix/instruments/svalve-over');
	}
}


function cv (i, s, d) {
	document['v' + i].src = 'pix/instruments/' + s + 'valve';
	if (d) {
		document['v' + i].src += '-over';
	}
}


var popplayer;
function popaudio (clip, note) {
	var w = (note == 'y') ? 350 : 270;
	var h = (note == 'y') ? 500 : 240;

	if ((popplayer) && (!popplayer.closed)) {
		popplayer.resizeTo(w, h);
	}
	popplayer = window.open ('fabaudio?f=' + clip + '&n=' + note, 'audiopop', 'scrollbars,resizable,width=' + w + ',height=' + h);
	popplayer.focus();
}


var popnote;
function popWin (i) {
	popnote = window.open ('shownote?n=' + i, 'notewin', 'scrollbars,resizable,width=350,height=500');
}


function closePop () {
	if ((popplayer) && (!popplayer.closed)) {
		popplayer.close();
	}
	if ((popnote) && (!popnote.closed)) {
		popnote.close();
	}
}


function noSpam() {
	var link = noSpam.arguments[0];
	var pre = noSpam.arguments[1];

	var myat = String.fromCharCode(64);
	var mydot = String.fromCharCode(46);
	var addr = '';
	var i;
	for (i = 2; i < noSpam.arguments.length; i++) {
		if (addr) {
			addr += (i == pre + 2) ? myat : mydot;
		}
		addr += noSpam.arguments[i];
	}
	
	var str = '';
	if (link) {
		str = '<a href="mailto:' + addr + '">';
		str += (link == 'addr') ? addr : link;
		str += '<\/a>';
	}
	else {
		str = addr;
	}
	
	document.write (str);
}


var nextYear = new Date();
nextYear.setFullYear (nextYear.getFullYear() + 1);
document.cookie = 'visited=yes; expires=' + nextYear.toGMTString();
