// Global variablesvar output = "";var dialog = null;var x, y, w, h;// Centered dialogfunction windowWidth() {	if (window.innerWidth) {		return window.innerWidth;	} else if (document.body && document.body.offsetWidth) {		return document.body.offsetWidth;	} else {		return 0;	}}function windowHeight() {	if (window.innerHeight) {		return window.innerHeight;	} else if (document.body && document.body.offsetHeight) {		return document.body.offsetHeight;	} else {		return 0;	}}function windowX() {	if (window.screenX) {		return window.screenX;	} else if (window.screenLeft) {		return window.screenLeft;	} else if (document.body && document.body.offsetLeft) {		return document.body.offsetLeft;	} else {		return 0;	}}function windowY() {	if (window.screenY) {		return window.screenY;	} else if (window.screenTop) {		return window.screenTop;	} else if (document.body && document.body.offsetTop) {		return document.body.offsetTop;	} else {		return 0;	}}function initCenteredDialog() {	if (dialog == null) {		x = windowX();		y = windowY();		w = windowWidth();		h = windowHeight();	}}function openCenteredDialog( url, name, width, height ) {	var cx, cy;	if (dialog == null) {		cx = x + (Math.round((w - width) / 2));		cy = y + (Math.round((h - height) / 2));		dialog = window.open( url, name, 'left=' + cx + ',top=' + cy + ',width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes');	} else {		dialog.focus();	}}function closeCenteredDialog() {	if (dialog != null) {		dialog.close();		dialog = null;	}}// Navigator objectfunction appName() {	if (navigator.appName) {		return navigator.appName;	} else {		return "n/a";	}}function appVersion() {	if (navigator.appVersion) {		return navigator.appVersion;	} else {		return "n/a";	}}function platform() {	if (navigator.platform) {		return navigator.platform;	} else {		return "n/a";	}}function userAgent() {	if (navigator.userAgent) {		return navigator.userAgent;	} else {		return "n/a";	}}function language() {	if (navigator.language) {		return navigator.language;	} else {		return "n/a";	}}function browserLanguage() {	if (navigator.browserLanguage) {		return navigator.browserLanguage;	} else {		return "n/a";	}}function userLanguage() {	if (navigator.userLanguage) {		return navigator.userLanguage;	} else {		return "n/a";	}}function javaEnabled() {	return navigator.javaEnabled();}function cookieEnabled() {	var cookieEnabled;	if (typeof document.cookie == "string") {		if (document.cookie.length == 0) {			document.cookie = "test";			cookieEnabled = (document.cookie == "test");			document.cookie = "";			return cookieEnabled;		} else {			return true;		}	} else if (navigator.cookieEnabled) {		return navigator.cookieEnabled;	} else {		return "n/a";	}}// Screen objectfunction screenWidth() {	if (screen.width) {		return screen.width;	} else {		return "n/a";	}}function screenHeight() {	if (screen.height) {		return screen.height;	} else {		return "n/a";	}}function screenColorDepth() {	if (screen.colorDepth) {		return screen.colorDepth;	} else {		return "n/a";	}}function screenAvailWidth() {	if (screen.availWidth) {		return screen.availWidth;	} else {		return "n/a";	}}function screenAvailHeight() {	if (screen.availHeight) {		return screen.availHeight;	} else {		return "n/a";	}}function screenAvailLeft() {	if (screen.availLeft) {		return screen.availLeft;	} else {		return "n/a";	}}function screenAvailTop() {	if (screen.availTop) {		return screen.availTop;	} else {		return "n/a";	}}// Window objectfunction windowScreenX() {	if (window.screenX) {		return window.screenX;	} else {		return "n/a";	}}function windowScreenY() {	if (window.screenY) {		return window.screenY;	} else {		return "n/a";	}}function windowOuterWidth() {	if (window.outerWidth) {		return window.outerWidth;	} else {		return "n/a";	}}function windowOuterHeight() {	if (window.outerHeight) {		return window.outerHeight;	} else {		return "n/a";	}}function windowInnerWidth() {	if (window.innerWidth) {		return window.innerWidth;	} else {		return "n/a";	}}function windowInnerHeight() {	if (window.innerHeight) {		return window.innerHeight;	} else {		return "n/a";	}}function windowScreenLeft() {	if (window.screenLeft) {		return window.screenLeft;	} else {		return "n/a";	}}function windowScreenTop() {	if (window.screenTop) {		return window.screenTop;	} else {		return "n/a";	}}function bodyOffsetLeft() {	if (document.body && document.body.offsetLeft) {		return document.body.offsetLeft;	} else {		return "n/a";	}}function bodyOffsetTop() {	if (document.body && document.body.offsetTop) {		return document.body.offsetTop;	} else {		return "n/a";	}}function bodyOffsetWidth() {	if (document.body && document.body.offsetWidth) {		return document.body.offsetWidth;	} else {		return "n/a";	}}function bodyOffsetHeight() {	if (document.body && document.body.offsetHeight) {		return document.body.offsetHeight;	} else {		return "n/a";	}}// Variousfunction historyLength() {	if (history.length) {		return history.length;	} else {		return "n/a";	}}// Returns the current date an time.function timestamp() {	return new Date();}// Returns the localized date and time.function toLocaleDate( date ) {	return date.toLocaleString();}// Converts  a number into a string and adds a "0" at the beginning if it's less than 10 (e.g. 7 returns "07").function addZero( number ) {	return ((number < 10) ? "0" : "") + number;}// Returns the date and time formatted as DD.MM.YYYY hh:mm:ss.function formatDate( date ) {	var day = addZero(date.getDate());	var month = addZero(date.getMonth() + 1);	var year = date.getFullYear();	var hours = addZero(date.getHours());	var minutes = addZero(date.getMinutes());	var seconds = addZero(date.getSeconds());	date = day + "." + month + "." + year + " " + hours + ":" + minutes + ":" + seconds;	return date;}/*http://www.mikezilla.com/exp0015.htmlI have been playing around with formatting the JavaScript date object and I have created two functions to helpme out. The main function takes a date object and a format string and returns a formatted date. It is verybasic at the moment but it works. The format string should be supplied in standard date format, in any orderwith any delimiters.DD for Date of the monthMM for monthYY or YYYY for Yearhh for hoursmm for minutesss for secondse.g. MM/DD/YY hh:mm:ss or DD.MM.YYYY hh:mm:ss// Formats  a datefunction formatDate( date, format ) {	var day = addZero(date.getDate());	var month = addZero(date.getMonth() + 1);	var yearLong = addZero(date.getFullYear());	var yearShort = addZero(date.getFullYear().toString().substring(3, 4));	var year = (format.indexOf("YYYY") > -1 ? yearLong : yearShort)	var hours = addZero(date.getHours());	var minutes = addZero(date.getMinutes());	var seconds = addZero(date.getSeconds());	var dateString = format.replace(/DD/g, day).replace(/MM/g, month).replace(/y{1, 4}/g, year);	dateString = dateString.replace(/hh/g, hours).replace(/mm/g, minutes).replace(/ss/g, seconds);	return dateString;}*///Table builderfunction newTable( border, pad, space ) {	return '<table border="' + border + '" cellpadding="' + pad + '" cellspacing="' + space + '">\n';}function addTitle( title ) {	var code;	code = '\t<tr>\n';	code += '\t\t<td colspan="2"><h3>' + title + '</h3></td>\n';	code += '\t</tr>\n';	return code;}function addRow( label, value ) {	var code;	code = '\t<tr valign="top">\n';	code += '\t\t<td>' + label + '</td>\n';	code += '\t\t<td>' + value + '</td>\n';	code += '\t</tr>\n';	return code;}function addSeparator() {	var code;	code = '\t<tr>\n';	code += '\t\t<td colspan="2">&nbsp;</td>\n';	code += '\t</tr>\n';	return code;}function endTable() {	return '</table>\n';}// Formattingfunction formatNumber( number, digits, character ) {	number = "" + number;	if (number.length > digits) {		var mod = number.length % digits;		var result = (mod > 0 ? (number.substring(0, mod)) : "");		for (i=0 ; i < Math.floor(number.length/digits); i++) {			if ((mod == 0) && (i == 0)) {				result += number.substring(mod+digits*i, mod+digits*i+digits);			} else {				result += character + number.substring(mod+digits*i ,mod+digits*i+digits);			}		}		return result;	} else {		return number;	}}