/*
Standard Functions for KislingburyOnline
*/

function imgSwap(btnName,imgTo,strStatusText)
{
	document.getElementById(btnName).src = imgTo;
	window.status=strStatusText;
}


function fCleanString (strDataToClean)
{
	strValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789!&*()+=@#~.,?/\\<>:;-_"
	strResult = ""
	for (ix=0; ix < strDataToClean.length; ix++)
		{
		if(strValidChars.indexOf(strDataToClean.charAt(ix).toUpperCase())>=0)
			{
			strResult = strResult + strDataToClean.charAt(ix)
			}
		else
			{
			alert("Sorry, but < " + strDataToClean.charAt(ix) + " > is not a usable character in this box.  If it is not automatically removed, please remove it and try again.")
			}
		}
	return strResult
}

function ShowAmenityDetails(intWhich)
//Opens Another Web Site - ALL Words Capitalised
{
var arrPageToShow = new Array()
arrPageToShow[5] = "http://www.theolderedlion.net"
arrPageToShow[6] = "http://www.kislingburyschool.co.uk"
arrPageToShow[8] = "thesun.php"
arrPageToShow[9] = "http://www.northantsfarmholidays.co.uk/accommodation/BB05.shtml"

if (arrPageToShow[intWhich].substr(0,7).toLowerCase() == "http://")
	{
		strWindowName = "enlarge"
	}
	else
	{
		strWindowName = "fmeMainDisplay"	
	}

newWin = window.open(arrPageToShow[intWhich],strWindowName,'')
newWin.focus()
}

function showAmenityDetails(intWhich)
//Opens photo of amenity
{
var arrAmenity = new Array()
var arrPhoto = new Array()
arrAmenity[1] = "The 'Cromwell Cottage'"
arrPhoto[1] = "cromwellcottage"
arrAmenity[2] = "Roger Elliott - Family Butcher"
arrPhoto[2] = "butcher"
arrAmenity[3] = "St Luke's Parish Church"
arrPhoto[3] = "church"
arrAmenity[4] = "The Playing Field and Bowls, Cricket and Football Clubs"
arrPhoto[4] = "playingfield"
// 5 = The Olde Red Lion with link
// 6 = Primary School with link
arrAmenity[7] = "The Village Shop"
arrPhoto[7] = "minimarket"
arrAmenity[8] = "The Sun Inn"
arrPhoto[8] = "thesun"
// 9 = The Elms with link
arrAmenity[10] = "Kislingbury Baptist Church"
arrPhoto[10] = "baptistchurch"
arrAmenity[11] = "Collins and Co. Fireplaces"
arrPhoto[11] = "collinsco"
arrAmenity[12] = "The Village Hall"
arrPhoto[12] = "villagehall"


strURL = "largephoto.php?pic=" + arrPhoto[intWhich] + "&dn=villagephotos&w=400&sw=500&sh=450&t="+arrAmenity[intWhich]+"&warn=0"
window.open(strURL,'enlarge','scrollbars=yes,resizable=yes')

}

function setupVillagePhotos()
{

strPhotoName[1] = "stlukes"
strPhotoName[2] = "approach"
strPhotoName[3] = "themill"
strPhotoName[4] = "kislinflood"
strPhotoName[5] = "cygnets"
strPhotoName[6] = "sunset"
strPhotoName[7] = "playingfield"
strPhotoName[8] = "thatch"
strPhotoName[9] = "thegreen"
strPhotoName[10] = "quarry"
strPhotoName[11] = "ashbyct"
strPhotoName[12] = "theelms"
strPhotoName[13] = "theelms2"
strPhotoName[14] = "dennybuilders"


strPhotoTitle[1] = "St Lukes Church"
strPhotoTitle[2] = "Just entering the Village"
strPhotoTitle[3] = "Kislingbury Mill"
strPhotoTitle[4] = "The Mill Pond In Flood"
strPhotoTitle[5] = "Cygnets on the Mill Pond"
strPhotoTitle[6] = "Sunset over the River"
strPhotoTitle[7] = "The Village Playing Field"
strPhotoTitle[8] = "A Thatched House"
strPhotoTitle[9] = "The Village Green"
strPhotoTitle[10] = "The Old Quarry"
strPhotoTitle[11] = "View from Ashby Court"
strPhotoTitle[12] = "The Elms"
strPhotoTitle[13] = "Near The Elms"
strPhotoTitle[14] = "Denny Builders (Heyford) Building Cottages near the Church (1935)"



strPhotoTitleExtra[1] = ""
strPhotoTitleExtra[2] = ""
strPhotoTitleExtra[3] = " (now Collins Fireplaces)"
strPhotoTitleExtra[4] = ""
strPhotoTitleExtra[5] = ""
strPhotoTitleExtra[6] = ""
strPhotoTitleExtra[7] = ""
strPhotoTitleExtra[8] = " - One of Many in the Village"
strPhotoTitleExtra[9] = " (on Jubilee Day)"
strPhotoTitleExtra[10] = " (and Express Lift Tower)"
strPhotoTitleExtra[11] = " (by Wesley Hodges)"
strPhotoTitleExtra[12] = " (courtesy of Mick Read)"
strPhotoTitleExtra[13] = " (courtesy of Mick Read)"
strPhotoTitleExtra[14] = " (courtesy of John Butcher)"

}

function preLoadCentrePhotos()
{
var imgPhoto1 = new Image()
var imgPhoto2 = new Image()
var imgPhoto3 = new Image()
var imgPhoto4 = new Image()
var imgPhoto5 = new Image()
var imgPhoto6 = new Image()
var imgPhoto7 = new Image()
var imgPhoto8 = new Image()

imgPhoto1.src = "images/pics/ducksonpond_cover.jpg"
imgPhoto2.src = "images/pics/highstreet_cover.jpg"
imgPhoto3.src = "images/pics/kfc_cover.jpg"
imgPhoto4.src = "images/pics/rainbow_cover.jpg"
imgPhoto5.src = "images/pics/redlion_cover.jpg"
imgPhoto6.src = "images/pics/stlukes_cover.jpg"
imgPhoto7.src = "images/pics/stlukesnight_cover.jpg"
imgPhoto8.src = "images/pics/villagehall_cover.jpg"
}

