am = "This function is disabled!";

bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;

function printWindow()
                {
                                bV = parseInt(navigator.appVersion);
                                if (bV >= 4) window.print();
                }

function repeatshelp()
                {
                                window.open("repeatshelp.html",
                                "mywindow","location=0,status=0,scrollbars=1,width=420,height=550");
                }

function center()
                {
                                var doPopUpX = (screen.width-420)/2;
                                var doPopUpY = (screen.height-550)/3;
                                window.moveTo(doPopUpX,doPopUpY)
                }

function validate_appsterms ( )
                {
                valid = true;

                if ( document.appsterms.terms.checked == false )
                                {
                                alert ( "Please confirm that you have read the Terms & Conditions." );
                                valid = false;
                }

        return valid;
                }

function validate_form_apps ( )
                {
                valid = true;

                if ( document.apps.realname.value == "" )
  		                {
                                alert ( "Please fill in your First Name." );
                                valid = false;
                                }

                if ( document.apps.surname.value == "" )
                                {
                                alert ( "Please fill in your Surname." );
                                valid = false;
                                }

                if ( ( document.apps.sex[0].checked == false )
                                && ( document.apps.sex[1].checked == false ) )
                                {
                                                alert ( "Please choose your Gender: Male or Female" );
                                        valid = false;
                                }

 

                if ( document.apps.day.selectedIndex == 0 )

                                {

                                                alert ( "Please select your Day of Birth." );

                                valid = false;

                                }

 

                if ( document.apps.month.selectedIndex == 0 )

                                {

                                                alert ( "Please select your Month of Birth." );

                                valid = false;

                                }

 

                if ( document.apps.year.value == "yyyy" )

                                {

                                                alert ( "Please fill in your Year of Birth." );

                                valid = false;

                                }

 

                if ( document.apps.appday.selectedIndex == 0 )

                                {

                                                alert ( "Please select your Day of Appointment." );

                                valid = false;

                                }

 

                if ( document.apps.appmonth.selectedIndex == 0 )

                                {

                                                alert ( "Please select your Month of Appointment." );

                                valid = false;

                                }

 

                if ( document.apps.apptime.value == "hh:mm" )

                                {

                                                alert ( "Please fill in your Appointment Time in the Format hh:mm eg 08:30." );

                                valid = false;

                                }

 

                if ( document.apps.clinician.selectedIndex == 0 )

                                {

                                                alert ( "Please select a clinician you wish to cancel your Appointment with." );

                                valid = false;

                                }

 

                if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.apps.email.value))

                                valid = true;

                                else

                                {

                                alert("Invalid E-mail Address! Please re-enter.")

                                valid = false;

                                }

 

                if ( document.apps.contact_nr.value == "" )

                                {

                                                alert ( "Please fill in a Contact Number." );

                                valid = false;

                                }

 

                return valid;

                }

 

function validate_repeatsterms ( )

                {

                valid = true;

 

                if ( document.repeatsterms.terms.checked == false )

                                {

                                alert ( "Please confirm that you have read the Terms & Conditions." );

                                valid = false;

                }

 

        return valid;

                }

 

function validate_form_repeats ( )

                {

                valid = true;

 

                if ( document.repeats.realname.value == "" )

                                {

                                                alert ( "Please fill in your First Name." );

                                valid = false;

                                }

 

                if ( document.repeats.surname.value == "" )

                                {

                                                alert ( "Please fill in your Surname." );

                                valid = false;

                                }

 

                if ( ( document.repeats.sex[0].checked == false )

                                && ( document.repeats.sex[1].checked == false ) )

                                {

                                                alert ( "Please choose your Gender: Male or Female" );

                                        valid = false;

                                }

 

                if ( document.repeats.day.selectedIndex == 0 )

                                {

                                                alert ( "Please select your Day of Birth." );

                                valid = false;

                                }

 

                if ( document.repeats.month.selectedIndex == 0 )

                                {

                                                alert ( "Please select your Month of Birth." );

                                valid = false;

                                }

 

                if ( document.repeats.year.value == "yyyy" )

                                {

                                                alert ( "Please fill in your Year of Birth." );

                                valid = false;

                                }

 

                if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.repeats.email.value))

                                valid = true;

                                else

                                {

                                alert("Invalid E-mail Address! Please re-enter.")

                                valid = false;

                                }

 

                if ( document.repeats.patient_ref.value == "This can be found at the top of your script." )

                                {

                                                alert ( "Please fill in your Patient Reference Nr. This can be found at the top of your script." );

                                valid = false;

                                }

 

                if ( document.repeats.contact_nr.value == "" )

                                {

                                                alert ( "Please fill in a Contact Number." );

                                valid = false;

                                }

 

                if ( document.repeats.item1.value == "" )

                                {

                                                alert ( "Please fill in at least one Item eg Atenolol." );

                                valid = false;

                                }

 

                if ( document.repeats.strenght1.value == "" )

                                {

                                                alert ( "Please fill in at least one Item's Strenght eg 20mg." );

                                valid = false;

                                }

 

                if ( document.repeats.amount1.value == "" )

                                {

                                                alert ( "Please fill in at least one Item's Amount eg 20 tabs." );

                                valid = false;

                                }

 

                return valid;

                }

 

function validate_form_feedback ( )

                {

                valid = true;

 

                if ( document.feedback.realname.value == "" )

                                {

                                                alert ( "Please fill in your First Name." );

                                valid = false;

                                }

 

                if ( document.feedback.surname.value == "" )

                                {

                                                alert ( "Please fill in your Surname." );

                                valid = false;

                                }

 

                if ( ( document.feedback.sex[0].checked == false )

                                && ( document.feedback.sex[1].checked == false ) )

                                {

                                                alert ( "Please choose your Gender: Male or Female" );

                                        valid = false;

                                }

 

                

                if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.feedback.email.value))

                                valid = true;

                                else

                                {

                                alert("Invalid E-mail Address! Please re-enter.")

                                valid = false;

                                }

                                

                if ( document.feedback.contact_nr.value == "" )

                                {

                                                alert ( "Please fill in a Contact Number." );

                                valid = false;

                                }

 

                if ( document.feedback.feedback.value == "" )

                                {

                                                alert ( "Please complete the Feedback/Comments area." );

                                valid = false;

                                }

 

                return valid;

                }

