﻿function fnMoveItem(lstbxFrom,lstbxTo)
{
    var varFromBox = document.all(lstbxFrom);
    var varToBox = document.all(lstbxTo); 
    if ((varFromBox != null) && (varToBox != null)) 
    { 
        if(varFromBox.length < 1) 
        {
            alert('Listede seçilecek nesne bulunmamaktadır!');
            return false;
        }
        if(varFromBox.options.selectedIndex == -1) // when no Item is selected the index will be -1
        {
            alert('Lütfen taşımak için bir nesne seçin');
            return false;
        }
        while ( varFromBox.options.selectedIndex >= 0 ) 
        { 
            var newOption = new Option(); // Create a new instance of ListItem 
            newOption.text = varFromBox.options[varFromBox.options.selectedIndex].text; 
            newOption.value = varFromBox.options[varFromBox.options.selectedIndex].value; 
            varToBox.options[varToBox.length] = newOption; //Append the item in Target Listbox
            varFromBox.remove(varFromBox.options.selectedIndex); //Remove the item from Source Listbox
            
            /*  myText.value += newOption.value + '<br>';   */
            document.getElementById("TextArea1").value += newOption.value + "\r";
        } 
     }
     return false; 
}
        
function fnRemoveItem(lstbxFrom)
{
    var varFromBox = document.all(lstbxFrom);
    if (varFromBox != null) 
    { 
        if(varFromBox.length < 1) 
        {
            alert('Listede silinecek nesne bulunmamaktadır!');
            return false;
        }
        if(varFromBox.options.selectedIndex == -1) // when no Item is selected the index will be -1
        {
            alert('Lütfen silmek için bir nesne seçin');
            return false;
        }
        while ( varFromBox.options.selectedIndex >= 0 ) 
        { 
            varFromBox.remove(varFromBox.options.selectedIndex); //Remove the item from Source Listbox 
            
        } 
    }
    return false; 
}

function cellImg(idCell, imgName) { 
document.getElementById(idCell).style.background = "url(" + imgName + ")"; 
document.getElementById(idCell).style.backgroundRepeat = 'no-repeat';

} 

function cellImg2(idCell, imgName) { 
document.getElementById(idCell).style.background = "url(" + imgName + ")"; 
document.getElementById(idCell).style.backgroundRepeat = 'no-repeat';
}