// Get object's browser specific DOM reference
function getDOM(objID,fStyle) {
	var isID = 0;
	var isAll = 0;
	if (document.getElementById) {isID  = 1; }
	if (document.all) 			 {isAll = 1; }
	if (fStyle == 1) {
		if (isID) 		{return (document.getElementById(objID).style);}
		else if (isAll) {return (document.all[objID].style);}
		else 			{return null; }
	}
	else {
		if (isID) 		{return (document.getElementById(objID));}
		else if (isAll) {return (document.all[objID]);}
		else 			{return null; }
	}
}

//Function for changing display attribute of an object
//Changing the values for the display property affects the layout of the surrounding content by:

//    * Adding a new line after the element with the value block.
//    * Removing a line from the element with the value inline.
//    * Hiding the data for the element with the value none. 

// Allowable values for display attribute are:
//block	Object is rendered as a block element.
//none	Object is not rendered.
//inline	Default. Object is rendered as an inline element sized by the dimensions of the content.
//inline-block	Object is rendered inline, but the contents of the object are rendered as a block element. Adjacent 
//              inline elements are rendered on the same line, space permitting.
//list-item	Microsoft Internet Explorer 6 and later. Object is rendered as a block element, and a list-item marker is 
//          added.
//table-header-group	Table header is always displayed before all other rows and row groups, and after any top
//                      captions. The header is displayed on each page spanned by a table.
//table-footer-group	Table footer is always displayed after all other rows and row groups, and before any bottom
//                      captions. The footer is displayed on each page spanned by a table.

//In contrast to the visibility property, display=none reserves no space for the object on the screen.
function swapDisplay (objID) {
	var dom = getDOM(objID,0);
	if (dom.style.display == "block") {
		(dom.style.display = "none");
		} else {
			(dom.style.display = "block");
		}
}

function hideBio (objID){
	var dom = getDOM(objID,0);
	(dom.style.display = "none");
}

function hideSubMenus (){
	var dom = getDOM('schools',0);
	(dom.style.display = "none");
	var dom = getDOM('recreation',0);
	(dom.style.display = "none");
	var dom = getDOM('arts',0);
	(dom.style.display = "none");
	var dom = getDOM('island',0);
	(dom.style.display = "none");
	var dom = getDOM('interest',0);
	(dom.style.display = "none");
}




//Clicking the right arrow cycles forward through images
function nextImage() {
	if (document.images) {
		if (iCurPhoto < (nPhotos - 1)) {
        	iCurPhoto++;
		} else {
			(iCurPhoto = 0);
		}
	}
	var dom = getDOM('photo_name',0);
	dom.src = aImages[iCurPhoto];
//	var dom = getDOM('div_caption',0);
//	dom.innerHTML = caption[iCurPhoto];
//	var dom = getDOM('div_counter',0);
//	dom.innerHTML = ((iCurPhoto + 1) + " of " + nPhotos);
}

//Clicking the left arrow cycles backward through images
function prevImage() {
	if (document.images) {
		if (iCurPhoto > 0) {      
        	iCurPhoto--;
		} else {
			(iCurPhoto = (nPhotos - 1));
		}
	}
	var dom = getDOM('photo_name',0);
	dom.src = dom.src = aImages[iCurPhoto];
//	var dom = getDOM('div_caption',0);
//	dom.innerHTML = caption[iCurPhoto];
//	var dom = getDOM('div_counter',0);
//	dom.innerHTML = ((iCurPhoto + 1) + " of " + nPhotos);
}

function setVisibility(objectID,state) {
		var dom = findDOM(objectID,1);
		dom.visibility = state;
	}
		
function toggleVisibility(objectID) {
		var dom = findDOM(objectID, 1);
		state = dom.visibility;
		if (state == 'hidden' || state == 'hide')
			dom.visibility = 'visible';
		else {
			if (state == 'visible' || state == 'show')
				dom.visibility = 'hidden';
		else dom.visibility = 'visible';
		}
	}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function headerSetFrames (newPage) {
	document.location.href = "header" + newPage + ".htm";
	parent.navframe.document.location.href = "nav" + newPage + ".htm";
	parent.contentframe.document.location.href = "content" + newPage + ".htm";
}
