<!-- Hide the script// written by Amin Al-Juffali// Version 1.5, 2002-2008.// Coping or using any of the routines is prohibited unless prior permission is// obtained from the author. Some of the routines were developed in the early // eighties and have been ported to JavaScript.  var PI               = Math.PI; var SmallNumber      = 1.0e-14; var iShafii          = 0; var iHanafi          = 1; var iEgypt           = 0; var iAlqura          = 1; var iGulf            = 2; var iEurope          = 3; var iNAmerica        = 4; var iKarachi         = 5; var bOk              = true; var    sYr, sMn, sDy, sLonDeg, sLonMin, sLatDeg, sLatMin; var    sGMT, sAltitude, sVAR, sDST, sStandard, sRamadhan, sJuristic;// -------------------------------------------------------------------------function Fix(x)      // Get integer part.{  if (x < 0.0)   return(Math.ceil(x));  else   return(Math.floor(x));}// -------------------------------------------------------------------------function Frac(x)     // Get fractional part.{  return(x - Fix(x));}// -------------------------------------------------------------------------function TimeString(fTime) {   var s = "";   var Hour = Math.round(Fix(fTime));   var Minute = Math.round(60.0 * (fTime-Hour));   if (Hour < 10)      s = "0" + Hour;    else     s = Hour;   if (Minute < 10)      s += ":0" + Minute;    else      s += ":" + Minute;   return(s); }//-----------------------------------------------------------------------------function IsLeapYearGre(yr) {    if ((yr % 4 == 0) &&         (yr % 4000 != 0) &&           ((yr % 100 != 0) || (yr % 400 == 0)))      return(1);    else      return(0); }//-----------------------------------------------------------------------------function DaysInMonGre(yr, mn){    switch (mn)	{	 case  1:	 case  3:	 case  5:	 case  7:	 case  8:	 case 10:	 case 12: return(31);     case  4:	 case  6:	 case  9:	 case 11: return(30);     case  2: return(28 + IsLeapYearGre(yr));    }  return(0);}//-----------------------------------------------------------------------------function CheckDateGre(yr, mn, dy){ if ((yr > 2002.0)&&(yr < 2501.0)	          &&((mn > 0)&&(mn < 13))               && (dy > 0)                  && (dy <= DaysInMonGre(yr,mn)))     return(1);    else     return(0);}// ------------------------------------------------------------------------- function ShowDate()   {     var TodaysDate = new Date();       document.Location.lDay.value = TodaysDate.getDate();     document.Location.lMonth.value = TodaysDate.getMonth() + 1;     if (TodaysDate.getYear() < 1900)       document.Location.lYear.value = TodaysDate.getYear() + 1900;      else       document.Location.lYear.value = TodaysDate.getYear();           document.Location.SelectLocation.focus();     document.Location.lDay.focus();     return;   }// -----------------------------------------------------------------------------function GetRadioSelection(x) {   var value = null;   var i;      for (i=0;i<x.length;i++)    {      if(x[i].checked)       {        value = x[i].value;        break;       }    }   return (value);  }// ------------------------------------------------------------------------- function SetValues()  {   switch(parseInt(document.Location.SelectLocation.value))    {     case  1:      case  2:      case  3:      case  4:      case  5:      case  6:      case  7:      case  8:      case  9: document.Location.rTwilight[iAlqura].checked = true;              document.Location.rJuristic[iShafii].checked = true;              break;     case 20:     case 21:      case 22:      case 23:      case 24:      case 25:      case 26:      case 27:      case 28:      case 29:      case 80: document.Location.rTwilight[iEurope].checked = true;              document.Location.rJuristic[iShafii].checked = true;              break;                   case 40:      case 41:      case 42:      case 43:      case 44:      case 45:      case 46:      case 47:      case 48:      case 49:      case 50:      case 51:      case 52:      case 70:      case 71:      case 72:      case 73:      case 74: document.Location.rTwilight[iNAmerica].checked = true;              document.Location.rJuristic[iShafii].checked   = true;              break;                   case 90: document.Location.rTwilight[iKarachi].checked = true;              document.Location.rJuristic[iShafii].checked = true;              break;    }    return;  }   // ----------------------------------------------------------------------------- function ObtainValues()  {   switch(parseInt(document.Location.SelectLocation.value))    {     case  1: sLonDeg   = "39.0";              sLonMin   = "49.0";              sLatDeg   = "21.0";              sLatMin   = "25.0";              sGMT      = "3.0";              sAltitude = "0.0";              sVAR      = "2.0";              break;     case  2: sLonDeg   = "39.0";              sLonMin   = "10.0";              sLatDeg   = "21.0";              sLatMin   = "30.0";              sGMT      = "3.0";              sAltitude = "0.0";              sVAR      = "2.0";              break;     case  3: sLonDeg   = "46.0";              sLonMin   = "42.0";              sLatDeg   = "24.0";              sLatMin   = "41.0";              sGMT      = "3.0";              sAltitude = "0.0";              sVAR      = "2.0";              break;     case  4: sLonDeg   = "39.0";              sLonMin   = "42.3";              sLatDeg   = "24.0";              sLatMin   = "33.1";              sGMT      = "3.0";              sAltitude = "0.0";              sVAR      = "3.0";              break;     case  5: sLonDeg   = "50.0";              sLonMin   = "07.3";              sLatDeg   = "26.0";              sLatMin   = "26.0";              sGMT      = "3.0";              sAltitude = "0.0";              sVAR      = "2.0";              break;     case  6: sLonDeg   = "50.0";              sLonMin   = "9.3";              sLatDeg   = "26.0";              sLatMin   = "16.0";              sGMT      = "3.0";              sAltitude = "0.0";              sVAR      = "2.0";              break;     case 20: sLonDeg   = "-0.0";              sLonMin   = "-6.0";              sLatDeg   = "51.0";              sLatMin   = "30.0";              sGMT      = "0.0";              sAltitude = "0.0";              sVAR      = "-2.0";              break;     case 21: sLonDeg   = "-0.0";              sLonMin   = "-27.7";              sLatDeg   = "51.0";              sLatMin   = "28.7";              sGMT      = "0.0";              sAltitude = "0.0";              sVAR      = "-2.0";              break;     case 22: sLonDeg   = "2.0";              sLonMin   = "20.0";              sLatDeg   = "48.0";              sLatMin   = "52.0";              sGMT      = "1.0";              sAltitude = "0.0";              sVAR      = "-1.0";              break;     case 23: sLonDeg   = "11.0";              sLonMin   = "34.0";              sLatDeg   = "48.0";              sLatMin   = "8.0";              sGMT      = "1.0";              sAltitude = "0.0";              sVAR      = "1.0";              break;     case 24: sLonDeg   = "9.0";              sLonMin   = "12.0";              sLatDeg   = "48.0";              sLatMin   = "41.0";              sGMT      = "1.0";              sAltitude = "0.0";              sVAR      = "1.0";              break;     case 40: sLonDeg   = "-118.0";              sLonMin   = "-0.0";              sLatDeg   = "33.0";              sLatMin   = "50.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "13.0";              break;     case 41: sLonDeg   = "-82.0";              sLonMin   = "-28.0";              sLatDeg   = "27.0";              sLatMin   = "58.0";              sGMT      = "-5.0";              sAltitude = "0.0";              sVAR      = "-4.0";              break;     case 42: sLonDeg   = "-73.0";              sLonMin   = "-59.0";              sLatDeg   = "40.0";              sLatMin   = "46.0";              sGMT      = "-5.0";              sAltitude = "0.0";              sVAR      = "-13.0";              break;     case 43: sLonDeg   = "-117.0";              sLonMin   = "-8.0";              sLatDeg   = "32.0";              sLatMin   = "43.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "12.0";              break;     case 44: sLonDeg   = "-122.0";              sLonMin   = "-25.0";              sLatDeg   = "37.0";              sLatMin   = "47.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "14.0";              break;     case 45: sLonDeg   = "-118.0";              sLonMin   = "-7.0";              sLatDeg   = "33.0";              sLatMin   = "46.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "13.0";              break;     case 46: sLonDeg   = "-77.0";              sLonMin   = "-0.0";              sLatDeg   = "38.0";              sLatMin   = "53.0";              sGMT      = "-5.0";              sAltitude = "0.0";              sVAR      = "-10.0";              break;     case 47: sLonDeg   = "-121.0";              sLonMin   = "-16.0";              sLatDeg   = "38.0";              sLatMin   = "8.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "14.0";              break;     case 48: sLonDeg   = "-71.0";              sLonMin   = "-3.0";              sLatDeg   = "42.0";              sLatMin   = "22.0";              sGMT      = "-5.0";              sAltitude = "0.0";              sVAR      = "-15.0";              break;     case 49: sLonDeg   = "-87.0";              sLonMin   = "-38.0";              sLatDeg   = "41.0";              sLatMin   = "51.0";              sGMT      = "-6.0";              sAltitude = "0.0";              sVAR      = "-3.3";              break;     case 50: sLonDeg   = "-122.0";              sLonMin   = "-52.0";              sLatDeg   = "42.0";              sLatMin   = "20.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "16.0";              break;     case 51: sLonDeg   = "-122.0";              sLonMin   = "-40.0";              sLatDeg   = "45.0";              sLatMin   = "31.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "16.5";              break;     case 52: sLonDeg   = "-122.0";              sLonMin   = "-21.0";              sLatDeg   = "47.0";              sLatMin   = "37.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "17.0";              break;     case 70: sLonDeg   = "-123.0";              sLonMin   = "-10.0";              sLatDeg   = "49.0";              sLatMin   = "15.0";              sGMT      = "-8.0";              sAltitude = "0.0";              sVAR      = "19.0";              break;     case 71: sLonDeg   = "-73.0";              sLonMin   = "-35.0";              sLatDeg   = "45.0";              sLatMin   = "30.0";              sGMT      = "-5.0";              sAltitude = "0.0";              sVAR      = "-15.0";              break;     case 72: sLonDeg   = "-79.0";              sLonMin   = "-25.0";              sLatDeg   = "43.0";              sLatMin   = "40.0";              sGMT      = "-5.0";              sAltitude = "0.0";              sVAR      = "-11.0";              break;     case 73: sLonDeg   = "-75.0";              sLonMin   = "-42.0";              sLatDeg   = "45.0";              sLatMin   = "25.0";              sGMT      = "-5.0";              sAltitude = "0.0";              sVAR      = "-14.0";              break;     case 74: sLonDeg   = "-114.0";              sLonMin   = "-04.0";              sLatDeg   = "51.0";              sLatMin   = "2.0";              sGMT      = "-7.0";              sAltitude = "0.0";              sVAR      = "15.5";              break;     case 80: sLonDeg   = "35.0";              sLonMin   = "58.0";              sLatDeg   = "31.0";              sLatMin   = "59.5";              sGMT      = "2.0";              sAltitude = "0.0";              sVAR      = "3.0";              break;     case 90: sLonDeg   = "72.0";              sLonMin   = "50.0";              sLatDeg   = "18.0";              sLatMin   = "58.0";              sGMT      = "5.5";              sAltitude = "0.0";              sVAR      = "-1.0";              break;  }             sYr       = document.Location.lYear.value;             sMn       = document.Location.lMonth.value;             sDy       = document.Location.lDay.value;             sDST      = (document.Location.cbDST.checked) ? "1.0" : "0.0";             sStandard = GetRadioSelection(document.Location.rTwilight);             sRamadhan = (document.Location.cbRamadhan.checked) ? "Yes" : "No";             sJuristic = GetRadioSelection(document.Location.rJuristic);  }   // ------------------------------------------------------------------------- function ShowResults()   {    var s = "";    var a = Fix(parseFloat(document.Location.lYear.value));    var b = Fix(parseFloat(document.Location.lMonth.value));    var c = Fix(parseFloat(document.Location.lDay.value));         bOk = true;     if(CheckDateGre(a, b, c))     {      document.Location.lLonDeg.value   = sLonDeg;      document.Location.lLonMin.value   = sLonMin;      document.Location.lLatDeg.value   = sLatDeg;      document.Location.lLatMin.value   = sLatMin;      document.Location.lGMT.value      = sGMT;      document.Location.lAltitude.value = sAltitude;      document.Location.lVAR.value      = sVAR;      document.Location.lDST.value      = sDST;      document.Location.lStandard.value = sStandard;      document.Location.lRamadhan.value = sRamadhan;      document.Location.lJuristic.value = sJuristic;     }       else     {      bOk = false;     }     return;   }// ----------------------------------------------------------------------------- function TurnOff()   {      return false;   }// ----------------------------------------------------------------------------- function TurnOn()   {      ObtainValues();      ShowResults();      if(!bOk)        window.alert("Date Error...");      return bOk;   }// ----------------------------------------------------------------------------- function DisplayInfo()   {        window.location.href = "IslamicPrayerTimesInfo15.html";              return;   }// -----------------------------------------------------------------------------// unhide the scipt -->
