// windows.js
// put this line into each page:
// <script src="../scripts/windows.js" language = JAVASCRIPT type="TEXT/JAVASCRIPT"></script>

var win;
var art;
var help;
var months = new Array ("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec");

function showMonth(){
	var now = new Date();
	var month = now.getMonth();
	var newcontent = ("calendar.html#" + months[month]);
	parent.content.location = newcontent;
}

function showQuote(mon){
	document.quote.src = "../images/quotes/quote-" + mon + ".gif";
}

function loadQuote(){
	var now = new Date();
	var month = now.getMonth();
	var newquote = ("../images/quotes/quote-" + months[month] + ".gif");
	document.quote.src = newquote;
}

function spanishLesson(){
	var now = new Date();
	var month = now.getMonth();
	var newLesson = ("../help/spanish-lessons/" + months[month] + "-spanish-lesson.html");
	helpWindow(newLesson,500,700)
}	
		
function closeWindow(){
	win = window.name;
	if (win == "content") history.back();
	else self.close();
}

function newWindow(url,width,height){
	var x = width + 40;
	var y = height + 80;
	var win_attr = "width=" + x + ",height=" + y + ",menubar,scrollbars,resizable,screenX=50,screenY=50";
	if (win && !win.closed) {win.resizeTo(x,y);}
	win = window.open(url,'newWin',win_attr);
	win.focus();
}

function artWindow(img,width,height){
	var x = width + 60;
	var y = height + 100;
	var art_attr = "width=" + x + ",height=" + y + ",scrollbars,resizable,screenX=50,screenY=50";
	if (art && !art.closed) {art.resizeTo(x,y);}
	art = window.open("",'artWin',art_attr);
	art.document.open();
	art.document.writeln('<title>Online Art</title>');
	art.document.writeln('<body bgcolor="#000000">');
	art.document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="5">');
	art.document.writeln('<tr>');
	art.document.writeln('<td>');
	art.document.writeln('<a href="javascript:self.close()">');
	art.document.writeln('<img src="../images/buttons/exit.gif" width="49" height="25" border="0"></a>');
	art.document.writeln('</td>');
	art.document.writeln('</tr>');
	art.document.writeln('<tr>');
	art.document.writeln('<td align="center">');
	art.document.writeln('<img src="' + img + '" border="0">');
	art.document.writeln('</td>');
	art.document.writeln('</tr>');
	art.document.writeln('</table>');
	art.document.writeln('</body>');
	art.document.close();
	art.focus();
}

function artWindow2(img,width,height){
	var x = width + 60;
	var y = height + 100;
	var art_attr = "width=" + x + ",height=" + y + ",scrollbars,resizable,screenX=50,screenY=50";
	if (art && !art.closed) {art.resizeTo(x,y);}
	art = window.open("",'artWin',art_attr);
	art.document.open();
	art.document.writeln('<title>Online Art</title>');
	art.document.writeln('<body bgcolor="#000000">');
	art.document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="5">');
	art.document.writeln('<tr>');
	art.document.writeln('<td>');
	art.document.writeln('<a href="javascript:self.close()">');
	art.document.writeln('<img src="images/buttons/exit.gif" width="49" height="25" border="0"></a>');
	art.document.writeln('</td>');
	art.document.writeln('</tr>');
	art.document.writeln('<tr>');
	art.document.writeln('<td align="center">');
	art.document.writeln('<img src="' + img + '" border="0">');
	art.document.writeln('</td>');
	art.document.writeln('</tr>');
	art.document.writeln('</table>');
	art.document.writeln('</body>');
	art.document.close();
	art.focus();
}


function helpWindow(newContent,width,height){
	var x = width;
	var y = height;
	var help_attr = "width=" + x + ",height=" + y + ",scrollbars,resizable,screenX=50,screenY=50";
	if (help && !help.closed) {help.resizeTo(x,y);}
	help = window.open("",'helpWin',help_attr);
	help.document.writeln('<title>Online Help</title>');
	help.document.writeln('<frameset rows="45,628*" frameborder="NO" border="0" framespacing="0" cols="*">');
	help.document.writeln('<frame name="helpBanner" scrolling="NO" noresize src="../help/help-banner.html" frameborder="NO" >');
	help.document.writeln('<frame name="helpContent" scrolling="YES" resize src="' + newContent +'" >');
	help.document.writeln('</frameset>');
	help.document.close();
	help.focus();
}

function scrollUp () {
	self.scroll(0,0);
}

function jump(url) {
	location.href=url;
}

