var theWindow
var theyesnoWindow
var theDocument

function newGenericWindow(theContent, width, height, left, top){
if (theWindow && !theWindow.closed){theWindow.close()};
if (arguments.length == 1){
	theWindow = window.open(theContent, "", "width=500, height=300, left=300, top=250");
}
else if (arguments.length == 3) {
	theWindow = window.open(theContent, "", "width=" + width + ", height=" + height + ", left=" + (screen.availWidth - width)/2 + ", top=" + (screen.availHeight-height)/2 );	
}
else{
	theWindow = window.open(theContent, "", "width=" + width + ", height=" + height + ", left=" + left + ", top=" + top );
}
}

function newLingoWindow(theTitle, theGif, theText){
if (theWindow && !theWindow.closed){theWindow.close()};

//for now pass a hardcoded springishere, later get it from theContent, add a comma and pass title text too
theWindow = window.open("lingopage.asp?ltitle=" + theTitle + "&lgif=" + theGif+ "&ltext=" + theText ,'','width=500, height=300, left=300, top=250');
}
	


function newSmallVidWin(lessonnumber, tracktype){
if (theWindow && !theWindow.closed){theWindow.close()};

if (screen.availWidth <=800){
	width=screen.availWidth-24;
	height=screen.availHeight-30;
	winleft = 0;
	wintop = 0;
}
else {
	width = 800;
	height = 600;
	winleft = (screen.availWidth-width)/2;
	wintop = (screen.availHeight-height)/2;
}

//for now pass a hardcoded springishere, later get it from theContent, add a comma and pass title text too
theWindow = window.open("videochoicesmall.asp?lessonnumber=" + lessonnumber + "&tracktype=" + tracktype ,"","width=" + width + ", height=" + height + ", left=" + winleft + ", top=" + wintop + ", scrollbars, resizable");
}

function newVideoChoiceWindow(theContent, theTitle, theExtension){
if (theWindow && !theWindow.closed){theWindow.close()};

//for now pass a hardcoded springishere, later get it from theContent, add a comma and pass title text too
theWindow = window.open("videochoice.asp?video=" + theContent + ",videotitle=" + theTitle+ ",videoextension=" + theExtension ,'','');
theWindow.theContent = theContent;
}

function startQuiz(atquestionnumber){
	//close the child window if one is open
	if (theWindow && !theWindow.closed){theWindow.close()};

	
	theWindow = window.open("","","width=475, height=375, left=" + (screen.availwidth - 450)/2 + ", top=" + (screen.availheight-300)/2 );
	theDocument = theWindow.document;
	// Start HTML Code -------------
	theDocument.writeln("<HTML><HEAD><TITLE>Musical List with Quiz</TITLE>");
	theDocument.writeln("");
	theDocument.writeln("<LINK REL='STYLESHEET' HREF='pianostyle.css' TYPE='text/css'>");
	theDocument.writeln("<SCRIPT LANGUAGE=JAVASCRIPT TYPE='TEXT/JAVASCRIPT'>var questionnumber = " + atquestionnumber + "; </SCRIPT></HEAD>");
	theDocument.writeln("");
	theDocument.writeln("<FRAMESET ROWS=\"1,*\" border=\"0\">");
	theDocument.writeln("		<FRAME SRC=\"quizheader.htm\" NAME=\"quizheader\" SCROLLING=\"no\" frameborder=\"0\" />");
	theDocument.writeln("		<FRAME SRC=\"symbolquiz.htm\" NAME=\"quiz\" SCROLLING=AUTO frameborder=\"0\" />");
	theDocument.writeln("</FRAMESET>");
	theDocument.writeln("");
	theDocument.writeln("</HTML>");
	// End HTML Code -------------
	theDocument.close();
}
 

