﻿$(function() {
    $("#txtDefaultHtmlArea").htmlarea();
})

$(function() {
    $('#btnadress').click(function() {
        $('#txtDefaultHtmlArea').htmlarea('insertImage', $('#txtadress').val());
        $("#panelWindow").jWindowClose();
    });
});


var onupload=function()
{
 
     var txtadress=$('#txtadress').val();
     if(!(txtadress.length>0))
     {
        alert("图片地址不能为空！");
        return;
     }
     $('#txtDefaultHtmlArea').htmlarea('insertImage', txtadress);
        $("#panelWindow").jWindowClose();
}

var hideDiv = function(idName) {
    $("#" + idName).fadeOut("fast");
};
var loadingUrl ="Http://www.5dxt.com/Album/UpPhoto/loadimg.gif";
var uploading = function(imgsrc, itemid) {
    var el = $("#uploading" + itemid);
    $("#ifUpload" + itemid).fadeOut("fast");
    el.fadeIn("fast");
    el.html("<img src='" + loadingUrl + "' align='absmiddle' /> 上传中...");
    return el;
};

//上传成功后的处理
var uploadsuccess = function(newpath, itemid) {
    $("#uploading" + itemid).html("图片上传成功.");
    $('#txtDefaultHtmlArea').htmlarea('insertImage', newpath);
    uploadcreate($("#uploadbox"), 0);
    $("#panelWindow").jWindowClose();
};
var currentItemID = 0;
//创建一个上传控件

var uploadcreate = function(el, itemid) {

       var strContent = "<div class='uploadcontrol'><iframe src=\""+wdxt.siteinfo.domain+"/JavaScript/Edit/upload.aspx?id=" + itemid + "\" id=\"ifUpload" + itemid + "\" frameborder=\"no\" scrolling=\"no\" style=\"width:300px; height:40px;\"></iframe>";

    strContent += "<div class=\"uploading\" id=\"uploading" + itemid + "\" style=\"display:none;\" ></div>";
    strContent += "<div class=\"image\" id=\"panelViewPic" + itemid + "\" style=\"display:none;\"></div></div>";
    el.html(strContent);
   window.parent.frames["ifUpload0"].location.reload();
}
//定义字体
var oFamily = function(family) {
    // uploadcreate($("#uploadbox"), 0);
$('#txtDefaultHtmlArea').htmlarea('forecolor', 'blue');
$("#panelWindow").jWindowClose();
};

//表情
var onEditFace = function(newpath) {
    $('#txtDefaultHtmlArea').htmlarea('insertImage', newpath);
    $("#panelWindow").jWindowClose();
};
