// legacy
function popupVotes(votes, layer, staticwidth)
{ doWork(votes,layer,"MCVotes");
}

// current
function popupVotes2(votes, layer, voteid)
{ doWork(votes,layer,"MCVotes"+voteid);
}

// look up the correct choice from the proper form then submit the vote in a new window
function doWork(votes, layer, formname) 
{   
    var selectedChoices="";
    var form;
    // identify if a Netscape layer exists for compatability then reference the correct layer
    // layers dont exist after netscape 4
    if (navigator.appName=="Netscape" && parseInt(navigator.appVersion) < 5)
    { if (document.layers.length>0 && layer.length>0)
        {   form=document.layers[layer].forms[formname];
        }
        else
        {   form=document.forms[formname];
        }
        for (var i=0; i < form.choice.length; i++) 
        { if (form.choice[i].checked=="1") 
            selectedChoices+="&choice"+i+"="+form.choice[i].value;      
        }
    }
    else
    {   form=document.forms[formname];
        // get the selected choice
        for (var i=0; i < form.choice.length; i++) 
        {   if (form.choice[i].checked)
              selectedChoices+="&choice"+i+"="+form.choice[i].value;
        }
    }
	
    // append the selected choice to the submit url, set the window properties then call the servlet from the new window
    votes+=selectedChoices;
    var height=460+(form.choice.length-2)*30;
    if(height>600)
      height=600;
    windowprops = "height="+height+",width=515,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no";
    window.open(votes, "MultiVotes", windowprops);
}
