function sendSmallImage(imgId) {
    var uid = '1003';
    var sid = '0';
    var r = /uid=(\d+)&sid=(\d+)/;
    var u = window.location.href;
    if (r.test(u)) {
        uid = RegExp.$1;
        sid = RegExp.$2;
    }
    window.open("http://app.sms888.net/web/apps/func/send_img.php"
        + "?uid=" + uid
        + "&sid=" + sid
        + "&class=" + "TP"
        + "&cpweb=" + 'gaoshouji'
        + "&url=" + document.getElementById(imgId).src );
}

function sendLargeImage(imgId) {
    var uid = '1003';
    var sid = '0';
    var r = /uid=(\d+)&sid=(\d+)/;
    var u = window.location.href;
    if (r.test(u)) {
        uid = RegExp.$1;
        sid = RegExp.$2;
    }
    window.open("http://app.sms888.net/web/apps/diynew.php"
        + "?uid=" + uid
        + "&sid=" + sid
        + "&class=" + "TP"
        + "&cpweb=" + 'gaoshouji'
        + "&url=" + document.getElementById(imgId).src );
}

function copyImage(imgId) {
	var img = document.getElementById(imgId);
    if (typeof img.contentEditable == 'undefined') return false;
    if (!document.body.createControlRange) return false;
	alert('复制完成，现在你可以粘贴到你的QQ对话框中了！');
    img.contentEditable = true;
	var ctrl = document.body.createControlRange();
	ctrl.addElement(img);
	ctrl.execCommand('Copy');
}

function submitEmotion(formObj, imgId) {
    if (typeof formObj == 'string') {
        formObj = document.getElementById(formObj);
    }
    document.getElementById(imgId).src = 'images/emotions/loading.gif';
    var handleSuccess = function(o) {
        if (o.responseText.match(/w.(gif|jpg)/i)) {
            document.getElementById(imgId).src = o.responseText;
        } else {
            alert(o.responseText);
        }
    };
    var callback = { success: handleSuccess };
    YAHOO.util.Connect.setForm(formObj.id);
    YAHOO.util.Connect.asyncRequest(formObj.method, formObj.action, callback);
}


function submitEmotion1(imgId, txtId) {
    query = "imgUrl=" + encodeURIComponent(document.getElementById(imgId).src) + "&imgText=" + encodeURIComponent(document.getElementById(txtId).value);
    document.getElementById(imgId).src = 'http://www.5igao.com/images/emotions/loading.gif';
    var handleSuccess = function(o) {
        if (o.responseText.match(/^http/i)) {
            document.getElementById(imgId).src = o.responseText;
        } else {
            alert(o.responseText);
        }
    };
    var callback = { success: handleSuccess };
    YAHOO.util.Connect.asyncRequest('GET', "http://www.gaoshouji.com/emotion1.php?"+query, callback);
}

