 /*javascript for multiselect neighborhoods*/



 function allselect()
 {	 	 
	 var neigh;	 	 
	 var strChosenItems="",ListBox;	 
         ListBox=document.community_create.nhood;            
         //alert(ListBox);
         for(var i=0;i<ListBox.options.length;i++)
         {
	   	  if(ListBox.options[i].selected)
	           {
			 strChosenItems=ListBox.options[i].text;
		         strChosenItems=strChosenItems+","+ListBox.options[i].text;	   	      
		   } 
	 } 	 
	   //window.location.replace("Communities.119.0.html?strChosenItemsDisp="+strChosenItems);					 
 }
 /*javascript for multiselect neighborhoods over*/
 
function fileupallmem()
{
    if(!document.community_edit.fileup.checked)
        document.community_edit.allmemfileup.disabled=true;
    else
        document.community_edit.allmemfileup.disabled=false;
}
//-- start epc field required setting while create community
function addepcfieldyes()
{
	var htmltxt;
	htmltxt = '<table width=100%><tr>';
	htmltxt +='<td width=26% class=data>EPC field required</td>';
	htmltxt +='<td width=1%>:</td>';
	htmltxt +='<td width=5><input type=checkbox name=epcfieldreq value="y"></td>';
	htmltxt +='<td class=data><b>Check</b> EPC field required. <br><b>Uncheck</b> EPC field not required.</td>';
	htmltxt +='</tr></table>';

	txt_field = document.getElementById("epclabel");
	txt_field.innerHTML=htmltxt;
}
function addepcfieldno()
{
	txt_field = document.getElementById("epclabel");
	txt_field.innerHTML = ""; 
}
//-- over --
//EP search result page nevigation function
function ep_pre1link(val1,val2)
{
 document.commnav1.prv.value=1;
 document.commnav1.nxt.value=0;
 document.commnav1.strtpgs.value=val1;
 document.commnav1.endpgs.value=val2;
 document.commnav1.strt.value=val2;
 document.commnav1.submit();
}
function ep_next1link(val1,val2)
{
  document.commnav1.nxt.value=1;
  document.commnav1.prv.value=0;//2 is put for not set that variable
  document.commnav1.endpgs.value=val2;
  document.commnav1.strt.value=val2;
  document.commnav1.strtpgs.value=val1;
  document.commnav1.submit();
}
function ep_display1(val1,startval1,endval2)
{
  document.commnav1.strt.value=val1;
  document.commnav1.strtpgs.value=startval1;
  document.commnav1.endpgs.value=endval2;
  document.commnav1.nxt.value=0;
  document.commnav1.prv.value=0;//2 is put for not set that variable
  document.commnav1.submit();
}
//function for enhanced private community
function epupdtprofile(comm_id)
{
	var win1,pgopen;
  //halohalo.com
  pgopen="dynepins.231.0.html?commid="+comm_id;
  //halo.moc
  //pgopen="dynepins.218.0.html?commid="+comm_id;
  win1=window.open(pgopen,"dynepins","height=400,width=600,scrollbars=yes");
}
function chkcommsrch()
{
	if(isblank(document.view_comm.srchwordcomm.value))
	{
		alert("Enter Text to search.");
	}
	else
	{
		document.view_comm.submit();
		//var link;
		//link="ep_searchresult.211.0.html?comm_id="+document.view_comm.comm_id.value;
		//win=window.location.replace(link);
	}
}
function delepinvtid(id)
{
	document.form1.deleprowid.value=id;
//	alert(document.form1.deleprowid.value);
	document.form1.submit();
}
function chkepmails()
{
	var fileupflag,mailenterflag;
	fileupflag=0;mailenterflag=0;
	if(!isblank(document.form1.userfile.value))
	{
		fileupflag=1;
	}
	if(!isblank(document.form1.emails.value))
		mailenterflag=1;
	if(mailenterflag==0 && fileupflag==0)
	{
		alert("Give CSV file name or enter emails list.");
		return false;
	}
	else
	{
		return true;
	}
}
function fileformathlp()
{
	var hlpopen,ans;
	hlpopen="upload_csv_file.htm";
	ans=window.open(hlpopen,"csv_file_format","width=800,height=450,scrollbars=no");
}
/* For Bug 1735 file format help for option 1 email, firstname and lastname*/
function fileformathlp_withname()
{
	var hlpopen,ans;
	hlpopen="upload_csv_file_withname.htm";
	ans=window.open(hlpopen,"csv_file_format_withname","width=810,height=400,scrollbars=no");
}

function officailMap()
{
	var hlpopen,ans;
	hlpopen="include/officialMap.php";
	ans=window.open(hlpopen,"Assign_Official_Map","width=700,height=700,scrollbars=yes");
}
function aprv_badge()
{
	var hlpopen1,ans1;
	hlpopen1="include/approve_badges.php";
	ans1=window.open(hlpopen1,"Approve Badges","width=700,height=700,scrollbars=yes");
}

function epinvitemember(commid)
{
	var pageopen,ans;	
	pageopen="EPSendEmailInvite.232.0.html?comm_id="+commid;	//+"&userid="+userid;
	ans=window.open(pageopen,"EP_member_invite","width=825,height=575,scrollbars=yes,resizable=yes");
}
// for storefrontmember
function sf_epinvitemember(commid,uid)
{
	var pageopen,ans;	
	//pageopen="StorefrontEmailInvite.315.0.html?comm_id="+commid;	//+"&userid="+userid;
	//pageopen="StorefrontEmailInvite.375.0.html?comm_id="+commid;	//+"&userid="+userid;	
	pageopen="EPSendEmailInvite.232.0.html?cur_user="+uid+"&comm_id="+commid;	//+"&userid="+userid;
	ans=window.open(pageopen,"EP_member_invite","width=825,height=575,scrollbars=yes,resizable=yes");
}

function createProfile(commid,uid)
{
	var pageopen,ans;	
	//pageopen="StorefrontEmailInvite.315.0.html?comm_id="+commid;	//+"&userid="+userid;
	//pageopen="StorefrontEmailInvite.375.0.html?comm_id="+commid;	//+"&userid="+userid;	
	pageopenCP="CreateProfilePage.232.0.html?cur_user="+uid+"&comm_id="+commid+"&link=CP";
	ansCP=window.open(pageopenCP,"Create_Profile_Page","width=825,height=575,scrollbars=yes,resizable=yes");
}

function sf_join_epcomm(commid)
{
	var joinpageopen,ans1;
	//halo.moc
	//joinpageopen="epjoinmessage.214.0.html?comm_id="+commid;
	//halohalo.com
	joinpageopen="epjoinmessage.316.0.html?comm_id="+commid;
	ans1=window.open(joinpageopen,"EP_member_join","width=600,height=200,scrollbars=no");
}

//function join_epcomm(commid,userid)
function join_epcomm(commid)
{
	var joinpageopen,ans1;
	//halo.moc
	//joinpageopen="epjoinmessage.214.0.html?comm_id="+commid;
	//halohalo.com
	joinpageopen="epjoinmessage.233.0.html?comm_id="+commid;
	ans1=window.open(joinpageopen,"EP_member_join","width=600,height=200,scrollbars=no");
}
function epstatstracking(commid)
{
	var statstrack,win1;
	//halo.moc
	//statstrack="ep_statstracking.216.0.html?comm_id="+commid;
	//halohalo.com
	statstrack="ep_statstracking.235.0.html?comm_id="+commid;
	win1=window.open(statstrack,"EP_statstrack","width=600,height=500,scrollbars=yes");
}
function chkepjoin()
{
	if(isblank(document.join_message.workingon.value))
	{
		alert("Please fill Working On field first.");
		document.join_message.workingon.focus();
		return false;
	}
	else
	{
		return true;
	}
}
//------------- OVER HERE ------------------
//event mail send
function removecheckerr()
{
  txt_field = document.getElementById("checkerr");
  txt_field.innerHTML = "";
}
function removesubjecterr()
{
  var txt_field;
  txt_field =document.getElementById("subjecterr");
  txt_field.innerHTML = "";
}
function removemesserr()
{
  var txt_field;
  txt_field =document.getElementById("messerr");
  txt_field.innerHTML = "";
}
function checkeventmail()
{
  var txt_field;
  if(!(document.eventmail.rsvpYes.checked || document.eventmail.rsvpNo.checked || document.eventmail.rsvpMay.checked))
  {
    txt_field = document.getElementById("checkerr");
   	txt_field.innerHTML = "Select at least one Checkbox.";
   	return false;
  }
  if(isblank(document.eventmail.subject.value))
  {
    txt_field =document.getElementById("subjecterr");
   	txt_field.innerHTML = "Enter Subject first.<br>";
   	return false;
  }
  if(isblank(document.eventmail.message.value))
  {
    txt_field =document.getElementById("messerr");
   	txt_field.innerHTML = "Enter Message first.<br>";
   	return false;
  }
  return true;
}

//for navigation link in communities :  topic(reply post) list of selected post
function topic_pre1link(val1,val2)
{
 document.commnav1.prv.value=1;
 document.commnav1.nxt.value=0;
 document.commnav1.strtpgs.value=val1;
 document.commnav1.endpgs.value=val2;
 document.commnav1.strt.value=val2;
 document.commnav1.submit();
}
function topic_next1link(val1,val2)
{

  document.commnav1.nxt.value=1;
  document.commnav1.prv.value=0;//2 is put for not set that variable
  document.commnav1.endpgs.value=val2;
  document.commnav1.strt.value=val2;
  document.commnav1.strtpgs.value=val1;
  document.commnav1.submit();
}
function topic_display1(val1,startval1,endval2)
{
  document.commnav1.strt.value=val1;
  document.commnav1.strtpgs.value=startval1;
  document.commnav1.endpgs.value=endval2;
  document.commnav1.nxt.value=0;
  document.commnav1.prv.value=0;//2 is put for not set that variable
  document.commnav1.submit();
}
//Friendrequest - outgoing request
function delinvtid(invtid)
{
  document.ReviewPastInvites.delInviteId.value=invtid;
  document.ReviewPastInvites.submit();
}
function invtasfrnd(frndid,ownid)
{
  document.ReviewPastInvites.delFriendId.value=frndid;
  document.ReviewPastInvites.delOwnId.value=ownid;
  document.ReviewPastInvites.submit();
}
//EDIT pending community request
function load_desc_char()		//common to display no. of characters in message box
{
	var field,txt_field;
	field = document.getElementById("desc_txtarea");
	txt_field = document.getElementById("countBody");
	txt_field.innerHTML = field.value.length;
}
function pendingchk_err_zip()
{
	txt_field = document.getElementById("err_zip");
	if(document.pendingcommreq.zip_txt.value!="" && !chkOnlyDigits(document.pendingcommreq.zip_txt.value))
	  	txt_field.innerHTML = "Please enter Zip Code in Numeric only<br>";
	else
		txt_field.innerHTML = " ";
}
function pendingchk_err_name()
{
	var str=document.pendingcommreq.name_txt.value;
	while (str.charAt(0) == " ")
	{
		str = str.substring(1);
	}
	while (str.charAt(str.length - 1) == " ")
	{
	str = str.substring(0,str.length - 1);
	}
	if(str!="")
	{
		txt_field = document.getElementById("err_name");
  	txt_field.innerHTML = " ";
	}
}
function pendingchk_confirm()
{
	var chk=0;
	if(document.pendingcommreq.name_txt.value=='')
	{
		field = document.getElementById("name_txt");
	  	txt_field = document.getElementById("err_name");
	  	txt_field.innerHTML = "Please enter name<br>";
	  	chk=1;
	}
	if(document.pendingcommreq.desc_txtarea.value=='')
	{
		field = document.getElementById("desc_txtarea");
	  	txt_field = document.getElementById("err_desc");
	  	txt_field.innerHTML = "Please enter description1<br>";
	  	chk=1;

	}
	
	/*if(pendingcommreq.cat_opt.value=="Choose")
	{
		field = document.getElementById("cat_opt");
	  	txt_field = document.getElementById("err_catg");
	  	txt_field.innerHTML = "Please choose category<br>";
		chk=1;
	}*/
	//check zip must numeric if entered
	if(document.pendingcommreq.zip_txt.value!="" && !chkOnlyDigits(document.pendingcommreq.zip_txt.value))
	{
	  	txt_field = document.getElementById("err_zip");
	  	txt_field.innerHTML = "Please enter Zip Code in numeric only<br>";
		chk=1;
	}
	if(chk==0)
		return true;
	else
		return false;
}
//pending request of community create
function penreqdel(uid)	//delete request
{
	document.pendingreq.rowid.value=uid;
	document.pendingreq.penreq.value="delete";
	document.pendingreq.submit();
}
function penreqedit(uid) //edit request content
{
	document.pendingreq.rowid.value=uid;
	document.pendingreq.penreq.value="edit";
	document.pendingreq.submit();
}
//community request in requestfriend
function memreqyes(uid,commid)
{
    document.reqjoincomm.reqmemid.value=uid;
    document.reqjoincomm.reqcommid.value=commid;
    document.reqjoincomm.reqcommans.value=1;
	   document.reqjoincomm.submit();
}
function memreqno(uid,commid)
{
    document.reqjoincomm.reqmemid.value=uid;
    document.reqjoincomm.reqcommid.value=commid;
    document.reqjoincomm.reqcommans.value=0;
    document.reqjoincomm.submit();
}
function commsuspend(uid)	// req. for comm. is suspended
{
  var ans,txt_field;
  document.reqcommcreate.commuid.value=uid;
  document.reqcommcreate.commans.value=2;
  txt_field = document.getElementById("pendingcode");
  txt_field.innerHTML = "<br><table width=100% border=0 cellspacing=1 cellpadding=2 bgcolor=#333399><tr><td class=UpEventHead4 height=18>Give Reason To Suspend Community!!</td></tr><tr bgcolor=#E8E9F7><td><font color=#FF0000><span id='err_reason' class=smalltext></span></font><textarea name=reason id=reason cols=70 rows=3 class=but></textarea></td></tr><tr bgcolor=#E8E9F7><td><input type=submit name='pencommreason' value=Submit class=but onclick='javascript:chkreason()'>&nbsp;<input type=button name=cancle_btn value=Cancel class=but onclick='javascript:window.location.reload()'></td></tr></table>";
  document.reqcommcreate.reason.focus();
}
function sf_commsuspend(uid,userid)	// req. for comm. is suspended
{
  var ans,txt_field;
  document.reqcommcreate.commuid.value='-1';
  document.reqcommcreate.commans.value='#';
  document.reqcommcreate.sf_commuid.value=uid;
  document.reqcommcreate.sf_commans.value=2;
  document.reqcommcreate.sf_emailuser.value=userid;
  txt_field = document.getElementById("pendingcode");
  txt_field.innerHTML = "<br><table width=100% border=0 cellspacing=1 cellpadding=2 bgcolor=#333399><tr><td class=UpEventHead4 height=18>Give Reason To Suspend Storefront!!</td></tr><tr bgcolor=#E8E9F7><td><font color=#FF0000><span id='err_reason' class=smalltext></span></font><textarea name=reason id=reason cols=70 rows=3 class=but></textarea></td></tr><tr bgcolor=#E8E9F7><td><input type=submit name='pencommreason' value=Submit class=but onclick='javascript:chkreason()'>&nbsp;<input type=button name=cancle_btn value=Cancel class=but onclick='javascript:window.location.reload()'></td></tr></table>";
  document.reqcommcreate.reason.focus();
}
function chkreason()
{

  var str=document.getElementById("reason");
  str=str.value;
  while (str.charAt(0) == " ")
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")
		str = str.substring(0,str.length - 1);
  txt_field = document.getElementById("err_reason");
  if(str!="")
	{
	  	txt_field.innerHTML = " ";
	    document.reqcommcreate.submit();
	}
	else
	{
		txt_field.innerHTML = "Enter Reason First.<br>";
	}

}
//Added By Hetal Bug No. 1207

//For Video
function videoreqyes(uid)	//req. community accepted
{
    document.reqvideocreate.videouid.value=uid;
    document.reqvideocreate.videoans.value=1;
	  document.reqvideocreate.submit();
}
function videoreqno(uid)		//req. for community is rejected
{
    document.reqvideocreate.videouid.value=uid;
    document.reqvideocreate.videoans.value=2;
    document.reqvideocreate.submit();
}
//For photoshow
function photoreqyes(uid)	//req. community accepted
{
    document.getElementsByName("photouid").value=uid;
	document.getElementsByName("photoans")[0].value=1;
	var link=document.getElementsByName("linkUrl")[0].value;
	window.location.href=link+'&photouid='+uid+'&photoans=1';
}
function photoreqno(uid)		//req. for community is rejected
{
    document.getElementsByName("photouid")[0].value=uid;
	document.getElementsByName("photoans")[0].value=2;
	var link=document.getElementsByName("linkUrl")[0].value;
	window.location.href=link+'&photouid='+uid+'&photoans=2';
}
//over
function commreqyes(uid)	//req. community accepted
{
    document.reqcommcreate.commuid.value=uid;
    document.reqcommcreate.commans.value=1;
	  document.reqcommcreate.submit();
}
function sf_commreqyes(uid)	//req. community accepted
{
	alert(uid);
    document.location.href = "CommunityMassage.379.0.html?sf_commuid="+uid+"&sf_commans="+1;
    /*document.sf_reqcommcreate.sf_commuid.value=uid;
    document.sf_reqcommcreate.sf_commans.value=1;
    document.sf_reqcommcreate.submit();*/
}

function commreqno(uid)		//req. for community is rejected
{
    document.reqcommcreate.commuid.value=uid;
    document.reqcommcreate.commans.value=0;
    document.reqcommcreate.submit();
}
function sf_commreqno(uid)		//req. for community is rejected
{
    document.sf_reqcommcreate.sf_commuid.value=uid;
    document.sf_reqcommcreate.sf_commans.value=0;
    document.sf_reqcommcreate.submit();
}

//prev..next page navigation link for forms in community for page_next_link()
function page_pre1link(val1,val2,funno)
{
  switch(funno)
  {
  		case 3:	document.commnav.job.value='';  break;
			case 4: document.commnav.job.value='';  break;
			case 5: document.commnav.job.value='view all member';  break;
			case 6: document.commnav.job.value='View Forum';  break;
			case 7: document.commnav.job.value='memcancle';  break;
			case 8: document.commnav.job.value='View Events';  break;
  }
 document.commnav.prev.value=1;
 document.commnav.next.value=0;
 document.commnav.startpages.value=val1;
 document.commnav.endpages.value=val2;
 document.commnav.start.value=val2;
 document.commnav.submit();
}
function page_next1link(val1,val2,funno)
{
  switch(funno)
  {
  		        case 3:	document.commnav.job.value='';  break;
			case 4: document.commnav.job.value='';  break;
			case 5: document.commnav.job.value='view all member';  break;
			case 6: document.commnav.job.value='View Forum';  break;
			case 7: document.commnav.job.value='memcancle';  break;
			case 8: document.commnav.job.value='View Events';  break;
  }
  document.commnav.next.value=1;
  document.commnav.prev.value=0;//2 is put for not set that variable
  document.commnav.endpages.value=val2;
  document.commnav.start.value=val2;
  document.commnav.startpages.value=val1;
  document.commnav.submit();
}
function page_display1(val1,startval1,endval2,funno)
{
  switch(funno)
  {
  		        case 3:	document.commnav.job.value='';  break;
			case 4: document.commnav.job.value='';  break;
			case 5: document.commnav.job.value='view all member';  break;
			case 6: document.commnav.job.value='View Forum';break;
			case 7: document.commnav.job.value='memcancle';  break;
			case 8: document.commnav.job.value='View Events';  break;
  }
  document.commnav.start.value=val1;
  document.commnav.startpages.value=startval1;
  document.commnav.endpages.value=endval2;
  document.commnav.next.value=0;
  document.commnav.prev.value=0;//2 is put for not set that variable
  document.commnav.submit();


}
///==============add functions for the Immediate Associations page======bug no. 1547
function check_all_comm1() 
{
   if(document.vij.checkall.checked)
   {	
	str=document.vij.viju.checked=true;
   }
  else
   {
	str=document.vij.viju.checked=false;
  }	
		
}




function page_pre1linkrt(val1,val2,funno)
{
  switch(funno)
  {
  		        case 3:	document.commnavrt.job.value='';  break;
			case 4: document.commnavrt.job.value='';  break;
			case 5: document.commnavrt.job.value='view all member';  break;
			case 6: document.commnavrt.job.value='View Forum';  break;
			case 7: document.commnavrt.job.value='memcancle';  break;
			case 8: document.commnavrt.job.value='View Events';  break;
  }
 document.commnavrt.prevrt.value=1;
 document.commnavrt.nextrt.value=0;
 document.commnavrt.endpagesrt.value=val2;
 document.commnavrt.startrt.value=val2;
 document.commnavrt.startpagesrt.value=val1;
 document.commnavrt.submit();
 
}
function page_next1linkrt(val1,val2,funno)
{
  switch(funno)
  {
  		case 3:	document.commnavrt.job.value='';  break;
			case 4: document.commnavrt.job.value='';  break;
			case 5: document.commnavrt.job.value='view all member';  break;
			case 6: document.commnavrt.job.value='View Forum';  break;
			case 7: document.commnavrt.job.value='memcancle';  break;
			case 8: document.commnavrt.job.value='View Events';  break;
  }
  document.commnavrt.nextrt.value=1;
  document.commnavrt.prevrt.value=0;//2 is put for not set that variable
  document.commnavrt.endpagesrt.value=val2;
  document.commnavrt.startrt.value=val2;
  document.commnavrt.startpagesrt.value=val1;
  document.commnavrt.submit();
  

}
function page_display1rt(val1,startval1,endval2,funno)
{
    switch(funno)
    {
  		        case 3:	document.commnavrt.job.value='';  break;
			case 4: document.commnavrt.job.value='';  break;
			case 5: document.commnavrt.job.value='view all member';  break;
			case 6: document.commnavrt.job.value='View Forum';break;
			case 7: document.commnavrt.job.value='memcancle';  break;
			case 8: document.commnavrt.job.value='View Events';  break;
  }
  document.commnavrt.startrt.value=val1;
  document.commnavrt.startpagesrt.value=startval1;
  document.commnavrt.endpagesrt.value=endval2;
  document.commnavrt.nextrt.value=0;
  document.commnavrt.prevrt.value=0;//2 is put for not set that variable
  document.commnavrt.submit();
}

///==============end part of Immediate Associations page=========
//invite friend - form
// bug - 874 -  change by Jignesh on 17-july-06 problem : "Invite a friend email concatenates emails when emails are separated by ;"
function chk_friend_submit()
{
    var len,i,fileName,nofile,frn_chk=0,oth_chk=0;
    var str=document.invitefriend.emailaddlist.value;
    nofile=0;
    len=document.invitefriend.elements.length;
    var rdo_friend=document.getElementsByName("chkUsrFrnd[]").length;
    var rdo_other=document.getElementsByName("chkUsrOthGrp[]").length;
    
    var frnd_chk=document.getElementById("commInviteRdo1").checked;
    var other_chk=document.getElementById("commInviteRdo2").checked;
    var fr_chks=document.getElementsByName("chkUsrFrnd[]");
    var oth_chks=document.getElementsByName("chkUsrOthGrp[]");
    
    if(frnd_chk==true || frnd_chk==1)
    {		
	for(h=0;h<rdo_friend;h++)
	{
		if(fr_chks[h].checked==true)
		{
			frn_chk=1;
			break;
		}	
	}
   }
   if(other_chk==true || other_chk==1)
    {	
	for(b=0;b<rdo_other;b++)
	{
		if(oth_chks[b].checked==true)
		{
			oth_chk=1;
			break;
		}	
	}
    }

    for(i=0;i<len;i++)
    {
        if(document.invitefriend.elements[i].type== "file")
        {
            filename=document.invitefriend.elements[i].value;
            if(filename.length>0)
          	{
            		nofile=1;
            		break;
          	}
  	}
    }
	
    if(nofile==0 && str=="" && frn_chk=='' && oth_chk=='')
    {
        alert("Please enter E-mail address to send mail.\n Or Upload file from desktop Or select members.");
        return false;
    }

    if(str!="")
    {
        var temp = document.invitefriend.emailaddlist.value;
        var newstr = "";
        for(j=0;j<temp.length;j++)
        {		   
             //alert(temp.charAt(j)+" : "+temp.charCodeAt(j))
             // remove new line character
             if(temp.charAt(j)=='\n' || temp.charCodeAt(j)==10 || temp.charCodeAt(j)== 13)
             { }             
             else
             {
                  newstr = newstr + temp.charAt(j);
             }
        }    
        temp = newstr;
        //alert(newstr);
        var count_at = 0;
        v1  = temp.split(",");
        count_at = v1.length-1;
        count_cm = 0;
        for(j=0;j<temp.length;j++)
        {
            //alert(temp.charCodeAt(j));     
            if(temp.charAt(j)==",") count_cm++;    
            if(temp.charAt(j)=="@") count_at++;
        }
        count_at  = count_at-1;
        if(count_at < count_cm)
        {
            alert("Separate addresses by commas only.");   
            return false;
        }    
        flg = "false";
        for(i=0;i<v1.length;i++) 
        {
            if(echeck(v1[i])==false)
            {            
                flg = "true";
                break;
            }
        } 
        if(flg == "true"){
                return false;
        }    
        // return false;
    }
}
function echeck (emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.
   It also is used to separate the username from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	//alert("Email address seems incorrect (check @ and .'s)")
	  alert("Separate addresses by commas only.");
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    //alert("The username doesn't seem to be valid.")
    alert("Separate addresses by commas only.");
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        //alert("Destination IP address is invalid!")
	        alert("Separate addresses by commas only.");
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	   //alert("The domain name doesn't seem to be valid.")
	   alert("Separate addresses by commas only.");
    return false
}

    //domain name seems valid, but now make sure that it ends in a
    //three-letter word (like com, edu, gov) or a two-letter word,
    //representing country (uk, nl), and that there's a hostname preceding 
    //the domain or country.

    //Now we need to break up the domain to get a count of how many atoms
    //it consists of.
    
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   //alert("The address must end in a three-letter domain, or two letter country.")
   alert("Separate addresses by commas only.");
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   //alert(errStr)
   alert("Separate addresses by commas only.");
   return false
}

// If we've gotten this far, everything's valid!
return true;
}

// bug 874
//image - content of locations
function chk_geo_affi()
{
	var no=document.image_content.geo_aff.value;
	var txt_field;
	txt_field = document.getElementById("err_geoaff");
	if(no==(-1))
		txt_field.innerHTML = "select any location from given list";
	else{
		txt_field.innerHTML = "";
		document.image_content.submit();
	}
	return false;
}
//for what's new form
function chkwhatsnew()
{
	var str=document.whats_new.description.value;
	while (str.charAt(0) == " ")	//ltrim
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")	//rtrim
		str = str.substring(0,str.length - 1);

	if(str=="")
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = "Please enter atleast description";
		return false;
	}
	else
		return true;
}
//for navigation link in communities :  comm list of selected category
function pre1link(val1,val2,catg_id,seq)
{
 document.commnav.prev.value=1;
 document.commnav.next.value=0;
 document.commnav.startpages.value=val1;
 document.commnav.endpages.value=val2;
 document.commnav.start.value=val2;
 document.commnav.seq.value=seq;
 document.commnav.catg_id.value=catg_id;
 document.commnav.submit();
}
function next1link(val1,val2,catg_id,seq)
{
  document.commnav.next.value=1;
  document.commnav.prev.value=0;//2 is put for not set that variable
  document.commnav.endpages.value=val2;
  document.commnav.start.value=val2;
  document.commnav.startpages.value=val1;
  document.commnav.seq.value=seq;
  document.commnav.catg_id.value=catg_id;
  document.commnav.submit();
}
function display1(val1,startval1,endval2,catg_id,seq)
{
  document.commnav.start.value=val1;
  document.commnav.startpages.value=startval1;
  document.commnav.endpages.value=endval2;
  document.commnav.next.value=0;
  document.commnav.prev.value=0;//2 is put for not set that variable
  document.commnav.seq.value=seq;
  document.commnav.catg_id.value=catg_id;
  document.commnav.submit();
}
//function:community spotlight
function chksubmit_commspot()
{
    if(document.comm_spotlight.comm_sel.value==0)
    {
        alert("Please Select Community.");
        return false;
    }
    if(isblank(document.comm_spotlight.new_details.value))
    {
        alert("Enter details of community spot light.");
        return false;
    }
    return true;
}
function chk_comm_spot()
{    
    if(document.comm_spotlight.comm_sel.value!=0)
    {  
        document.comm_spotlight.comm_select.value=document.comm_spotlight.comm_sel.value;
        document.comm_spotlight.submit();
    }
}
//functions:moderator_request
function remove_mod(val,no)
{
	var ans;
	if(no==1)
		ans=confirm("sure!!!\nRemove the LAST moderator???");
	else
		ans=confirm("are you sure!!!\nRemove the moderator???");
	if(ans)
	{
		document.comm_moderator.row_uid.value=val;
		return true;
	}
	else
		return false;
}

function chk_comm_sel()
{
	var field;
	field = document.getElementById("sel_comm_error");
	if(document.comm_moderator.comm_sel.value==0)
		field.innerHTML="Select community from given list";
	else
	{
		field.innerHTML="";
		document.comm_moderator.submit();
	}
}
function chk_moderator_sel()
{
	var field;
	field = document.getElementById("mod_sel_error");
	if(document.comm_moderator.user_id_sel.value==0)
	{
		field.innerHTML="Select user as moderator from given list";
		document.comm_moderator.submit_btn.disabled=true;
	}
	else
	{
		field.innerHTML="";
		document.comm_moderator.submit_btn.disabled=false;
	}
}
function chkTxtVal()	/* ############## added for 1699*/ 
{
	
	var chkUser, chkBusi, chkOrg, chkSch, chkComu, chkBadge;

	if(document.comm_moderator.txtVal.value=="")
	{
	  alert('Please Enter Search Text');
	  document.comm_moderator.txtVal.focus();
		return false;
	}
	else
	{
		//alert(document.comm_moderator.comm_sel.value);
		document.comm_moderator.comm_sel.value=0;
		//alert(document.comm_moderator.comm_sel.value);
		return true;
	}
}
//***********************************************
function unjoin_sure()	//unjoin user by moderator
{
	var ans;
	ans=confirm("Accept!!!\ncommunity will be generated???");
	if(ans)
		return true;
	else
		return false;
}
//all requset to admin for create community
function admin_yes_comm(no)
{
	var ans;
	document.comm_create_request.uid.value=no;
	ans=confirm("Accept!!!\ncommunity will be generated???");
	if(ans)
	{
		return true;
	}
	else
		return false;
}
function admin_no_comm(no)
{
	var ans;
	document.comm_create_request.uid.value=no;
	ans=confirm("No!!!\ncommunity will be Rejected???");
	if(ans)
	{
		return true;
	}
	else
		return false;
}

function accepted_friend(no)
{
	var ans;
	document.friend_request.uid.value=no;
	document.friend_request.friendidans.value="Yes";
	document.friend_request.submit();
}
function denied_friend(no)
{
	var ans;
	//alert(no);
	document.friend_request.uid.value=no;
	document.friend_request.friendidans.value="No";
	document.friend_request.submit();
}

//all community requset
function all_yes_request(user_id,comm_id)
{
	var ans;
	document.all_member_request.req_comm.value=comm_id;
	document.all_member_request.req_user.value=user_id;
	ans=confirm("Join!!!\nUser will join community???");
	if(ans)
		return true
	else
		return false;
}
function all_no_request(user_id,comm_id)
{
	var ans;
	document.all_member_request.req_comm.value=comm_id;
	document.all_member_request.req_user.value=user_id;
	ans=confirm("No!!!\nLoose one more user???");
	if(ans)
		return true
	else
		return false;
}
// member request
function yes_request(user_id,comm_id)
{
	var ans;
	document.member_request.req_comm.value=comm_id;
	document.member_request.req_user.value=user_id;
	ans=confirm("Join!!!\nUser will join community???");
	if(ans)
		return true
	else
		return false;
}
function no_request(user_id,comm_id)
{
	var ans;
	document.member_request.req_comm.value=comm_id;
	document.member_request.req_user.value=user_id;
	ans=confirm("No!!!\nLoose one more user???");
	if(ans)
		return true
	else
		return false;
}
//send message
function typeplain()
{
  document.send_message.sendMail.disabled=true;
}
function typehtml()
{
  document.send_message.sendMail.disabled=false;
}
function send_message_load()
{
  document.send_message.mailtype[0].focus();
}
/*2464 22feb10*/
function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
return objXMLHttp;
}

function sel_sendtoall()
{
	document.getElementById("selmem").style.display='none';	
}
function sel_recipient(chk_rdo,comm)
{	
        document.getElementById("selmem").style.display='inline';
	document.send_message.radioval.value=chk_rdo;
	var xmlHttp=GetXmlHttpObject();
	var url="../include/findcomm_member.php?id="+comm;
	//xmlHttp.onreadystatechange=stateChangedIncPrint
	xmlHttp.onreadystatechange=function () 
	{
		document.getElementById("selmem").innerHTML='<span style="background: #FFFF00; color:#FF0000;"><strong>Wait...</strong></span>';
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			//document.getElementById("addfrnd").innerHTML=xmlHttp.responseText;
			document.getElementById("selmem").innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function checksendmessage()
{
/*alert("message=  "+document.send_message.message.value);
alert("message=  "+document.getElementById("message").length);
*/
        /*for(i=0; i<document.send_message.elements.length; i++)
	{
	document.write("The field name is: " + document.send_message.elements[i].name + " and it’s value is: " + document.send_message.elements[i].value + ".<br/>");
	}*/
	//alert(document.getElementById("selrecip").options[1].selected);

	var selected_sch='';
	var sel_recp_btn=document.getElementById("radioval").value;
	if(sel_recp_btn=='recip_id')
	{
	var selschLen=document.getElementById("selrecip").length;
	for(p=0; p < selschLen; p++)
				{
					if(document.getElementById("selrecip")[p].selected)
					{
					selected_sch+=document.getElementById("selrecip")[p].value+",";
					}
				}
	document.send_message.tempselected.value=selected_sch;
	}
    if(document.send_message.mailtype[0].checked==false && document.send_message.mailtype[1].checked==false )
     {
        alert("Select Email Type (Plain/HTML)");
        document.send_message.mailtype[0].focus();
        return false;
     }
    if(isblank(document.send_message.subject.value))
    {
      alert("Enter a subject");
      document.send_message.subject.focus();
      return false;
    }
	
    /*if(isblank(document.send_message.message.value))
    {
      alert("Enter a message");
      document.send_message.message.focus();
      return false;
    }*/
    return true;
}
function sendmail_load()
{
  document.send_message.mailtype[0].focus();
}
// rsvp cheking for radio selection
function rsvp_check()
{
	if(document.view_selected_event.ans[0].checked==false &&  document.view_selected_event.ans[1].checked==false  && document.view_selected_event.ans[2].checked==false)
    {
        alert("want to register???(Yes/No/May Be)");
        return false;
    }
    return true;
}

function chkOnlyDigits(str)
{
  if (str.length>0)
  {
    var strLen = str.length;
    for(var i=0; i<strLen; i++)
    {
      if (str.charCodeAt(i)>=48 && str.charCodeAt(i)<=57)
        continue;
      else
        return false;
    }
    var j=0;
    for(var i=0;i<strLen;i++)
    {
      if (str.charCodeAt(i)==48)
        j++;
    }
    if(j==strLen)
      return false;
    return true;
  }
  else
    return false;
}
function isblank(s)
{
        for(var i=0; i < s.length; i++)
        {
                var c = s.charAt(i);

                if((c!=' ')&&(c!="\n")&&(c!="\t"))
                        return false;
        }
        return true;
}
//event edit
function edit_event_load()
{
	document.edit_event.eventtitle.focus();
}

function edit_eventvalidation()
{
	if(isblank(document.edit_event.eventtitle.value))
	    {
	        alert("Enter EventTitle");
	        document.edit_event.eventtitle.focus();
	        return false;
	    }
	else if(isblank(document.edit_event.eventnote.value))
	    {
	    	alert("Enter Notes for Event");
	        document.edit_event.eventnote.focus();
	        return false;
	    }
	else if(isblank(document.edit_event.eventplace.value))
	    {
	        alert("Enter Eventplace");
	        document.edit_event.eventplace.focus();
	        return false;
	    }
    else if(document.edit_event.eventzip.value!="" && !chkOnlyDigits(document.edit_event.eventzip.value))
	    {
	      alert("Enter zipcode in a numeric format");
	      document.edit_event.eventzip.value="";
	      document.edit_event.eventzip.focus();
	      return false;
	    }
    else if(document.edit_event.eventmonth.value!="" && !chkOnlyDigits(document.edit_event.eventmonth.value))	//event month cheking
	{
		alert("Please Select Event Month");
		document.edit_event.eventmonth.value="";
		document.edit_event.eventmonth.focus();
		return false;
	}
	else if(document.edit_event.eventdate.value!="" && !chkOnlyDigits(document.edit_event.eventdate.value))	//event month cheking
	{
		alert("Please Select Event Day");
		document.edit_event.eventdate.value="";
		document.edit_event.eventdate.focus();
		return false;
	}
    else if(document.edit_event.eventyear.value!="" && !chkOnlyDigits(document.edit_event.eventyear.value))	//event month cheking
	{
		alert("Please Select Event Year");
		document.edit_event.eventyear.value="";
		document.edit_event.eventyear.focus();
		return false;
	}
  /*else
	{
	  	var i,daysInMonth,datechk=1;
	  	var strDay=document.edit_event.eventdate.value;
	  	var strMonth=document.edit_event.eventmonth.value;
	  	var strYear=document.edit_event.eventyear.value;
	  	var strYr=strYear;
	  	month=parseInt(strMonth);
	  	day=parseInt(strDay);
	  	year=parseInt(strYr);
	  	if (month==4 || month==6 || month==9 || month==11)
	  		{daysInMonth = 30}
	  	else if (month==2)
	  		{daysInMonth = daysInFebruary(year);}
	  	     else daysInMonth=31;
	
	  	if(day > daysInMonth)
	  	{
	  		alert("Please enter a valid day");
	  		document.edit_event.eventdate.focus();
	  		return false;
	  	}
	}
  	if(datechk==1)
    	return true;*/
  if(document.edit_event.eventdate.value !="" && document.edit_event.eventmonth.value !="" && document.edit_event.eventyear.value !="")
	{
	  	var i,daysInMonth,datechk=1;
	  	var strDay=document.edit_event.eventdate.value;
	  	var strMonth=document.edit_event.eventmonth.value;
	  	var strYear=document.edit_event.eventyear.value;
	  	var strYr=strYear;
	  	month=parseInt(strMonth);
	  	day=parseInt(strDay);
	  	year=parseInt(strYr);
	  	if (month==4 || month==6 || month==9 || month==11)
	  		{daysInMonth = 30}
	  	else if (month==2)
	  		{daysInMonth = daysInFebruary(year);}
	  	     else daysInMonth=31;
	 
	  	if(day > daysInMonth)
	  	{
	  		alert("Please enter a valid Start Date");
	  		document.edit_event.eventdate.focus();
	  		return false;
	  	}
	}
	if(document.edit_event.eventdateEnd.value !="" && document.edit_event.eventmonthEnd.value !="" && document.edit_event.eventyearEnd.value !="")
	{
	  	var i1,daysInMonth1,datechk1=1;
	  	var strDay1=document.edit_event.eventdateEnd.value;
	  	var strMonth1=document.edit_event.eventmonthEnd.value;
	  	var strYear1=document.edit_event.eventyearEnd.value;
	  	var strYr1=strYear1;
	  	month1=parseInt(strMonth1);
	  	day1=parseInt(strDay1);
	  	year1=parseInt(strYr1);
	  	if (month1==4 || month1==6 || month1==9 || month1==11)
	  		{daysInMonth1 = 30}
	  	else if (month1==2)
	  		{daysInMonth1 = daysInFebruary(year);}
	  	     else daysInMonth1=31;
	  	if(day1 > daysInMonth1)
	  	{
	  		alert("Please enter a valid End Date");
	  		document.edit_event.eventdateEnd.focus();
	  		return false;
	  	}
	}
  	if(datechk==1 && datechk1==1)
    	return true;
   
}
//**********event entry
function add_event_load()
{
	document.add_event.eventtitle.focus();
}
function eventvalidation()
{
	if(isblank(document.add_event.eventtitle.value))	//event title check
    {
        alert("Enter EventTitle");
        document.add_event.eventtitle.focus();
        return false;
    }
    else if(isblank(document.add_event.eventnote.value))	//event note check
    {
    	alert("Enter Notes for Event");
        document.add_event.eventnote.focus();
        return false;
    }
	  else if(isblank(document.add_event.eventplace.value))	//event place check
    {
        alert("Enter Eventplace");
        document.add_event.eventplace.focus();
        return false;
    }
    else if(document.add_event.eventzip.value!="" && !chkOnlyDigits(document.add_event.eventzip.value))
    {
      alert("Enter zipcode in a numeric format");	//event zipcode check
      document.add_event.eventzip.value="";
      document.add_event.eventzip.focus();
      return false;
    }
    else if(document.add_event.eventmonth.value!="" && !chkOnlyDigits(document.add_event.eventmonth.value))	//event month cheking
	{
		alert("Please Select Event Month");
		document.add_event.eventmonth.value="";
		document.add_event.eventmonth.focus();
		return false;
	}
	else if(document.add_event.eventdate.value!="" && !chkOnlyDigits(document.add_event.eventdate.value))	//event month cheking
	{
		alert("Please Select Event Day");
		document.add_event.eventdate.value="";
		document.add_event.eventdate.focus();
		return false;
	}
    else if(document.add_event.eventyear.value!="" && !chkOnlyDigits(document.add_event.eventyear.value))	//event month cheking
	{
		alert("Please Select Event Year");
		document.add_event.eventyear.value="";
		document.add_event.eventyear.focus();
		return false;
	}
  /*else
	{
	  	var i,daysInMonth,datechk=1;
	  	var strDay=document.add_event.eventdate.value;
	  	var strMonth=document.add_event.eventmonth.value;
	  	var strYear=document.add_event.eventyear.value;
	  	var strYr=strYear;
	  	month=parseInt(strMonth)
	  	day=parseInt(strDay)
	  	year=parseInt(strYr)
	  	if (month==4 || month==6 || month==9 || month==11)
	  		{daysInMonth = 30}
	  	else if (month==2)
	  		{daysInMonth = daysInFebruary(year);}
	  	     else daysInMonth=31;

	  	if(day > daysInMonth)
	  	{
	  		alert("Please enter a valid day")
	  		return false
	  	}
	}
  	if(datechk==1)
    	return true;*/
    	
  if(document.add_event.eventdate.value !="" && document.add_event.eventmonth.value !="" && document.add_event.eventyear.value !="")
	{
	  	var i,daysInMonth,datechk=1;
	  	var strDay=document.add_event.eventdate.value;
	  	var strMonth=document.add_event.eventmonth.value;
	  	var strYear=document.add_event.eventyear.value;
	  	var strYr=strYear;
	  	month=parseInt(strMonth);
	  	day=parseInt(strDay);
	  	year=parseInt(strYr);
	  	if (month==4 || month==6 || month==9 || month==11)
	  		{daysInMonth = 30}
	  	else if (month==2)
	  		{daysInMonth = daysInFebruary(year);}
	  	     else daysInMonth=31;
	  	
	  	if(day > daysInMonth)
	  	{
	  		alert("Please enter a valid Start Date");
	  		document.add_event.eventdate.focus();
	  		return false;
	  	}
	}
	if(document.add_event.eventdateEnd.value !="" && document.add_event.eventmonthEnd.value !="" && document.add_event.eventyearEnd.value !="")
	{
	  	var i1,daysInMonth1,datechk1=1;
	  	var strDay1=document.add_event.eventdateEnd.value;
	  	var strMonth1=document.add_event.eventmonthEnd.value;
	  	var strYear1=document.add_event.eventyearEnd.value;
	  	var strYr1=strYear1;
	  	month1=parseInt(strMonth1);
	  	day1=parseInt(strDay1);
	  	year1=parseInt(strYr1);
	  	if (month1==4 || month1==6 || month1==9 || month1==11)
	  		{daysInMonth1 = 30}
	  	else if (month1==2)
	  		{daysInMonth1 = daysInFebruary(year);}
	  	     else daysInMonth1=31;
	  	
	  	if(day1 > daysInMonth1)
	  	{
	  		alert("Please enter a valid End Date");
	  		document.add_event.eventdateEnd.focus();
	  		return false;
	  	}
	}
  	if(datechk==1 && datechk1==1)
    	return true;
}
//****** edit community ******
function community_edit_load()
{
	var field,txt_field;
	field = document.getElementById("desc_txtarea");
	txt_field = document.getElementById("countBody");
	txt_field.innerHTML = field.value.length;
	document.community_edit.name_txt.focus();
}
function edit_err_name_chng()
{
	var str=document.community_edit.name_txt.value;
	while (str.charAt(0) == " ")
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")
		str = str.substring(0,str.length - 1);
	if(str!="")
	{
		txt_field = document.getElementById("err_name");
	  	txt_field.innerHTML = " ";
	}
}
function edit_chk_confirm()
{
	var chk=0;
	var str=document.community_edit.name_txt.value;
	while (str.charAt(0) == " ")
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")
		str = str.substring(0,str.length - 1);
	txt_field = document.getElementById("err_name");
//	if(document.community_edit.name_txt.value=='')
    if(str=='')
	{
		//field = document.getElementById("name_txt");
	  	txt_field.innerHTML = "Please enter name<br>";
	  	chk=1;
	}
	else
	{
		txt_field.innerHTML = "";
	}
	txt_field = document.getElementById("err_desc");
	if(document.community_edit.desc_txtarea.value=='')
	{
		//field = document.getElementById("desc_txtarea");
	  	// Allow blank field in description of community/storefront date : 20 march 2008 	
		/*txt_field.innerHTML = "Please enter description2<br>";
	  	chk=1; */
	}
	else
		txt_field.innerHTML = "";

	//check zip must numeric if entered
	txt_field = document.getElementById("err_zip");
	if(document.community_edit.zip_txt.value!="" && !chkOnlyDigits(document.community_edit.zip_txt.value))
	{
	  	txt_field.innerHTML = "Please enter Zip Code in numeric only<br>";
		chk=1;
	}
	else
		txt_field.innerHTML = "";

	///====check for category==========
	txt_field = document.getElementById("err_catg");
	if(document.community_edit.cat_opt.value=="Choose")
	{
	  	txt_field.innerHTML = "please choose category<br>";
		chk=1;
	}
	else
		txt_field.innerHTML = "";	

	if(chk==0)
		return true;
	else
		return false;
}
//******* edit main topic ****
function edit_main_topic_ok()
{
    var desc;
    var opt=0;
    //subject cheking
    var subj=document.edit_topic.subject.value;
    while (subj.charAt(0) == " ")
	{
		subj = subj.substring(1);
	}
	while (subj.charAt(subj.length - 1) == " ")
	{
	    subj = subj.substring(0,subj.length - 1);
	}
	txt_field = document.getElementById("err_no_subject");
    if(subj=='')
    {
		txt_field.innerHTML = "Please enter Subject for main topic...";
		opt=1;
    }
    else
     {
        txt_field.innerHTML = "";
     }
    //desc cheking
    desc=document.edit_topic.desc_txtarea.value;
    while (desc.charAt(0) == " ")
	{
		desc = desc.substring(1);
	}
	while (desc.charAt(desc.length - 1) == " ")
	{
	    desc = desc.substring(0,desc.length - 1);
	}
	if(desc=="")
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = "Please enter Message for topic...";
		opt=1;
	}
	else
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = "";
	}
	if(opt==1)
	    return false;
	else
	    return true;
}
//******* edit topic ******
function edit_topic_load()		//common to display no. of characters in message box
{
	var field,txt_field;
	field = document.getElementById("desc_txtarea");
	txt_field = document.getElementById("countBody");
	txt_field.innerHTML = field.value.length;
	document.edit_topic.subject.focus();
}
function edit_topic_ok()
{	//message editing  cheking

	var mess=document.edit_topic.desc_txtarea.value;
	while (mess.charAt(0) == " ")
	{
		mess = mess.substring(1);
	}
	while (mess.charAt(mess.length - 1) == " ")
	{
	    mess = mess.substring(0,subj.length - 1);
	}
	if(mess=="")
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = "Please enter Message for topic...";
		return false;
	}
	else
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = " ";
		return true;
	}
}
//******* add topic ******
function newreply_load()
{
	document.add_topic.subject.focus();
}
function add_topic_ok()
{	//message entry cheking
	var mess=document.add_topic.desc_txtarea.value;
	if(mess=="")
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = "Please Enter Message For Topic...<br>";
		return false;
	}
	else
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = " ";
		return true;
	}
}
//********* create new topic *********** form :forum_new_topic
function forum_new_topic_load()
{
	document.forum_new_topic.subject.focus();
}
function err_subject()
{
	var str=document.forum_new_topic.subject.value;
	while (str.charAt(0) == " ")
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")
		str = str.substring(0,str.length - 1);
	if(str!="")
	{
		txt_field = document.getElementById("err_no_subject");
	  	txt_field.innerHTML = " ";
	}
}
function chk_topic_ok()
{
  var chk=0;
    // subject entery checking
  var str=document.forum_new_topic.subject.value;
	while (str.charAt(0) == " ")// ltrim
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ") //rtrim
		str = str.substring(0,str.length - 1);
	//message entry cheking
	var mess=document.forum_new_topic.desc_txtarea.value;
	if(str=="")
	{
		txt_field = document.getElementById("err_no_subject");
		txt_field.innerHTML = "Please enter Topic...";
		chk=1;
	}
	else
	{
		txt_field = document.getElementById("err_no_subject");
		txt_field.innerHTML = " ";
	}
	if(mess=="")
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = "Please enter Message for topic...";
		chk=1;
	}
	else
	{
		txt_field = document.getElementById("err_desc");
		txt_field.innerHTML = " ";
	}
	if(chk==0)
	    return true;
	else
	   return false;
}
//************* search community ***********
function chk_btn_search()
{
	var str=document.community.srch_name.value;
	while (str.charAt(0) == " ")
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")
		str = str.substring(0,str.length - 1);
	if(str=="")
	{
		txt_field = document.getElementById("err_srch_srchcomm");
		txt_field.innerHTML = "Please enter proper search criteria<br>";
		return false;
	}
	else
	{
		txt_field = document.getElementById("err_srch_srchcomm");
		txt_field.innerHTML = " ";
		return true;
	}
}
function chk_search_ok()
{
	var str=document.community_search.srch_name.value;
	while (str.charAt(0) == " ")
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")
		str = str.substring(0,str.length - 1);

	if(str=="")
	{
		txt_field = document.getElementById("err_srch_srchcomm");
		txt_field.innerHTML = "Please enter proper search criteria<br>";
		return false;
	}
	else
	{
		txt_field = document.getElementById("err_srch_srchcomm");
		txt_field.innerHTML = " ";
		return true;
	}
}
//**************** community create *********
function community_create_load()
{
	document.community_create.name_txt.focus();
}
function err_name_chng()
{
	var str=document.community_create.name_txt.value;
	while (str.charAt(0) == " ")
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")
		str = str.substring(0,str.length - 1);

	if(str!="")
	{
		txt_field = document.getElementById("err_name");
	  	txt_field.innerHTML = " ";
	}
}
function desc_err_chang(no)
{
	var str;
	var fld;
	var txt_field;
	switch(no)
	{
		case 1:str=document.community_create.desc_txtarea.value;
				break;
		case 2:str=document.community_edit.desc_txtarea.value;
				break;
		case 3:str=document.edit_topic.desc_txtarea.value;
				break;
		case 4:str=document.add_topic.desc_txtarea.value;
				break;
		case 5:str=document.forum_new_topic.desc_txtarea.value;
				break;
		case 6:str=document.pendingcommreq.desc_txtarea.value;
				break;
	}
	while (str.charAt(0) == " ")
	{
		str = str.substring(1);
	}
	while (str.charAt(str.length - 1) == " ")
	{
		str = str.substring(0,str.length - 1);
	}

	fld = document.getElementById("desc_txtarea");
    txt_field = document.getElementById("countBody");
	txt_field.innerHTML = fld.value.length;
	if(str!="")
	{
	  txt_field = document.getElementById("err_desc");
  	  txt_field.innerHTML = " ";
  	}
}
function counterUpdate()
{
	  var txt_field,field,str;
	  field = document.getElementById("desc_txtarea");
	  txt_field = document.getElementById("countBody");
	  txt_field.innerHTML = field.value.length;
}
function counterUpdate1(maxlen)
{
	  var txt_field,field,str,mess;
	  field = document.getElementById("desc_txtarea");
	  txt_field = document.getElementById("countBody");
	  txt_field.innerHTML = field.value.length;
	  if(field.value.length>=maxlen)
	  {
	  	mess="Max. length is "+maxlen+" characters.";
	  	alert(mess);
	  	str=field.value;
	  	field.value=str.substring(0,maxlen);
	  	field = document.getElementById("desc_txtarea");
	  	txt_field = document.getElementById("countBody");
	  	txt_field.innerHTML = field.value.length;
	  }
}
function chk_confirm()
{
	var chk=0;
	
	
	if(document.community_create.name_txt.value=='')
	{
		field = document.getElementById("name_txt");
	  	txt_field = document.getElementById("err_name");
	  	txt_field.innerHTML = "Please enter name<br>";
	  	chk=1;
	}
	/*if(document.community_create.nhood[].value=='')
	{
		field = document.getElementById("nhood[]");
	  	txt_field = document.getElementById("err_neigh");
	  	txt_field.innerHTML = "Please select neighborhood(s)<br>";
	  	chk=1;
	}*/
	if(document.community_create.desc_txtarea.value=='')
	{
		
		field = document.getElementById("desc_txtarea");
	  	txt_field = document.getElementById("err_desc");
	  	txt_field.innerHTML = "Please enter description3<br>";
	  	chk=1;
	}
	
	if(document.community_create.cat_opt.value=="Choose")
	{
		field = document.getElementById("cat_opt");
	  	txt_field = document.getElementById("err_catg");
	  	txt_field.innerHTML = "Please choose category<br>";
		chk=1;
	}
	//check zip must numeric if entered
	if(document.community_create.zip_txt.value!="" && !chkOnlyDigits(document.community_create.zip_txt.value))
	{
	  	txt_field = document.getElementById("err_zip");
	  	txt_field.innerHTML = "Please enter Zip Code in numeric only<br>";
		chk=1;
	}
	if(chk==0)
	{
		//return true;
		document.community_create.submit();
	}
	else
	{
		document.community_create.name_txt.focus();
		return false;
	}
}
/* =================    for ajax scirpt for displaying subcategory ====================== */

function FillDispOrder2(a,b)
{  
	if(a == "subcat_opt0")
	{		
		if(document.getElementById("hidsubcat_opt0"))
			document.getElementById("hidsubcat_opt0").value = b;
		document.getElementById("hidsubcat_opt1").value = '';	
		document.getElementById("hidsubcat_opt2").value = '';	
		document.getElementById("hidsubcat_opt3").value = '';	
	}
	else if(a == "subcat_opt1")
	{		
		if(document.getElementById("hidsubcat_opt1"))
			document.getElementById("hidsubcat_opt1").value = b;
		document.getElementById("hidsubcat_opt2").value = '';	
		document.getElementById("hidsubcat_opt3").value = '';		
	}
	else if(a == "subcat_opt2")
	{		
		if(document.getElementById("hidsubcat_opt2"))
			document.getElementById("hidsubcat_opt2").value = b;			
		document.getElementById("hidsubcat_opt3").value = '';	
	}
	else if(a == "subcat_opt3")
	{		
		if(document.getElementById("hidsubcat_opt3"))
			document.getElementById("hidsubcat_opt3").value = b;
	}	
	var aa=new Array();
	
	var vurl = '../include/showcategory1.php';
	var pars = 'name='+ a + '&catid=' +b;
	if(a == "subcat_opt0") {
		var myAjax = new Ajax.Request(	vurl, { method: 'get',  parameters: pars, onComplete: showResponse1 });		
		var d = $('DivDispOrder');	
		d.innerHTML = "<blink><font color=red>Wait....</font></blink>";	
	
		var e = $('DivDispOrder1');	
		e.innerHTML = "";	
		
		var f = $('DivDispOrder2');	
		f.innerHTML = "";	
		
		//var g = $('DivDispOrder3');	
		//g.innerHTML = "";	
	
	}else if(a == "subcat_opt1")	{
		var myAjax = new Ajax.Request(	vurl, { method: 'get',  parameters: pars, onComplete: showResponse2 });		
		
		var e = $('DivDispOrder1');	
		e.innerHTML =  "<blink><font color=red>Wait....</font></blink>";	
		
		var f = $('DivDispOrder2');	
		f.innerHTML = "";	
		
		//var g = $('DivDispOrder3');	
		//g.innerHTML = "";	
		
	}else if(a == "subcat_opt2")	{
		var myAjax = new Ajax.Request(	vurl, { method: 'get',  parameters: pars, onComplete: showResponse3 });		
		
		var f 		= $('DivDispOrder2');	
		f.innerHTML =  "<blink><font color=red>Wait....</font></blink>";	
		
		//var g = $('DivDispOrder3');	
		//g.innerHTML = "";	
		
	}else if(a == "subcat_opt3")		{
		var myAjax = new Ajax.Request(	vurl, { method: 'get',  parameters: pars, onComplete: showResponse4 });			
		//var g = $('DivDispOrder3');	
		//g.innerHTML = "Wait...";	

	}
}
function showResponse1(originalRequest)
{
	var d = $('DivDispOrder');	
	if(originalRequest.responseText.length != 2)
		d.innerHTML = originalRequest.responseText;	
	else
		d.innerHTML = "No categories found.";	

}
function showResponse2(originalRequest)
{
	var d = $('DivDispOrder1');	
	if(originalRequest.responseText.length != 2)
		d.innerHTML = originalRequest.responseText;	
	else
		d.innerHTML = "No categories found.";	
}
function showResponse3(originalRequest)
{
	var d = $('DivDispOrder2');	
	if(originalRequest.responseText.length != 2)
		d.innerHTML = originalRequest.responseText;	
	else
		d.innerHTML = "No categories found.";	
}
function showResponse4(originalRequest)
{
	var d = $('DivDispOrder3');	
	if(originalRequest.responseText.length != 2)
		d.innerHTML = originalRequest.responseText;	
	else
		d.innerHTML = "No categories found.";	
}

/* =================================================================================== */
function sel_category()
{
	var field;
	//if(community_create.cat_opt.value=="Choose")
	if($('cat_opt') == "Choose")	
	{
		  field = document.getElementById("cat_opt");
	  	txt_field = document.getElementById("err_catg");
	  	txt_field.innerHTML = "please choose category<br>";
	}
	else
	{
	  	field = document.getElementById("cat_opt");
	  	txt_field = document.getElementById("err_catg");
	  	txt_field.innerHTML = "";
	}
}

//************* community forum form - create category*****
//function edit_cat(no) // not in use
//{
//	comm_forum.cat_id.value=no;
//	comm_forum.job.value="edit";
//	//****
//	var len;
//	var x_txt,x_link;
//	x_txt="comm_name"+no;
//	len=comm_forum.elements.length;
//	for(var i=0;i<len;i++)
//	{
//		if(comm_forum.elements[i].name == x_txt)
//		{
//  			comm_forum.val.value=comm_forum.elements[i].value;
//  			comm_forum.elements[i].disabled=true;
//  			break;
//  		}
//    }
//	//****
//	comm_forum.submit();
//}
// add & edit & delete communtit category
function add_cat_chkeck()
{
  var txt_field;
  if(isblank(document.comm_forum.cat_name.value))
  {
	  txt_field = document.getElementById("cat_name_err");
	  txt_field.innerHTML = "Enter Category name first.";
	  return false;
	}
	return true;
}
function change_comm(no)
{
  var len,i;
  var x_txt,x_link,x_span_id,x_nhood;
  var tmp=0;
  // value to hidden field
  document.comm_forum.cat_id.value=no;
  document.comm_forum.job.value="edit";
  x_txt="comm_name"+no;
  
  var nhood_txt = "nhood_name"+no;
  var com_txt = "com_name"+no;
  var profile_txt = "profile_name"+no;
  x_link="edit_comm"+no;
  x_span_id="edit_nm"+no;
  x_nhood="nhood_name"+no;
 
  len=document.comm_forum.elements.length;
  for(i=0;i<len;i++)
  {
  	if(document.comm_forum.elements[i].name == x_txt)
  	{
		if(!document.comm_forum.elements[i].disabled)
  		{
  			document.comm_forum.val.value=document.comm_forum.elements[i].value;
  			document.comm_forum.elements[i].disabled=true;
  			txt_field = document.getElementById(x_span_id);
			txt_field.innerHTML="Edit";
	  		document.comm_forum.submit();
  			
  		}
  		else
  		{
	  		document.comm_forum.elements[i].disabled=false;
 			txt_field = document.getElementById(x_span_id);
			txt_field.innerHTML="Save";
	  		
  		}
  	}
	if(document.comm_forum.elements[i].name == nhood_txt)
  	{ 
		if(!document.comm_forum.elements[i].disabled)
  		{  			
  			document.comm_forum.elements[i].disabled=true;  		
  			
  		}
  		else
  		{
	  		document.comm_forum.elements[i].disabled=false;
	  		
  		}
  	}
	if(document.comm_forum.elements[i].name == com_txt)
  	{ 
		if(!document.comm_forum.elements[i].disabled)
  		{  			
  			document.comm_forum.elements[i].disabled=true;  		
  			
  		}
  		else
  		{
	  		document.comm_forum.elements[i].disabled=false;
	  		
  		}
  	}
	if(document.comm_forum.elements[i].name == profile_txt)
  	{ 
		if(!document.comm_forum.elements[i].disabled)
  		{  			
  			document.comm_forum.elements[i].disabled=true;  		
  			
  		}
  		else
  		{
	  		document.comm_forum.elements[i].disabled=false;
	  		
  		}
  	}
	
  }
  return;
}
function editgeoaffi(num,pageid)
{
    //hidedit, newhidvalues, hidids, hidpageids, hidoldgeo are the PHP hidden Varibles.
    var len,item,txtname,txtspan;
    var itemname;

    txtspan = "edit"+num;
    item = document.getElementById(txtspan);
    txtname="geoid"+num;
    itemname = document.getElementById(txtname);
    if(item.innerHTML == "[Edit]")
    {
        document.frmeditgeo.hidedit.value = "false";
        itemname.disabled=false;
        item.innerHTML = "[Save]";
    }
    else
    {
        if(item.innerHTML == "[Save]")
        {
            if(itemname.value == "")
            {
                alert("Please a Name");
            }
            else
            {
                document.frmeditgeo.hidedit.value = "true";
                document.frmeditgeo.newhidvalues.value = itemname.value;
                document.frmeditgeo.hidids.value = num;
                document.frmeditgeo.hidpageids.value = pageid;
    		item = document.getElementById("oldgeoname"+num);
                document.frmeditgeo.hidoldgeo.value = item.value;
                document.frmeditgeo.submit();
                item.innerHTML = "[Edit]";
            }
        }
    }
}

/*for bug 2464*/
var upload_number = 1;
function addFileInput() 
{		
 	var d = document.createElement("div");
 	var file = document.createElement("input");
 	file.setAttribute("type", "file");
 	file.setAttribute("name", "attachment"+upload_number);
	file.setAttribute("id", "attachment"+upload_number);
 	d.appendChild(file);
	
	/*var val="document.send_message.attachment"+(upload_number-1);
	alert(val);
	alert(val.value);*/

 	document.getElementById("moreUploads").appendChild(d);
 	upload_number++;	
	document.send_message.no_of_attch.value=upload_number;
}

/*function attachfiles()
{
	alert("hi");
	var htmltxt;
	htmltxt='<input type="file" name="attach" value="">';
	htmltxt+='<a href="javascript:attachfiles();">Attach</a>';
	txt_field = document.getElementById("upload_file");
	txt_field.innerHTML=htmltxt;
}*/


// for edit Neighborhood pages.
function editNHood(num,nPid,pageid)
{
    //hidedit, newhidvalues, hidids, hidpageids, hidoldgeo are the PHP hidden Varibles.
    var len,item,txtname,txtspan;
    var itemname;

    txtspan = "edit"+num;
    item = document.getElementById(txtspan);
    txtname="geoid"+num;
    itemname = document.getElementById(txtname);
    if(item.innerHTML == "[Edit]")
    {
        document.frmeditgeo.hidedit.value = "false";
        itemname.disabled=false;
        item.innerHTML = "[Save]";
    }
    else
    {
        if(item.innerHTML == "[Save]")
        {
            if(itemname.value == "")
            {
                alert("Please a Name");
            }
            else
            {
                document.frmeditgeo.hidedit.value = "true";
                document.frmeditgeo.newhidvalues.value = itemname.value;
                document.frmeditgeo.hidids.value = num;
                document.frmeditgeo.nHoodPid.value = nPid;
                document.frmeditgeo.hidpageids.value = pageid;
    		item = document.getElementById("oldgeoname"+num);
                document.frmeditgeo.hidoldgeo.value = item.value;
                document.frmeditgeo.submit();
                item.innerHTML = "[Edit]";
            }
        }
    }
}

/*function chk_emailaddlist()
{
	var str=document.invitefriend.emailaddlist.value;
	while (str.charAt(0) == " ")	//ltrim
		str = str.substring(1);
	while (str.charAt(str.length - 1) == " ")	//rtrim
		str = str.substring(0,str.length - 1);
	txt_field = document.getElementById("err_emailaddlist");
	if(str=="")
		txt_field.innerHTML = "Please enter E-mail address to send mail.<br>";
	else
		txt_field.innerHTML = "";
}*/
/*function desc_err_chang1()
{
	var str=document.community_create.desc_txtarea.value;
	while (str.charAt(0) == " ")
	{
		str = str.substring(1);
	}
	while (str.charAt(str.length - 1) == " ")
	{
	str = str.substring(0,str.length - 1);
	}
	  field = document.getElementById("desc_txtarea");
	  txt_field = document.getElementById("countBody");
	  txt_field.innerHTML = field.value.length;
		if(str!="")
		{
		  txt_field = document.getElementById("err_desc");
	  	  txt_field.innerHTML = " ";
	  	}
}*/
function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function emailCheck1 (emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.
   It also is used to separate the username from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Email address seems incorrect (check @ )")
	//  alert("Separate addresses by commas only.");
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("The username doesn't seem to be valid.")
    //alert("Separate addresses by commas only.");
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
	        //alert("Separate addresses by commas only.");
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	   alert("The domain name doesn't seem to be valid.")
	   //alert("Separate addresses by commas only.");
    return false
}

    //domain name seems valid, but now make sure that it ends in a
    //three-letter word (like com, edu, gov) or a two-letter word,
    //representing country (uk, nl), and that there's a hostname preceding 
    //the domain or country.

    //Now we need to break up the domain to get a count of how many atoms
    //it consists of.
    
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("The address must end in a three-letter domain, or two letter country.")
   //alert("Separate addresses by commas only.");
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   //alert("Separate addresses by commas only.");
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
/*function for bug:2464 7apr10*/
function selectkAllOth() 
{
			var chks = document.getElementsByName("chkUsrOthGrp[]");
 			//alert(chks.length);
			//alert(document.getElementById("checkchkOth").checked);
			
			if(document.getElementById("checkchkOth").checked==true)
			{
				for (var i = 0; i < chks.length; i++)
				{
					chks[i].checked=true;
				}
			}
			else
			{
				for (var i = 0; i < chks.length; i++)
				{
					chks[i].checked=false;
				}
			}
		
}
function find_commMem(comID)	// to find out group member according to group
{
		//alert(comID+"===="+eid);
		
		document.getElementById("othMemResult").style.display='inline';
		document.getElementById("othMemResult").innerHTML = '<table border="0" align="center"><tr><td><font color="blue">Loading... Please wait...</font></td></tr></table>';
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		var url="include/otherGroupmember_Ajx.php"
		url=url+"?com="+comID;
		//url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=stateChanged1 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
}

function stateChanged1() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			//alert(xmlHttp.responseText )
			document.getElementById("othMemResult").innerHTML=xmlHttp.responseText 
			//document.getElementById("ShowInvite_othergrup").style.display='inline';
			
		} 
}
function showBuz(buzVal)	// to find out group member according to group
	{	
		document.getElementById("othMemResult").style.display='none';
		document.getElementById("comCombo").style.display='inline';
		document.getElementById("comCombo").innerHTML = '<table border="0" align="center"><tr><td><font color="blue">Please wait...select community</font></td></tr></table>';
		xmlHttpCombo=GetXmlHttpObject();
		if (xmlHttpCombo==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		var url="include/otherGroupmember_Ajx.php"
		url=url+"?buz="+buzVal;
		xmlHttpCombo.onreadystatechange=stateChangedCombo 
		xmlHttpCombo.open("GET",url,true)
		xmlHttpCombo.send(null)
	}

function stateChangedCombo() 
{ 
		if (xmlHttpCombo.readyState==4 || xmlHttpCombo.readyState=="complete")
		{ 
			//alert(xmlHttp.responseText )
			document.getElementById("comCombo").innerHTML=xmlHttpCombo.responseText 
		} 
}
function checkAllFrnd() 
		{
			var chks = document.getElementsByName("chkUsrFrnd[]");
 			//alert(chks.length);
			if(document.invitefriend.checkchkFrnd.checked==true)
			{
				for (var i = 0; i < chks.length; i++)
				{
					chks[i].checked=true;
				}
			}
			else
			{
				for (var i = 0; i < chks.length; i++)
				{
					chks[i].checked=false;
				}
			}
		
		}
function showCommHTML(str)
{	
	
	if(str=="Friends")
	{
		/*if(document.getElementById("comNm"))
			document.getElementById("comNm").value=0;
		document.getElementById("samegrp_submtbtn").style.display='none';
		document.getElementById("othermem_submtbtn").style.display='none';
		document.getElementById("ShowInvite").style.display='none';
		document.getElementById("othGrpHTML").style.display='none';
		document.getElementById("sameGrpHTML").style.display='none';	
		document.getElementById("othMemResult").style.display='none';
		document.getElementById("frndsHTML").style.display='inline';*/
		document.getElementById("ShowInvite").style.display='none';
		document.getElementById("othGrpHTML").style.display='none';
		document.getElementById("othMemResult").style.display='none';
		document.getElementById("frndsHTML").style.display='inline';
	}
	else if(str=="OtherGroup")
	{
		/*document.getElementById("samegrp_submtbtn").style.display='none';
		document.getElementById("frnds_submtbtn").style.display='none';
		document.getElementById("othermem_submtbtn").style.display='none';
		document.getElementById("ShowInvite").style.display='none';
		document.getElementById("sameGrpHTML").style.display='none';*/
		document.getElementById("frndsHTML").style.display='none';
		document.getElementById("othGrpHTML").style.display='inline';
		document.getElementById("ShowInvite").style.display='none';
		
	}
	else if(str=="inv_bymail")
	{		
		document.getElementById("frndsHTML").style.display='none';
		document.getElementById("othGrpHTML").style.display='none';
		document.getElementById("ShowInvite").style.display='inline';
	}
	else if(str=="list" || str=="twitter" || str=="facebookrdo")
	{		
		document.getElementById("frndsHTML").style.display='none';
		document.getElementById("othGrpHTML").style.display='none';
		document.getElementById("ShowInvite").style.display='none';
		document.getElementById("othMemResult").style.display='none';
	}
}
/*2464 over*/
/*for bug: 2826*/
function show_nonprofield()
{
	var show_hide=document.getElementById("cause_add").style.display;
	if(show_hide=='none')
	{
		document.getElementById("cause_add").style.display='inline';
	}
	else
	{
		document.getElementById("cause_add").style.display='none';
	}
}

/* Added by Chirag for Bug 2969 */
function causeTrack(chkOpt,usr,comm)
{
	//document.getElementById("comCombo").innerHTML = '<table border="0" align="center"><tr><td><font color="blue">fill Combo... Please wait...</font></td></tr></table>';
	xmlHttpCzTrack=GetXmlHttpObject()
	if (xmlHttpCzTrack==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="../typo3conf/ext/sf_communtiy_add/pi1/czSelectionTrack.php"
	//var url="czSelectionTrack.php"
	url=url+"?chk="+chkOpt+"&usR="+usr+"&coM="+comm;
	xmlHttpCzTrack.onreadystatechange=stateChangedCzTrack
	xmlHttpCzTrack.open("GET",url,true)
	xmlHttpCzTrack.send(null)
}

function stateChangedCzTrack() 
{ 
	if (xmlHttpCzTrack.readyState==4 || xmlHttpCzTrack.readyState=="complete")
	{ 
		//alert(xmlHttpCzTrack.responseText)
		//document.getElementById("comCombo").innerHTML=xmlHttpCzTrack.responseText 
	}
}
/* Added by Chirag for Bug 2969 */
