	var closeButton;
	var invite;
	var friends=new String();
	function chooseAttend(i){
		if(i==0){lastPic='images/imgoing.gif'}
		if(i==1){lastPic='images/maybe.gif'}
		if(i==2){lastPic='images/countmeout.gif'}
		href = "ajaxSaveIsGoing.asp?attend="+i+"&eventid="+document.addComment.eventId.value;
		window.location.href = href;
	}
	function showButtons(i){	    
	    if(i==0){document.getElementById("imGoingButton").style.display="none"}else{document.getElementById("imGoingButton").style.display="block";}
	    if(i==1){document.getElementById("maybeButton").style.display="none"}else{document.getElementById("maybeButton").style.display="block";}
	    if(i==2){document.getElementById("imOutButton").style.display="none"}else{document.getElementById("imOutButton").style.display="block";}
	    	    	    
		if(i==0){document.getElementById("goingText").innerHTML=document.getElementById("imGoingText").innerHTML;}
		if(i==1){document.getElementById("goingText").innerHTML=document.getElementById("maybeText").innerHTML;}
		if(i==2){document.getElementById("goingText").innerHTML=document.getElementById("imOutText").innerHTML;}
	}
	function chooseAttend2(i){	    		
		href = "ajaxSaveIsGoing.asp?attend="+i+"&eventid="+document.addComment.eventId.value;
		showButtons(i);
		window.location.href = href;
	}
	function saveComment(){
		href = "ajaxSaveCommentEvent.asp?comment="+escape(document.addComment.comment.value)+"&eventID="+document.addComment.eventId.value
		window.location.href = href; 	  										
		document.getElementById("yourComment").innerHTML=document.addComment.comment.value
	}			
	//function limit(txt,lim){
	//	document.getElementById(txt.id+"TextLeft").innerHTML=lim-txt.value.length + ' characters remaining.';
	//	if(txt.value.length>lim){alert('Sorry. A max of ' + lim + ' characters can fit on a note.');txt.value=txt.value.substr(0,lim);}
	//	}
/*
	function closeMe(){document.getElementById("inviteFriends").style.visibility="hidden";document.getElementById("closeButton").style.visibility="hidden";}
	function sendInvite(){
		closeMe();
		var strInvites='',strEmail='',strMessage,strNotifyBy,strEventId;
		for(i=0;i<friends.length-1;i++){
			strInvites=strInvites+eval("document.inviteFriends.inviteFriend"+i+".value")+"|"
		}
		for(i=0;i<3;i++){
			strEmail=strEmail+eval("document.inviteFriends.inviteEmail"+i+".value")+"|"
		}				
		strEventId=document.addComment.eventId.value;
		strMessage=document.inviteFriends.inviteMessage.value;
		inviteNotify=document.inviteFriends.inviteNotify;
		if(inviteNotify[0].checked){strNotifyBy="both"}else if(inviteNotify[1].checked){strNotifyBy="email"}else{strNotifyBy="postit"}
		strQuery="?email="+escape(strEmail)+"&userid="+document.addComment.eventId.value+"&notifyby="+escape(strNotifyBy)+"&message="+escape(message)+"&invites="+escape(strInvites)+"&eventid="+escape(strEventId)
		try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} 
			catch (E) {xmlhttp = false;}
		}		
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {xmlhttp = new XMLHttpRequest();}
		xmlhttp.open("GET", "sendInvite.asp"+strQuery)
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
							
			}
		}					
		xmlhttp.send(null)				
	}
	function inviteFriends(){				
		invite=document.getElementById("inviteFriends");								
		invite.style.left="200px";
		invite.style.top="200px";				
		invite.style.width="500px";
		str="<b style='float:left;margin:8px;font-size:18px;'>Invite friends:</b><br><br>";
		str=str+"<form name=inviteFriends><div style='clear:both;float:left;margin-left:10px;'>"
		str=str+"<div style='float:left;font-weight:bold;'>Message</div><textarea id=inviteMessageArea onkeydown=limit(this,document.getElementById('inviteMessageAreaTextLeft'),150); name=inviteMessage style='float:left;clear:both;height:30px;width:440px;padding:0px;'></textarea>"
		str=str+"<div id=inviteMessageAreaTextLeft style='float:right;margin-right:50px;'></div>"
		str=str+"<table style='float:left;clear:both;margin:0px;padding:0px;margin-top:10px;width:480px;' cellpadding=0 cellspacing=0><tr>"
		//get friends
		var friendsArray=new String();
		try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} 
			catch (E) {xmlhttp = false;}
		}		
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {xmlhttp = new XMLHttpRequest();}

		xmlhttp.open("GET", "ajaxGetFriends.asp?userid="+document.addComment.userId.value);	
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {						
				friends=xmlhttp.responseText.split("|");						
				for(i=0;i<friends.length-1;i++){
					if(i%4==0){str=str+'</tr><tr>'}
					str=str+"<td style='padding:0xp;margin:0px;text-align:left;'><input type=checkbox name=inviteFriend"+i+" value="+friends[i].split("!")[1]+"><span style='margin-left:3px;margin-right:5px;'>"+friends[i].split("!")[0]+"</span></td>";
				}					
				str=str+"</tr><tr><td style='text-align:left;'>"
				str=str+"<a style='display:block;margin-top:5px;font-size:14px' href='javascript:{selectAllFriends()}'>Select all friends</a>"
				str=str+"</td></tr></table>"
				str=str+"<div style='float:left;clear:both;margin-top:10px;margin-bottom:10px;font-size:12px;'><b>Notify by:</b> <input name=inviteNotify style='margin-left:10px;' type=radio value='both' checked>Email & Post-It<input style='margin-left:15px;' name=inviteNotify type=radio value='email'>Email only<input name=inviteNotify style='margin-left:15px;' type=radio value='postit'>Post-It only</div>"
				str=str+"<b style='clear:both;float:left;display:block;'>(Optional)</b><br><div class=breaker></div>"
				for(i=0;i<3;i++){
					str=str+"<div style='float:left;clear:left;margin-right:5px;'><b>Email:</b></div> <input type=text name=inviteEmail"+i+" style='float:left;width:420px;'>"
				}												
				str=str+"<div style='margin:5px 30px 20px;float:right;' onmouseover=buttonOverOff(this,'over') onmouseout=buttonOverOff(this,'') style='margin:2px;float:right;' class='button'><div class='btnleft'></div><a class='btncenter' href='javascript:{sendInvite();}'><b>Send Invite</b></a><div class='btnright'></div></div>"
				str=str+"</form></div>"						
				invite.innerHTML=str;
				invite.style.visibility="visible";		
				closeButton=document.createElement("div");								
				closeButton.id="closeButton"
				closeButton.style.visibility="visible"
				closeButton.className = "postItCloseStyle"						
				closeButton.style.left='480px';
				closeButton.onclick=function(){closeMe()};
				closeButton.onmouseover=function(){this.style.cursor='pointer'};
				closeButton.onmouseout=function(){this.style.cursor='auto'};
				document.getElementById("inviteFriends").appendChild(closeButton);
				closeButton.style.top='8px';
			}
		}
		xmlhttp.send(null)
	}
	function selectAllFriends(){
		for(i=0;i<friends.length-1;i++){				
			checkBox=eval("document.inviteFriends.inviteFriend"+i);
			checkBox.checked=true;
		}
	}
*/