function getlogin(){
	if (document.frmlogin.txtusername.value==""){
		alert("User name required");
		document.frmlogin.txtusername.focus();
		return false;
		}
	else if (document.frmlogin.txtpassword.value==""){
		alert("Password required");
		document.frmlogin.txtpassword.focus();
		return false;
		}	
	return true;
}

function submitactivitynews(dm,pg){
	if(dm.subject.value==""){
		alert("Enter subject");
		dm.subject.focus();
	}
	else if(dm.news.value==""){
		alert("News filed is empty");
		dm.news.focus();
	}
	else{
		dm.method="Post";
		dm.action = pg;
		dm.submit();
	}	
}
function uplogin(dm){
	if(dm.login.value=="" && dm.npwd.value==""){
		alert("Must enter either Login name or password to Update");
		return false;
	}

}

function groupemail(dm){
	if (dm.txtTo.value==""){
		alert("To required");
		dm.txtTo.focus();
		return false;
		}
	else if (dm.txtmsg.value==""){
		alert("Message required");
		dm.txtmsg.focus();
		return false;
		}	
	return true;
}

function simsearch(dm){
	if(dm.txtsearch.value==""){
		alert("Enter Text for Search");
		dm.txtsearch.focus();
		return false;
	}
	return true;
}
function PostAds(dm){
	if(dm.txtitemname.value==""){
		alert("Enter Item Name");
		dm.txtitemname.focus();
		return false;
	}
	return true;
}

function LostPwd(dm){
	if(dm.txtemail.value==""){
		alert("Enter Email");
		dm.txtemail.focus();
		return false;
	}
	return true;
}

function formSubmit(dm,pg){
	//alert("hi");
	dm.method="Post";
	dm.action=pg;
	dm.submit();
}


function delrecord(dm,msgConfirm,pg)
	{
	if(confirm(msgConfirm)){
			dm.method="Post";
			dm.action=pg;
			dm.submit();
		}
}

function submitThisForm(dm,pg){
	dm.method="Post";
	dm.action=pg;
	dm.submit();
}

function feedbackcomment(){
	var mycomment=document.frmfb.comment.value.length;
	var curValue=document.frmfb.comment.value;
	
	if(mycomment>499){
		alert("You have exceed Maximum allowed Character");
		curValue=curValue.substring(0,curValue.length-1)
		document.frmfb.comment.value = curValue.substring(0, 499);
		}
}

function postpoll(dm,pg)
{
var radiochecked="";
if(dm.rdo.length)
  {
	for(i=0;i<dm.rdo.length;i++)
	  {
		if(dm.rdo[i].checked)
		  {
			radiochecked="yes";

			break;
		  }
	  }
  }
else
   {
	if(dm.rdo.checked)
		radiochecked="yes";
   }
if(radiochecked=="yes")
	{
	dm.method="post";
	dm.action=pg;
	dm.submit();
	}
else
	alert("You must make a choice!");
}

function pollcommentsubmit(){
	var mycomment=document.pollcomment.comment.value.length;
	var curValue=document.pollcomment.comment.value;
	
	if(mycomment>100){
		alert("You have exceed Maximum allowed Character");
		curValue=curValue.substring(0,curValue.length-1)
		document.pollcomment.comment.value = curValue.substring(0, 100);
		}
}


function submitvendor(){
	return true;
}
function popprint(dm){
	window.open(dm,'','menubar=no addressbar=no,status=no,scrollbars=yes resizable=yes width=860 height=660');
}

function actmembers(dm){
	window.open(dm,'activitymembers','menubar=no addressbar=no,status=no,scrollbars=yes resizable=yes width=430 height=660');
}


function selectrecord(){
	var counter = 0
	var msgError = "Please select checkbox.";
	var myval="";
	
	for(i=0;i<document.frm.elements.length;i++){
		if(document.frm.elements[i].name=="chk[]"){
			if(document.frm.elements[i].checked){
				myval=document.frm.elements[i].value+","+myval
				counter ++
			}
		}
	}
	
	if(counter>0){
			myval = myval.substr(0,myval.length-1);
			window.opener.document.frmge.txtTo.value=myval;
			window.close();
	}
	else
		alert(msgError);
}


function salbum(){
	if(document.frmalbum.txtalbum.value==""){
		alert("Please enter album name");
		document.frmalbum.txtalbum.focus();
		return false;
	}
	else
		return true;
}

function submitphoto(){
	var thisUserImg=new Image();
	var mycrt;
	var invalid=0;
	for (i=1;i<6;i++){
		mycrt=eval("document.frmalbum.txtphoto"+i);
		if(mycrt.value!=""){
			thisUserImg.src=mycrt.value;
			strFilename = mycrt.value;;
			checkDot=strFilename.lastIndexOf(".");
			extenson = strFilename.substring(checkDot+1,strFilename.length)
			if(extenson!="jpg" && extenson!="JPG" && extenson!="jpeg" && extenson!="JPEG"){
				invalid=i;
				break;
				}
			}
		
	}

	if(document.frmalbum.txtphoto1.value=="" && document.frmalbum.txtphoto2.value=="" && document.frmalbum.txtphoto3.value=="" && document.frmalbum.txtphoto4.value=="" && document.frmalbum.txtphoto5.value=="")
		alert("Must select atleast one photo to upload");
	else if(invalid>0){
		alert("Must select only JPEG/JPG photos. You have selected "+extenson+" extension for Photo "+invalid)
	}
	else{
		document.frmalbum.method="post";
		document.frmalbum.action=submitphoto.arguments[0];
		document.frmalbum.submit()
	}

}

function slideshow(dm){
	window.open(dm,'','menubar=no addressbar=no,status=no,scrollbars=yes resizable=yes,width=860 height=700 left=10 top=10');
}

function monthvalue(){
	document.frmmonth.method="post";
	document.frmmonth.action=monthvalue.arguments[0];
	document.frmmonth.submit()
	}
