I am working within phpZend CMS and have a page where you can download pdf's after checking the box agreeing to the rules & regulations. For some reason, while I can get the message requiring the box be checked to appear for all of the documents, once the box is checked I can only get the first document to download. Below is the code I am trying to use.



<?php
echo $this->partial('partials/_left-nav.phtml', $this->leftnav_data);
?>




<script language="JavaScript" type="text/JavaScript">

function legal() {
if (document.getElementById('chk1').checked) {

document.getElementById('subm').onclick = function(){

window.open('http://dev.joico-hair.com/lounge_docs/care/care_colorEndure_Guide.pdf');

}
} else {
alert("Please read the terms and legal statement and check the box to download the pdf");

}
}

function legaltwo() {
if (document.getElementById('chk1').checked=='submtwo') {

document.getElementById('submtwo').onclick = function(){

window.open('http://dev.joico-hair.com/lounge_docs/care/care_colorEndure_Sheet_Violet.pdf');

}
} else {
alert("irving");

}
}

function legalthree() {
if (document.getElementById('chk1').checked=='submthree') {

document.getElementById('submthree').onclick = function(){

window.open('http://dev.joico-hair.com/lounge_docs/care/care_downloadAll_colorEndure.pdf');

}
} else {
alert("fred");

}
}
</script>




<link href="/css/lounge.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

</script>


<style type="text/css">
#inner_details {
background-image: url(/images/Lounge/messageBox_colorEndureCare.png);
height:510px;
width:450px;

}

#inner_text {
height:400px;
width:375px;
margin-top:80px;
margin-bottom:15px;
margin-left:30px;
padding-right:10px;
color:#ffffff;
overflow:auto;
}


.download {
margin-top:20px;
}

.thumbs {
width:50px;
height:63px;
display: inline;
vertical-align: top;
margin-right: 10px;
}

</style>



<title>download vero</title>

<div id="detail_content">
<div id="inner_details">
<div id="inner_text">
The brand designed to promote the tonal integrity and color longevity, use these ads so your clients know to use Color Endure to preserve their haircolor.
<br /><br />
<strong>NOTE:</strong>&nbsp;To download the pdf's you MUST first read and agree to the <a style="color:#cf993f;"href="#" onclick="MM_openBrWindow('http://www.joico.com/stile_legal','','width=500,height=500')">Joico S.T.I.L.E. Bylines</a>. <br /><br />
<form action="#" id="form1" >
<input type="checkbox" id="chk1" onclick="legal()" />&nbsp;By checking here I confirm that I have read and agree to the above bylines as stated.</form>



<div class="download"> <a href='' id="subm" onclick="legal()"><img src="/images/Lounge/care/thumb_care_colorEndure_Guide.jpg" border="0" class="thumbs"/></a>Color Endure Guide </div>


<div class="download"> <a href='' id="submtwo" onclick="legaltwo()"><img src="/images/Lounge/care/thumb_care_colorEndure_Sheet_Violet.jpg" border="0" class="thumbs"/></a>Color Endure Violet Sell Sheet </div>

<div class="download"> <a href='' id="submthree" onclick="legalthree()"><img src="/images/Lounge/downloadAll.jpg" border="0" class="thumbs"/></a>Download all Color Endure Materials here </div>



</div>
</div>
</div>