		//////////////////////////////////////////////////////////////////////
		// All scripts Copyright (c) 2005 - Jupiter Information Technology  //
		//                    All rights reserved                           //
		//////////////////////////////////////////////////////////////////////
		// These functions are used in:                                     //
		//                       index.html                                 //
		//                       calculator.html                            //
		//                       newsletter.html                            //
		//                                                                  //
		//////////////////////////////////////////////////////////////////////

		//////////////////////////////////////////////////////////////////////
		// Miscellaneous functions
		//////////////////////////////////////////////////////////////////////

		function OptimumSize(){
			// we want to display the pages at their optimum size, always
			// in particular we want to ensure that the page displays in a standard
			// aspect ratio, NOT widescreen
			window.moveTo(0,0);
			if (window.screen.availWidth >= 1024){
				if (window.screen.availHeight <= 768){
					window.resizeTo(1024, screen.availHeight);
				}
				else {
					window.resizeTo(1024, 768);
				}
			}
			else if (window.screen.availWidth >= 800 && window.screen.availWidth < 1024){
				window.resizeTo(800, screen.availHeight);
			}
			else {
				alert("This web site needs a minimum screen resolution of 800 x 600");
				window.resizeTo(800, screen.availHeight);
				}
		}




		function newWin(url, winHeight,winWidth, flag) {
		// Create a resizable, menued window with or without a scrollbar
		// flag parameter is optional
		// if flag = {0 | no | false}, then no scrollbar
		// if flag = {1 | yes | true}, display a scrollbar
		// the default is to display a scrollbar
			var winNew

			switch(flag){
				case 0:
				case "no":
				case "false":
					winNew = window.open(url,'winNew','height=' + winHeight + ',width=' + winWidth + ',scrollbars=0, screenX=15, screenY=15,resizable=1,menubar=1');
					break;
				case 1:
				case "yes":
				case "true":
				default:
					winNew = window.open(url,'winNew','height=' + winHeight + ',width=' + winWidth + ',scrollbars=1, screenX=15, screenY=15,resizable=1,menubar=1');
					break;
			}
			return false;
		}
		
		function popUp(url, winHeight,winWidth, flag, offX, offY){
		// if flag = {0 | no}, then no scrollbar
		// if flag = {1 | yes}, display a scrollbar
		// offX and offY are screen placement co-ordinates (ie, offsets from 0,0)
				winOpen = window.open(url,'winOpen','height=' + winHeight + ',width=' + winWidth + ',scrollbars=' + flag + ',screenX=' + offX + ',screenY=' + offY + ',resizable=0,menubar=0');
		}
		



		// Enable an alternative textbox, depending upon results of primary textbox
		function enableOther(othername, thisval, otherval) {
			othername.value = "";
			othername.disabled = (thisval != otherval);
			if (othername.disabled){
				othername.style.backgroundColor = "#C0C0C0";
			}
			else {
				othername.style.backgroundColor = "#FFFFFF";				
			}
		}



		function obMail(recipient) {
			var contact = "Jupiter Information Technology"
			// var email = "webmaster"
			var emailHost = "jup-it-er.co.uk"
			document.write("<a href=" + "mail" + "to:" + recipient + "@" + emailHost+ ">" + contact + "</a>" )
		}


		//////////////////////////////////////////////////////////////////////
		// Character functions
		//////////////////////////////////////////////////////////////////////
		function isLetter (c)
		{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
		}


		function isDigit (c) {
		// Returns true if character c is a digit (0 .. 9).

			return ((c >= "0") && (c <= "9"))
		}

		function isSpecial (c) {  
		// Returns true if character c is an underscore or dash (0 .. 9).
			return ((c == "_") || (c == "-"))
		}

		function isEmpty(s) {
		// check if string s is empty

			return ((s == null) || (s.length == 0))
		}

		function isAlphanumeric (s) {
		// isAlphanumeric (STRING s [, BOOLEAN emptyOK])
		//
		// Returns true if string s is English letters (a .. z, a..z) and numbers only.
		//
			var i;

			if (isEmpty(s))
			if (isAlphanumeric.arguments.length == 1) return defaultEmptyOK;
			else return (isAlphanumeric.arguments[1] == true);

			// Search through string's characters one by one
			// until we find a non-alphanumeric character.
			// When we do, return false; if we don't, return true.

			for (i = 0; i < s.length; i++)
			{
				// Check that current character is number, letter or special.
				var c = s.charAt(i);

				if (! (isLetter(c) || isDigit(c) || isSpecial(c)) )
				return false;
			}

			// All characters are numbers or letters.
			return true;
		}


		function isNumeric (s) {
		// isNumeric (STRING s [, BOOLEAN emptyOK])
		//
		// Returns true if string s is numbers only.

			var i;

			if (isEmpty(s))
			   if (isNumeric.arguments.length == 1) return defaultEmptyOK;
			   else return (isNumeric.arguments[1] == true);

			for (i = 0; i < s.length; i++)
			{
				var c = s.charAt(i);

				if (! isDigit(c)  ) return false;
			}
			return true;
		}


		function CheckAllDigits (s) {
			for (i = 0; i < s.length; i++)
			{
				var c = s.charAt(i);

				if (! isDigit(c) )
				return false;
			}
			return true;
		}


		//////////////////////////////////////////////////////////////////////
		// Error checking functions
		//////////////////////////////////////////////////////////////////////

		function isEmail(sEmail) {return /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(sEmail)}


		function checkNaN(checkvalue){
		// Check value of function is a valid number
		// Provide a meaningful error message if result is non-numeric
		// (The 'NaN' error will mean nothing to most people)
			var result

			result = parseInt(checkvalue)
			if (isNaN(result)){
				checkvalue='Input Error'
			}
			return checkvalue
		}


		//////////////////////////////////////////////////////////////////////
		// End of Miscellaneous functions
		//////////////////////////////////////////////////////////////////////
