// JavaScript Document
/*	Clock Script
<script language="JavaScript"> */
var d=new Array();
for(i=0;i<10;i++) {
 	d[i]=new Image();
 	d[i].src="../files/dgt"+i+".gif";
}
var pm=new Image;
pm.src="../files/dgtp.gif";
var am=new Image;
am.src="../files/dgta.gif";
var dates,min,sec,hour;
var amPM="am";
function clock() {
 	dates=new Date();
 	hour=dates.getHours();
 	min=dates.getMinutes();
 	sec=dates.getSeconds();
 	if(hour < 12) {
  		amPM=am.src;
 	}
 	if(hour > 11) {
  		amPM=pm.src;
  		hour=hour-12;
 	}
 	if(hour == 0) {
  		hour=12;
 	}
 	if(hour < 10) {
  		document["tensHour"].src="../files/dgtbl.gif";
  		document["Hour"].src=d[hour].src;
 	}
 	if(hour > 9) {
  		document["tensHour"].src=d[1].src;
  		document["Hour"].src=d[hour-10].src;
 	}
 	if(min < 10) {
  		document["tensMin"].src=d[0].src;
 	}
 	if(min > 9) {
  		document["tensMin"].src=d[parseInt(min/10,10)].src;
 	}
 		document["Min"].src=d[min%10].src;
 	if(sec < 10) {
  		document["tensSec"].src=d[0].src;
 	}
 	if(sec > 9) {
  		document["tensSec"].src=d[parseInt(sec/10,10)].src;
 	}
 	document["Sec"].src=d[sec%10].src;
 	document["amPM"].src=amPM;
 	setTimeout("clock();",100);
}
/*	</script>	*/

// Calendar
function clndr() {
	DaysofWeek = new Array()
	DaysofWeek[0]="Sunday"
	DaysofWeek[1]="Monday"
	DaysofWeek[2]="Tuesday"
	DaysofWeek[3]="Wednesday"
	DaysofWeek[4]="Thursday"
	DaysofWeek[5]="Friday"
	DaysofWeek[6]="Saturday"
	Months = new Array()
	Months[0]="January"
	Months[1]="February"
	Months[2]="March"
	Months[3]="April"
	Months[4]="May"
	Months[5]="June"
	Months[6]="July"
	Months[7]="August"
	Months[8]="September"
	Months[9]="October"
	Months[10]="November"
	Months[11]="December"
	RightNow = new Date()
	var day = DaysofWeek[RightNow.getDay()]
	var date = RightNow.getDate()
	var Month = Months[RightNow.getMonth()]
	var Year = RightNow.getFullYear()
	if (date == 1 || date == 21 || date == 31)
		{ender = "<sup>st</sup>"}
	else
		if (date == 2 || date == 22)
			{ender = "<sup>nd</sup>"}
		else
			if (date == 3 || date == 23)
				{ender = "<sup>rd</sup>"}
			else
				{ender = "<sup>th</sup>"}
}

function start(){
	window.onLoad=clock();
	window.onLoad=clndr();
}

/*	Slowly Coming-together status scroller 
<script language="JavaScript"> */
	<!--
	/*
		Slowly coming together status bar scroller
		Written by BengalBoy (www.angelfire.com/nt/bengaliboy/index.html)
		Visit http://javascriptkit.com for this script and more
	*/
	
//set message:
msg = "Welcome to my NEW \& IMPROVED Web site!!!";
timeID = 10;
stcnt = 16;
wmsg = new Array(33);
	wmsg[0]=msg;
    blnk = "                                                               ";
    for (i=1; i<32; i++)
    {
     	b = blnk.substring(0,i);
        wmsg[i]="";
        for (j=0; j<msg.length; j++) wmsg[i]=wmsg[i]+msg.charAt(j)+b;
    }
function wiper()
{
	if (stcnt > -1) str = wmsg[stcnt]; else str = wmsg[0];
    if (stcnt-- < -40) stcnt=31;
    status = str;
    clearTimeout(timeID);
    timeID = setTimeout("wiper()",40);
}
wiper()
/*	// -->
</script>	*/

// BROWSER CHECK
var nVer = navigator.appVersion;
var browserName  = '';	//Browser name
var fullVersion  = 0; 	//Full version
var majorVersion = 0;	//Major version
var navAppName = navigator.appName;	//navigator.appName
var nAgt = navigator.userAgent;		//navigator.userAgent
// In Internet Explorer, the true version is after "MSIE" in userAgent
if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
 	browserName  = "Microsoft Internet Explorer";
 	fullVersion  = parseFloat(nAgt.substring(verOffset+5));
 	majorVersion = parseInt(''+fullVersion);
}
// In Opera, the true version is after "Opera" 
else if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
 	browserName  = "Opera";
 	fullVersion  = parseFloat(nAgt.substring(verOffset+6));
 	majorVersion = parseInt(''+fullVersion);
}
// In Firefox, the true version is after "Firefox" 
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
 	browserName  = "Firefox";
 	fullVersion  = parseFloat(nAgt.substring(verOffset+8));
 	majorVersion = parseInt(''+fullVersion);
}
// In Safari, the true version is before "Safari" 
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
 	browserName  = "Safari";
 	fullVersion  = parseFloat(nAgt.substring(verOffset-6));
 	majorVersion = parseInt(''+fullVersion);
}
// In Netscape, the true version is after "Navigator" 
else if ((verOffset=nAgt.indexOf("Navigator"))!=-1) {
 	browserName  = "Navigator";
 	fullVersion  = parseFloat(nAgt.substring(verOffset+10));
 	majorVersion = parseInt(''+fullVersion);
}
// In most other browsers, "name/version" is at the end of userAgent 
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) 
{
 	browserName  = nAgt.substring(nameOffset,verOffset);
 	fullVersion  = parseFloat(nAgt.substring(verOffset+1));
 	if (!isNaN(fullVersion)) majorVersion = parseInt(''+fullVersion);
 	else {fullVersion  = 0; majorVersion = 0;}
}
// Finally, if no name and/or no version detected from userAgent...
if (browserName.toLowerCase() == browserName.toUpperCase()
 	|| fullVersion==0 || majorVersion == 0 )
{
 	browserName  = navigator.appName;
 	fullVersion  = parseFloat(nVer);
 	majorVersion = parseInt(nVer);
}
// MANUAL-REDIRECT
function reDirect() {
	switch (browserName) {
		case "Microsoft Internet Explorer": location.href="Graphical/home.htm";
		break;
		case "Opera": location.href="Graphical/home.htm";
		break;
		case "Safari": location.href="Graphical/home.htm";
		break;
		case "Chrome": location.href="Graphical/home.htm";
		break;
		case "Firefox": location.href="Textual/home.htm";
		break;
		case "Netscape": location.href="Textual/home.htm";
		break;
		default: location.href="Textual/home.htm";
	}
}

// Fortune Telling Service
function Show() {
	alert('The following alert messages contain your fortune. Get ready for you life to change from now on!')    
	alert(document.gypsy.number.value + ' is the number of times you should be smacked over the head with your keyboard for thinking that stupid tests like this actually mean anything.');
    alert(document.gypsy.attracted.value + ' is someone who will never sleep with you because you are stupid enough to waste your time on something like this.');
    alert('The fact that you picked ' + document.gypsy.color.value + ' means nothing. Its a fucking color!');
    alert(document.gypsy.pet.value + ' is the name of a dead animal.');
    alert(document.gypsy.work1.value + ' and ' + document.gypsy.work2.value + ' are colleagues who are embarrassed to know you.');
    alert('Pass this on to everyone you know, so they can feel like a twat too. If you dont pass this on to at least 40,000 people in the next four seconds then not only will your wish of ' + document.gypsy.wish.value + ' not come true, but the fleas of one thousand camels will infest your pubic hair.');
    alert('Now fuck off and get on with your work!');
}

// Quote Of The Day
function qotd() {
	var quote = new Array(22);
	quote[0] = "Never will come up.";
	quote[1] = "Chance favors the prepared mind.";
	quote[2] = "A stitch in time, saves nine.";
	quote[3] = "The only difference between bravery and stupidity is the outcome.";
	quote[4] = "One should never let a formal education get in the way of learning.";
	quote[5] = "Happiness is two kinds of ice cream.";
	quote[6] = "If you choose not to decide, then you still have made a choice.";
	quote[7] = "Do, or do not. There is no try.";
	quote[8] = "Reality is merely an illusion, albeit a very persistent one.";
	quote[9] = "No one ever said life would be easy.";
	quote[10] = "The will does not choose between good and evil; it is its choice, rather, that makes it good or evil. -- Karl Jaspers"; 
	quote[11] = "Education is going to college to learn to express your ignorance in scientific terms.";
	quote[12] = "I hate the idea of causes, and if I had to choose between betraying my country and betraying my friend, I hope I should have the guts to betray my country.";
	quote[13] = "A person can be smart, but people are very stupid.";
	quote[14] = "The purpose of war is not to die for one's country, but to make the other man die for his.";
	quote[15] = "If women did not exist, all the money in the world would have no meaning.";
	quote[16] = "When choosing between two evils, I always like to try the one I have never tried before.";
	quote[17] = "Boop Boopy Doo!";
	quote[18] = "If at first you do not succeed, lower your standards.";
	quote[19] = "Happy Happy Joy Joy!";
	quote[20] = "You can pick your friends, you can pick your nose, but do not wipe your friends under the couch.";
	quote[21] = "Reality is for people who can't handle drugs.";
	now=new Date()
	num=(now.getSeconds())%22
	document.qotdForm.txtQOTD.value=quote[num]
}

// Rocky Movies
function Balboa() {
	var num = document.RockyForm.RockyUser.value
	var Movie = new Array(7) 
	Movie[0]="There was no Rocky 0"
	Movie[1]="Rocky"
	Movie[2]="Rocky II"
	Movie[3]="Rocky III"
	Movie[4]="Rocky IV"
	Movie[5]="Rocky V"
	Movie[6]="Rocky Balboa"
	var Outcome = new Array(7)
	Outcome[0]="There was no Rocky 0"
	Outcome[1]="Rocky Loses"
	Outcome[2]="Rocky Wins"
	Outcome[3]="Rocky Loses, then Wins"
	Outcome[4]="Apollo Dies, Rocky Wins"
	Outcome[5]="Rocky Wins Street Brawl"
	Outcome[6]="Who really cares anymore"
	var Rating = new Array(7)
	Rating[0]="There was no Rocky 0"
	Rating[1]="***** out of 5"
	Rating[2]="**** out of 5"
	Rating[3]="*** out of 5"
	Rating[4]="** out of 5"
	Rating[5]="* out of 5"
	Rating[6]="*** out of 5"
	document.RockyForm.RockyTitle.value=Movie[num]
	document.RockyForm.RockyOutcome.value=Outcome[num]
	document.RockyForm.RockyRating.value=Rating[num] 
	if(num >= 7)
		{document.RockyForm.RockyTitle.value="There were only 6 movies -  "
		document.RockyForm.RockyOutcome.value=" bonehead!"
		document.RockyForm.RockyRating.value="No Rating"}
}

// Lotto Numbers
function lotto() { 
	var now=new Date()
	var num=(now.getDate())+1%46 
	var now2=new Date() 
	var num2=(now.getDay())+1%46 
	var now3=new Date() 
	var num3=(now.getHours())+1%46
	var now4=new Date() 
	var num4=(now.getMinutes())+1%46
	var now5=new Date() 
	var num5=(now.getSeconds())+1%46  
	var now6=new Date() 
	var num6=(now.getMonth())+1%26
	document.myform.num1.value=(""+num+"");
	document.myform.num2.value=(""+num2+"");
	document.myform.num3.value=(""+num3+"");
	document.myform.num4.value=(""+num4+"");
	document.myform.num5.value=(""+num5+"");
	document.myform.num6.value=(""+num6+"");
	defaultStatus = "Good Luck!"
}

// Animation - 3 Pic Flip
function startshow() {
	var num=0
	img0 = new Image (55,45)
	img0.src = "../files/pic1.gif"
	img1 = new Image (55,45)
	img1.src = "../files/pic2.gif"
	img2 = new Image (55,45)
	img2.src = "../files/pic3.gif" 
	num=num+1
	if(num==3)
	{num=0}
	document.mypic.src=eval("img"+num+".src")
	setTimeout('startshow()','500')
}

// Quiz
function Gradeit(){
	function getselectedIndex(){
		return document.quiz.q1.selectedIndex
		return document.quiz.q2.selectedIndex
		return document.quiz.q3.selectedIndex
		return document.quiz.q4.selectedIndex
		return document.quiz.q5.selectedIndex
	}
	var Answers=new Array(1,2,2,3,1)
	var UserAnswers = new Array(document.quiz.q1.selectedIndex,document.quiz.q2.selectedIndex,document.quiz.q3.selectedIndex, document.quiz.q4.selectedIndex,document.quiz.q5.selectedIndex)
	var count0 = 0
	if (Answers[0] == UserAnswers[0])
		{count0 = count0 + 1}
	else
		{count0 = count0}
	if (Answers[1] == UserAnswers[1])
		{count1 = count0 + 1}
	else
		{count1 = count0}
	if (Answers[2] == UserAnswers[2])
		{count2 = count1 + 1}
	else
		{count2 = count1}
	if (Answers[3] == UserAnswers[3])
		{count3 = count2 + 1}
	else
		{count3 = count2}
	if (Answers[4] == UserAnswers[4])
		{count4 = count3 + 1}
	else
		{count4 = count3}
	alert("You got " + count4 + "/5 right.")
}