///	messages.js 
///	Created by Questronics Computing Service

///		xmas	///	Function to display the Christmas and/or New Year Greetings in appropriate period

function xmas() {
	var cText='', today = new Date()
	var bXmas = ((today.getMonth() == 11) && (today.getDate() < 27) && (today.getDate() > 17))
	var bNewyear =  (bXmas || ((today.getMonth() == 11) && (today.getDate() > 17)) || ((today.getMonth() == 0) && (today.getDate() < 7)))
//bXmas=true
	if (bXmas || bNewyear) {
		cText = '<p align=center><font face="Wide Latin, Cairo SF, Times, serif" color=red size=5>'
			+ 'Best Wishes for a ' + ((bXmas) ? 'Happy Christmas and a ' : '') + 'Successful and Peaceful New Year</font><p>' 
			+ '<p align=center><font size=3 face="Arial, sans-serif" color=black><b>Greetings from</b><br></font>'
			+ '<font face="Arial, Helvetica, sans-serif" size=6 color=black>www.ShaftesburyCC.co.uk<br></font>'
			+ '<font size=1><br></font><img src="images/scc_hlines.gif" width=100% height=12 align=center><br></p>'
		showMessage(cText, 500, ((bXmas) ? 235 : 205), 15000, 'white', 'Greetings')
	}
}

///		sorry		///	Function to display a Sorry message

function sorry() {
	var cText1 = '<h2 style="text-align:center; color:black;">Shaftesbury Cycling Club</h2>Sorry if you have recently been having trouble accessing this '
		+ 'site.<br> The company that hosts the site have been installing a new system and, although they said there would be no disruption, there have '
		+ 'obviously been some problems.<p>Those of you that remembered and tried the old address of <p style="text-align:center; color:blue; ">'
		+ 'http://www.Shaftesbury-CC.fsnet.co.uk</p>will have realised that it is still valid and can be used as an alternative.'
		+ '<p align=right>Once again, sorry for any inconvenience.</p>'
	showMessage(cText1, 550, 300, 15000, 'white', 'Shaftesbury CC')
}

///		sorry2		///	Function to display a Sorry message

function sorry2() {
	var cText1 = '<h2 style="text-align:center; color:black;">Shaftesbury Cycling Club</h2>Sorry, but due to other committments in the last couple of weeks '
		+ 'the site has not been updated as regularly as we would have liked. I know you will miss the instant Results Service for the Weekend events and '
		+ 'the Evening 10\'s but for a short period the old "word of mouth" will have to suffice.<p>'
	showMessage(cText1, 550, 175, 10000, 'white', 'Shaftesbury CC')
}

var oPopup
var ie = document.all

function showMessage(cText1, nwidth, nheight, ntime, bgcolor, cTitle) {
	if (oPopup) { return }
	var x = Math.max((screen.availWidth - nwidth + 120) / 2, 0)
	var y = Math.max((screen.availHeight - nheight) / 2, 0)
	var frameWidth = (ie) ? document.body.clientWidth : self.innerWidth
	x = ((frameWidth + 110 - nwidth) / 2) - 3
//alert(x)
	if (window.createPopup) {
		oPopup = window.createPopup()
		var oPopupBody = oPopup.document.body
		with (oPopupBody.style) {
			backgroundColor = bgcolor
			border = "solid red 3px"
			padding = "8px"
			textAlign = "justify"
			color = "red"
			fontFamily = "Arial, sans-serif"
			fontSize = "12.0pt"
			fontWeight = "700"
		}
		oPopupBody.innerHTML = cText1
//		oPopup.show(x, 200, nwidth, nheight, document.body)
		oPopup.show(x, 60, nwidth, nheight, document.body)
		window.setTimeout("oPopup.hide()", ntime)
	} else {
		oPopup = window.open('','msgWindow','width=' + nwidth + ',height=' + nheight + ',screenX=' + x + ',screenY=' + y + ',alwaysRaised,titlebar')
		var cText = '<html><head><title>' + cTitle + '</title>\n<style type="text/css">\n<!--\n'
			+ 'body { font-family:"Arial, sans-serif"; font-size:12.0pt; font-weight:700; text-align:justify; color:red; background-color:' + bgcolor + '; }\n'
			+ '-->\n</style>\n</head>\n<body>' + cText1 + '</body></html>'
		oPopup.document.write(cText)
		oPopup.document.close()
		oPopup.focus()
		oPopup.setTimeout("window.close()", (ntime*0.4))
	}
}

