 //*******Calculate and set the min-height attribute so that we can fill the screen.*******
 function findheight() {
 
 	var wheight = screen.availHeight;
 	
 	if (document.all){
 	
 		var nheight = wheight-438;
 	}
 	else {
 		var nheight = wheight-428;
 	}
 	
 	document.getElementById('maincontent').style.minHeight=nheight+"px";
 
}



 /* ====================================================
 Image Slide Show
==================================================== */

//*** Fader script ***
// http://brainerror.net/scripts/javascript/blendtrans/ for the fade transition

function opacityin(id, opacStart, opacEnd, millisec) { 
//speed for each frame 
var speed = Math.round(millisec / 100); 
var timer = 10; 

//determine the direction for the blending, if start and end are the same nothing happens 
if(opacStart > opacEnd) { 
 for(i = opacStart; i >= opacEnd; i--) { 
     setTimeout("changeOpacin(" + i + ",'" + id + "')",(timer * speed)); 
     timer++; 
 } 
} else if(opacStart < opacEnd) { 
 for(i = opacStart; i <= opacEnd; i++) 
 { 
     setTimeout("changeOpacin(" + i + ",'" + id + "')",(timer * speed)); 
     timer++; 
 } 
} 
} 


//change the opacity for different browsers 
function changeOpacin(opacity, id) { 
var object = document.getElementById(id).style; 
	object.filter = "alpha(opacity=" + opacity + ")"; 
	object.opacity = (opacity / 100); 
	object.MozOpacity = (opacity / 100); 
	object.KhtmlOpacity = (opacity / 100); 
} 


//*** DECLARE VARIABLES *** these have been removed for this website to allow for a varied size in images via css
//var imgwidth = "275";
//var imgheight = "275";
//var imgclass = "rsimg";


var opimages = new Array();
opimages[0]='/gfx/headgallery/kral78.jpg';
opimages[1]='/gfx/headgallery/dijon-celeb2.jpg';
opimages[2]='/gfx/headgallery/0FGJHMP0ODH4E80EGH1C100DT401_600.jpg';
opimages[3]='/gfx/headgallery/IMG_0098.jpg';
opimages[4]='/gfx/headgallery/kral62.jpg';

var opimagesB = new Array();
opimagesB[0]='/gfx/highlightsgallery/graves72.jpg';
opimagesB[1]='/gfx/highlightsgallery/kral26.jpg';
opimagesB[2]='/gfx/highlightsgallery/kral31.jpg';
opimagesB[3]='/gfx/highlightsgallery/kral65.jpg';
opimagesB[4]='/gfx/highlightsgallery/kral72.jpg';


var nimg = -1;
var nimgC = -1;
var nimgl = opimages.length-1;
var nimglB = opimagesB.length-1;

//*** Image swaper ***
function imagehide() {
	//this hides the initial fade-in image to make way for the full slide-show 	
	document.getElementById("imageslide").style.display = "none";
}

function imagehideB() {
	//this hides the initial fade-in image to make way for the full slide-show 	
	document.getElementById("imageslideB").style.display = "none";
}


function imagegallery() {

	//this part is what generates the image and calculates what image it is on and increment it by one on each loop of the image_swap() function
	if (nimg<opimages.length-1)
	{
	nimg++
	}
	else if (nimg>=opimages.length-1)
	{
	nimg = 0;
	}
	
	document.getElementById("headgallery").innerHTML = '<div id="slidecontainer" class="imagefade"><img src="'+opimages[nimg]+'" alt="Team JVA Gallery" /></div>';
	opacityin('slidecontainer', 0, 100, 500);
	setTimeout("opacityin('slidecontainer', 100, 0, 500)",4400);  
	return true;
}

function imagegalleryB() {

	//this part is what generates the image and calculates what image it is on and increment it by one on each loop of the image_swap() function
	if (nimg<opimagesB.length-1)
	{
	nimg++
	}
	else if (nimg>=opimagesB.length-1)
	{
	nimg = 0;
	}
	
	document.getElementById("highlightsgallery").innerHTML = '<div id="slidecontainerB" class="imagefade"><img src="'+opimagesB[nimg]+'"  alt="Team JVA Highlights" /></div>';
	opacityin('slidecontainerB', 0, 100, 500);
	setTimeout("opacityin('slidecontainerB', 100, 0, 500)",19400);  
	return true;
}

//**** gallery page forward and back scripts
function imagegalleryC(nimgC) {

	clearclass();
	
	if (nimgC<opimagesC.length-1)
	{
	nimgC++
	}
	else if (nimgC>=opimagesC.length-1)
	{
	nimgC = 0;
	}
	
	thisSlide = nimgC+1;
	totslides = opimagesC.length;
	slidenumb = "<b>Photo:</b> "+thisSlide+" of "+totslides;
	
	thisimgid = nimgC-1;
	curimgid = "pgi"+thisimgid;
	document.getElementById(curimgid).className = "curimg";
	
	document.getElementById("largePGimage").innerHTML = '<a id="slideprev" onclick="imagegalleryCback('+nimgC+')" onmousedown="gallerybuttons(\'1\',\'slideprev\')" onmouseup="gallerybuttons(\'0\',\'slideprev\')"></a><div id="slidecontainerC" class="imagefade"><img src="'+opimagesC[nimgC]+'"  alt="Team JVA Photo Gallery" /><br />'+slidenumb+'</div><a id="slidenext" onclick="imagegalleryC('+nimgC+')" onmousedown="gallerybuttons(\'1\',\'slidenext\')" onmouseup="gallerybuttons(\'0\',\'slidenext\')"></a>';
	opacityin('slidecontainerC', 0, 100, 500);
	return true;
}

function imagegalleryCback(nimgC){

	clearclass();
	
	if (nimgC>0)
	{
	nimgC--
	}
	else if (nimgC<=0)
	{
	nimgC = opimagesC.length-1;
	}
	
	thisSlide = nimgC+1;
	totslides = opimagesC.length;
	slidenumb = "<b>Photo:</b> "+thisSlide+" of "+totslides;
	
	thisimgid = nimgC-1;
	curimgid = "pgi"+thisimgid;
	document.getElementById(curimgid).className = "curimg";
	
	document.getElementById("largePGimage").innerHTML = '<a id="slideprev" onclick="imagegalleryCback('+nimgC+')" onmousedown="gallerybuttons(\'1\',\'slideprev\')" onmouseup="gallerybuttons(\'0\',\'slideprev\')"></a><div id="slidecontainerC" class="imagefade"><img src="'+opimagesC[nimgC]+'"  alt="Team JVA Photo Gallery" /><br />'+slidenumb+'</div><a id="slidenext" onclick="imagegalleryC('+nimgC+')" onmousedown="gallerybuttons(\'1\',\'slidenext\')" onmouseup="gallerybuttons(\'0\',\'slidenext\')"></a>';
	opacityin('slidecontainerC', 0, 100, 500);
	return true;
}

function gallerybuttons(changeit,id) {

	theimga = "url(/gfx/"+id+"on.gif)";
	theimgb = "url(/gfx/"+id+".gif)";

	if(changeit == "1")
	{
		document.getElementById(id).style.backgroundImage = theimga;
	}
	else
	{
		document.getElementById(id).style.backgroundImage = theimgb;
	}

}

function totop() {
	top.location='#';
}

//****** Image Gallery - image change *******

function image_swap()
{
	if(document.getElementById("highlightsgallery") != null){image_swapB();}
	//if(document.getElementById("largePGimage") != null){image_swapC();}
	
	//this part has been added to show the last image in the array to start with for 5 seconds as the slideshow has a 5 second delay	
	document.getElementById("headgallery").innerHTML = '<div id="slidecontainer" class="imagefade"><img src="'+opimages[nimgl]+'"  id="imageslide" alt="Team JVA Gallery" /></div>';
	opacityin('slidecontainer', 0, 100, 500);
	setTimeout("opacityin('slidecontainer', 100, 0, 500)",4400);
	var Tout = setTimeout("imagehide()", 4800);

	//this part activates and loops the fade in/out and image change script	
	var Tinterval = setInterval("imagegallery()", 5000);
	
}

function image_swapB()
{
	//this part has been added to show the last image in the array to start with for 5 seconds as the slideshow has a 5 second delay	
	document.getElementById("highlightsgallery").innerHTML = '<div id="slidecontainerB" class="imagefade"><img src="'+opimagesB[nimglB]+'"  id="imageslideB" alt="Team JVA Highlights" /></div>';
	opacityin('slidecontainerB', 0, 100, 500);
	setTimeout("opacityin('slidecontainerB', 100, 0, 500)",19400);
	var ToutB = setTimeout("imagehideB()", 19800);
	
	//this part activates and loops the fade in/out and image change script	
	var TintervalB = setInterval("imagegalleryB()", 20000);
}



function comingsoon() {

document.getElementById("mssg").style.display = "block";
document.getElementById("mssg").innerHTML = '<div id="comingsoon">Content coming soon.<div id="mssgclose"><a href="#" onclick="hide(\'mssg\')">Close</a></div></div>';

}

function hide(id){
document.getElementById(id).style.display = "none";
}



/**** Show/Hide top drop menu ****/

function showmenu(menuid,theclass,fromleft){

var themenu = document.getElementById(menuid);

	if(themenu != null)
	{
		newcurtop = 198;
		newcurleft = fromleft;

		document.getElementById(theclass).className = "topmenuHi";
		document.getElementById(menuid).style.left = newcurleft+"px";
		document.getElementById(menuid).style.top = newcurtop+"px";
		document.getElementById(menuid).style.display = "block";
	}
}

function hidemenu(menuid,theclass){

var themenu = document.getElementById(menuid);

	if(themenu != null)
	{
		document.getElementById(theclass).className = "";
		document.getElementById(menuid).style.display = "none";
	}
}