function call_std_list_by_section(id){
	var session = $("#session").val();
	var datastr = "section_id="+id+"&session="+session;
	if(session==""){
		alert("Enter a session");
		$("#session").focus();
		return false;
	}
	else{
		alert("loading students..");
		$("#std_list_for_sms_select").load("module/general_notice/load_std_list_for_sms.php",datastr);
	}
}


function load_sms_preview(){
	var session = $("#session").val();
	var sec_id = $("#section_id").val();
	var sms_body = $("#form-field-8").val();
	var datastr = "session="+session+"&sec_id="+sec_id+"&sms_body="+encodeURIComponent(sms_body);
	var check_all = $("#check_all").is(':checked') ? 1 : 0;
	var std_sms_checked_list = [];
	
	if(!sms_body){
		alert('Please write the sms first');
		$("#form-field-8").focus();
		return false;
	}
	if(check_all!=1){
		var total_row = $("#tot_std").val();
		var std_sms_checked_list = [];
	
		for (i = 1; i <= total_row; i++) {
			var select_for_sms = $("#select_for_sms_"+i+"").is(':checked') ? 1 : 0;
			var select_std_id = $("#std_id_"+i+"").val();
			//var select_datastr = select_std_id+"-"+select_for_sms;
			//alert(select_datastr);
			
			if(select_for_sms==1){	
				std_sms_checked_list.push(select_std_id);
			}
		
		}
		datastr = datastr+"&std_sms_checked_list="+std_sms_checked_list;
	}
	
	if(check_all==0 && std_sms_checked_list==""){
		alert("Please select student");
		return false;
	}
	//alert(datastr);
	$('#form_holder').css("display", "none");
	$("#std_sms_confirm_list").load("module/general_notice/load_std_sms_list_confirmation.php",datastr);
	$('#std_list_holder').css("display", "block");
	

}
	
function return_std_list_for_sms(){
	$('#std_list_holder').css("display", "none");
	$('#form_holder').css("display", "block");
}

function send_customized_sms(){
	var session = $("#session").val();
	var sec_id = $("#section_id").val();
	var sms_type = $("#sms_type").val();
	var mod_id = $("#module_id").val();
	var sms_body = encodeURIComponent($(".message_default").val());
	var selected_std_list = encodeURIComponent($("#selected_std_list").val());
	var per_msg_length = document.getElementById("per_message").innerHTML;
	var sms_type = "";
	var eng_max_part_no = $("#eng_part_info_holder" ).val();
	var ban_max_part_no = $("#ban_part_info_holder" ).val();
	var max_part_no = 0;
	
	if(per_msg_length<=160 && per_msg_length>70){
		sms_type="english";
		max_part_no = eng_max_part_no;
	}
	if(per_msg_length<=70){
		sms_type="bangla";
		max_part_no = ban_max_part_no;
	}
	var datastr = "session="+session+"&sec_id="+sec_id+"&sms_type="+sms_type+"&mod_id="+mod_id+"&sms_body="+sms_body+"&selected_std_list="+selected_std_list+"&max_part_no="+max_part_no;
	//alert(datastr);
	$.ajax({
		type:"post",
		url:"module/general_notice/process_customized_general_notice.php",
		data:datastr ,
		success:function(st){
			alert(st);
		}
	});
}

function call_medium(id){
	var datastr="shift_id="+id;
	$("#medium_id").load("module/settings/get_medium_list_for_form.php",datastr);
}
function call_class(id){
	var datastr="medium_id="+id;
	$("#class_id").load("module/settings/get_class_list_for_form.php",datastr);
}
function call_department(id){
	var datastr="class_id="+id;
	$("#department_id").load("module/settings/get_department_list_for_form.php",datastr);
}
function call_std_type(id){
	var datastr="department_id="+id;
	$("#student_type_id").load("module/settings/get_student_type_list_for_form.php",datastr);
}
function call_section(id){
	var datastr="student_type_id="+id;
	$("#section_id").load("module/settings/get_section_list_for_form.php",datastr);
}

