//upon closing (hiding) the window, reset the form to blank state.  otherwise, if user submits form, and then opens "add link" page, the confirm will show again. persist username though

   function onhide(name) {
        document.getElementById('divLinkConfirm').innerHTML = "";
		document.getElementById('link').value = "";
		document.getElementById('description').value = "";
    }


   //function to hide window and set the onhide function, which resets the form
    function hideLinkWindow() {
        ColdFusion.Window.onHide("windowAddLink", onhide);
        ColdFusion.Window.hide("windowAddLink");
    }

   //function to hide window and set the onhide function, which resets the form
    function hideCommentWindow() {
        ColdFusion.Window.hide("windowAddComment");
    }	

   function submitLinkForm() {
        ColdFusion.Ajax.submitForm('frmAddLink', 'addContent.cfm');
		document.getElementById('divLinkConfirm').innerHTML = "<br /><span class='contentRed'>Link Submitted! Upon review, it will be added to this page. Thanks!</span><br /><br /><input type='button' value='Close This Window' onclick='javascript:hideLinkWindow()' />";
    } 
	
   function submitCommentForm() {
        ColdFusion.Ajax.submitForm('frmAddComment', 'addContent.cfm');
		document.getElementById('divCommentConfirm').innerHTML = "<br /><span class='contentRed'>Comment Submitted! Upon review, it will be added to this page. Thanks!</span><br /><br /><input type='button' value='Close This Window' onclick='javascript:hideCommentWindow()' />";
    } 	
	
 
function textCounter( field, countfield, maxlimit ) {
  if ( field.value.length > maxlimit )
  {
    field.value = field.value.substring( 0, maxlimit );
    alert( 'Textarea value can only be 1000 characters in length.' );
    return false;
  }
}
function filterProfile() {
   ColdFusion.Window.hide("windowFilterSeason");
   var player = document.getElementById("player").value;
   var gametype = "";
	for (var i=0; i < document.filterForm.gametype.length; i++)
	   {
	   if (document.filterForm.gametype[i].checked)
	      {
	      gametype = gametype + document.filterForm.gametype[i].value + ",";
	      }
	   }
	   
   var gameloc = "";
	for (var i=0; i < document.filterForm.gameloc.length; i++)
	   {
	   if (document.filterForm.gameloc[i].checked)
	      {
	      gameloc = gameloc + document.filterForm.gameloc[i].value + ",";
	      }
	   }	   

   //strip off last comma
   var gametype = gametype.replace(/\,$/,'');   
   var gameloc = gameloc.replace(/\,$/,'');

   //if nothing is selected, just default to all.  user's stupidity. don't want to deal with validation/alert, more trouble than worth.
   if (gametype.length==0 && gameloc.length==0)
   			{
				gametype=9;
			}

    
   ColdFusion.navigate('profilediv.cfm?playerid='+escape(player)+'&gametype='+escape(gametype)+'&gameloc='+escape(gameloc),'resultdiv');
   //put this up here, unlike the others, deselect shouldn't come immediately.  want to deselect for next form submission
   //ColdFusion.Window.hide("windowFilterSeason");
   return false;
}

function clearCheckBoxes() {
	var cbo1 = document.getElementById("gametype_1");
	var cbo2 = document.getElementById("gametype_2");
	var cbo3 = document.getElementById("gametype_3");
	var cbo4 = document.getElementById("gametype_4");
	var cbo5 = document.getElementById("gametype_5");
	var cbo6 = document.getElementById("gametype_6");	
	var cbo7 = document.getElementById("gameloc_1");
	var cbo8 = document.getElementById("gameloc_2");
	var cbo10 = document.getElementById("gameloc_3");	

		
	if (cbo1) {cbo1.checked=false;}
	if (cbo2) {cbo2.checked=false;}
	if (cbo3) {cbo3.checked=false;}
	if (cbo4) {cbo4.checked=false;}
	if (cbo5) {cbo5.checked=false;}
	if (cbo6) {cbo6.checked=false;}
	if (cbo7) {cbo7.checked=false;}
	if (cbo8) {cbo8.checked=false;}
	if (cbo10) {cbo10.checked=false;}		

}

 