function changeS(id, div)
{
   
        switch(id)
        {
            case 1:
            case 2: document.getElementById(div).style.display = "none"; break;
            case 3: document.getElementById(div).style.display = "block"; break;
        }
}

function check1()
{
    d = document.getElementById('mySelect');
    if(d != null && d.value == "other")
    {
        changeS(3, 'D1');
    }
    else changeS(1, 'D1');
}

var _opendID = 0;

function showFlash(id)
{
    $('emb'+id).className = "ppup";
}



  function emailCloak() {
    if (document.getElementById) {
      var alltags = document.all? document.all : document.getElementsByTagName("*");
      for (i=0; i < alltags.length; i++) {
        if (alltags[i].className == "emailCloak") {
          var oldText = alltags[i].firstChild;
          var emailAddress = alltags[i].firstChild.nodeValue;
          var user = emailAddress.substring(0, emailAddress.indexOf("("));
          var website = emailAddress.substring(emailAddress.indexOf(")")+1, emailAddress.length);
          var newText = user+"@"+website;
          var a = document.createElement("a");
          a.href = "mailto:"+newText;
        var address = document.createTextNode(newText);
        a.appendChild(address);
        alltags[i].replaceChild(a,oldText);
        }
      }
    }
  }
  window.onload = emailCloak;


function Vote(vid)
{
    var form = $('vote');
    var els = form.getInputs('radio', 'choice');
    var cid = 0;

    for(i=0; i<els.length; i++)
    {
        str = els[i].getAttribute("checked");
        if(str == true) cid = els[i].value;
    }

    if(cid == 0) return;

    url = "/ajax.php";
    pars = "?vid="+vid+"&cid="+cid+"&rand="+Math.random();

    new Ajax.Request(
              url, 
              { method: "get", 
                parameters: pars, 
                onComplete: showResponseVote, 
                onFailure: showError}
              );
}

function showResponseVote(req)
{
    div = $('voteDiv');
    par = div.parentNode;
    pS = div.previousSibling;
    par.removeChild(div);
    new Insertion.After(pS, req.responseText);
}

function showError()
{
    alert("Error");
}
