var myWindow;
var dictWindow;
var ozdictWindow;
var helpWindow;

function openCenteredWindow(url) {
    var width = 760;
    var height = 500;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2) - 10);
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",status,resizable,left=" + left + ",top=" + top + 
        "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(url, "subWind", windowFeatures);
	return false;
}

function openDictionaryWindow(word) {
    var width = 760;
    var height = 450;
    var left = parseInt((screen.availWidth/2) - (width/2) + 50);
    var top = parseInt((screen.availHeight/2) - (height/2) - 50);
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",status,resizable,scrollbars,menubar,location,toolbar,left=" + left + ",top=" + top + 
        "screenX=" + left + ",screenY=" + top;
	if (word == "") {
    	dictWindow = window.open("http://www.onelook.com", "dictWind", windowFeatures);
	}
	else {
    	dictWindow = window.open("http://www.onelook.com/?w=" + word, "dictWind", windowFeatures);
	}
	// in case window was previously created but is obscured
	if (dictWindow && !dictWindow.closed) {
		dictWindow.focus();
	}
}

function openOzDictWindow(word) {
    var width = 760;
    var height = 200;
    var left = parseInt(40);
    var top = parseInt((screen.availHeight/2) - (height/2) + 100);
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",status,resizable,scrollbars,menubar,location,toolbar,left=" + left + ",top=" + top + 
        "screenX=" + left + ",screenY=" + top;
	if (word == "") {
    	ozdictWindow = window.open("ozdict.html", "ozdictWind", windowFeatures);
	}
	else {
    	ozdictWindow = window.open("ozdict.html#" + word, "ozdictWind", windowFeatures);
	}
	// in case window was previously created but is obscured
	if (ozdictWindow && !ozdictWindow.closed) {
		ozdictWindow.focus();
	}
}

function openHelpWindow() {
    var width = 600;
    var height = 480;
    var left = parseInt(screen.availWidth - width - 20);
    var top = 1;
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",status,resizable,scrollbars,toolbar,left=" + left + ",top=" + top + 
        "screenX=" + left + ",screenY=" + top;
    	helpWindow = window.open("help/helpmain.html", "helpWind", windowFeatures);
	// in case window was previously created but is obscured
	if (helpWindow && !helpWindow.closed) {
		helpWindow.focus();
	}
}

function formatDate(inDate) {
// Array list of days.
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Array list of months.
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

	var year = inDate.getFullYear();
// To deal with a bug in some Netscape versions, where the date last modified is given wrongly
	if (year < 2000) {
		year += 100;
	}
	
	retDate =  days[inDate.getDay()] + " " +				
               inDate.getDate() + " " +
              months[inDate.getMonth()] + " " +
                year;

	return retDate;  
}