code for Javascript date picker.
date-picker.html is another file

When i select start date or end date.it is displaying in same text field.
How to resolve the problem


date.php
<html>
<head>
<script type="text/javascript">
<!--
function SelectDate()
{
D = document.getElementById('Date').value;
if(D){
D = D.split('/');
}else{
Dat = new Date();
D = new Array(Dat.getDay(), Dat.getMonth(), Dat.getFullYear());
}
win = window.open("date-picker.html","win","status=no,scrollbars=no,toolbar=no,menubar=no,height=150,width=150");
if (parseInt(navigator.appVersion) == 2 && navigator.appName == "Netscape")
win = window.open("date-picker.html","win","status=yes,height=325,width=250");
//win'MakeDate',D[2], D[1],D[0], 'SetDate');
win.MakeDate(D[2], D[1], D[0]);
}
function SetDate(Day, Month, Year)
{
document.getElementById('Date').value = Year + '-' + Month + '-' + Day;
}
-->
</script>

<script type="text/javascript">
<!--
function SelectDate2()
{
D = document.getElementById('d').value;
if(D){
D = D.split('/');
}else{
Dat = new Date();
D = new Array(Dat.getDay(), Dat.getMonth(), Dat.getFullYear());
}
win = window.open("date-picker.html","win","status=no,scrollbars=no,toolbar=no,menubar=no,height=150,width=150");
if (parseInt(navigator.appVersion) == 2 && navigator.appName == "Netscape")
win = window.open("date-picker.html","win","status=yes,height=325,width=250");
//win'MakeDate',D[2], D[1],D[0], 'SetDate');
win.MakeDate(D[2], D[1], D[0]);
}
function SetDate(Day, Month, Year)
{
document.getElementById('d').value = Year + '-' + Month + '-' + Day;
}
s-->
</script>

</head>

<body>

<input type="text" name="Date" id="Date" readonly />
<input type="button" onClick="SelectDate('Date1')" value="start date"><br>



<input type="text" name="d" id="d" readonly />
<input type="button" onClick="SelectDate2('Date1')" value="End date"><br>

</body>
</html>

can any one point out the mistake