function editorWebmasterNews(){

	$.ajax({
		url:'modules/news/formWebmasterNews.php',
		cache: true,
		type:'POST',
		success:function(data){
              var msg = BTN_CLOSE+data;
              $.blockUI({
                    message: msg,
                    css: {
                       width: 800+'px',
                       border: 'none',
                       cursor:'auto',
                       top:  ($(window).height() - (800 - (800/2) ) ) /2 + 'px',
                       left: ($(window).width() - 800) /2 + 'px',
                       padding: '2px 10px 10px 10px'
                    },
                    baseZ: 1
               });
		}

	});
}

function putWebmasterMsg(){
    var msg = FCKeditorAPI.GetInstance('editor_txt').GetXHTML();
    $('#webmasterMsg').val(msg);
}

function previewWebmasterNews(){
    $('#webmasterNews').empty().append($('#webmasterMsg').val());
    $('#tmpPreviewWebmasterNews').val($('#webmasterMsg').val());
    $('.divWebmasterNews .divWebmasterNews1').hide();
    $('.divWebmasterNews .divWebmasterNews2').show();
    $.unblockUI();
}

function returnPreviewWebmasterNewsEdit(){ 
    $.ajax({
		url:'modules/news/formWebmasterNews.php',
		cache: true,
        data :{'newsEdit':$('#tmpPreviewWebmasterNews').val()},
		type:'POST',
		success:function(data){
              var msg = BTN_CLOSE+data;
              $.blockUI({
                    message: msg,
                    css: {
                       width: 800+'px',
                       border: 'none',
                       cursor:'auto',
                       top:  ($(window).height() - (800 - (800/2) ) ) /2 + 'px',
                       left: ($(window).width() - 800) /2 + 'px',
                       padding: '2px 10px 10px 10px'
                    },
                    baseZ: 1
               });
		}

	});
}

function webmasterNewsSubmit(){
  return true;
}

function webmasterNewsSubmitSuccess(data){
   if(data==1){
      $.ajax({
		url:'modules/news/webmaster.php',
		cache: false,
        data :{'reqType':'ajax'},
		type:'POST',
		success:function(data){ 
            $("#webmasterNews").empty().append(data);
            $('.divWebmasterNews .divWebmasterNews1').show();
            $('.divWebmasterNews .divWebmasterNews2').hide();
            $.unblockUI();
		}
	});
   }else{
     alert(data);
   }
   
}

function saveWebmasterNews(){
    if($("#tmpPreviewWebmasterNews").val()!=''){
        $.ajax({
            url:'modules/news/formWebmasterNewsSub.php',
            cache: false,
            data :{'webmasterMsg':$("#tmpPreviewWebmasterNews").val()},
            type:'POST',
            success:function(data){
                if(data==1){
                webmasterNewsSubmitSuccess(data);
                  $('.divWebmasterNews .divWebmasterNews1').show();
                  $('.divWebmasterNews .divWebmasterNews2').hide();
                }else{
                  alert(data);
                }
            }
        });
    }
}