

function popupCalendar(start) {

   startDate = start;


   var w=200; var h=310; var t; var l;
   if (navigator.appName=="Microsoft Internet Explorer"){
     t = (document.calimg.offsetTop + window.screenTop) -200;
     l = (document.calimg.offsetLeft + window.screenLeft) -200;
   } else {
     t = (document.calimg.offsetTop + screenY)-400;
     l = (document.calimg.offsetLeft + screenX);
   }

   calWindow = window.open("calendar.asp?selectDate="+startDate+"", "Calendar", "width="+w+",height="+h+",status=yes,resizable=no,top="+t+",left="+l);
   calWindow.opener = self;
   calWindow.focus();
   calWindow.document.close();


}

function showFriends() {
			Ctrl = document.sendFriendFrm.friendCount.value;
			if (Ctrl==1){
			toggle('friendName2');
			toggle('friend2');
			document.sendFriendFrm.friendCount.value = 2
			}	else if (Ctrl==2){
			toggle('friendName3');
			toggle('friend3');
 			document.sendFriendFrm.friendCount.value = 3
			}	else if (Ctrl==3){
			toggle('friendName4');
			toggle('friend4');
 			document.sendFriendFrm.friendCount.value = 4
      }	else if (Ctrl==4){
			toggle('friendName5');
			toggle('friend5');
			toggle('addAnother');
			}
		}
function toggleFieldsOff() {
			toggle('friendName2');
			toggle('friend2');
			toggle('friendName3');
			toggle('friend3');
			toggle('friendName4');
			toggle('friend4');
			toggle('friendName5');
			toggle('friend5');
			}
      
      
 
function toggle(target)
{ obj=(document.all) ? document.all[target] : document.getElementById(target);
  obj.style.display=(obj.style.display=='none') ? 'inline' : 'none';
}
function validateSendFriendForm(theForm) {
Ctrl = theForm.senderEmail;
if (theForm.senderName.value==""){
alert("Please enter your name.");
theForm.senderName.focus();
return(false);
}
if (theForm.senderEmail.value==""){
alert("Please enter your email address.");
theForm.senderEmail.focus();
return(false);
}
else if (Ctrl.value==" " || Ctrl.value.indexOf ('@',0) == -1)
{
alert("Please enter a valid email address.");
theForm.senderEmail.focus();
return(false);
}
else if (Ctrl.value==" " || Ctrl.value.indexOf ('.',0) == -1){
alert("Please enter a valid email address.");
theForm.senderEmail.focus();
return(false);
}
if (theForm.friendsName1.value==""){
alert("Please enter your friends name.");
theForm.friendsName1.focus();
return(false);
}
Ctrl = theForm.friendsEmail1;
if (theForm.friendsEmail1.value==""){
alert("Please enter your friends email address.");
theForm.friendsEmail1.focus();
return(false);
}
else if (Ctrl.value==" " || Ctrl.value.indexOf ('@',0) == -1)
{
alert("Please enter a valid email address for your friend.");
theForm.friendsEmail1.focus();
return(false);
}
else if (Ctrl.value==" " || Ctrl.value.indexOf ('.',0) == -1){
alert("Please enter a valid email address for your friend.");
theForm.friendsEmail1.focus();
return(false);
}
return(true);
} 
