var PollID = "A4212";

function updated_menu()
{
	document.writeln("<TABLE BORDER='2' BGCOLOR='#CCCCCC' CELLSPACING='0' CELLPADDING='3' VSPACE='5' HSPACE='5' CLASS='credits' WIDTH='100%'>");
	document.writeln("<TR>");
	document.writeln("<TD nowrap><U><B>Recently updated</B></U>");
	document.writeln("<P>");
	document.writeln("<B>");

	document.writeln("(October 25) <A HREF=news10.htm>News</A><BR>");

	document.writeln("</B>");

	document.writeln("(October 23) <A HREF=match_reports/fulham_h.htm>Villa vs Fulham</A><BR>");
	document.writeln("(October 23) <A HREF=rumours.htm>Rumours and speculation</A><BR>");
	document.writeln("(October 23) <A HREF=injuries.htm>Injuries etc.</A><BR>");
	document.writeln("(October 23) <A HREF=overview.htm>Overview</A><BR>");
	document.writeln("(October 23) <A HREF=stats.htm>Statistics</A><BR>");
	document.writeln("(October 23) <A HREF=fixtures.htm>Fixtures</A><BR>");
	document.writeln("(October 23) <A HREF=pictures.htm>Pictures</A><BR>");
	document.writeln("(October 17) <A HREF=match_reports/arsenal_a.htm>Arsenal vs Villa</A><BR>");
	document.writeln("(October 2) <A HREF=match_reports/blackburn_a.htm>Blackburn vs Villa</A><BR>");
//	document.writeln("(August 28) <A HREF=transfers.htm>Transfers</A><BR>");
//	document.writeln("(August 17) <A HREF=../site/whats_new.htm>What's new?</A><BR>");

//	document.writeln("(May 15) <A HREF=match_reports/manchester_united_h.htm>Villa vs Man Utd</A><BR>");
//	document.writeln("(May 15) <A HREF=../club/staff.htm>Staff</A><BR>");
//	document.writeln("(May 9) <A HREF=match_reports/southampton_a.htm>Southampton vs Villa</A><BR>");
//	document.writeln("(May 2) <A HREF=match_reports/tottenham_h.htm>Villa vs Tottenham</A><BR>");
//	document.writeln("(19/08) <A HREF=../3rdhalf.html>3rd Half</A><BR>");


	document.writeln("</TD>");
	document.writeln("</TR>");
	document.writeln("</TABLE>");
}

var announcementstatus = false;
var announcementstatusFrontPage = false;


function announcement()
{
	window.open('../other_html/flash.htm', 'NewsFlash', "status=1,menubar=0,location=0,toolbar=0,directories=0,resizable=0,scrollbars=0");
}

function announcementFrontPage()
{
	if (announcementstatusFrontPage == true)
	{
		window.open('flash.htm', 'NewsFlash', "status=1,menubar=0,location=0,toolbar=0,directories=0,resizable=0,scrollbars=0");
	}
}

function DomainForSale()
{
	window.open('/domainforsale.htm', 'DomainForSale', "status=1,menubar=0,location=0,toolbar=0,directories=0,resizable=0,scrollbars=0");
}

function ComposeEMail()
{
	var params="width=1, height=1, status=0, menubar=0, location=0, toolbar=0, directories=0, resizable=0, scrollbars=0";
	var EMailWindow = window.open("mailto:webmaster@astonvilla.dk?subject=The VillaWeb", "Email", params);
	if(EMailWindow)
	{
		EMailWindow.close();
	}
}

function ComposeEMail_sc()
{
	var params="width=1, height=1, status=0, menubar=0, location=0, toolbar=0, directories=0, resizable=0, scrollbars=0";
	var EMailWindow = window.open("mailto:webmaster@astonvilla.dk?subject=The Silver Cross", "Email", params);
	if(EMailWindow)
	{
		EMailWindow.close();
	}
}

function openreport(url,name)
{
	window.open(url,name,"width=800,height=450,status=1,location=0,toolbar=0,menubar=1,directories=0,resizable=1,scrollbars=1")
}

function opennote()
{
	window.open("note.htm","note","width=450,height=300,status=1,menubar=0,location=0,toolbar=0,directories=0,resizable=1,scrollbars=0");
}

function ad()
{
}

function show_ad()
{
}

function show_pagefooter()
{
	document.writeln('<HR WIDTH="100%" SIZE="1" noshade>');
	document.writeln('<SPAN CLASS="pagefooter">Copyright &#169; <A HREF=file:///D|/index.html TARGET=_top>Christian Jahnsen</A>, 2004.<BR>All Rights Reserved.<BR>This document was last modified on');
	PrintLastModified();
	document.writeln('</SPAN>');
}

function show_pagefooter_sc()
{
	document.writeln('<HR WIDTH="100%" SIZE="1" noshade>');
	document.writeln('<SPAN CLASS="pagefooter">This document was last modified on');
	PrintLastModified();
	document.writeln('<br><a href="javascript:nothing()" onclick="ComposeEMail_sc()">Click here to e-mail webmaster</a>.');
	document.writeln('</SPAN>');
}

function big_crest()
{
	document.writeln('<IMG SRC="graphics/buttons_front_page/crest.jpg" WIDTH="150" HEIGHT="225" ALT="Aston Villa Crest">');
}

function small_crest()
{
	document.writeln("<IMG SRC=\"../graphics/crest_small.gif/\" ALT=\"Aston Villa Crest\" WIDTH=\"70\" HEIGHT=\"105\">");
}

function up_the_villa()
{
	document.writeln("<IMG SRC=../graphics/up_the_villa.gif WIDTH=152 HEIGHT=197 ALT=\"Up the Villa!\">");
}

function openwindow(url,windowname,width,height)
{
	var params="width=" + width + ",height=" + height + ",status=1,menubar=0,location=0,toolbar=0,directories=0,resizable=0,scrollbars=1"
	window.open(url,windowname,params)
}

function centerwindow(width, height)
{
	window.resizeTo(width, height);
	window.moveTo(((screen.availWidth - width) / 2), ((screen.availHeight - height) / 2));
}

function nothing()
{
}

function section(filename)
{
	window.open(filename,"index");
}

function showpicture(url, name)
{
	window.open(url,name,"width=500,height=400,status=1,location=0,toolbar=0,menubar=0,directories=0,resizable=0,scrollbars=0")
}

function showbigpicture(url, name)
{
	window.open(url,name,"width=780,height=550,status=1,location=0,toolbar=0,menubar=0,directories=0,resizable=0,scrollbars=0")
}

function LePr()
{
	openwindow('league_progress.htm','LePr',750,570);
}




// ------------------------------------
// FUNCTIONS FOR AUTOMATED FOOTER

function showcopyright()
{
	document.writeln("</TD></TR></TABLE></DIV></CENTER>");
	document.writeln('<HR WIDTH="100%" SIZE="1" noshade>');
	document.writeln('<SPAN CLASS="pagefooter">This page was last modified on ');
	PrintLastModified();
	document.writeln('This document and its entire contents are property of The VillaWeb.');
	document.writeln('<BR>Copyright &copy; Christian Jahnsen</a>, 2004.');
	document.writeln('<A HREF="javascript:nothing()" onClick="ComposeEMail()">Click here to e-mail Webmaster</A>.');
	document.writeln('<BR>If you wish to reproduce contents and/or graphics from this site, please seek the permission of the Webmaster.');
	document.writeln('<BR>For best view of this site, use Internet Explorer 5 or newer.');
	document.writeln('<BR></SPAN>');
}

function showcopyright_fp()
{
	document.writeln('<TABLE CLASS="pagefooter" WIDTH="100%" border="0" cellspacing="0" cellpadding="2"><TR><TD VALIGN="TOP">');
	document.writeln('This site was last updated on ');
	PrintLastModifiedFrontPage()
	document.writeln('<BR>Copyright &copy; Christian Jahnsen</a>, 2004.');
	document.writeln('<BR><A HREF="javascript:nothing()" onClick="ComposeEMail()">Click here to e-mail Webmaster</A>.');
	document.writeln('<BR>Please seek the permission of the webmaster before reproducing any part of this website.<BR>');
	document.writeln('For best view of this site, please use Internet Explorer 5 or newer.');
	document.writeln('</tr></table>');
}

function PrintLastModified()
{
	var Datostring = document.lastModified;
	var Dag=Datostring.substr(3,2);
	var MaanedTemp=Datostring.substr(0,2);
	var Aar=Datostring.substr(6,4);
	var Maanednavne = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

	if (MaanedTemp.substr(0,1) == 0)
	{
		MaanedTemp = MaanedTemp.substr(1,1);
	}

	if (Dag == "11" || Dag == "12" || Dag == "13")
	{
		var Denounce = "th";
	}
	else if (Dag.substr(1,1) == 1)
	{
		var Denounce = "st";
	}

	else if (Dag.substr(1,1) == 2)
	{
		var Denounce = "nd";
	}

	else if (Dag.substr(1,1) == 3)
	{
		var Denounce = "rd";
	}

	else
	{
		var Denounce = "th";
	}

	if (Dag.substr(0,1) == 0)
	{
		Dag = Dag.substr(1,1);
	}

	var MaanedInt = MaanedTemp-1;
	var Maaned = Maanednavne[(MaanedInt)];

	document.writeln(Maaned + " " + Dag + Denounce + ", " + Aar + ".");
}

function PrintLastModifiedFrontPage()
{
	var Datostring = document.lastModified;
	var Dag=Datostring.substr(3,2);
	var MaanedTemp=Datostring.substr(0,2);
	var Aar=Datostring.substr(6,4);
	var Maanednavne = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

	if (MaanedTemp.substr(0,1) == 0)
	{
		MaanedTemp = MaanedTemp.substr(1,1);
	}

	if (Dag == "11" || Dag == "12" || Dag == "13")
	{
		var Denounce = "th";
	}
	else if (Dag.substr(1,1) == 1)
	{
		var Denounce = "st";
	}

	else if (Dag.substr(1,1) == 2)
	{
		var Denounce = "nd";
	}

	else if (Dag.substr(1,1) == 3)
	{
		var Denounce = "rd";
	}

	else
	{
		var Denounce = "th";
	}

	if (Dag.substr(0,1) == 0)
	{
		Dag = Dag.substr(1,1);
	}

	var MaanedInt = MaanedTemp-1;
	var Maaned = Maanednavne[(MaanedInt)];

	document.writeln(Maaned + " " + Dag + Denounce + ", " + Aar + ".");
}




// ------------------------------------
// FUNCTIONS FOR RIGHT-CLICK PROTECTION




var RightClickMessage="To print, press CTRL+P or click the print button in your browser.\n\nIf you wish to gain permission to use material from this site,\nplease seek the permission of the webmaster, thank you.";

//Message for the alert box

// Don't edit below!

function click(e)
{
	if (document.all)
	{
		if (event.button == 2)
		{
			alert(RightClickMessage);
			return false;
		}
	}
	if (document.layers)
	{
		if (e.which == 3)
		{
			alert(RightClickMessage);
			return false;
		}
	}
}

if (document.layers)
{
	document.captureEvents(Event.mousedown);
}

// document.writeln("<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"../images.js/\"></SCRIPT>");

document.onmousedown=click;











// HEADER-FUNCTIONALITY

function ShowHeader(Section, Title, Title2)
{
	document.writeln("<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"0\" CELLPADDING=\"0\" VSPACE=\"0\" HSPACE=\"0\" CLASS=\"body\">");
	document.writeln("<TR><TD ROWSPAN=4 VALIGN=TOP>");
//		alert(Section);

	if(Section == 1)
	{
		// Current Season
		document.writeln("<IMG SRC=\"../graphics/headers/current_season.jpg\" ALT=\"You are currently in the 'Current Season' section\"");
	}

	if(Section == 2)
	{
		// Players
		document.writeln("<IMG SRC=\"../graphics/headers/squad.jpg\" ALT=\"You are currently in the 'Squad' section\"");
	}

	if(Section == 3)
	{
		// Club
		document.writeln("<IMG SRC=\"../graphics/headers/club.jpg\" ALT=\"You are currently in the 'Club' section\"");
	}

	if(Section == 4)
	{
		// History
		document.writeln("<IMG SRC=\"../graphics/headers/history.jpg\" ALT=\"You are currently in the 'History' section\"");
	}

	if(Section == 5)
	{
		// MATCH REPORTS (2 dirs down)
		document.writeln("<IMG SRC=\"../../graphics/headers/current_season.jpg\" ALT=\"You are currently in the 'Current Season' section\"");
	}

	if(Section == 6)
	{
		// This site
		document.writeln("<IMG SRC=\"../graphics/headers/this_site.jpg\" ALT=\"You are currently in the 'This Site' section\"");
	}

	if(Section == 7)
	{
		// Links
		document.writeln("<IMG SRC=\"../graphics/headers/links.jpg\" ALT=\"You are currently in the 'Links' section\"");
	}

	if(Section == 8)
	{
		// On-line
		document.writeln("<IMG SRC=\"../graphics/headers/links.jpg\" ALT=\"You are currently in the 'Links' section\"");
	}

	if(Section == 9)
	{
		// SEASON ARCHIVES
		document.writeln("<IMG SRC=\"../../../graphics/headers/history.jpg\" ALT=\"You are currently in the 'History' section\"");
	}

	if(Section == 10)
	{
		// SEASON ARCHIVES - MATCH REPORTS
		document.writeln("<IMG SRC=\"../../../../graphics/headers/history.jpg\" ALT=\"You are currently in the 'History' section\"");
	}

	if(Section == 11)
	{
		// PAST PLAYERS (2 dirs down)
		document.writeln("<IMG SRC=\"../../graphics/headers/history.jpg\" ALT=\"You are currently in the 'History' section\"");
	}

	if(Section == 12)
	{
		// Players (2 dirs down)
		document.writeln("<IMG SRC=\"../../graphics/headers/squad.jpg\" ALT=\"You are currently in the 'Squad' section\"");
	}

	document.writeln(" WIDTH=175 HEIGHT=179></TD><TD>&nbsp;<BR></TD></TR><TR>");
	document.writeln("<TD WIDTH=\"100%\" ALIGN=\"CENTER\"><SPAN CLASS=\"pageheader\">" + Title);

	if(Title2 != "")
	{
		document.writeln("</SPAN><BR>" + Title2	 + "</TD>");
	}
	else
	{
		document.writeln("</SPAN></TD>");
	}


	document.writeln("</TR><TR><TD>&nbsp;</TD></TR><TR><TD>");

	if(Section == 1)
	{
		if (announcementstatus == true)
		{
			document.writeln("<SPAN CLASS=\"BODY\"><A HREF=\"javascript:announcement()\">VillaWeb newsflash</A></SPAN><BR><BR><BR>");
		}
	}
}

function InsertPoll()
{
		document.writeln("<SCRIPT SRC=http://x1.quickpoll.dk/qp/qp/QPServlet?pollid=" + PollID + "></SCRIPT>");
/*
		document.writeln("<CENTER><SPAN CLASS='credits'><A HREF='javascript:nothing()' onClick=\"openwindow('../other_html/previous_polls.htm', 'OtherPolls', 600, 400)\">Previous polls</A></SPAN>");
		document.writeln("</CENTER>");
*/
}



/*
	-------------------------------------------
	FUNCTIONS FOR OPENING IMAGE IN A NEW WINDOW
*/

var image;
var urlquery;
var urlterms;
var img;
var imgheight;
var imgwidth;
	
function ViewImage(Url)
{
	window.open(Url, 'ImageWindow', "status=1,menubar=0,location=0,toolbar=0,directories=0,resizable=1,scrollbars=1");
}

function Pause(milliseconds)
{
	setTimeout("nothing()", milliseconds); 
}


function LoadImage()
{
	// Fetch relative path to image from URL

	urlquery = location.href.split("?")
	urlterms = urlquery[1].split(",")

	img = urlterms[0];
	image = new Image();
	image.src = img;

/*
	imgheight = image.height;
	imgwidth  = image.width;

	var WaitCounter;
	WaitCounter = 0;
	
	while(imgwidth == 0)
	{
		Pause(500);
		imgheight = image.height;
		imgwidth  = image.width;
		WaitCounter++;
		if(WaitCounter == 20)
		{
			document.location.reload();
		}
	}
*/
//	alert(img + ", " + image + ", " + imgheight + ", " + imgwidth);

	// Write image-tag with width and height included for smoother download
	document.writeln('<center><img src="' + img + '"></center>');
	document.writeln('<center class="txt"><a href="javascript:window.close()">Luk vinduet</A></center>');
}

function CreateImagePage()
{
	// Extract image width and height and decide window size

	imgheight = image.height;
	imgwidth  = image.width;

	var windowheight = imgheight + 80;
	var windowwidth = imgwidth + 35;
	
	// Check if window size exceeds screen resolution

	if (screen.availWidth <= windowwidth)
	{
		windowwidth = screen.availWidth - 5;
	}

	if (screen.availHeight <= (windowheight + 50))
	{
		windowheight = screen.availHeight;
	}

	// Adjust window size and center it

	window.resizeTo(windowwidth, windowheight);
	window.moveTo(((screen.availWidth - windowwidth) / 2), ((screen.availHeight - windowheight) / 2));
	window.focus();
}
