function initImage(imageId,imageName,path,title, category, createdon, art_size, price_code, artistName, medium, aeid, thefilename, description) {
	if(typeof myid != "undefined"){clearTimeout(myid);}
	if(typeof fadeid != "undefined"){clearTimeout(fadeid);}
	document[imageName].src=path;
	image = document.getElementById(imageId);
	//alert(thefilename);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0,4);
	document.getElementById('title').innerHTML = title;
	document.popup_img.src =  "../images/" + thefilename;
	document.getElementById('createdon').innerHTML = createdon;
	document.getElementById('art_size').innerHTML = art_size;
	document.getElementById('price_code').innerHTML = price_code;
	document.getElementById('medium').innerHTML = medium;
	document.getElementById('message').innerHTML = 'Inquiry about \"'+ title + '\" by ' + artistName;
	//alert(document.getElementById('hidden_message').value);
	document.getElementById('hidden_message').value = 'They were viewing '+ title + ' by ' + artistName;
	//alert(document.getElementById('hidden_message').value);
	display_other_views("other_images", aeid);
	document.getElementById('description').innerHTML = description;
	
//popup image
	document.getElementById('popup_img_title').innerHTML = title;
	document.getElementById('popup_img_createdon').innerHTML = createdon;
	document.getElementById('popup_img_art_size').innerHTML = art_size;
	document.getElementById('popup_img_medium').innerHTML = medium;

}

function fadeIn(objId,opacity,fade) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += fade;
			fadeid=window.setTimeout("fadeIn('"+objId+"',"+opacity+","+fade+")", 10);
		}
	}
}
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}
window.onload = function() {initImage()}

function display_other_views(theDiv, aeid) {	
	document.getElementById(theDiv).innerHTML="";
	if (theDiv=="")
	  {
	  return;
	  }
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
	    	document.getElementById(theDiv).innerHTML=xmlhttp.responseText;
	    }
	  }
	xmlhttp.open("GET","../includes/other_images.php?aeid="+aeid,true);
	xmlhttp.send();
} 
function showDiv(theDiv){
	document.getElementById(theDiv).style.display = 'block';
}
function hideDiv(theDiv){
	document.getElementById(theDiv).style.display = 'none';
}



