//for the news gallery
function renderImage(num, image){
	var imageinfo
	imageinfo = "<img src=\"../images/cuttings/"+image+"_med.png\" id=\""+num+"_thumb\" alt=\"\" border=\"0\" ";
	imageinfo += "onmouseover=\"this.style.cursor='pointer'\" ";
  imageinfo += "onclick=\"displayNewImage('large_image', '../images/cuttings/', '"+image+".png'), ";
  imageinfo += "displayNewText('cutting_desc','left_side_text_"+num+"')\"/> "
	document.write(imageinfo);
}


//used with SELECT element to change a displayed image when an option is selected
/* 
ARG 1 (theElement) = The element where the image is to be displayed - usually a blank image
ARG 2 = the name of the image inc tag
ARG 3 = the path where it is stored on the server
ARG 4 = text element
ARG 5 = '' or 'none' = display or hide
*/

function displayNewImage(imageElement, thePath, imageName){
var newImage=document.getElementById(imageElement)
	newImage.src = thePath + imageName;
}

function displayNewText(toElement,fromElement){
	var x=document.getElementById(toElement);
	var y=document.getElementById(fromElement);
	//x.innerHTML = '';
	x.innerHTML = y.innerHTML;
	}




//CALL: onchange="displayImagePlus('display_image', this.options[this.selectedIndex].value, 'images/products/','','')"
function displayImage(theElement, theValue, thePath, object, showText){
var theImage=document.getElementById(theElement)
//var theText=document.getElementById(object)
	//image change
	theImage.src = thePath + theValue;
	
	//text or other change
	if(showText	== "hide")showText = "none";
	if(showText == "show")showText = "block";
	document.getElementById(object).style.display = showText;
}


//used with SELECT element to check an images size and change a displayed image when an option is selected
//CALL: onchange="checkAndDisplayImage(theElement, theValue, thePath, errorElement, maxWidth, maxHeight, imageWidth, imageHeight)"
function checkAndDisplayImage(theElement, theValue, thePath, errorElement, maxWidth, maxHeight, imageWidth, imageHeight){
	if(imageWidth > maxWidth || imageHeight > maxHeight){
		document.getElementById(errorElement).innerHTML='The selected image is too large'; }
	else{
	 displayImage(theElement, theValue, thePath)
	}
}





//Show one and hide other elements
function showSidebarText(object) {
		document.getElementById('side_text_00').style.display='none';
		document.getElementById('side_text_01').style.display='none';
		document.getElementById('side_text_02').style.display='none';
		document.getElementById('side_text_03').style.display='none';
		document.getElementById('side_text_04').style.display='none';
		document.getElementById('side_text_05').style.display='none';
		document.getElementById('side_text_06').style.display='none';
		document.getElementById('side_text_07').style.display='none';
		document.getElementById('side_text_08').style.display='none';
		document.getElementById('side_text_09').style.display='none';
		document.getElementById('side_text_10').style.display='none';
		document.getElementById('side_text_11').style.display='none';
		document.getElementById('side_text_12').style.display='none';
		document.getElementById('side_text_13').style.display='none';
		document.getElementById('side_text_14').style.display='none';
		document.getElementById('side_text_15').style.display='none';
		document.getElementById('side_text_16').style.display='none';
		document.getElementById('side_text_17').style.display='none';
		document.getElementById('side_text_18').style.display='none';
		document.getElementById('side_text_19').style.display='none';
		
		document.getElementById(object).style.display='';
}



function show(object) {
		document.getElementById(object).style.display=''
}
function hide(object) {	 
		document.getElementById(object).style.display='none'		
}

function getBackgroundImage(member_name){
	
}




