function onDocLoad()
{
	if ( document.getElementById("txtTitle") )
	{
		document.getElementById("txtTitle").focus();
	}
}
function validatePost()
{
	
	lRet		= true;
	cMsg		= "";
	oForm		= document.getElementById("frmPostPic");
	oTitle 		= document.getElementById("txtTitle");
	oImg1		= document.getElementById("txtFile1");
	oImg2		= document.getElementById("txtFile2");
	oImg3		= document.getElementById("txtFile3");
	oForSale	= document.getElementById("chkForSale"); 
	oPrice		= document.getElementById("txtPrice");
	oCmnt		= document.getElementById("txtComment");
	oFocus		= null;
	
	
	if ( !oTitle.value )
	{
		cMsg 	= "- Title is required.\n";
		oFocus	= oTitle;
	}
	
	if (    !oForm.rdoTheme[0].checked 		 
		 && !oForm.rdoTheme[1].checked
		 && !oForm.rdoTheme[2].checked
		 && !oForm.rdoTheme[3].checked )
	{
		cMsg += "- You must select a theme.\n";
	}
	
	if (    !oForm.rdoAgeGroup[0].checked
		 && !oForm.rdoAgeGroup[1].checked )
	{
		cMsg += "- You must select an age group.\n";
	}


	if ( oForSale.checked && !parseFloat(oPrice.value) )
	{
		cMsg += "- You must enter an amount - or - uncheck the for sale checkbox.\n";

		if (!oFocus) { oFocus = oPrice; }
	}
	
	if ( parseFloat(oPrice.value) && !oForSale.checked )
	{
		oForSale.checked = true;
	}


	if ( !oImg1.value && !oImg2.value && !oImg3.value )
	{
		cMsg += "- You must enter at least one file to upload.\n";
		
		if (!oFocus) { oFocus = oImg1; }
	}
	
	if ( !oCmnt.value )
	{
		cMsg += "- Please comment on your artwork.\n";
		
		if (!oFocus) { oFocus = oCmnt; }
	}
		
	if (cMsg)
	{
		lRet = false;
		
		cMsg = "Oops!\n\n" + cMsg;
		
		alert(cMsg);
		
		oFocus.focus();
	}
				
	return lRet;
}

function onChangePrice()
{
	oForSale	= document.getElementById("chkForSale"); 
	oPrice		= document.getElementById("txtPrice");
	
	if ( parseFloat(oPrice.value) )
	{
		oForSale.checked = true;
	}
	else
	{
		oForSale.checked = false;
	}
}

function selectTheme(nTheme)
{
	oForm = document.getElementById("frmPostPic");
	
	oForm.rdoTheme[nTheme].checked = true;
}

function selectAgeGroup(nAgeGroup)
{
	oForm = document.getElementById("frmPostPic");
	
	oForm.rdoAgeGroup[nAgeGroup].checked = true;
}

function toggleForSale()
{
	oForm = document.getElementById("frmPostPic");
	
	oForm.chkForSale.checked = !oForm.chkForSale.checked;
}