// ===============================
// CIS 114 
// Basic Javascript Function Library
// Spring 2004 
// These are old functions - should still work
// ===============================

// ===============================
// TO USE THIS FILE FOLLOW THESE DIRECTIONS
//  
// Put this file in the same directory as your HTML file. 
// Place the following code between the <head> 
// tags in your HTML document. Be sure to remove the 
// leading double slashes "//" from the line.
//
// <script language="JavaScript" src="cis114jlib.js"> </script>
//
// ===============================

// ===============================
// Print current time
// Must be used with a document.write() line between <script> tags
// ===============================

function showDateSlashes() {

	var Today = new Date();
	var d = Today.getDate();
	var m = Today.getMonth()+1;
	var y = Today.getFullYear();

	document.write(m + "/" + d + "/" + y);
	
}

function showDateLong() {

	var mName = new Array("","January","February","March","April","May","June","July","August","September","October","November","December");
	var dName = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

	var Today = new Date();
	var d = Today.getDate();
	var dow = Today.getDay();
	var m = Today.getMonth()+1;
	var y = Today.getFullYear();

	document.write(dName[dow] + " " + mName[m] + " " + d + ", " + y);
	
}

// ===============================
// Simple image swap
// Accepts the images name and the path of the image to be swapped
// You must name your image for this to work
// ===============================

function swapImage(iName,swapName) {

	iName.src = swapName;


}

// ===============================
// Change the background color of a page
// Accepts the color as a string argument
// ===============================

function changeBgColor(color) {

	document.bgColor = color;
	
}

// ===============================
// Launch a basic alert box
// Accepts the alert message as a string argument
// ===============================

function launchAlert(message) {

	alert(message);

}

// ===============================
// Launch a pop-up-window
// Accepts the height, width, and message as parameters
// ===============================

function launchWindow(h, w, pText) {

	var wParams = "height=" + h + ",width=" + w + ",scrollbars=yes,resizable=yes";
	newWin = window.open("","",wParams);
	newWin.focus();
	newWin.document.write(pText);
	newWin.document.close();

}
//==============================
//Trivia rounds 1 thu 7
// Updated by Maggy Burnick
//==============================

function Round1()
{
Q1=prompt("What is the Japanese name for karate School? \n (a) Ryote   (b) Hiza   (c)   Dojo   (d) Gi","Enter a,b,c,or d here");
if (Q1=="c")
{
alert("Correct!")
document.verify.Question2.value="Granted"
}
else
{
alert("Incorrect! Try Again.")
}
}
function Round2()
{
Q2=prompt("What is the Japanese name for Circle Block and Thrust? \n  (a) Migi ashi mae   (b) Wa-uke   (c) Hojo Undo   (d) kata","Enter a,b,c,or d here")
if (Q2=="b")
{
alert("Correct!")
document.verify.Question3.value="Granted"
}
else
{
alert("Incorrect! Try Again.")
}
}
function Round3()
{
Q3=prompt("What is the first kata you learn and practice thru all your ranks? \n  (a) Sanchin   (b) Kyu Kumite   (c) Kanshiwa   (d) Kanshu","Enter a,b,c,or d here")
if (Q3=="a")
{
alert("Correct!")
document.verify.Question4.value="Granted"
}
else
{
alert("Incorrect! Try Again.")
}
}
function Round4()
{
Q4=prompt("What is the Rank name of yellow belt? \n (a) Shichikyu   (b) Nikyu   (c) Rokkyu   (d) Kyukyu","Enter a,b,c,or d here")
if (Q4=="d")
{
alert("Correct!")
document.verify.Question5.value="Granted"
}
else
{
alert("Incorrect! Try Again.")
}
}

function Round5()
{
Q5=prompt("What does karate begin and end with? \n  (a) Junbi Undo   (b) Respect   (c) Hidari ashi mae   (d) Kata","Enter a,b,c,or d here")
if (Q5=="b")
{
alert("Correct!")
document.verify.Question6.value="Granted"
}
else
{
alert("Incorrect! Try Again.")
}
}

function Round6()
{
Q6=prompt("Who Founded Uechi Ryu style karate? \n (a) Kanbun   (b) Kanei   (c) Tomoyose   (d) Cho Tsu Ho","Enter a,b,c,or d here")
if (Q6=="a")
{
alert("Correct!")
document.verify.Question7.value="Granted"
}
else
{
alert("Incorrect! Try Again.")
}
}

function Round7()
{
Q7=prompt("Who was Sensei Stephen Drehobl's Sensei? \n(a) James Thompson (b) George Mattson (c) Ryuko Tomoyose (d) Bart Simpson","Enter a,b,c,or d here")
if (Q7=="a")
{
alert("Correct!")
alert("You answered every question correctly! Congrats! \n\n\n\n\n\n\n\n\n Created By Jeremy Greenfield \n\n Updated by Maggy Burnick")
alert("Thanks for playing!")
}
else
{
alert("Incorrect! Try Again.")
}
}
function PendRound2()
{
if (document.verify.Question2.value=="Granted")
{
Round2()
}
if (document.verify.Question2.value=="Denied")
{
alert("You must answer the previous rounds correctly before advancing to this round.") 
}
}
function PendRound3()
{
if (document.verify.Question3.value=="Granted")
{
Round3()
}
if (document.verify.Question3.value=="Denied")
{
alert("You must answer the previous rounds correctly before advancing to this round.") 
}
}
function PendRound4()
{
if (document.verify.Question4.value=="Granted")
{
Round4()
}
if (document.verify.Question4.value=="Denied")
{
alert("You must answer the previous rounds correctly before advancing to this round.") 
}
}
function PendRound5()
{
if (document.verify.Question5.value=="Granted")
{
Round5()
}
if (document.verify.Question5.value=="Denied")
{
alert("You must answer the previous rounds correctly before advancing to this round.") 
}
}
function PendRound6()
{
if (document.verify.Question6.value=="Granted")
{
Round6()
}
if (document.verify.Question6.value=="Denied")
{
alert("You must answer the previous rounds correctly before advancing to this round.") 
}
}
function PendRound7()
{
if (document.verify.Question7.value=="Granted")
{
Round7()
}
if (document.verify.Question7.value=="Denied")
{
alert("You must answer the previous rounds correctly before advancing to this round.") 
}

}
//  End -->

