function validCommentEvent(){
	document.xx.desc.value    = trim(document.xx.desc.value);
	if(!(document.xx.join[0].checked) && !(document.xx.join[1].checked) && !(document.xx.join[2].checked)){
		window.alert('الرجاء اختيار النوع');
		//document.xx.join.focus();
		return false;
	}else if (document.xx.desc.value == ''){
		window.alert('الرجاء ادخال التعليق');
		document.xx.desc.focus();
		return false;
	}
	var strComments = document.xx.desc.value ;
	var errorValid = 0 ;
	for (i=0;i<strComments.length;i++){
		if (strComments[i]+strComments[i+1] +strComments[i+2]+strComments[i+3] == '<img' || strComments[i]+strComments[i+1] +strComments[i+2]+strComments[i+3] == '<IMG'){
			errorValid = 1 ;
			break ;
		}
	}
	if (errorValid == 1){
		window.alert('لا يمكنك ادراج صور ضمن هذه التعليقات');
		document.xx.desc.focus();
		return false;
	}
}
function AddEventComemnts(){
	 _("errorMsg").style.display = 'none';
	var strComments = document.getElementById('txtCommnts').value ;
	var eventIdd = document.getElementById('eventId').value ;
	if (strComments == ""){
		_("errorMsg").innerHTML ="الرجاء ادخال التعليق";
	 	_("errorMsg").style.display = 'block';
		document.getElementById('txtCommnts').focus();
		document.getElementById('btnAdd').disabled = false ;
	}else{
		for (i=0;i<strComments.length;i++){
			strComments = handleText(strComments);
			strComments = strComments.replace("?","firastunsiramibadranabedsalem");
		}
		document.getElementById('btnAdd').disabled = true ;
		AJAXGet(domainName+"request/addEventComments.php?comment="+strComments+"&eventId="+eventIdd,commentHandler,false,true);
		document.getElementById('txtCommnts').value = '';
	}
}
function commentHandler(strText){
	var temp1 = new Array();
	temp1 = strText.split(',');
	var Status = temp1[0];
	var event =  temp1[1];
	if (Status == "1"){
		var ownFlag = document.getElementById("owner").value;
		AJAXGet(domainName+"request/getEventComments.php?eventId="+event+"&owner="+ownFlag,commentHandlerGet,false,true);
	}
	document.getElementById('btnAdd').disabled = false ;
}
function commentHandlerGet(strText){
	var temp2 = new Array();
	temp2 = strText.split('$');
	State = temp2[0];
	body =  temp2[1];
	if (State == "1"){
		document.getElementById("CommentsContent").innerHTML = body ;
		_("loading").style.display = 'block';
	}
}
function deleteComment(strDiv,CommentId){
	pn = document.getElementById("pagenum").value ;
	idd = document.getElementById("eventId").value ;
	AJAXGet(domainName+"request/deleteEventComment.php?commentId="+CommentId+"&strDiv="+strDiv+"&pn="+pn+"&id="+idd,commentHandlerDel,false,true);
}
function commentHandlerDel(strText){
	var temp = new Array();
	temp = strText.split('$');
	Stat = temp[0];
	DivId =  temp[1];
	goback =  temp[2];
	pN = temp[3];
	eventIdd = temp[4];
	fillDiv = temp[5];
	replacement = temp[6];
	if (Stat == "1"){
		document.getElementById(DivId).innerHTML = "";
		document.getElementById(DivId).style.display = "none" ;
		document.getElementById(DivId).style.visibility = "hidden" ;
		if (goback == "1"){
			window.location = domainName+'eventDetails.htm?id='+eventIdd+'&pageNumber='+pN+'&rand='+Math.floor(1000000*Math.random()) ;
		}
	}
	if (fillDiv == 1){
		document.getElementById(DivId).innerHTML = replacement;
		document.getElementById(DivId).style.display = "block" ;
		document.getElementById(DivId).style.visibility = "visible" ;
	}
}
function deleteEvent(id,data){
	if (confirm("هل أنت متأكد من حذف هذا النشاط ؟")){
		window.location = 'deleteEvent.htm?id='+id+'&data='+data ;
	}
}