function InitSendParams( id , d ) {
	$("#"+id+"_send_email_dlg").data( "datas" , d );
}

function SendInEmail_Send( id ) {
	SendInEmail_Submit( id );
}

function SendInEmail_Cancel( id ) {
	var o = $("#"+id+"_send_email_dlg");
	o.dialog( "close" );
	o.dialog( "destroy" );
}

function SendInEmail_Render( id ) {
	var o = $("#"+id+"_send_email_dlg");
	
}

function SendInEmail_Submit( id ) {
	var d = {};
	d.inajax = 1;
	d.ajaxevent = "send_content_email";
	d.ajaxtarget = id;
	d.sender_name = document.frm_send_email.sender_name.value;
	d.sender_email = document.frm_send_email.sender_email.value;
	d.target_name = document.frm_send_email.target_name.value;
	d.target_email = document.frm_send_email.target_email.value;
	d.sender_message = document.frm_send_email.personal_message.value;
	$.ajax(
		{
			type: "POST",
			cache: false,
			data: d,
			success: function( ret ) {
				var d = eval( ret );
				if (typeof d.error != "undefined") {
					eval( d.error );
				} else if (d.sent>0) {
					var o = $("#"+id+"_send_email_dlg");
					o.dialog( "close" );
					o.dialog( "destroy" );
				}
			}
		}
	);
}

function SendInEmail( id ) {
	SendInEmail_Render( id );
	var o = $("#"+id+"_send_email_dlg");
	var btns = {};
	btns[aJSLangDefs.Send]=function() { SendInEmail_Send(id); };
	btns[aJSLangDefs.Cancel]=function() { SendInEmail_Cancel(id); };
	o.dialog(
		{
			title: aJSLangDefs.sendinemail_Send_in_email,
			modal: true,
			width: 480,
			height: 350,
			buttons: btns
		}
	);
}

function InitPrintParams( id , d ) {
	$("#"+id+"_print_content_dlg").data( "datas" , d );
}

function PrintContent( id ) {
	var d = $("#"+id+"_print_content_dlg").data( "datas" );
	window.open( d.url , 'print_tab' );
}
