function popWindow(url, width, height, scrollable)	{

	window.open(url, '', "height=" + height + ", width=" + width + ", scrollbars=" + scrollable);

}

function DeactivateLinks(objLink)	{
	
	for (var i = 0; i < document.links.length; i++) {
		document.links[i].style.background = '#E1DFC0';
		document.links[i].style.color = '#404039';
	}
	
	document.links[objLink].style.background = '#404039';
	document.links[objLink].style.color = '#FFFFFF';
	
}

function ChangeFrame(Level, CategoryID, Page)	{

	if(Level == 1)	{
	
		window.parent.window.frames['imagesframe'].location.replace('browseresults.php?CategoryID=' + CategoryID);
		window.parent.window.frames['description'].location.replace('categorydescription.php?CategoryID=' + CategoryID);
		window.parent.window.frames['categories2'].location.replace('categories2.php?ParentID=' + CategoryID);
		window.parent.window.frames['categories3'].location.replace('blank.php');
		window.parent.window.frames['categories4'].location.replace('blank.php');
		
	}
	
	if(Level == 2)	{
	
		window.parent.window.frames['imagesframe'].location.replace('browseresults.php?CategoryID=' + CategoryID);
		window.parent.window.frames['description'].location.replace('categorydescription.php?CategoryID=' + CategoryID);
		window.parent.window.frames['categories3'].location.replace('categories3.php?ParentID=' + CategoryID);
		window.parent.window.frames['categories4'].location.replace('blank.php');
		
	}
	
	if(Level == 3)	{
	
		window.parent.window.frames['imagesframe'].location.replace('browseresults.php?CategoryID=' + CategoryID);
		window.parent.window.frames['description'].location.replace('categorydescription.php?CategoryID=' + CategoryID);
		window.parent.window.frames['categories4'].location.replace('categories4.php?ParentID=' + CategoryID);
		
	}
	
	if(Level == 4)	{
	
		window.parent.window.frames['imagesframe'].location.replace('browseresults.php?CategoryID=' + CategoryID);
		window.parent.window.frames['description'].location.replace('categorydescription.php?CategoryID=' + CategoryID);
		
	}

}


function ChangeSearchFrame(Level, CategoryID)	{

	if(Level == 1)	{
	
		window.parent.window.frames['subcategories'].location.replace('sub_categories.php?CategoryID=' + CategoryID);
		
	}

}

function ChangePioneerDescription(PioneerID)	{
	
		window.parent.window.frames['description'].location.replace('pioneer_description.php?PioneerID=' + PioneerID);

}

function ClearPioneerDescription()	{
	
		window.parent.window.frames['description'].location.replace('blank.php');

}

function ChangeCategoryDescription(CategoryID)	{
	
		window.parent.window.frames['description'].location.replace('search_category_description.php?CategoryID=' + CategoryID);

}

function pioneerSelected(obj)	{

	if(obj.checked)	{
		window.parent.window.frames['selectedcriteria'].location.replace('selected_criteria.php?action=addPioneer&pioneer=' + obj.value);
	}
	else	{
		window.parent.window.frames['selectedcriteria'].location.replace('selected_criteria.php?action=removePioneer&pioneer=' + obj.value);
	}

}

function pioneerSelectedB(obj)	{

	if(obj.checked)	{
		window.location.replace('selected_criteria.php?action=addPioneer&pioneer=' + obj.value);
	}
	else	{
		window.location.replace('selected_criteria.php?action=removePioneer&pioneer=' + obj.value);
		window.parent.window.frames['subcategories'].location.reload(true);
	}

}

function categorySelected(obj)	{

	if(obj.checked)	{
		window.parent.window.frames['selectedcriteria'].location.replace('selected_criteria.php?action=addCategory&category=' + obj.value);
	}
	else	{
		window.parent.window.frames['selectedcriteria'].location.replace('selected_criteria.php?action=removeCategory&category=' + obj.value);
	}

}

function categorySelectedB(obj)	{

	if(obj.checked)	{
		window.location.replace('selected_criteria.php?action=addCategory&category=' + obj.value);
	}
	else	{
		window.location.replace('selected_criteria.php?action=removeCategory&category=' + obj.value);
		window.parent.window.frames['subcategories'].location.reload(true);
	}

}

function WriteLayer(ID,parentID,URL) {
if (document.layers) {
var oLayer;
if(parentID){
oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
}else{
oLayer = document.layers[ID].document;
}
oLayer.open();
oLayer.write(URL);
oLayer.close();
}
else if (parseInt(navigator.appVersion)>=5&&navigator.
appName=="Netscape") {
document.getElementById(ID).innerHTML = URL;
}
else if (document.all) document.all[ID].innerHTML = URL
}

function ChangeMediumView(ImageID, position, resultSize)	{
		
			window.parent.window.frames['mediumview'].location.replace('medium_view.php?ImageID=' + ImageID);

}

function ChangeMediumViewDesc(ImageID, position, resultSize)	{
		
			window.parent.window.frames['mediumviewdescription'].location.replace('medium_view_description.php?ImageID=' + ImageID);

}

function ChangeMediumViewShortDesc(ImageID, position, resultSize)	{
		
			window.parent.window.frames['mediumviewshortdescription'].location.replace('medium_view_short_description.php?ImageID=' + ImageID);

}

function MoveToImage(ImageID, position, resultSize)	{

	if(position >= 0)	{
	
		if(position < resultSize)	{
		
			window.parent.window.frames['mediumview'].location.replace('medium_view.php?ImageID=' + ImageID);
			window.parent.window.frames['mediumviewdescription'].location.replace('medium_view_description.php?ImageID=' + ImageID);
			window.parent.window.frames['mediumviewshortdescription'].location.replace('medium_view_short_description.php?ImageID=' + ImageID);
			window.parent.window.frames['collectionview'].location.replace('collection_view.php?ImageID=' + ImageID);
			WriteLayer('number',null, (position + 1) + ' of ' + resultSize);
			
		}
		else	{
			stopSlideShow();
		}
	}

}

var myinterval;

function startStop(position, resultSize)	{

if(document.getElementById('playpausebutton').src == 'http://www.ahrf.com/images/btn_play_slideshow.gif')	{
	WriteLayer('playpause',null, '<img src="images/btn_pause_slideshow.gif" alt=""  border="0" id="playpausebutton">');
	//document.getElementById('playpause').src = 'http://www.ahrf.com/dev/images/btn_pause_slideshow.gif';
	startSlideShow(position, resultSize);
	return;
}

if(document.getElementById('playpausebutton').src == 'http://www.ahrf.com/images/btn_pause_slideshow.gif')	{
	WriteLayer('playpause',null, '<img src="images/btn_play_slideshow.gif" alt=""  border="0" id="playpausebutton">');
	//document.getElementById('playpause').src = 'http://www.ahrf.com/dev/images/btn_play_slideshow.gif';
	stopSlideShow();
	return;
}

}

function startSlideShow(position, resultSize)	{

myinterval = window.setInterval('MoveToImage(imageArray[position + 1], 1+position++, resultSize)', 5000);

}

function stopSlideShow()	{

window.clearInterval(myinterval);
WriteLayer('playpause',null, '<img src="images/btn_play_slideshow.gif" alt=""  border="0" id="playpausebutton">');

}

function enlarge(ImageID)	{

	leftPos = 0;
	topPos = 0;
	if (screen) {
		leftPos = (screen.width / 2) - 400;
		topPos = (screen.height / 2) - 300;
	}
	ElementWindow = window.open('large_view.php?ImageID=' + ImageID,'ElementWin','width=800,height=600,left='+leftPos+',top='+topPos);

}


function ExpandPioneerSection(obj)	{

	document.getElementById("AtoB").style.display = "none";
	document.getElementById("CtoD").style.display = "none";
	document.getElementById("EtoF").style.display = "none";
	document.getElementById("GtoH").style.display = "none";
	document.getElementById("ItoJ").style.display = "none";
	document.getElementById("KtoL").style.display = "none";
	document.getElementById("MtoN").style.display = "none";
	document.getElementById("OtoP").style.display = "none";
	document.getElementById("QtoR").style.display = "none";
	document.getElementById("StoT").style.display = "none";
	document.getElementById("UtoV").style.display = "none";
	document.getElementById("WtoX").style.display = "none";
	document.getElementById("YtoZ").style.display = "none";
	
	document.getElementById(obj).style.display = "block";

}