function openwin(file,Iwidth,Iheight) {
	var newWin1=window.open(file,'nWin2','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,copyhistory=no,width='+Iwidth+',height='+Iheight+',screenX=0,screenY=0,left=20,top=20');
}
function CheckAll(){
	var frm=document.formn;
	var count = frm.elements.length;
	
			if(document.formn.chk.checked == 0){
				for (i=0; i < count; i++){
					if(frm.elements[i].type=="checkbox"){
						frm.elements[i].checked = 0;
						
						document.formn.chk.checked=0;
					}
				}
			} 
			if(document.formn.chk.checked == 1 ){
				for (i=0; i < count; i++){
					if(frm.elements[i].type=="checkbox"){
						frm.elements[i].checked = 1;
						
						document.formn.chk.checked=1;
					}
				}
			} 
	
}
function chkdelete(){
	var frm=document.formn;
	count = frm.elements.length;
	var c=0;
	for (i=0; i < count; i++){
		if(frm.elements[i].checked == 1){
			c = 1;
		}
	}
	if(c == 0){
		alert('Please select a record first to delete.');
		return false;
	}
	if(c!=0){
		 return confirm('Are you sure you want to delete ....');
	}
}
function chksendmail(){
	var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
	count = document.formn.elements.length;
	var c=0;
	for (i=0; i < count; i++){
		if(document.formn.elements[i].checked == 1){
			c = 1;
		}
		
	}
	if(c == 0){
		alert('First, select the record');
		return false;
	}
	else{
		
		if(document.formn.subject.value == ""){
				alert('Please enter subject.');
				document.formn.subject.focus();
				return false;
		}
		/*if(document.formn.message.value == ""){
				alert('Please enter message.');
				document.formn.message.focus();
				return false;
		}*/
		
	}
}	
function CheckAllNew(){
	var frm=document.formn;
	var count = frm.elements.length;
	
			if(document.formn.chk.checked == 0 || document.formn.checkall.value=="Uncheck All"){
				for (i=0; i < count; i++){
					if(frm.elements[i].type=="checkbox"){
						frm.elements[i].checked = 0;
						
						document.formn.chk.checked=0;
					}
				}
			} 
			if(document.formn.chk.checked == 1 || document.formn.checkall.value=="Check All"){
				for (i=0; i < count; i++){
					if(frm.elements[i].type=="checkbox"){
						frm.elements[i].checked = 1;
						
						document.formn.chk.checked=1;
					}
				}
			} 
			if(document.formn.checkall.value=="Uncheck All"){
				document.formn.checkall.value="Check All";
			}else{
				document.formn.checkall.value="Uncheck All";
			}
	
}
function chkactivate(){
	var frm=document.formn;
	
	count = frm.elements.length;
	var c=0;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked == 1){
				c = 1;
			}
		}
	}
	if(c == 0){
		alert('Please select a record first ...');
		return false;
	}
}
function atleastone(){
	var frm=document.formn;
	count = frm.elements.length;
	var c=0;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked == 1){
				c = 1;
			}
		}
	}
	if(c == 0){
		alert('Please select a record first ...');
		return false;
	}
}
