﻿function _emclipboard(id)
{
    var oPanel = document.getElementById(id);
    var msg = oPanel.innerText;
    window.clipboardData.setData('text',msg);
    alert("متن فارسی این صفحه کپی شد. به صفحه مورد نظر رفته و متن را جایگزین کنید\n\r\n\rThe Persian text has been copied to your computer clipboard. You may paste it to a web page, blog, or any local application such as Microsoft Word.");
}

function _emclipboardHTML(id)
{
    var oPanel = document.getElementById(id);
    
    var msg = "<html><body><div style='font-size:small;'><br />";
    msg = msg + "<table width='95%' border='0' align='center' cellpadding='3' cellspacing='3'  bgcolor='#a0a0ff'>";
    msg = msg + "<tr><td><table width='100%' cellspacing='0' cellpadding='5' bgcolor='#FFFFFF' dir='rtl' style='border: 1px solid #000000'>";
    msg = msg + "<tr><td><div style='font-family:Arial; font-size:medium; line-height:150%; direction:rtl'>";

    msg = msg + oPanel.innerHTML;

    msg = msg + "</div></td></tr></table></td></tr>";
    msg = msg + "<tr><td style='font-size:x-small;'>Composed on <a href='http://emonshi.com'>eMonshi.com</a>";
    msg = msg + "</td></tr></table><br /></div></body></html>";
    window.clipboardData.setData('text',msg);
    alert("متن فارسی این صفحه کپی شد. به صفحه مورد نظر رفته و متن را جایگزین کنید\n\r\n\rThe Formatted message has been copied to your clipboard. You may paste it to the body section of any email system such as google,yahoo, or Outlook.");
}

function _emcleartext(id)
{
    var oTextbox = document.getElementById(id);
    oTextbox.value = "";

    //var oPanel = document.getElementById("<%=Panel1.ClientID%>");
    //oPanel.innerHTML = "";
}


function ubbc(open, end)
{
    if (open == "")
    {
        var txt = prompt("Enter URL for the link.","http://");

        if (txt)
        {
            open = '<a href="'+txt+'">';
        }
        else
        {
            return false;
        }
    }

    if (open == "<ul>")
    {
        var list_item = prompt("Enter a list item. Press \"Cancel\" when you are done.","");

        if (list_item)
        {
            while (list_item)
            {
                open = open+"\n<li>"+list_item+"</li>";
                list_item = prompt("Enter a list item. Press \"Cancel\" when you are done.","");
            }

        open = open+"\n";
        }
        else
        {
            return false;
        }
    }

    var tArea = document.document.getElementById("emControlTextarea");
    var isIE = (document.all)? true : false;
    var open = (open)? open : "";
    var end = (end)? end : "";

    if (isIE)
    {
        tArea.focus();
        var curSelect = document.selection.createRange();
        if (arguments[2])
        {
            curSelect.text = open + arguments[2] + ">" + curSelect.text + end;
        }
        else
        {
            curSelect.text = open + curSelect.text + end;
        }
    }
    else if (!isIE && typeof tArea.selectionStart != "undefined")
    {
        var selStart = tArea.value.substr(0, tArea.selectionStart);
        var selEnd = tArea.value.substr(tArea.selectionEnd, tArea.value.length);
        var curSelection = tArea.value.replace(selStart, '').replace(selEnd, '');
        if (arguments[2])
        {
            tArea.value = selStart + open + arguments[2] + ">" + curSelection + end + selEnd;
        }
        else
        {
            tArea.value = selStart + open + curSelection + end + selEnd;
        }
    }
    else
    {
        tArea.value += (arguments[2])? open + arguments[2] + ">" + end : open + end;
    }
}

        

