function show_register_result_onclick(p_goto_url,p_recordtype,p_username,p_password,p_code,p_fuseaction){ 	
	//v_url = _DSP_MODAL_DIALOG_URL_PATH;
	v_url = p_goto_url + "?hdn_recordtype_filter=" + p_recordtype + "&hdn_username=" + p_username + "&hdn_password=" + p_password + "&hdn_code=" + p_code +"&modal_dialog_mode=1";
	v_url = v_url + "&fuseaction=" + p_fuseaction + "&modal_dialog_mode=1" 
	v_url = v_url+ "&" + randomizeNumber();
	goto_url(v_url,3);
}

function show_chanege_password_onclick(p_goto_url,p_fuseaction){     
	v_url = _DSP_MODAL_DIALOG_URL_PATH;
	v_url = v_url + "?goto_url=" + p_goto_url + "&fuseaction=" + p_fuseaction ;
	v_url = v_url + "&modal_dialog_mode=1" + "&" + randomizeNumber();
	sRtn = showModalDialog(v_url,"","dialogWidth=400pt;dialogHeight=240pt;dialogTop=80pt;status=no;scroll=no;");
	if (!sRtn){;}
}
function btn_citizen_update(p_fuseaction){
	_save_xml_tag_and_value_list(document.forms[0],document.forms[0].hdn_list_xml_tag,document.forms[0].hdn_list_xml_value,false);
	if (verify(document.forms[0])){
		document.forms[0].fuseaction.value = p_fuseaction;
		if (document.forms[0].txt_password.value != document.forms[0].txt_re_password.value){
			alert("Sai nhap lai mat khau, hay nhap lai"); return;
		}
		document.forms[0].submit();
	}
}
function btn_password_update(p_fuseaction){
	if (_MODAL_DIALOG_MODE==1)
		document.forms[0].action = "index.php?modal_dialog_mode=1";
	else
		document.forms[0].action = "index.php";
	if (verify(document.forms[0])){
		document.forms[0].fuseaction.value = p_fuseaction;
		if (document.forms[0].txt_new_password.value != document.forms[0].txt_re_new_password.value){
			alert("Sai nhap lai mat khau moi, hay nhap lai"); 
			return;
		}
		document.forms[0].submit();
	}
}
function onchange_generate_code_net(obj_sel_type,obj_hdn_type,v_fuseation){
	var v_temp = '';
	obj_hdn_type.value = obj_sel_type.value;
	v_temp = v_temp + document.forms[0].hdn_deploy_unit.value + ".";
	v_temp = v_temp + document.forms[0].hdn_recordtype_filter.value  + ".";
	v_temp = v_temp + document.forms[0].hdn_year.value  + ".";
	v_temp = v_temp + "NET";
	document.forms[0].txt_code1.value = v_temp;
	if (document.forms[0].txt_code2.value!=""){
		document.forms[0].hdn_code.value = document.forms[0].txt_code1.value + "." + document.forms[0].txt_code2.value;
	}
	document.forms[0].fuseaction.value = v_fuseation;
}
function onchange_generate_code(obj_sel_type,obj_hdn_type,v_fuseation){
	var v_temp = '';
	obj_hdn_type.value = obj_sel_type.value;
	document.forms[0].hdn_year.value = document.forms[0].sel_year.value;
	v_temp = v_temp + document.forms[0].hdn_deploy_unit.value + ".";
	v_temp = v_temp + document.forms[0].hdn_recordtype_filter.value  + ".";
	v_temp = v_temp + document.forms[0].hdn_year.value.substring(2,4);
	document.forms[0].txt_code1.value = v_temp;
	if (document.forms[0].txt_code2.value!=""){
		document.forms[0].hdn_code.value = document.forms[0].txt_code1.value + "." + document.forms[0].txt_code2.value;
	}
	document.forms[0].fuseaction.value = v_fuseation;
}
function onchange_hinhthuc(){
	if(document.forms[0].hinh_thuc_dang_ky.value=='THUE_DAT'){
		document.all.id_vi_tri_xin_thue.style.display='block';			
		document.all.id_dien_tich_thue.style.display='block';	
		document.all.id_thoi_han_thue.style.display='block';	
		
		document.all.id_phuong_thuc_tra_tien.style.display='none';	
		document.all.id_dien_tich_xin_giao.style.display='none';	
		document.all.id_dia_diem_xin_giao.style.display='none';	
	}else{
		document.all.id_phuong_thuc_tra_tien.style.display='block';	
		document.all.id_dia_diem_xin_giao.style.display='block';	
		document.all.id_dien_tich_xin_giao.style.display='block';
				
		document.all.id_vi_tri_xin_thue.style.display='none';		
		document.all.id_dien_tich_thue.style.display='none';	
		document.all.id_thoi_han_thue.style.display='none';	
	}
}

// ham btn_save() duoc goi khi NSD nhan chuot vao nut "Chap nhan"
//  - p_fuseaction: ten fuseaction tiep theo
function btn_save(p_checkbox_obj,p_hidden_obj,p_fuseaction){	
	if (_MODAL_DIALOG_MODE==1)
		document.forms[0].action = "index.php?modal_dialog_mode=1";
	else{
		document.forms[0].action = "index.php";
	}		
	if (verifyforFireFox(document.forms[0])){		
		document.forms[0].fuseaction.value = p_fuseaction;
		p_hidden_obj.value = checkbox_value_to_list(p_checkbox_obj,",");
		document.forms[0].submit();
	}
}
/*
function btn_delete_onclick(p_fuseaction){
	if(confirm('Ban thuc su muon xoa bo DON THU hay khong?')){
		check_value_in_form();
		btn_save_onclick('DELETE_CUSTOMER_RECORD');
	}
}
*/
function btn_delete_onclick(p_checkbox_obj, p_hidden_obj, p_fuseaction){
	if (!checkbox_value_to_list(p_checkbox_obj,",")){
		alert("Chua co doi tuong nao duoc chon");
	}	
	else{
		if(confirm('Ban thuc su muon xoa doi tuong da chon ?'))
		{

			document.forms[0].fuseaction.value = p_fuseaction;
			p_hidden_obj.value = checkbox_value_to_list(p_checkbox_obj,",");
			document.forms[0].submit(); 	
		}
	}	
}


function btn_print_petition_onclick(p_goto_url,p_item_id,p_type,p_fuseaction) {
	v_url = p_goto_url + "?hdn_record_id=" + p_item_id + "&hdn_recordtype_filter=" + p_type +"&fuseaction="+p_fuseaction +"&modal_dialog_mode=1";
	v_url = v_url+ "&" + randomizeNumber();
	goto_url(v_url,3);
}
function btn_signon_onclick(p_work){	
	if(document.forms[0].txt_customer_name){
		document.forms[0].hdn_customer_name.value =document.forms[0].txt_customer_name.value
	}	
	if(document.forms[0].txt_customer_card_id){
		document.forms[0].hdn_customer_card_id.value =document.forms[0].txt_customer_card_id.value
	}
	document.forms[0].hdn_worktype.value = p_work;	
}
