function checkform()
	{
	if(document.downloadform.agree_terms.checked == false)
		{
		alert("You must agree to the image usage terms above to download this photo.");
		return false;
		}
	else
		{
		return true;
		}
	}

function showHide(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'block';
		}
		else {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
		}
	}
}


function save_comment(photo_id)
	{
	var xmlHttp;
	var div_name="crec";
	var comment_name=escape(document.crec_form.comment_name.value);
	var comment_text=escape(document.crec_form.comment.value);
	document.getElementById(div_name).innerHTML="<center><table border=0 width=100% height=100% cellpadding=0 cellspacing=0><tr><td valign=middle align=center><img src='/i/ajax-loader.gif'></td></tr></table>";

	var fetch_url;
	var params;
	params='photo_id=' + photo_id + '&comment_name=' + comment_name + '&comment_text=' + comment_text + '&r=' + Math.random();
	try
		{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{
   		 // Internet Explorer
    		try
			{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		catch (e)
			{
			try
				{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
			catch (e)
				{
				alert("Your browser does not support AJAX!");
				return false;
				}
			}
		}

	xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4)
			{
			var mySplitResults = xmlHttp.responseText.split("|");
			if (mySplitResults[1])
				{
				document.getElementById(div_name).innerHTML=mySplitResults[0];
				//alert(mySplitResults[1]);
				}
			else
				{
				document.getElementById(div_name).innerHTML="";
				//alert("Sorry, an error occurred processing your request.  Please try again later.");
				}
			
			}
		}

	fetch_url='/save_comment.php?' + params;
	xmlHttp.open("GET",fetch_url,true);
	xmlHttp.send(null);

	}