function datingAlbumDeleteImage(itemID,folderID,memberID){
	var funcArr = new Array;
	funcArr[0] = memberID;
	funcArr[1] = itemID;
	funcArr[2] = folderID;
	jsDatingAlbum('myTIC_Main','deleteItem',funcArr);	
}

function uploadImage(){	
	if(document.photoEditor.uploadedImageFile_1.value != ""){
		document.photoEditor.submit();
	}
}

function profileEdit_Submit(){
	jsDatingProfile('myTIC_Main','editProfile',xajax.getFormValues('myTIC_profileEdit'));	
}

function datingRegistration_Submit(){
	jsDatingProfile('myTIC_Main','datingRegistration',xajax.getFormValues('myTIC_profileEdit'));	
}

function accountEdit_Submit(strProcess){
	
	document.accountEdit.type.value = strProcess;
	switch(strProcess){
		case 1:
			var customerName = document.accountEdit.customer_name.value;
			if(customerName=="" ||customerName==" " ||customerName==null){
				alert("請輸入顯示名稱!!!");
				document.accountEdit.customer_name.focus();
				return;
			}
			break;
			
		case 2:
			var password = document.accountEdit.password.value;
			var newpassword = document.accountEdit.newpassword.value;
			var newpasswordconfirm = document.accountEdit.newpasswordconfirm.value;

			if(password=="" ||password==" " ||password==null){
				alert("請輸入 密碼!!!");
				document.accountEdit.password.focus();
				return;
			}
			if(newpassword=="" ||newpassword==" " ||newpassword==null){
				alert("請輸入 新密碼!!!");
				document.accountEdit.newpassword.focus();
				return;
			}
			if(newpasswordconfirm=="" ||newpasswordconfirm==" " ||newpasswordconfirm==null){
				alert("請輸入 確定新密碼!");
				document.accountEdit.newpasswordconfirm.focus();
				return;
			}
			if(newpassword != newpasswordconfirm){
				alert("新密碼 與 確定新密碼 不相同, 請重新輸入!!!");
				document.accountEdit.newpassword.focus();
				return;
			}		
			break;

		case 3:
			var email = document.accountEdit.email.value;
			if(email=="" ||email==" " ||email==null){
				alert("請輸入聯絡電郵!!!");
				document.accountEdit.customer_name.focus();
				return;
			}
			break;
			
	}
	jsTicAccount('myTIC_Main','editTicAc',xajax.getFormValues('accountEdit'));	
	if(strProcess==1)
		jsDatingProfile('myTIC_Main','updateCustomerName',xajax.getFormValues('accountEdit'))
		
	return;
}

function newDatingAlbumFolder(){
	var funcArr = new Array;
	funcArr[1] = document.getElementById('newAlbum').value;
	jsDatingAlbum('myTIC_Main','newAlbumFolder',funcArr);
}

function delDatingAlbumFolder(folderName){
	if(confirm("確定刪除?")){
		var funcArr = new Array;
		funcArr[1] = folderName;
		jsDatingAlbum('myTIC_Main','delAlbumFolder',funcArr);
	}
}
function editDatingAlbumFolder(folderName){
	var funcArr = new Array;
	funcArr[1] = folderName;	
	funcArr[2] = document.getElementById('txt_' + folderName).value;
	jsDatingAlbum('myTIC_Main','editAlbumFolder',funcArr);
}


function datingFriendListAddFriend(form){
	var funcArr = new Array;
	
	if(form == "" || form == null){
		funcArr[0] = document.addForm.customer_id.value;
		funcArr[1] = document.addForm.groupID.value;
		funcArr[2] = document.addForm.friend_id.value;
	}else{
		funcArr[0] = document.getElementById(form).customer_id.value;
		funcArr[1] = document.getElementById(form).groupID.value;
		funcArr[2] = document.getElementById(form).friend_id.value;
	}
	
	jsDatingFriendList('detailZone','datingFriendListAddFriend',funcArr);	
	if(form == "" || form == null){
		document.addForm.friend_id.value = "";
		setTimeout("gotoFriendGroup("+ funcArr[1]+")",500);
	}

}

function datingFriendListDeleteFriend(a,b,c){
	var funcArr = new Array;
	funcArr[0] = a;
	funcArr[1] = b;
	funcArr[2] = c;
	jsDatingFriendList('detailZone','datingFriendListDeleteFriend',funcArr);	
}

function datingFriendListApproveFriend(a,b){
	var funcArr = new Array;
	funcArr[0] = a;
	funcArr[1] = 3;
	funcArr[2] = b;
	jsDatingFriendList('detailZone','acceptFriend',funcArr);
}

function datingFriendListAccept(a){
	jsDatingFriendList('detailZone','acceptFriend',a);
}

function datingFriendListReject(a){
	jsDatingFriendList('detailZone','rejectFriend',a);
}

function gotoFriendGroup(id){
	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;
	if(id == null){
		funcVarArr[1] = 1;
	}else{
		funcVarArr[1] = id;
	}
	jsDatingFriendList('detailZone','showFriendList',funcVarArr);
	if(funcVarArr[1] == 4){
		document.getElementById('addFormImage').style.display = "none";
		document.getElementById('blackFormImage').style.display = "";
		document.addForm.groupID.value = 4;
	}else{
		document.getElementById('addFormImage').style.display = "";
		document.getElementById('blackFormImage').style.display = "none";
		if(funcVarArr[1] > 4){
			document.addForm.groupID.value = funcVarArr[1];
		}else{
			document.addForm.groupID.value = 2;
		}
	}
	document.getElementById('txtTitle').innerHTML = (document.getElementById('selectGroup').options[funcVarArr[1]-1].text);
}

function gotoMessagePage(pageName,pageNo,sendTo){
	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;	
	if(pageNo == undefined){
		pageNo=1;
	}
	switch(pageName){
		case '0':
		case 'inbox':
			funcVarArr[1] = 0;
			funcVarArr[2] = -1;
			funcVarArr[3] = pageNo;
			jsDatingMessage('myTIC_Message','showMessageList',funcVarArr);
			break;
		case '1':
		case 'outbox':
			funcVarArr[1] = 1;
			funcVarArr[2] = -1;
			funcVarArr[3] = pageNo;			
			jsDatingMessage('myTIC_Message','showMessageList',funcVarArr);
			break;
	
		case 'compose':
			if(sendTo)
				funcVarArr[4] = sendTo;
			jsDatingMessage('myTIC_Message','showMessage_compose',funcVarArr);
			break;
		
		case 'sendSMS':
			jsDatingMessage('myTIC_Message','sendMail',xajax.getFormValues('nform'));
			break;
			
		case 'index':
			alert(pageName + ' - Under Contruct');
			break;	
			
		case 'sendMail':	
			jsDatingMessage('myTIC_Message','sendMail',xajax.getFormValues('nform'));
			break;
			
	}
}

function gotoSchedulePage(pageName){
	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;	
	switch(pageName){
		case 'mainPage':
			jsDatingSchedule('myTIC_Zone','mainPage',funcVarArr);
			break;
			
		case 'showCalender':
			funcVarArr[1] = document.getElementById('schmonth').value;	
			funcVarArr[2] = document.getElementById('schyear').value;				
			jsDatingSchedule('myTIC_Zone','mainPage',funcVarArr);
			break;
			 
	}
}

function showTimeTable(date){
	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;	
	funcVarArr[1] = date;
	jsDatingSchedule('myTIC_Zone','showTimeTable',funcVarArr);
}
 
function showAppointment(id,zoneName){
	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;
	funcVarArr[1] = id;
	jsDatingSchedule(zoneName,'showScheduleDetail',funcVarArr);
}

function updateScheduleStatus(zoneName,id,val,date){
	if(val=1){
		if(!confirm('確定刪除?')){			
			end;
		}
	}
	var funcVarArr = new Array;
	funcVarArr[0] = id;
	funcVarArr[1] = val;
	jsDatingSchedule(zoneName,'updateStatus',funcVarArr);
	setTimeout("jsDatingSchedule('myTIC_Zone','showTimeTable','"+document.getElementById('memberID').value+ "," +date+"')",500);
}

function saveSchedule(form){	
	if(form.title.value == ""){
		alert('請輸入主旨');
		end;
	}

	if(form.startDate.value == ""){
		alert('請輸入開始日期');
		end;
	}
	
	if(form.startTime.value == ""){
		alert('請輸入開始時間');
		end;
	}
	var varStartDate = form.startDate.value;
	jsDatingSchedule('myTIC_Zone','saveSchedule',xajax.getFormValues('appointmentEdit'));
	setTimeout("showTimeTable('"+varStartDate+"')",500);
}

function messageDelete(id,type,form){
	var funcVarArr = new Array;
	if(id > 0){
		if(confirm('確定刪除?')){			
			funcVarArr[0] = document.getElementById('memberID').value;			
			funcVarArr[1] = type;	
			funcVarArr[2] = -1;
			funcVarArr[3] = id;		
			jsDatingMessage('myTIC_Message','updateStatus',funcVarArr);
		}
	}else{
		funcVarArr = xajax.getFormValues('msgForm');
		jsDatingMessage('myTIC_Message','updateStatus_multi',funcVarArr);
	}
}

function datingMsgShowDT(id, type,status){
	var zoneName = 'msgDtZone_' + id;
	if(type == 0 || type == null){
		var funcVarArr = new Array;
		funcVarArr[0] = id;
		funcVarArr[1] = status;
		funcVarArr[2] = document.getElementById('memberID').value;			
		jsDatingMessage(zoneName,'showDetail',funcVarArr);
	}else{
		document.getElementById(zoneName).innerHTML = ""
	}

}

function replyMessage(id,type){
	if(type == null)
		type = 'mail'
	 
	var formName = 'replyForm_'+id;
	var zoneName = 'msgDtZone_' + id;
	var zoneName = 'myTIC_Message';
	a = xajax.getFormValues(formName);
	if(type == 'mail'){
		jsDatingMessage(zoneName,'replyMail',xajax.getFormValues(formName));
	}else{
		jsDatingMessage(zoneName,'replySms',xajax.getFormValues(formName));
	}
		
}

function showReply(id,type,status){
	var divName = 'div_'+id
	if(document.getElementById(divName) == null){
		datingMsgShowDT(id,0,status)
		setTimeout("document.getElementById('"+divName+"').style.display =''",500)
	}else{
		document.getElementById(divName).style.display =''
	}
}

function showCompose(id,action){
	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;					
	funcVarArr[1] = action;
	funcVarArr[2] = id;
	jsDatingMessage('myTIC_Message','showMessage_compose',funcVarArr);	
}


function gotoDiaryPage(pageName,pageNo){

	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;	

	switch(pageName){
		case 'mainPage':
			if(pageNo != null)
				funcVarArr[1] = pageNo;
			
			jsDatingDiary('myTIC_Zone','mainPage',funcVarArr);
			break;
		
		case 'newDiary':
			funcVarArr[2] = 'new';
			jsDatingDiary('myTIC_Zone','editPage',funcVarArr);
			break;			
	}	
}

function showDiaryContent(id,zoneName){
	var funcVarArr = new Array;
	funcVarArr[0] = document.getElementById('memberID').value;	
	funcVarArr[1] = id;
	jsDatingDiary(zoneName,'showContent',funcVarArr);
}

function submitDiaryForm(formName){
	if(formName.postDate.value == ""){
		alert("請輸入日期");
		end;
	}
	if(formName.topic.value == ""){
		alert("請輸入主題 ");
		end;	
	}
	jsDatingDiary('myTIC_Zone','saveDiary',xajax.getFormValues(formName));
	setTimeout("gotoDiaryPage('mainPage')",500);
}

function diaryStatus(id,value){
	var funcVarArr = new Array;
	funcVarArr[0] = id;
	funcVarArr[1] = value;
	if(value == -1)
		if(!confirm('確定刪除?'))
			end;
	jsDatingDiary('myTIC_Zone','updateStatus',funcVarArr);
	setTimeout("gotoDiaryPage('mainPage')",500);
}

function diaryDelete(){
	if(confirm('確定刪除?')){			
		funcVarArr = xajax.getFormValues('diaryForm');
		jsDatingDiary('myTIC_Zone','updateStatus_multi',funcVarArr);
		setTimeout("gotoDiaryPage('mainPage')",500);
	}
}
