/*2014.6*/
function checkMVotingForm(formName, id, breite, hoehe, fensterName) {
             ok = 0;
             for (i=0; i < formName.length; i++) {
                 if (formName.elements[i].checked == true) {
                    ok = 1;
                 }
             }
             if (ok==0) {
                alert("Bitte treffen Sie eine Auswahl.");
             }
             else {
                window.open("",fensterName,"width="+breite+",height="+hoehe+",resizable=no,scrollbars=no,menubar=no,directories=no");
               formName.submit();
               document.getElementById("send"+id).href = "javascript:alert('Sie haben bereits abgestimmt.');";
            }
    }

function viewCookieMessage() {
        alert('Sie haben bereits abgestimmt.');
}

// formStyle.js, produced by Philip Howard, GamingHeadlines.co.uk
// This JavaScript is open source and freely available to all those who wish to use it.
// A link back to GamingHeadlines.co.uk would be appreciated!
function toggleCheckbox(cbId,cbKey,ffId)
{
if (cbKey==0||cbKey==32){
var cbFF = document.getElementById(ffId);

var cbFFValue = cbFF.checked;

if(cbId.className.indexOf("checkboxChecked")<0)
{
var checkBoxType = cbId.className.replace("checkbox","");
cbFF.checked=true;cbId.className="checkboxChecked"+checkBoxType;}
else
{
var checkBoxType = cbId.className.replace("checkboxChecked","");
cbFF.checked=false;cbId.className="checkbox"+checkBoxType;}
return false;
}
}

function InitialiseCheckboxes()
{
var inputFields = document.getElementsByTagName("span");
var checkboxIndex = 0;
for (var inputIndex=0;inputIndex<inputFields.length;inputIndex++)
{
if (inputFields[inputIndex].className=="cbStyle")
{
var styleType = "";
if (inputFields[inputIndex].getAttribute("name")!=null){styleType=inputFields[inputIndex].getAttribute("name");}

var inputCurrent = inputFields[inputIndex].getElementsByTagName("input").item(0);
if(inputCurrent.getAttribute("type")=="checkbox")
{
inputCurrent.className = "inputHidden";
inputCurrent.setAttribute("id","StyledCheckbox"+checkboxIndex);

if(navigator.appName.indexOf("Internet Explorer")>0)
{
//Internet Explorer
var inputHTML = inputFields[inputIndex].innerHTML;
var styledHTML = "<a"//href=\"#\""
styledHTML+=" tabindex=\""+inputIndex+"\"";
//styledHTML+=" name=\""+inputCurrent.getAttribute("name")+"\""

if(inputCurrent.hasAttribute){if(inputCurrent.hasAttribute("title")){styledHTML+=" title=\""+inputCurrent.getAttribute("title")+"\"";}}

if (inputCurrent.checked)
{styledHTML+=" class=\"checkboxChecked"+styleType+"\""}
else
{styledHTML+=" class=\"checkbox"+styleType+"\""}

styledHTML+=" onClick=\"toggleCheckbox(this,'','StyledCheckbox"+checkboxIndex+"');return false;\""
styledHTML+=" onKeyPress=\"return toggleCheckbox(this,event.keyCode,'StyledCheckbox"+checkboxIndex+"');\""

styledHTML+="></a>"

inputFields[inputIndex].innerHTML = inputHTML+styledHTML;
inputFields[inputIndex].className = "radiobox"+styleType;
}
else
{
var styledCheckbox = document.createElement("a"); 
styledCheckbox.setAttribute("href","#");

if(inputCurrent.hasAttribute){if(inputCurrent.hasAttribute("title")){styledCheckbox.setAttribute("title",inputCurrent.getAttribute("title"));}}

styledCheckbox.setAttribute("onClick","toggleCheckbox(this,'','StyledCheckbox"+checkboxIndex+"');return false;");
styledCheckbox.setAttribute("onKeyPress","return toggleCheckbox(this,event.keyCode,'StyledCheckbox"+checkboxIndex+"');");

if (inputCurrent.checked)
{styledCheckbox.className="checkboxChecked"+styleType;}
else
{styledCheckbox.className="checkbox"+styleType;}
inputFields[inputIndex].appendChild(styledCheckbox);
}

checkboxIndex++;
}
}
}
}

function toggleRadiobox(rbObj,rbKey,rbGroup,rbId)
{
if (rbKey==0||rbKey==32){
var inputFields = document.getElementsByTagName("a");
for (var inputIndex=0;inputIndex<inputFields.length;inputIndex++)
{
if (inputFields[inputIndex].getAttribute("name")==rbGroup){

if(inputFields[inputIndex].className.indexOf("radioboxChecked")<0)
{var RadioBoxType = inputFields[inputIndex].className.replace("radiobox","");}
else
{var RadioBoxType = inputFields[inputIndex].className.replace("radioboxChecked","");}

inputFields[inputIndex].className="radiobox"+RadioBoxType;
}
}
var inputFields = document.getElementsByTagName("input");
for (var inputIndex=0;inputIndex<inputFields.length;inputIndex++)
{
if (inputFields[inputIndex].getAttribute("name")==rbGroup)
{
if (inputFields[inputIndex].getAttribute("id")==rbId)
{
if(rbObj.className.indexOf("radioboxChecked")<0)
{var RadioBoxType = rbObj.className.replace("radiobox","");}
else
{var RadioBoxType = rbObj.className.replace("radioboxChecked","");}

inputFields[inputIndex].checked = true;rbObj.className="radioboxChecked"+RadioBoxType;}
else
{inputFields[inputIndex].checked = false;}
}
}
return false;
}
}

function InitialiseRadioboxes()
{
var inputFields = document.getElementsByTagName("span");
var radioboxIndex = 0;

for (var inputIndex=0;inputIndex<inputFields.length;inputIndex++)
{
if (inputFields[inputIndex].className=="rbStyle")
{
var styleType = "";
if (inputFields[inputIndex].getAttribute("name")!=null){styleType=inputFields[inputIndex].getAttribute("name");}

var inputCurrent = inputFields[inputIndex].getElementsByTagName("input").item(0);
if(inputCurrent.getAttribute("type")=="radio")
{
//inputCurrent.setAttribute("class","inputHidden");
inputCurrent.className = "inputHidden";
inputCurrent.setAttribute("id","styledRadiobox"+radioboxIndex);

if(navigator.appName.indexOf("Internet Explorer")>0)
{
//Internet Explorer
var inputHTML = inputFields[inputIndex].innerHTML;
var styledHTML = "<a"//href=\"#\""
styledHTML+=" tabindex=\"1"+inputIndex+"\"";

styledHTML+=" name=\""+inputCurrent.getAttribute("name")+"\""

if(inputCurrent.hasAttribute){if(inputCurrent.hasAttribute("title")){styledHTML+=" title=\""+inputCurrent.getAttribute("title")+"\"";}}

if (inputCurrent.checked)
{styledHTML+=" class=\"radioboxChecked"+styleType+"\""}
else
{styledHTML+=" class=\"radiobox"+styleType+"\""}

styledHTML+=" onClick=\"toggleRadiobox(this,'','"+inputCurrent.getAttribute("name")+"','styledRadiobox"+radioboxIndex+"');return false;\""
styledHTML+=" onKeyPress=\"return toggleRadiobox(this,event.keyCode,'"+inputCurrent.getAttribute("name")+"','styledRadiobox"+radioboxIndex+"');\""

styledHTML+="></a>"

inputFields[inputIndex].innerHTML = inputHTML+styledHTML;
inputFields[inputIndex].className = "radiobox"+styleType;
}
else
{
//Firefox, Opera, Netscape
var styledRadiobox = document.createElement("a"); 
styledRadiobox.setAttribute("href","#");
styledRadiobox.setAttribute("name",inputCurrent.getAttribute("name"));

if(inputCurrent.hasAttribute){if(inputCurrent.hasAttribute("title")){styledRadiobox.setAttribute("title",inputCurrent.getAttribute("title"));}}

styledRadiobox.setAttribute("onClick","toggleRadiobox(this,'','"+inputCurrent.getAttribute("name")+"','styledRadiobox"+radioboxIndex+"');return false;");
styledRadiobox.setAttribute("onKeyPress","return toggleRadiobox(this,event.keyCode,'"+inputCurrent.getAttribute("name")+"','styledRadiobox"+radioboxIndex+"');");

if (inputCurrent.checked)
{styledRadiobox.className="radioboxChecked"+styleType;}
else
{styledRadiobox.className="radiobox"+styleType;}

inputFields[inputIndex].appendChild(styledRadiobox);
}

radioboxIndex++;
}
}
}
}

function preloadImages()
{
foCbCh02 = new Image();foCbCh02.src = "gfx/forms/foCbCh02.gif";
foCbUn02 = new Image();foCbUn02.src = "gfx/forms/foCbUn02.gif";
foCbCh03 = new Image();foCbCh03.src = "gfx/forms/foCbCh03.gif";
foCbUn03 = new Image();foCbUn03.src = "gfx/forms/foCbUn03.gif";
foCbCh04 = new Image();foCbCh04.src = "gfx/forms/foCbCh04.gif";
foCbUn04 = new Image();foCbUn04.src = "gfx/forms/foCbUn04.gif";
foCbCh05 = new Image();foCbCh05.src = "gfx/forms/foCbCh05.gif";
foCbUn05 = new Image();foCbUn05.src = "gfx/forms/foCbUn05.gif";
foCbCh06 = new Image();foCbCh06.src = "gfx/forms/foCbCh06.gif";
foCbUn06 = new Image();foCbUn06.src = "gfx/forms/foCbUn06.gif";

foRbCh01 = new Image();foRbCh01.src = "gfx/forms/foRbCh01.gif";
foRbUn01 = new Image();foRbUn01.src = "gfx/forms/foRbUn01.gif";
foRbCh03 = new Image();foRbCh03.src = "gfx/forms/foRbCh03.gif";
foRbUn03 = new Image();foRbUn03.src = "gfx/forms/foRbUn03.gif";
foRbCh04 = new Image();foRbCh04.src = "gfx/forms/foRbCh04.gif";
foRbUn04 = new Image();foRbUn04.src = "gfx/forms/foRbUn04.gif";
}

function Initialise()
{
// preloadImages();
                        InitialiseRadioboxes();
                        InitialiseCheckboxes();
}
addLoadEvent(Initialise);



