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");
}
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");
}
//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 description<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 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>";
	}

}
function commreqyes(uid)	//req. community accepted
{
    document.reqcommcreate.commuid.value=uid;
    document.reqcommcreate.commans.value=1;
	  document.reqcommcreate.submit();
}
function commreqno(uid)		//req. for community is rejected
{
    document.reqcommcreate.commuid.value=uid;
    document.reqcommcreate.commans.value=0;
    document.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();
}
//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;
    var str=document.invitefriend.emailaddlist.value;
    nofile=0;
    len=document.invitefriend.elements.length;
    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=="")
    {
        alert("Please enter E-mail address to send mail.\n Or Upload file from desktop.");
        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 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();
}
function checksendmessage()
{
    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 (strMonth.length<1 || month<1 || month>12)
	  	{	alert("Please enter a valid month")
	  		return false } */
	  	if(day > daysInMonth)
	  	{
	  		alert("Please enter a valid day");
	  		document.edit_event.eventdate.focus();
	  		return false
	  	}
	}
  	if(datechk==1)
    	return true;
    /*else
    	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 (strMonth.length<1 || month<1 || month>12)
	  	{
	  		alert("Please enter a valid month")
	  		return false
	  	} */
	  	if(day > daysInMonth)
	  	{
	  		alert("Please enter a valid day")
	  		return false
	  	}
	}
  	if(datechk==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");
	  	txt_field.innerHTML = "Please enter description<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 = "";
	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.desc_txtarea.value=='')
	{
		field = document.getElementById("desc_txtarea");
	  	txt_field = document.getElementById("err_desc");
	  	txt_field.innerHTML = "Please enter description<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;
	}
	else
	{
		document.community_create.name_txt.focus();
		return false;
	}
}
function sel_category()
{
	var field;
	if(community_create.cat_opt.value=="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;
  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;
  x_link="edit_comm"+no;
  x_span_id="edit_nm"+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();
  			break;
  		}
  		else
  		{
	  		document.comm_forum.elements[i].disabled=false;
 			txt_field = document.getElementById(x_span_id);
			txt_field.innerHTML="Save";
	  		break;
  		}
  	}
  }
  return;
}
function editgeoaffi(num,pageid)
{
    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]";
            }
        }
    }
}
/*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 );
}
