var a = false, blog_url = "http://www.vxia.net/";
function insertSmile2(id) {
$('textarea[name=comment],textarea[name=reply]').parseHtml2('{' + id + '}')
}
function bqover(a){
var img='
'+a.title+'
';
$("#yulan").html(img);
var x=$(a).position().left+$(a).width();
var y=$(a).position().top-$("#yulan").height()-20;
$("#yulan").css({"left":x,"top":y});
//$(a).fadeTo("fast",0.5);
$("#yulan").show();
//alert(x+":"+y);
}
function bqout(a){
$("#yulan").hide();
}
$(function(){
$("textarea[name=comment],textarea[name=reply]").focus(function() {
if (!a) {
var bq = document.createElement('div');
$(bq).attr('id', 'biaoqing');
smiles2='';
$(bq).html(smiles2);
$('textarea[name=comment],textarea[name=reply]').before($(bq)); //将带有表情的层添加到 conten 之上;
var bq2 = document.createElement('div');
$(bq2).attr('id', 'yulan');
$('textarea[name=comment],textarea[name=reply]').before($(bq2));
$(bq).css({"width":$('textarea[name=comment],textarea[name=reply]').width()});
$(bq).fadeIn("slow");
$.fn.extend({
parseHtml2: function(myValue) {
var $t = $(this)[0];
if (document.selection) {
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus()
} else if ($t.selectionStart || $t.selectionStart == '0') {
var startPos = $t.selectionStart;
var endPos = $t.selectionEnd;
var scrollTop = $t.scrollTop;
$t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
this.focus()
$t.selectionStart = startPos + myValue.length;
$t.selectionEnd = startPos + myValue.length;
$t.scrollTop = scrollTop
} else {
this.value += myValue;
this.focus()
}
}
});
a = true;
}
});
});