function RetirarTodosItemSelect(IdObjselectDestino) 
{
    $('#'+IdObjselectDestino).empty();
}

function SelecionarTodosItemSelect(IdObjselectOrigem, IdObjselectDestino)
{
    var srcList  = document.getElementById(IdObjselectOrigem),
        destList = document.getElementById(IdObjselectDestino);

//        destList.innerHTML = srcList.innerHTML;
    $('#'+IdObjselectDestino).html(srcList.innerHTML);
}

function SelecionarItemSelect(IdObjselectOrigem,IdObjselectDestino) 
{
    var a = document.getElementById('idCidadeSelecionada').value
    srcList =  document.getElementById(IdObjselectOrigem); //window.document.forms[0].srcList;
    destList = document.getElementById(IdObjselectDestino); //window.document.forms[0].destList;
	
    var len = destList.length;
    for(var i = 0; i < srcList.length; i++)
    {
        if ((srcList.options[i] != null) && (srcList.options[i].selected))
        {
            var found = false;
            for(var count = 0; count < len; count++)
            {
                if (destList.options[count] != null)
                {
                    if (srcList.options[i].text == destList.options[count].text)
                    {
                        found = true;
                        break;
                    }
                }
            }
            if ( found != true )
            {
                destList.options[len] = new Option(srcList.options[i].text,srcList.options[i].value);
                len++;
            }
        }
    }
}

function SelecionarItemSelect2(IdObjselectOrigem,IdObjselectDestino) 
{
	
    srcList =  document.getElementById(IdObjselectOrigem); //window.document.forms[0].srcList;
    destList = document.getElementById(IdObjselectDestino); //window.document.forms[0].destList;
	
    var len = destList.length;
    for(var i = 0; i < srcList.length; i++)
    {
        if ((srcList.options[i] != null) && (srcList.options[i].selected))
        {
            var found = false;
            for(var count = 0; count < len; count++)
            {
                if (destList.options[count] != null)
                {
                    if (srcList.options[i].text == destList.options[count].text)
                    {
                        found = true;
                        break;
                    }
                }
            }
            if ( found != true )
            {
                destList.options[len] = new Option(srcList.options[i].text,srcList.options[i].value);
                len++;
            }
        }
    }
}

function DevolverItemSelect(IdObjselectDestino) 
{
    destList = document.getElementById(IdObjselectDestino); //window.document.forms[0].destList;
    var len = destList.options.length;
    for(var i = (len-1); i >= 0; i--) 
    {
        if ((destList.options[i] != null) && (destList.options[i].selected == true))
        {
            destList.options[i] = null;
        }
    }
}
