function addClipboard2(obj) {
var r = obj.createTextRange() ;
var name = document.sm.wert.value;
if ( name.length<1 ){
       alert("يرجى أختيار صورة ثم اضغط على زر النسخ");
       return false;
} else if( name == "اضغط على الصوره ثم انسخ الكود"){
       alert("يرجى أختيار صورة ثم اضغط على زر النسخ");
       return false;
}else{
 r.execCommand("Copy") ;
 alert("تم نسخ الرابط بنجاح");
}

}

function getSelection() {

   var selection= document.sm.output.selectedIndex;

   return selection;

}



function smile(swert) {

   var selection= getSelection();

   if (selection == 0) {

    var output= '[url=http://q815.com/][img]'+swert+'[\/img][/url]';

   } else if (selection == 1) {

    var output= swert;

   } else if (selection == 2) {

    var output= '[image]'+swert+'[\/image]';

   }

   document.sm.wert.value= output;

   document.sm.wert.select();

}



function changeOutput() {

   var output= document.sm.wert.value;

   if (output.indexOf('[img]') != -1) {

    var output= output.substring(output.indexOf('[img]')+5,output.indexOf('[\/img]'));

   } else if (output.indexOf('[image]') != -1) {

    var output= output.substring(output.indexOf('[image]')+7,output.indexOf('[\/image]'));

   } else if (output == "Klik op een emoticon voor de code") {

    var output= "";

   }

   smile(output);

}






