/*
 * libura V2.0R1.0
 * http://www.desknets.com/
 * Copyright (C)2010 NEOJAPAN,Inc. All Rights Reserved.
 * 本製品は日本国著作権法および国際条約により保護されています。 
 * 本製品の全部または一部を無断で複製したり、無断で複製物を頒 
 * 布すると著作権の侵害となりますのでご注意ください。 
 */
(function(){if(!neo.core.readyNamespace("neo.vdoc.sendiPhoneUrl")){return}neo.vdoc.sendiPhoneUrl={CGI_SEND_URL:"vdocrjsif",CMD_SEND_URL:"rjsifsendiphoneurl",SEND_URL_MOBILE:false,txtMsg:null,_initialize:function(){$(document).ready(neo.vdoc.sendiPhoneUrl._onLoadContent)},_onLoadContent:function(){neo.vdoc.sendiPhoneUrl._setSendUrl()},_setSendUrl:function(){var a=$(".send-iphoneurl-mail");a.click(neo.vdoc.sendiPhoneUrl._onClickSendiPhoneURL);var b=$(".send-mobileurl-mail");b.click(neo.vdoc.sendiPhoneUrl._onClickSendiPhoneURL)},_setEmailDialogOptions:function(){var e=neo.vdoc.Resource.sendiphoneurl;if(neo.vdoc.sendiPhoneUrl.SEND_URL_MOBILE==true){e=neo.vdoc.Resource.sendmobileurl}var d={width:400,title:e,buttons:{}};d.buttons[neo.vdoc.Resource.send]=parent.neo.vdoc.sendiPhoneUrl._onClickEmailOK;d.buttons[neo.vdoc.Resource.close]=parent.neo.vdoc.sendiPhoneUrl._onClickEmailClose;var c=$(".iphone-sendurl");var b=neo.vdoc.dialog.build(c,d);c.show();var a=b.find(".sendurl-msg");if(neo.vdoc.sendiPhoneUrl.txtMsg==null){neo.vdoc.sendiPhoneUrl.txtMsg=a.html()}if(neo.vdoc.sendiPhoneUrl.SEND_URL_MOBILE==true){a.html("&nbsp;&nbsp;"+neo.vdoc.Resource.sendmobilemsg)}else{a.html(neo.vdoc.sendiPhoneUrl.txtMsg)}return this._elDlgSendUrlEmail=b},_setMbEmailDialogOptions:function(){var d={width:400,title:neo.vdoc.Resource.sendmobileurl,buttons:{}};d.buttons[neo.vdoc.Resource.send]=parent.neo.vdoc.sendiPhoneUrl._onClickEmailOK;d.buttons[neo.vdoc.Resource.close]=parent.neo.vdoc.sendiPhoneUrl._onClickEmailClose;var c=$(".iphone-sendurl");var b=neo.vdoc.dialog.build(c,d);var a=b.find(".sendurl-msg");a.html(neo.vdoc.Resource.sendmobilemsg);c.show();return this._elDlgSendUrlEmail=b},_getSendiPhoneUrlDialog:function(){return this._elDlgSendUrlEmail||this._setEmailDialogOptions()},_elDlgSendUrlEmail:null,getElDlgSendMailSuccess:function(){return this._elDlgSendMailSuccess||this._initElDlgSendMailSuccess()},_initElDlgSendMailSuccess:function(){var c={dialogClass:neo.vdoc.dialog.CLS_DLG_TEXT,title:neo.vdoc.Resource.notice};var d=neo.vdoc.Resource.sentMail;var b=$("<div>"+d+"</div>");var a=neo.vdoc.dialog.build(b,c);return this._elDlgSendMailSuccess=a},_elDlgSendMailSuccess:null,_onClickSendiPhoneURL:function(b){b.preventDefault();delete neo.vdoc.sendiPhoneUrl._elDlgSendUrlEmail;neo.vdoc.sendiPhoneUrl._elDlgSendUrlEmail=null;if(neo.vdoc.sendiPhoneUrl.editing){neo.vdoc.sendiPhoneUrl.openDlgPreventEdit();return}var c=$(b.target);if(c.parent().hasClass("send-mobileurl-mail")){neo.vdoc.sendiPhoneUrl.SEND_URL_MOBILE=true}else{neo.vdoc.sendiPhoneUrl.SEND_URL_MOBILE=false}var a=neo.vdoc.sendiPhoneUrl._getSendiPhoneUrlDialog();a.find('textarea[name="mail-to"]').val("");a.find('textarea[name="message"]').val("");a.dialog("open");return},_onClickEmailOK:function(c){var b=neo.vdoc.sendiPhoneUrl._getSendiPhoneUrlDialog();if(b.find('textarea[name="mail-to"]').val()==""){neo.vdoc.displayError(neo.vdoc.Resource.emptyAddrTo,{close:function(){b.dialog("open")}});return false}var a=neo.vdoc.sendiPhoneUrl._getObjAjaxEmailOk();if(a==null){return false}a.sendRequest();delete neo.vdoc.sendiPhoneUrl._objAjax;b.dialog("close")},_getObjAjaxEmailOk:function(){if(neo.core.exists(neo.vdoc.sendiPhoneUrl,"_objAjax")){delete neo.vdoc.sendiPhoneUrl._objAjax}var a;a=neo.vdoc.sendiPhoneUrl._getAjaxEmailOptions();neo.vdoc.sendiPhoneUrl._objAjax=new neo.Ajax(a);return neo.vdoc.sendiPhoneUrl._objAjax},_getAjaxEmailOptions:function(c){var a=neo.vdoc.sendiPhoneUrl;var b=$.extend({},neo.vdoc.sendiPhoneUrl.options);b.getSendData=function(){var e={};var d=neo.vdoc.sendiPhoneUrl._getSendiPhoneUrlDialog();e.to=d.find('textarea[name="mail-to"]').val()||"";e.message=d.find('textarea[name="message"]').val()||"";if(neo.vdoc.sendiPhoneUrl.SEND_URL_MOBILE==true){e.mobile="1"}e.cmd=neo.vdoc.getCmd(neo.vdoc.sendiPhoneUrl.CMD_SEND_URL);return e};b.dataType="xml";b.url=neo.vdoc.getUrl(neo.vdoc.sendiPhoneUrl.CGI_SEND_URL,neo.vdoc.sendiPhoneUrl.CMD_SEND_URL);b.onAjaxSuccess=neo.vdoc.sendiPhoneUrl.onAjaxSuccess;b.beforeAjaxSend=function(){neo.vdoc.sendiPhoneUrl.editing=true};b.beforeShowError=neo.vdoc.sendiPhoneUrl.onAjaxFailEmail;b.onAjaxComplete=function(){neo.vdoc.sendiPhoneUrl.editing=false};return b},onAjaxSuccess:function(d){var c=neo.vdoc.sendiPhoneUrl;var b=$(d).find("result");if(b){var e=b.find("status");if(e&&e.text()!="ok"){var f=b.find("msg");neo.vdoc.displayError(f.text())}else{var a=neo.vdoc.sendiPhoneUrl.getElDlgSendMailSuccess();a.dialog("open")}}},onAjaxFailEmail:function(){var a=neo.vdoc.sendiPhoneUrl._getSendiPhoneUrlDialog();return neo.vdoc.sendiPhoneUrl.showErrorWithDialog(arguments,a)},_onClickEmailClose:function(b){var a=neo.vdoc.sendiPhoneUrl._getSendiPhoneUrlDialog();a.find('textarea[name="mail-to"]').val("");a.find('textarea[name="message"]').val("");a.dialog("close")},_getPreventEditDialog:function(){return this._elDlgPreventEdit||this._setPreventEditDialogOptions()},_elDlgPreventEdit:null,openDlgPreventEdit:function(){var a=neo.vdoc.sendiPhoneUrl._getPreventEditDialog();a.dialog("open")},closeDlgPreventEdit:function(){var a=neo.vdoc.sendiPhoneUrl._getPreventEditDialog();a.dialog("close")},_setPreventEditDialogOptions:function(){var c={dialogClass:neo.vdoc.dialog.CLS_DLG_TEXT,title:neo.vdoc.Resource.notice};var d=neo.vdoc.Resource.waitForPrefChange;var b=$("<div>"+d+"</div>");var a=neo.vdoc.dialog.build(b,c);return this._elDlgPreventEdit=a},showErrorWithDialog:function(b,a){var d={close:function(){if(a){a.dialog("open")}}};var c=[];$.map(b,function(e){c.push(e)});c.push(d);return neo.vdoc.beforeShowError.apply(this,c)}};neo.vdoc.sendiPhoneUrl._initialize()})();
