//簡介區塊	
function neothemesadmin_introductionblock(bid) {
  $("body").on("click", "#submitblock", function(e) {
    cancelHandler(); //加上鎖住外連設定  
    $.ajax({
      url: xoopsjsurl + '/modules/neothemesadmin/ajax.php',
      type: 'POST',
      data: {
        id: 7,
        dbid:CKEDITOR.instances.introductiontext.getData()
      },
      success: function(response) {
        $("#introductiontext").val(response);
        $('#blockform').submit(); //啟用submit();	
      },
      error: function() {
        console.log('ajax error!');
      }
    })
  })
}




//選擇回覆狀態
$(document).ready(function() {
	
enablebtn($enable=0);	
	
   $("body").on("click", "#enablebtn input", function (e){	 
	$enable=$('input[name=enable]:checked').val();
	enablebtn($enable);
	
	 })
	
	
    
function enablebtn($enable){
	

$ajaxsetup = $("#replycenterbox").attr("name"); 
if(typeof($ajaxsetup) != 'undefined'){
var  $ajaxsetup_arr = $ajaxsetup.split(',');  //切割陣列
var  $id=$ajaxsetup_arr[0];  
var  $dbid=$ajaxsetup_arr[1];  
var  $xoopsmodule=$ajaxsetup_arr[2];  


 $.ajax({
    url: xoopsjsurl + '/modules/neillibrary/ajax.php',
    type: 'POST', 
    data: { id: $id,
            dbid: $dbid,
            enable: $enable,            	
            xoopsmodule: $xoopsmodule              	         	     			       		
	    	},
        success: function(response) {
      $('#replycenterbox').html(response); 
    }, 
    error: function() {
      console.log('ajax error!'); 
    }

 })

}
}


});	




//關於我們區塊	
function aboutustextbtn() {
  $("body").on("click", "#submitblock", function(e) {
    cancelHandler(); //加上鎖住外連設定   
    var $blockimgname = $("#blockimgname").attr("name");
    var $blockimgname_arr = $blockimgname.split(','); //切割陣列	
    var file_data = $('#blockimg').prop('files')[0];
    var form_data = new FormData();
    //上傳檔案變數
    form_data.append('file', file_data); //檔案
    //自訂變數
    form_data.append('id', 146);
    form_data.append('dbid', CKEDITOR.instances.aboutustext.getData()); //文字框內容
    form_data.append('var1', $blockimgname_arr[0]); //圖檔尺寸
    form_data.append('var2', $blockimgname_arr[1]); //布景ID
    form_data.append('imguploader', true);
    $.ajax({
      url: xoopsjsurl + '/modules/neillibrary/ajax.php',
      cache: false,
      contentType: false,
      processData: false,
      data: form_data,
      type: 'post',
      success: function(response) {
        $("#blockimgname").html("<input type='hidden' name='options[0]'  value='" + response + "'> ");
        $('#blockform').submit(); //啟用submit();
      },
      error: function() {
        console.log('ajax error!');
      }
    })
  })
}









//聯絡我們區塊	
function contactustextbtn() {
  $("body").on("click", "#submitblock", function(e) {
    cancelHandler(); //加上鎖住外連設定   	   
    var $moviedescription = CKEDITOR.instances.contactustext.getData();
    $.ajax({
      url: xoopsjsurl + '/modules/neillibrary/ajax.php',
      type: 'POST',
      data: {
        id: '103',
        dbid: $moviedescription
      },
      success: function(response) {
        $('#blockform').submit(); //啟用submit();
      },
      error: function() {
        console.log('ajax error!');
      }
    })
  })
}



function cancelHandler(event) {
var event = event || window.event;//兼容IE 
//取消事件相關的預設行為
if (event.preventDefault) //標準技術 
event.preventDefault();
if (event.returnValue) //兼容IE9之前的IE 
event.returnValue = false;
return false; //用於處理使用對象屬性註冊的處理程序
}

	
	  