﻿
 function onSendFriendSucceeded(returnObject, userContext, methodName){
        $get('divBlockBackGround').style.display='none';
        $get('divPopUpMsg').style.display='none';
        if (methodName=='SendMessageToFriend'){
                if (returnObject=='1'){
                    alert('已成功地將您的訊息傳送給您的好友');
                }else{alert(returnObject);}
                reVCode();//重新取VC
        }
 }
 
//---寄給好友
function SendFriendSub(strCaseID){
    var strMyName=TrimTextBoxValue($get('txtMyName').value);
    var strFriendEmail=TrimTextBoxValue($get('txtFriendEmail').value);
    var strMsgToFriend=TrimTextBoxValue($get('txtMessageToFriend').value);
    var strVCQ=TrimTextBoxValue($get('txtVC_Friend').value);
    var strVCA=TrimTextBoxValue($get('VCHidden_Friend').value);            
    var strAlert='';
    if (strMyName==''){strAlert += '請填寫寄件人姓名\n\n'}
    if (strFriendEmail==''){strAlert += '請填寫好友的E-mail\n\n'}
    strAlert += EmailFormat('txtFriendEmail', '好友的E-mail格式有錯誤');
    if (strMsgToFriend==''){strAlert += '請填寫要給好友的話\n\n'}
    if (strVCQ==''){strAlert += '為預防惡意程式，請在問答處填入問題答案，感謝您的配合\n\n'}
    strAlert += FormStopWord("您所輸入的資料中請勿有script, iframe, style, link, ', <, >等字句",new Array("script","iframe","style","link","'","<",">"));
    if( strAlert != '' ){
	    alert(strAlert);
	    return false;
    }		    
    $get('divBlockBackGround').style.display='block';
    $get('divPopUpMsg').style.display='block';
    setPopUpPosition('divPopUpMsg');
    SetBGDIVWH();
    wsNormal.SendMessageToFriend(strCaseID, strMyName, strFriendEmail, strMsgToFriend, strVCQ, strVCA, onSendFriendSucceeded, WSFailed);
}