/***** [影片圖片顯示系統] *****/
function showMovie(targetDivID,vWid,vHei,theLink,loading_icon) {
	//if (($('#'+targetDivID).html().length)==0) {
		$('#'+targetDivID).show();
		$('#'+targetDivID).html("<img src='http://www.manatalk.com/mt2/img/ajax-loader.gif'>");
		$.ajax({
			url: 'http://www.manatalk.com/mt2/lib/db_api_mt2_ajax.php',
			cache: false,
			dataType: 'html',
				type:'POST',
				data: "cmd=showMovie&w="+vWid+"&h="+vHei+"&link="+theLink,
				success: function(response) {
					$('#'+targetDivID).html("");
					$('#'+targetDivID).html(response);
				}
		});
	//}
}
function showPhoto(targetDivID,pWid,pHei,theLink,loading_icon) {
	//if (($('#'+targetDivID).html().length)==0) {
		$('#'+targetDivID).show();
		$('#'+targetDivID).html("<img src='http://www.manatalk.com/mt2/img/ajax-loader.gif'>");
		$.ajax({
			url: 'http://www.manatalk.com/mt2/lib/db_api_mt2_ajax.php',
			cache: false,
			dataType: 'html',
				type:'POST',
				data: "cmd=showPhoto&w="+pWid+"&h="+pHei+"&link="+theLink,
				success: function(response) {
					$('#'+targetDivID).html("");
					$('#'+targetDivID).html(response);
				}
		});
	//}
}
function showVimeo(targetDivID,vWid,vHei,theLink,loading_icon) {
	//if (($('#'+targetDivID).html().length)==0) {
		$('#'+targetDivID).show();
		$('#'+targetDivID).html("<img src='http://www.manatalk.com/mt2/img/ajax-loader.gif'>");
		$.ajax({
			url: 'http://www.manatalk.com/mt2/lib/db_api_mt2_ajax.php',
			cache: false,
			dataType: 'html',
				type:'POST',
				data: "cmd=showVimeo&w="+vWid+"&h="+vHei+"&link="+theLink,
				success: function(response) {
					$('#'+targetDivID).html("");
					$('#'+targetDivID).html(response);
				}
		});
	//}
}

/***** [閱讀] *****/
function deleteReply(replyID, option) //刪除留言
{
	if (option=='MsgBox') {
		$.ajax({
			 url: 'http://www.manatalk.com/mt2/lib/qMsgDel.php',
			 cache: false,
			 dataType: 'html',
				 type:'POST',
			 data: "type=0&auto="+replyID,
			 success: function(response) {
				;
			 }
		});	
	}
	else {
		$.ajax({
			 url: 'http://www.manatalk.com/mt2/lib/qMsgDel.php',
			 cache: false,
			 dataType: 'html',
				 type:'POST',
			 data: "type=1&auto="+replyID,
			 success: function(response) {
				;//if (response) {
					//$('#mauto_'+auto).slideUp('slow');
				//}
			 }
		});
	}
}

function replaceShareMsg(msgID, message) //修改分享
{
   $.ajax({
         url: 'http://www.manatalk.com/mt2/lib/shareEdit.php',
         cache: false,
         dataType: 'html',
             type:'POST',
         data: "auto="+msgID+"&msg="+message,
		 
         success: function(response) {
			;//if (response) {
				//$('#mauto_'+auto).slideUp('slow');
			//}
         }
    });
}
function deleteShareMsg(msgID) //刪除分享
{
   $.ajax({
         url: 'http://www.manatalk.com/mt2/lib/shareDel.php',
         cache: false,
         dataType: 'html',
             type:'POST',
         data: "auto="+msgID,
		 
         success: function(response) {
			;//if (response) {
				//$('#mauto_'+auto).slideUp('slow');
			//}
         }
    });
}
function deleteNeighbor(userId, cateId, nbrId) //刪除鄰居
{
   $.ajax({
         url: 'http://www.manatalk.com/mt2/lib/db_api_mt2_ajax.php',
         cache: false,
         dataType: 'html',
             type:'POST',
         data: "cmd=deleteNeighbor&userId="+userId+"&nbrId="+nbrId,		 
         success: function(response) {
			;
         }
    });
}
function addNeighbor(userId, cateId, nbrId) //新增鄰居
{
   $.ajax({
         url: 'http://www.manatalk.com/mt2/lib/db_api_mt2_ajax.php',
         cache: false,
         dataType: 'html',
             type:'POST',
         data: "cmd=addNeighbor&userId="+userId+"&nbrId="+nbrId,		 
         success: function(response) {
			;
         }
    });
}
function saveUserInfo(userId, pw, email, nick, birth, addr) //儲存使用者資訊
{	
   $.ajax({
         url: 'http://www.manatalk.com/mt2/lib/db_api_mt2_ajax.php',
         cache: false,
         dataType: 'html',
             type:'POST',
         data: "cmd=saveUserInfo&cateId="+cateId+"&pw="+pw+"&email="+email+"&nick="+nick+"&birth="+birth+"&addr="+addr,		 
         success: function(response) {
			;
         }
    });	
}
//圖檔檢查
function getSize()
{
	fileupload = document.getElementById('file');
	if(fileupload.files)
	{
		var size = fileupload.files.item(0).fileSize;
	}
	if (size > 2000*1024) {
		alert('請使用2M以下的圖檔');
		return false;
	}
	else
		return true;
}


