    var API_Patient_Host = 'http://bingli.haodf.com';

    var API_Attach_Host = 'http://attach.haodf.com';

document.write('<script' + ' language="javascript" src="http://hdfimg.com/js/jquery-1.4.2.min.js"><' + '/script>');

document.write('<script' + ' language="javascript" src="http://hdfimg.com/js/thickbox/thickbox-compressed.js"><' + '/script>');
document.write('<link href="'+API_Patient_Host+'/static/jquery.thickbox.css" rel="stylesheet" type="text/css" />');

document.write('<script type="text/javascript" language="javascript" src="'+API_Attach_Host+'/upload.js"></script>');
document.write('<script' + ' language="javascript" src="'+API_Patient_Host+'/static/bingli.js?20100412"><' + '/script>');
document.write('<link href="'+API_Patient_Host+'/static/bingli.css" rel="stylesheet" type="text/css" />');

/** 隐藏的表单域，用于上传病历资料等 */
document.write('<iframe width="0" height="0" name="ifm_api_patient_write" id="ifm_api_patient_write" style="display:none;"></iframe>');
/** 隐藏调用的弹出层 */
document.write('<div id="el_patient_popup_window"></div>');
document.write('<div id="el_patient_popup_loading"></div>');

/** 常驻参数(默认的勾选框) */
var API_PATIENT_VAR1 = '';

/** 调用插入病例的输入框 */
//var API_BL_domain = 'zixun.haodf.com';
function API_Patient_insertAttachment(type_id){
	if (type_id != '-1') {
		tb_show("上传我的病历资料", myBingliUrl('/api/result.php?action=attachment_insert&type_id=' + type_id + '&domain=' + API_BL_domain, 600, 450));
	}
}

/** 获得当前用户的所有病历列表 */
function API_Patient_myAttachmentForSelect(el, isup, showcheckbox){
	$(el).html('病历资料载入中，请稍候... <img src="'+API_Patient_Host+'/static/loading.gif" />');
	var bind = '';
	if (API_PATIENT_VAR1 != '') {
		bind = '&default_ids=' + API_PATIENT_VAR1;
	}
	if ('undefined' != typeof(isup))
		bind += '&isup=1';
	else
		bind += '&isup=0';	

	if ('undefined' != typeof(showcheckbox))
		bind += '&showcheckbox=0';
	else
		bind += '&showcheckbox=1';
	myAjax('/api/result.php?action=my_attachment_for_select' + bind, function(rhtml){
		$(el).html(rhtml);
	});
}

/** 设置默认需要勾选的列表 */
function setAttachmentCheckedDefault(attachment_id){
	if (API_PATIENT_VAR1 == '') {
		API_PATIENT_VAR1 = attachment_id;
	} else {
		API_PATIENT_VAR1 += ',' + attachment_id;
	}
}

function API_setAttachmentCheckedDefault(attachment_id){
	setAttachmentCheckedDefault(attachment_id);
}

/** 我的病历输入控件 */
function API_Patient_myAttachmentTypes(el){
	$(el).html('<img src="'+API_Patient_Host+'/static/loading.gif" />');
	myAjax('/api/result.php?action=my_attachment_types', function(rhtml){
		$(el).html(rhtml);
	});
}

/** 提交数据后会调用的函数 */
function BL_InterfaceCall(message){
	// alert(message);
}

/** 列表那些被选择 */
function BL_listOnChecked(div_cn){
	var temp_list = new Array;
	
	$.each($('#' + div_cn).find('input[attachment=select]'), function(el){
		if ($(this).attr('checked') == 1) {
			temp_list = $.merge(temp_list, new Array($(this).attr('value')));
		}
	});
	return temp_list;
}

/** 根据ID显示几条病历资料 */
function API_Patient_attachmentSimpleDetail(el, ids, user_id){
	if (ids.split(','.length > 0)) {
		$(el).html('<img src="'+API_Patient_Host+'/static/loading.gif" />');
		myAjax('/api/result.php?action=attachment_simple_detail&ids=' + ids + '&user_id' + user_id, function(rhtml){
			$(el).html(rhtml);
		});
	}
}

/** 显示用户病历的详细信息 */
function BL_patientAttachmentDetail(attachmentid){
	tb_show("add a caption to title attribute / or leave blank", API_Patient_Host + '/api/result.php?action=my_attachment_types?height=300&amp;width=400');
}

