function checkInputIn(which_form, which_input, should_be)
{
var a = eval("document.forms."+which_form+"."+which_input+".value");
if (a == should_be)
	{
	eval("document.forms."+which_form+"."+which_input+".value = '';");
	}
}

function checkInputOut(which_form, which_input, should_be)
{
var a = eval("document.forms."+which_form+"."+which_input+".value");
if (a == "")
	{
	eval("document.forms."+which_form+"."+which_input+".value = '"+should_be+"';");
	}
}


function preloadImpactImgs()
{
if (document.images)
	{
	preload_image_object = new Image();
	image_url = new Array();
	image_url[0] = "/_images/impacts/accommodation.jpg";
	image_url[1] = "/_images/impacts/restaurant.jpg";
	image_url[2] = "/_images/impacts/bar.jpg";
	image_url[3] = "/_images/impacts/events.jpg";
	
	var i = 0;
	for(i=0; i<=3; i++) 
	preload_image_object.src = image_url[i];
	}
}


function navigate(which_impact,isOnAuto,faded,hideButton)
{

if (!isOnAuto == 1)
	{
	clearInterval (ChangeImpactIntervalId);
	}

var currentImpact = document.forms.CurrentImpactForm.CurrentImpact.value;

var currentDivLeftStr = "impact_"+currentImpact+"_left"
var currentDivLeft = document.getElementById(currentDivLeftStr);
currentDivLeft.className = 'impact_button_left';

var currentDivRightStr = "impact_"+currentImpact+"_right"
var currentDivRight = document.getElementById(currentDivRightStr);

if (faded == 1)
	{
	currentDivRight.className = 'impact_button_right impact_button_right_faded';
	}
else
	{
	currentDivRight.className = 'impact_button_right';
	}

document.forms.CurrentImpactForm.CurrentImpact.value = which_impact;


var pi = document.getElementById("impact_container_right");
pi.style.backgroundImage = "url(/_images/impacts/"+currentImpact+".jpg)";
pi.style.backgroundRepeat = "no-repeat";

var ii = document.getElementById("impactImg");

var ii_randomNumber = Math.floor(Math.random()*1000000);
ii.src = "/_images/impacts/"+which_impact+".jpg?"+ii_randomNumber;

ii.style.opacity = 1/10;
ii.style.filter = 'alpha(opacity=' + 1*10 + ')';

fadeImageIntervalId = setInterval ( "fadeImage('impactImg')", 70 );


divLeftStr = "impact_"+which_impact+"_left"
var divLeft = document.getElementById(divLeftStr);
divLeft.className = 'impact_button_left_selected';

divRightStr = "impact_"+which_impact+"_right"
var divRight = document.getElementById(divRightStr);
divRight.className = 'impact_button_right_selected';


var CurrentMessageDivStr = "impactCopyTop_"+currentImpact;
var CurrentMessageDiv = document.getElementById(CurrentMessageDivStr)
CurrentMessageDiv.className = 'impactCopyHidden';

var messageDivStr = "impactCopyTop_"+which_impact;
var messageDiv = document.getElementById(messageDivStr)
messageDiv.className = 'impactCopyVisible';


var CurrentBotMessageDivStr = "impactCopyBottom_"+currentImpact;
var CurrentBotMessageDiv = document.getElementById(CurrentBotMessageDivStr)
CurrentBotMessageDiv.className = 'impactCopyHidden';

var messageBotDivStr = "impactCopyBottom_"+which_impact;
var messageBotDiv = document.getElementById(messageBotDivStr)
messageBotDiv.className = 'impactCopyVisible';

if (!hideButton == 1)
	{
	var ButtonDiv = document.getElementById("impact_more_button");
	ButtonDiv.innerHTML = '<a href="/'+which_impact+'-at-The-Duke-of-Wellington/" title="find out more about the '+which_impact+' at The Duke of Wellington, Newton, Northumberland"><img src="/_images/buttons/bt_more.gif" alt="" /></a>';
	}
}


function fadeImage(which_image)
{
im = document.getElementById(which_image);
var imo = im.style.opacity;
imo = imo*10;
imo = imo+1;
im.style.opacity = imo/10;
im.style.filter = 'alpha(opacity=' + imo*10 + ')';
if (imo == 9)
	{
	clearInterval (fadeImageIntervalId);
	im.style.opacity = 10/10;
	im.style.filter = 'alpha(opacity=' + 10*10 + ')';
	}
}


function changeImpact()
{
getImpactName(currentImpactNum);

var nextImpactNum = currentImpactNum+1;
if (nextImpactNum == 5)
	{
	nextImpactNum = 1;
	}

navigate(currentImpact,1);

currentImpactNum = nextImpactNum;
}


function swapMiniGalleryThumb(which_thumb, which_thumb_num)
{
mg_img.src = "/_images/gallery/"+which_thumb+"_m.jpg";
var a = document.forms.CurrentMiniGalImgForm.CurrentMiniGalImg.value;
var b = "mgt"+a;
var c = document.getElementById(b);
c.className = "mini_gallery_thumb_container";
var d = "mgt"+which_thumb_num;
var e = document.getElementById(d);
e.className = "mini_gallery_thumb_container mini_gallery_thumb_container_hig";
document.forms.CurrentMiniGalImgForm.CurrentMiniGalImg.value = which_thumb_num;
}


function PrintWellingtonPage() {
window.print();
}



function showHideList(which_list) {
var a = document.getElementById(which_list);
if (a.className == "list_show")
	{
	a.className = "list_hidden";
	}
else
	{
	a.className = "list_show";
	}
}


function showHideYearList(which_list, which_plus_minus) {
var a = document.getElementById(which_list);
var b = document.getElementById(which_plus_minus);
if (a.className == "list_show")
	{
	a.className = "list_hidden";
	b.innerHTML = "+";
	}
else
	{
	a.className = "list_show";
	b.innerHTML = "-";
	}
}



function orderImage(which_imageID, whichID, up_or_down, returnPosition) {
document.forms.copyForm.final_save.value = "0";
if (up_or_down == "up")
	{
	document.forms.copyForm.rURL.value = "orderImageUp.asp?iID="+which_imageID+"&id="+whichID+"&returnPosition="+returnPosition;
	}
else
	{
	document.forms.copyForm.rURL.value = "orderImageDown.asp?iID="+which_imageID+"&id="+whichID+"&returnPosition="+returnPosition;
	}
document.forms.copyForm.submit();
}


function NewBlogImageSelector(which_iframe_ID, imageChangeId) {
var a = document.getElementById("selectImage"+which_iframe_ID);
var b = document.getElementById("plusMinus"+which_iframe_ID);
if (a.style.display == "block")
	{
	b.innerHTML = "+";
	a.src = "/_admin/blog/blank_iframe.asp";
	a.style.display = "none";
	}
else
	{
	b.innerHTML = "-";
	b.style.paddingLeft = "2px";
	b.style.paddingRight = "2px";
	a.src = "/_admin/blog/select_image.asp?iID="+which_iframe_ID+"&imageChangeId="+imageChangeId;
	a.style.display = "block";
	}
}


function SelectNewBlogImage(original_image, new_image, new_image_name, imageChangeId) {
var a = parent.document.getElementById("mBlogImg"+original_image);
a.style.display = "block";
a.src = "/_images/blog/"+new_image_name+"_m.jpg";
var b = parent.document.getElementById("commitLink"+original_image);

if (original_image == "NewImg")
	{
	b.innerHTML = '<input type="button" value="commit image addition" class="subButCommit" onclick="this.form.final_save.value=\'0\';	this.form.rURL.value=\'add_new_image.asp?nImg='+new_image+'\'; this.form.imageChangeId.value=\''+imageChangeId+'\'; this.form.imageChangeFrom.value=\''+original_image+'\'; this.form.imageChangeTo.value=\''+new_image+'\'; this.form.submit();" />';
	}
else
	{
	b.innerHTML = '<input type="button" value="commit image change" class="subButCommit" onclick="this.form.final_save.value=\'0\';	this.form.rURL.value=\'add_step4.asp\'; 	this.form.imageChangeId.value=\''+imageChangeId+'\'; this.form.imageChangeFrom.value=\''+original_image+'\'; this.form.imageChangeTo.value=\''+new_image+'\'; this.form.submit();" />';
	}
}


function DeleteBlogImage(imgID, dbID, blogID) {
var agree = confirm("Are you sure you wish to delete this blog image? Deleting this image will remove the copy above and below. If you'd like to keep the wording, please move it before deleting the image. And please save any unsaved copy changes before deleting. Only press OK if you're sure you want to delete.");
if (agree)
	{
	location.href="deleteBlogImage.asp?imgID="+imgID+"&dbID="+dbID+"&blogID="+blogID;
	}
else
	{
	return false;
	}
}


function largeBlogImg(which_img) {
var a = which_img;
var b = a.replace("_t.jpg", ".jpg");
alert (b);
}

