// To open a popup window
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

// Feedback form validation
function Feedback() {

	firstName = document.fbForm.txtFirstname
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	lastName = document.fbForm.txtlastname
	if (lastName.value == "" || !isNaN(lastName.value))
	{
		alert("Please enter your last name");
		lastName.focus()
		return false		
	}




	mailid = document.fbForm.txtemail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}

	age = document.fbForm.cmbAgeRange
	if (age.options[age.selectedIndex].value == "")
	{
		alert("Please select your age group");
	age.focus()
	return false		
	}	

	sportsAct = document.fbForm.txtsports
	if (sportsAct.value != "" && !isNaN(sportsAct.value))
	{
		alert("Please enter Sports Activities");
		sportsAct.focus()
		return false		
	}

	comments = document.fbForm.txtComments
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.fbForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.fbForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}

// Appointments form validation
function Appointment()
{
if (document.frmAppointment.txtFirstName.value=="" || !isNaN(document.frmAppointment.txtFirstName.value))
	{
	alert('Enter FirstName');
	document.frmAppointment.txtFirstName.focus();
	return false;
	}
if (document.frmAppointment.txtSurname.value=="" || !isNaN(document.frmAppointment.txtSurname.value))
	{
	alert('Enter Surname');
	document.frmAppointment.txtSurname.focus();
	return false;
	}
if (document.frmAppointment.txtHomePhoneNumber.value=="" )
	{
	alert('Enter Home Phone No.');
	document.frmAppointment.txtHomePhoneNumber.focus();
	return false;
	}
	
	
if (document.frmAppointment.txtEmailAddress.value=="")
	{
	alert('Enter Email Address');
	document.frmAppointment.txtEmailAddress.focus();
	return false;
	}
	else if (document.frmAppointment.txtEmailAddress.value.indexOf("@")==-1 || document.frmAppointment.txtEmailAddress.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		document.frmAppointment.txtEmailAddress.focus()	   
		return false
	}	
	
	if (document.frmAppointment.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.frmAppointment.uword.focus();
	return false;
	}
	return jcap();
}



// Contact Us form validation
function Contactus() {
	
	firstName = document.cuForm.txtName
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	mailid = document.cuForm.txtEmail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}

	comments = document.cuForm.txtMessage
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.cuForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.cuForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}

// Swap Images

<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function validateLogin()
 {
    var o = document.getElementById('txtusername');    
          if (o.value==0)
             {
                         alert("Enter User Name")
                         document.getElementById('txtusername').focus()	   
                         return false
             }
  var o = document.getElementById('txtpassword');    
          if (o.value==0)
             {
                         alert("Enter Password")
                         document.getElementById('txtpassword').focus()	   
                         return false
             }
 
 }
 
 function validatepatienthistory()
 {
 if (document.form1.txtname.value=="" )
	{
	alert('Please Enter your Name');
	document.form1.txtname.focus();
	return false;
	}
	if (document.form1.txtage.value=="" )
	{
	alert('Please Enter your Age');
	document.form1.txtage.focus();
	return false;
	}
	if (document.form1.txtdob.value=="" )
	{
	alert('Please Enter your Date of Birth');
	document.form1.txtdob.focus();
	return false;
	}
	if (document.form1.txtcomplaints.value=="" )
	{
	alert('Please Enter your Chief Complaint');
	document.form1.txtcomplaints.focus();
	return false;
	}
	
 }
 
  function validatepatientinfo()
 {
  var o = document.getElementById('txtname');    
          if (o.value==0)
             {
                         alert("Please Enter Name")
                         document.getElementById('txtname').focus()	   
                         return false
             }
              var o = document.getElementById('txtaddress');    
          if (o.value==0)
             {
                         alert("Please Enter Address")
                         document.getElementById('txtaddress').focus()	   
                         return false
             }
                  var o = document.getElementById('txtcity');    
          if (o.value==0)
             {
                         alert("Please Enter City")
                         document.getElementById('txtcity').focus()	   
                         return false
             }
               var o = document.getElementById('txtstate');    
                   if (o.value==0)
             {
                         alert("Please Enter State")
                         document.getElementById('txtstate').focus()	   
                         return false
             }
                 var o = document.getElementById('txtzip');    
                   if (o.value==0)
             {
                         alert("Please Enter Zip")
                         document.getElementById('txtzip').focus()	   
                         return false
             }
                var o = document.getElementById('txtcell');    
                   if (o.value==0)
             {
                         alert("Please Enter Cell Number")
                         document.getElementById('txtcell').focus()	   
                         return false
             }
                var o = document.getElementById('txtdob');    
                   if (o.value==0)
             {
                         alert("Please Enter Date of Birth")
                         document.getElementById('txtdob').focus()	   
                         return false
             }
//               var o = document.getElementById('txtage');    
//                   if (o.value==0)
//             {
//                         alert("Please Enter Age")
//                         document.getElementById('txtage').focus()	   
//                         return false
//             }
             
//             var o = document.getElementById('rdbsex');    
//             if (! o.checked)
//             {
//                         alert("Please Select Sex")
//                         document.getElementById('rdbsex').focus()	   
//                         return false
//             }

// var radio = document.getElementById('rdbsex');   
//   for (var i=0;i<radio.length;i++)
//   {
//       if (radio[i].checked)
//       {
//           isChecked=true;
//           break;
//        }
//   }
//   if(!isChecked)
//   {
//        alert("Please select Sex");
//        document.getElementById('rdbsex').focus()
//        return false;
//   }


               var o = document.getElementById('txtssn');    
                   if (o.value==0)
             {
                         alert("Please Enter Social Security No.")
                         document.getElementById('txtssn').focus()	   
                         return false
             }
              var o = document.getElementById('txtinsurance');    
                   if (o.value==0)
             {
                         alert("Please Enter insurance Co.")
                         document.getElementById('txtinsurance').focus()	   
                         return false
             }
              var o = document.getElementById('txtpolicyno');    
                   if (o.value==0)
             {
                         alert("Please Enter Policy Nos.")
                         document.getElementById('txtpolicyno').focus()	   
                         return false
             }
             var o = document.getElementById('txtlmsg');    
                   if (o.value==0)
             {
                         alert("Please Enter to leave messages regarding your health care")
                         document.getElementById('txtlmsg').focus()	   
                         return false
             }
             
 }

function chkallergies()
{
if ((document.getElementById('chkallergies').checked == false))
    {
        document.getElementById('pnlallergies').Visible = true;
       // alert("nicht gewaehlt");
    }
     else 
    {
        document.getElementById('pnlallergies').Visible = false;         
    }
    return false;
}

function showdiv(id,id1)
 {
  if (id[0]) 
  { // if the button group is an array (one button is not an array)
      for (var i=0; i<id.length; i++)
       {
         if (id[i].checked)
          {
           document.getElementById(id1).style.display = 'block';
         }
         else
         {
         document.getElementById(id).style.display = 'none';
         }
      }
   }

} 



