function loadTour(location, height) {
	if(/\#(\d+)$/.test(location)) {
		var match = /^(.*)\#(\d+)$/.exec(location);
		location = match[1];
		height = match[2];
	}

	var description = null;
	
	//alert(tour_information[location]);
	
	if(description = tour_information[location]) {
		$("#bvt-iframe").attr({ "src": location, "height": height });

		if(description["title"]) {
			$("#bvt-col1 h1").text(description["title"]);
		}
		if(description["copy"]) {
			$("#bvt-col1 p").text(description["copy"]);
		}
	} else {
		window.open(location); return false;
	}
}

$(function() {
	$("select#select-tour").change(function() {
		loadTour($(this).val());
	});

	$("a[target=bvt-iframe]").click(function() {
		var href = this.href.toString();
		var height = null;
		if(/^http/i.test(href)) {
			var captures = /^http\:\/\/.*?(\/.*?)(\#\d+)?$/i.exec(href);
			href = captures[1];
			height = captures[2];
		}
		$('select#select-tour').val(href + height);
		loadTour(this.href.toString());
		return false;
	});
});

