function dropVote()

in pysteve/www/htdocs/js/steve_stv.js [72:91]


function dropVote(ev, parent) {
    
    //ev.preventDefault();
    if (parent || fading) return;
    
    // Get who we dragged and who we dropped it on
    source = ev.dataTransfer.getData("Text");
    dest = parent ? ev.target.parentNode.getAttribute("data") : ev.target.getAttribute("data")
    if (dest == "UPPER") { dest = ballotNames[0]}
    if (dest == "LOWER") { dest = ballotNames[ballotNames.length -1] }
    if (candidates.indexOf(dest) != -1) {
        alert("Back to school!")
    }
    
    // If we didn't drag this onto ourselves, let's initiate the fade-out and swap
    if (source != dest) {
        fadeOut(1, "ballot");
    }
    
}