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)
{
mg_img.src = "/_images/gallery/"+which_thumb+".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;
var e = document.getElementById(d);
e.className = "mini_gallery_thumb_container mini_gallery_thumb_container_hig";
document.forms.CurrentMiniGalImgForm.CurrentMiniGalImg.value = which_thumb;
}


