
function cal_switch(curr_dy, artform) {
	for (var i=0; i<=31; i++) {
		if (document.getElementById("dy_"+i)) {
			document.getElementById("dy_"+i).className = 'calendar-off';
		}
	}
	document.getElementById("dy_"+curr_dy).className = 'calendar_artform';//'calendar-'+artform;
}

var rolling = true;
function preload() {
	if (document.images) {
		var dir = arguments['0'];
			for (var i=1; i<arguments.length; i++) {
				if (arguments[i] == 'done') rolling = true;
				else {
					eval(arguments[i]+'_off = new Image()')
					eval(arguments[i]+'_off.src = dir+"'+arguments[i]+'_off.gif";')
			}
		}
	}
}

function preloadon() {
	if (document.images) {
		var dir = arguments['0'];
			for (var i=1; i<arguments.length; i++) {
				if (arguments[i] == 'done') rolling = true;
				else {
					eval(arguments[i]+'_on = new Image()')
					eval(arguments[i]+'_on.src = dir+"'+arguments[i]+'_on.gif";')
			}
		}
	}
}

preload('http://www.barbican.org.uk/images/header/generic/','visitor_infomation','membership','login_register','logout','event_calendar');
preload('http://www.barbican.org.uk/images/footer/','about_the_barbican','restaurants_and_bars','tsponsorship','media_relations','contact_us','terms_and_conditions','how_to_book','site_map')
preloadon('http://www.barbican.org.uk/images/header/on/','art','banqueting','conferences','dance','education','film','music','theatre','trade_exhibitions','visitor_infomation','membership','login_register','logout','event_calendar','book_tickets');
preloadon('http://www.barbican.org.uk/images/footer/','about_the_barbican','restaurants_and_bars','tsponsorship','media_relations','contact_us','terms_and_conditions','how_to_book','site_map')

function roll(i,s) {
	if(rolling) document.images[i].src = eval(i + '_' + s + '.src');
}
function rollref(i,s,ref) {
	if(rolling) document.images[i+ref].src = eval(i + '_' + s + '.src');
}

function spawn(url, nameW, w, h) {
	if (navigator.appVersion.indexOf('4') != -1) {
		// Vars for centering the new window on Version 4 Browsers
		x4 = screen.width/2 - (w/2);
		y4 = screen.height/2 - (h/2);
		popwin = window.open(url, nameW, 'height='+h+',width='+w+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + x4 + ',top=' + y4 + '');
	} else {
		popwin = window.open(url, nameW, 'height='+h+',width='+w+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
	}
	if(popwin) popwin.remote = self;
}

