//<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
// Detect browser
var IE,NS,N6,OP;
if (document.all) {
  IE=true;
} else if (document.layers) {
  NS=true;
} else if (document.getElementById) {
  N6=true;
} else {
  OP=true;
}
// Select appropriate CSS link
//if (IE) {
//	links=document.all.tags("link");
//	links[0].disabled=true;
//	links[1].disabled=false;
//}
// Warn if screen size too small
var bestwidth = 800;
var bestheight = 600;
if (screen.width < bestwidth||screen.height<bestheight) {
    msg = "This site is at its best when viewed with a screen\n"
    + "set to " + bestwidth + "x" + bestheight + " resolution or higher, "
    + "but your screen\nresolution is only " + screen.width + "x"
    + screen.height + ".\n\nYou should, if possible, increase your screen resolution\n"
    + "to enhance your viewing of this and other sites.";
    alert(msg);
}
//Preload navigation buttons
a0Out=new Image(160, 160);
a0Out.src="images/enter1.gif";
a0Over=new Image(160, 160);
a0Over.src="images/enter2.gif";
a1Out=new Image(145, 35);
a1Out.src="images/menu1.gif";
a1Over=new Image(145, 35);
a1Over.src="images/menu2.gif";
a2Out=new Image(164, 20);
a2Out.src="images/book1.gif";
a2Over=new Image(164, 20);
a2Over.src="images/book2.gif";
a5Out=new Image(23, 8);
a5Out.src="images/here3.gif";
a5Over=new Image(23, 8);
a5Over.src="images/here4.gif";
a6Out=new Image(164, 20);
a6Out.src="images/basket1.gif";
a6Over=new Image(164, 20);
a6Over.src="images/basket2.gif";
a7Out=new Image(164, 35);
a7Out.src="images/admin1.gif";
a7Over=new Image(164, 35);
a7Over.src="images/admin2.gif";
a8Out=new Image(164, 20);
a8Out.src="images/menu01.gif";
a8Over=new Image(164, 20);
a8Over.src="images/menu01-on.gif";
a9Out=new Image(164, 20);
a9Out.src="images/menu14.gif";
a9Over=new Image(164, 20);
a9Over.src="images/menu14-on.gif";
a10Out=new Image(164, 20);
a10Out.src="images/menu16.gif";
a10Over=new Image(164, 20);
a10Over.src="images/menu16-on.gif";
// Rollover
function swapButton(imgName, state) {
	if (document.images) {
	document.images[imgName].src=eval(imgName+state+".src");
	}
}
// Set global variables for centering pop-up windows
var w=screen.availWidth;
var h=screen.availHeight;
// Function for creating a pop-up window to display a page specified by url.
var url_pop=null;
var popWidth=520;
var popHeight=260;
function openUrlWindow(url) {
    // First close any pop-up that is open. 
    if(url_pop!=null) if(!url_pop.closed) url_pop.close();
    // Open the window and let the url document fill it
    url_pop=window.open(url,"url_pop","resizable,scrollbars,width="+popWidth+",height="+popHeight+",left="+((w-popWidth-10)*.5)+",top="+((h-popHeight-30)*.5)+"");
}
function closeUrlWindow() {
	if (url_pop != null) url_pop.close();
}
// Function for creating a pop-up window to display tutor page specified by url.
var url_tutor=null;
var popWidth2=350;
var popHeight2=175;
function openTutorWindow(url) {
    // First close any pop-up that is open. 
    if(url_tutor!=null) if(!url_tutor.closed) url_tutor.close();
    // Open the window and let the url document fill it
    url_tutor=window.open(url,"url_tutor","width="+popWidth2+",height="+popHeight2+",left="+((w-popWidth2-10)*.5)+",top="+((h-popHeight2-30)*.5)+"");
}
// Check for numerical entry in form
function checkData(){
	testVar=checkDigits(document.booking.places.value);
	if (testVar == 0) {
	alert("Please enter a proper number.");
	return(false);
	}
	if ((document.booking.places.value)== 0) {
	alert("The number cannot be zero.");
	return(false);
	}
	return(true);
}
function checkDigits(inString) {
	if(inString.length==0) return(false);
	var refString="1234567890";
	for (count=0; count<inString.length; count++) {
		tempChar=inString.substring(count,count+1);
		if(refString.indexOf(tempChar,0)==-1);
			return(false);
	}
	return(true);
}
function checkPlaces (form) {
	var quantity=Number(form.quantity.value);
	var places=Number(form.places.value);
	if (quantity > places) {
		alert ("Sorry, there are only "+places+" places left on this course!");
		form.quantity.value = places;
	}
}
