
//--------THE FOLLOWING INFORMATION IS USED FOR PAGING IMAGE GALLERIES ON A PAGE ( MASTER HEADER)

var cur=1;
var pos;
var rootpath2;
var _newitem;

function masthead_page_image(currentitem,rootpath,pos)
{

	
	rootpath2=rootpath;
	
	//alert(currentitem+' '+rootpath+' '+pos)
	//1 undef
	var pagingimagepth = rootpath.split("data/uploads/").join('');
	var nextitem = '';
	if (pos=='prev'){
		nextitem = parseInt(currentitem);
	}else{
		nextitem = parseInt(currentitem) + 1;
	}

	_newitem = rootpath + imageArray[nextitem];
	//alert(summaryArray[nextitem].split("[pos]").join("'"))
	document.getElementById("_image").src = _newitem;
	document.getElementById("_summ").innerHTML = summaryArray[nextitem].split("[pos]").join("'");
	document.getElementById('imagepagingButtons').innerHTML=""
	document.getElementById('imagepagingButtons2').innerHTML=""
	
	if (imageArray.length-1 > nextitem){
		//display prev button
		var prevbttn=0;
		if (nextitem >= 1){
			document.getElementById("imagepagingButtons").innerHTML = "<a href=\"javascript:masthead_page_image('" + (parseInt(nextitem)-1) + "','" + rootpath + "','prev');\"><img src=\"data/htmlimages/prev.jpg\" /></a>";
			document.getElementById("imagepagingButtons2").innerHTML = "<a href=\"javascript:masthead_page_image('" + (parseInt(nextitem)-1) + "','" + rootpath + "','prev');\"><img src=\"data/htmlimages/prev.jpg\" /></a>";
			
			prevbttn=1;
			cur = (parseInt(nextitem)-1);
			pos = 'prev';
		}
		//display next button
		if (prevbttn==1){
			document.getElementById("imagepagingButtons").innerHTML = document.getElementById("imagepagingButtons").innerHTML + "<a href=\"javascript:masthead_page_image('" + nextitem + "','" + rootpath + "','next');\"><img src=\"data/htmlimages/next.jpg\" /></a>";	
			document.getElementById("imagepagingButtons2").innerHTML = document.getElementById("imagepagingButtons2").innerHTML + "<a href=\"javascript:masthead_page_image('" + nextitem + "','" + rootpath + "','next');\"><img src=\"data/htmlimages/next.jpg\" /></a>";
			
			cur = nextitem;
			pos = 'next';
		}else{
			document.getElementById("imagepagingButtons").innerHTML = "<a href=\"javascript:masthead_page_image('" + nextitem + "','" + rootpath + "','next');\"><img src=\"data/htmlimages/next.jpg\" /></a>";
			document.getElementById("imagepagingButtons2").innerHTML = "<a href=\"javascript:masthead_page_image('" + nextitem + "','" + rootpath + "','next');\"><img src=\"data/htmlimages/next.jpg\" /></a>";
			
			cur = nextitem;
			pos = 'next';
		}
		
	}else{ //we are at the end of the line show prev button
		document.getElementById("imagepagingButtons").innerHTML = "<a href=\"javascript:masthead_page_image('" + (parseInt(nextitem)-1) + "','" + rootpath + "','prev');\"><img src=\"data/htmlimages/prev.jpg\" /></a>"; //will just back up one item
		document.getElementById("imagepagingButtons2").innerHTML = "<a href=\"javascript:masthead_page_image('" + (parseInt(nextitem)-1) + "','" + rootpath + "','prev');\"><img src=\"data/htmlimages/prev.jpg\" /></a>"; //will just back up one item
		
		cur = (parseInt(nextitem)-1);
		pos = 'prev';
		
	}
	
}

var _state=0;
function openClose(){
	if (_state==0){
		document.getElementById("featuredcallout").style.display="none";
		document.getElementById("featuredcalloutClosed").style.display="block";
		_state = 1;
	}else{
		document.getElementById("featuredcallout").style.display="block";
		document.getElementById("featuredcalloutClosed").style.display="none";
		_state = 0;
	}
}

