function OpenCentredPopup(url, windowName, width, height)

{

    var popup;
    var left = 0;
    var top = 0;


    if (document.all || document.layers)

    {

        left    = Math.round((screen.availWidth - width) / 2);
        top     = Math.round((screen.availHeight - height) / 2);
    }

    else
    {
        left    = Math.round((screen.width - width) / 2);
        top     = Math.round((screen.height - height) / 2);
    }


    popup = window.open(url, windowName, "width=" + width + ",height=" + height + ",toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizeable=yes,left=" + left + ",top=" + top);
    
    if (!popup.opener)
        popup.opener = self;
}

function SetUniqueRadioButton(nameregex, current, contestantID)
{
   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
   SetHiddenValue("MiddleContent_cmsContentBodyDevPanel_CleoHerbalEssences_FinalistVoting2_hdnVote", contestantID);
}

function SetHiddenValue(hiddenField, value)
{
    hdn = document.getElementById(hiddenField);
    hdn.value = value;
}
