function checkDate()
{
        mnth = document.forms[0].Month.options[document.forms[0].Month.selectedIndex].value
        mnth = parseInt(mnth)+1;
        dy = parseInt(document.forms[0].Day.options[document.forms[0].Day.selectedIndex].value)

        //if the month isn't February...
        if (mnth != 2)
        {
                // then see if it's a month that only has 30 days...
                if (mnth == 4 || mnth == 6 || mnth == 9 || mnth == 11)
                {
                        // if it is, and the day value is greater than 30, alert the user
                        if (dy > 30)
                        {
                                alert("لا يمكن أن يكون هناك أكثر من 30 يوما")

                                // and select the 30 for them...
                                document.forms[0].Day.selectedIndex = 0
                                err = true
                                return
                        }
                }
        }
        else
        {
                //if it IS February , check if it's a leap year
                yr1 = parseInt(document.forms[0].Year.options[document.forms[0].Year.selectedIndex].value)
                // (this is the modulus operation which returns the remainder of the selected year divided by 4
                leapYrTest = yr1 % 4
                // if the year divides evenly by 4, it is a leap year and the remainder will be 0...
                if (leapYrTest == 0)
                {
                        // so our max day for february is 29
                        maxdy = 29
                }
                else
                {
                        maxdy = 28
                }
                // if the user selected a value greater than the max day AND the month is February
                if (dy > maxdy)
                {
                        // Alert the user and set the day back to 1

                        alert("لا يمكن أن يكون هناك أكثر من" +maxdy+ "يوما")

                        document.forms[0].Day.selectedIndex = 0
                        err = true
                        return
                }
        }
}
function jump(formelement)
{
        var increment=formelement.country.options[formelement.country.selectedIndex].value;

        formelement.City.options.length=conn[increment];

        for (var k=0; k<parseInt(conn[increment]); k++)
        {

                formelement.City.options[k].text=cities[increment][k];
                formelement.City.options[k].value=k;
                if(k==0)
                {
                        formelement.City.options[0].selected="true";
                }
        }
}

function jumpUSA(formelement)
{
        var increment=formelement.countryUSA.options[formelement.countryUSA.selectedIndex].value;

        formelement.CityUSA.options.length=connUSA[increment];

        for (var k=0; k<parseInt(connUSA[increment]); k++)
        {

                formelement.CityUSA.options[k].text=citiesUSA[increment][k];
                formelement.CityUSA.options[k].value=k;
                if(k==0)
                {
                        formelement.CityUSA.options[0].selected="true";
                }
        }
}
function setcountname(f)
{

   document.myform.hiddcountry.value=document.myform.country.options[document.myform.country.selectedIndex].text
   document.myform.hiddcity.value=document.myform.City.options[document.myform.City.selectedIndex].text;

}

function redirect(x)
{
 if(x==0){
 location.href='aprayer.php';
 }
 if(x==1){
 location.href='prayer.php';
 }
}
