﻿var fihgd=0;
var lastst=0;
function showdate() {

a = new Date();
d= a.getDay();
day= a.getDate();
highcmsmonth = a.getMonth()+1;
year= a.getYear();
year = (year== 0)?2000:year;
(year<1000)? (year += 2000):true;
year -= ( (highcmsmonth < 3) || ((highcmsmonth == 3) && (day < 21)) )? 622:621;
switch (highcmsmonth) {
case 1: (day<21)? (highcmsmonth=10, day+=10):(highcmsmonth=11, day-=20); break;
case 2: (day<20)? (highcmsmonth=11, day+=11):(highcmsmonth=12, day-=19); break;
case 3: (day<21)? (highcmsmonth=12, day+=9):(highcmsmonth=1, day-=20); break;
case 4: (day<21)? (highcmsmonth=1, day+=11):(highcmsmonth=2, day-=20); break;
case 5:
case 6: (day<22)? (highcmsmonth-=3, day+=10):(highcmsmonth-=2, day-=21); break;
case 7:
case 8:
case 9: (day<23)? (highcmsmonth-=3, day+=9):(highcmsmonth-=2, day-=22); break;
case 10:(day<23)? (highcmsmonth=7, day+=8):(highcmsmonth=8, day-=22); break;
case 11:
case 12:(day<22)? (highcmsmonth-=3, day+=9):(highcmsmonth-=2, day-=21); break;
default: break;}
document.getElementById("azanday").value=day;
document.getElementById("azanhighcmsmonth").value=highcmsmonth;}

/*  You may notice that a variety of array variables logically local
    to functions are declared globally here.  In JavaScript, construction
    of an array variable from source code occurs as the code is
    interpreted.  Making these variables pseudo-globals permits us
    to avoid overhead constructing and disposing of them in each
    call on the function in which they are used.  */

var J0000 = 1721424.5;                // Julian date of Gregorian epoch: 0000-01-01
var J1970 = 2440587.5;                // Julian date at Unix epoch: 1970-01-01
var JMJD  = 2400000.5;                // Epoch of Modified Julian Date system
var J1900 = 2415020.5;                // Epoch (day 1) of Excel 1900 date system (PC)
var J1904 = 2416480.5;                // Epoch (day 0) of Excel 1904 date system (Mac)

var NormLeap = new Array("Normal year", "Leap year");

function jwday(j)
{
	return mod(Math.floor((j+1.5)),7);
}

/*  WEEKDAY_BEFORE  --  Return Julian date of given weekday (0 = Sunday)
                        in the seven days ending on jd.  */

function weekday_before(weekday, jd)
{
    return jd - jwday(jd - weekday);
}

/*  SEARCH_WEEKDAY  --  Determine the Julian date for: 

            weekday      Day of week desired, 0 = Sunday
            jd           Julian date to begin search
            direction    1 = next weekday, -1 = last weekday
            offset       Offset from jd to begin search
*/

function search_weekday(weekday, jd, direction, offset)
{
    return weekday_before(weekday, jd + (direction * offset));
}

//  Utility weekday functions, just wrappers for search_weekday

function nearest_weekday(weekday, jd)
{
    return search_weekday(weekday, jd, 1, 3);
}

function next_weekday(weekday, jd)
{
    return search_weekday(weekday, jd, 1, 7);
}

function next_or_current_weekday(weekday, jd)
{
    return search_weekday(weekday, jd, 1, 6);
}

function previous_weekday(weekday, jd)
{
    return search_weekday(weekday, jd, -1, 1);
}

function previous_or_current_weekday(weekday, jd)
{
    return search_weekday(weekday, jd, 1, 0);
}

function TestSomething()
{
}

//  LEAP_GREGORIAN  --  Is a given year in the Gregorian calendar a leap year ?

function leap_gregorian(year)
{
    return ((year % 4) == 0) &&
            (!(((year % 100) == 0) && ((year % 400) != 0)));
}

//  GREGORIAN_TO_JD  --  Determine Julian day number from Gregorian calendar date

var GREGORIAN_EPOCH = 1721425.5;

function gregorian_to_jd(year, month, day)
{
    return (GREGORIAN_EPOCH - 1) +
           (365 * (year - 1)) +
           Math.floor((year - 1) / 4) +
           (-Math.floor((year - 1) / 100)) +
           Math.floor((year - 1) / 400) +
           Math.floor((((367 * month) - 362) / 12) +
           ((month <= 2) ? 0 :
                               (leap_gregorian(year) ? -1 : -2)
           ) +
           day);
}

//  JD_TO_GREGORIAN  --  Calculate Gregorian calendar date from Julian day

function jd_to_gregorian(jd) {
    var wjd, depoch, quadricent, dqc, cent, dcent, quad, dquad,
        yindex, dyindex, year, yearday, leapadj;

    wjd = Math.floor(jd - 0.5) + 0.5;
    depoch = wjd - GREGORIAN_EPOCH;
    quadricent = Math.floor(depoch / 146097);
    dqc = mod(depoch, 146097);
    cent = Math.floor(dqc / 36524);
    dcent = mod(dqc, 36524);
    quad = Math.floor(dcent / 1461);
    dquad = mod(dcent, 1461);
    yindex = Math.floor(dquad / 365);
    year = (quadricent * 400) + (cent * 100) + (quad * 4) + yindex;
    if (!((cent == 4) || (yindex == 4))) {
        year++;
    }
    yearday = wjd - gregorian_to_jd(year, 1, 1);
    leapadj = ((wjd < gregorian_to_jd(year, 3, 1)) ? 0
                                                  :
                  (leap_gregorian(year) ? 1 : 2)
              );
    month = Math.floor((((yearday + leapadj) * 12) + 373) / 367);
    day = (wjd - gregorian_to_jd(year, month, 1)) + 1;

    return new Array(year, month, day);
}

//  ISO_TO_JULIAN  --  Return Julian day of given ISO year, week, and day

function n_weeks(weekday, jd, nthweek)
{
    var j = 7 * nthweek;

    if (nthweek > 0) {
        j += previous_weekday(weekday, jd);
    } else {
        j += next_weekday(weekday, jd);
    }
    return j;
}

function iso_to_julian(year, week, day)
{
    return day + n_weeks(0, gregorian_to_jd(year - 1, 12, 28), week);
}

//  JD_TO_ISO  --  Return array of ISO (year, week, day) for Julian day

function jd_to_iso(jd)
{
    var year, week, day;

    year = jd_to_gregorian(jd - 3)[0];
    if (jd >= iso_to_julian(year + 1, 1, 1)) {
        year++;
    }
    week = Math.floor((jd - iso_to_julian(year, 1, 1)) / 7) + 1;
    day = jwday(jd);
    if (day == 0) {
        day = 7;
    }
    return new Array(year, week, day);
}

//  ISO_DAY_TO_JULIAN  --  Return Julian day of given ISO year, and day of year

function iso_day_to_julian(year, day)
{
    return (day - 1) + gregorian_to_jd(year, 1, 1);
}

//  JD_TO_ISO_DAY  --  Return array of ISO (year, day_of_year) for Julian day

function jd_to_iso_day(jd)
{
    var year, day;

    year = jd_to_gregorian(jd)[0];
    day = Math.floor(jd - gregorian_to_jd(year, 1, 1)) + 1;
    return new Array(year, day);
}

/*  PAD  --  Pad a string to a given length with a given fill character.  */

function pad(str, howlong, padwith) {
    var s = str.toString();

    while (s.length < howlong) {
        s = padwith + s;
    }
    return s;
}

//  LEAP_ISLAMIC  --  Is a given year a leap year in the Islamic calendar ?

function leap_islamic(year)
{
    return (((year * 11) + 14) % 30) < 11;
}

//  ISLAMIC_TO_JD  --  Determine Julian day from Islamic date

var ISLAMIC_EPOCH = 1948439.5;
var ISLAMIC_WEEKDAYS = new Array("اﻷﺣﺪ", "اﻻﺛﻨﻴﻦ",
                                 "اﻟﺜﻼﺛﺎء", "اﻷرﺑﻌﺎء",
                                 "اﻟﺨﻤﻴس", "اﻟﺠﻤﻌﺔ", "اﻟﺴﺒﺖ");
var ISLAMIC_MONTHS = new Array("محرم", "صفر",
                                 "ربيع الاول", "ربيع الثاني",
                                 "جمادي الاول", "جمادي الثاني", "رجب",
								  "شعبان", "رمضان",
                                 "شوال", "ذي القعده", "ذي الحجه");

function islamic_to_jd(year, month, day)
{
    return (day +
            Math.ceil(29.5 * (month - 1)) +
            (year - 1) * 354 +
            Math.floor((3 + (11 * year)) / 30) +
            ISLAMIC_EPOCH) - 1;
}

//  JD_TO_ISLAMIC  --  Calculate Islamic date from Julian day

function jd_to_islamic(jd)
{
    var year, month, day;

    jd = Math.floor(jd) + 0.5;
    year = Math.floor(((30 * (jd - ISLAMIC_EPOCH)) + 10646) / 10631);
    month = Math.min(12,
                Math.ceil((jd - (29 + islamic_to_jd(year, 1, 1))) / 29.5) + 1);
    day = (jd - islamic_to_jd(year, month, 1)) + 1;
    return new Array(year, month, day);
}

//  LEAP_PERSIAN  --  Is a given year a leap year in the Persian calendar ?

function leap_persian(year)
{
    return ((((((year - ((year > 0) ? 474 : 473)) % 2820) + 474) + 38) * 682) % 2816) < 682;
}

//  PERSIAN_TO_JD  --  Determine Julian day from Persian date

var PERSIAN_EPOCH = 1948320.5;
var PERSIAN_WEEKDAYS = new Array("يک شنبه", "دو شنبه",
                                 "سه شنبه", "چهار شنبه",
                                 "پنج شنبه", "جمعه", "شنبه");
var PERSIAN_MONTHS = new Array("فروردين", "ارديبهشت",
                                 "خرداد", "تير",
                                 "مرداد", "شهريور", "مهر", "آبان",
                                 "آذر", "دي",
                                 "بهمن", "اسفند");
function persian_to_jd(year, month, day)
{
    var epbase, epyear;

    epbase = year - ((year >= 0) ? 474 : 473);
    epyear = 474 + mod(epbase, 2820);
    
    return day +
            ((month <= 7) ?
                ((month - 1) * 31) :
                (((month - 1) * 30) + 6)
            ) +
            Math.floor(((epyear * 682) - 110) / 2816) +
            (epyear - 1) * 365 +
            Math.floor(epbase / 2820) * 1029983 +
            (PERSIAN_EPOCH - 1);
}

function mod(x,y)
{
    return x % y;
}
//  JD_TO_PERSIAN  --  Calculate Persian date from Julian day

function jd_to_persian(jd)
{
    var year, month, day, depoch, cycle, cyear, ycycle,
        aux1, aux2, yday;


    jd = Math.floor(jd) + 0.5;

    depoch = jd - persian_to_jd(475, 1, 1);
    
    cycle = Math.floor(depoch / 1029983);
    cyear = mod(depoch, 1029983);
    if (cyear == 1029982) {
        ycycle = 2820;
    } else {
        aux1 = Math.floor(cyear / 366);
        aux2 = mod(cyear, 366);
        ycycle = Math.floor(((2134 * aux1) + (2816 * aux2) + 2815) / 1028522) +
                    aux1 + 1;
    }
    year = ycycle + (2820 * cycle) + 474;
    if (year <= 0) {
        year--;
    }
    yday = (jd - persian_to_jd(year, 1, 1)) + 1;
    month = (yday <= 186) ? Math.ceil(yday / 31) : Math.ceil((yday - 6) / 30);
    day = (jd - persian_to_jd(year, month, 1)) + 1;
    return new Array(year, month, day);
}

function main()
{showdate();
var i = document.getElementById("cities").selectedIndex;
if(i==0)
return
var m=document.getElementById("azanhighcmsmonth").value;
var d=eval(document.getElementById("azanday").value);
var lg=eval(document.getElementById("longitude").value);
var lat=eval(document.getElementById("latitude").value);
var ep=sun(m,d,4,lg)
var zr=ep[0];
delta=ep[1];
ha=loc2hor(108.0,delta,lat)
var t1=Round(zr-ha,24)
ep=sun(m,d,t1,lg)
zr=ep[0];
delta=ep[1];
ha=loc2hor(108.0,delta,lat)
var t1=Round(zr-ha,24)
document.getElementById("azan_t1").innerHTML=hms(t1);
document.getElementById("azan_ht1").value=hhh(t1);
document.getElementById("azan_mt1").value=mmm(t1);
ep=sun(m,d,6,lg)
zr=ep[0];
delta=ep[1];
ha=loc2hor(90.833,delta,lat)
var t2=Round(zr-ha,24)
ep=sun(m,d,t2,lg)
zr=ep[0];
delta=ep[1];
ha=loc2hor(90.833,delta,lat)
t2=Round(zr-ha,24)

document.getElementById("azan_t2").innerHTML=hms(t2);
document.getElementById("azan_ht2").value=hhh(t2);
document.getElementById("azan_mt2").value=mmm(t2);
ep=sun(m,d,12,lg)
ep=sun(m,d,ep[0],lg)
zr=ep[0];
document.getElementById("azan_t3").innerHTML=hms(zr);
document.getElementById("azan_ht3").value=hhh(zr);
document.getElementById("azan_mt3").value=mmm(zr);
ep=sun(m,d,18,lg)
zr=ep[0];
delta=ep[1];
ha=loc2hor(90.833,delta,lat)
var t3=Round(zr+ha,24)
ep=sun(m,d,t3,lg)
zr=ep[0];
delta=ep[1];
ha=loc2hor(90.833,delta,lat)
t3=Round(zr+ha,24)
document.getElementById("azan_t4").innerHTML=hms(t3);
document.getElementById("azan_ht4").value=hhh(t3);
document.getElementById("azan_mt4").value=mmm(t3);
ep=sun(m,d,18.5,lg)
zr=ep[0];
delta=ep[1];
ha=loc2hor(94.3,delta,lat)
var t4=Round(zr+ha,24)
ep=sun(m,d,t4,lg)
zr=ep[0];
delta=ep[1];
ha=loc2hor(94.3,delta,lat)
t4=Round(zr+ha,24)
document.getElementById("azan_t5").innerHTML=hms(t4);
document.getElementById("azan_ht5").value=hhh(t4);
document.getElementById("azan_mt5").value=mmm(t4);
var t5=t2;
ep=sun(m,d,12,lg)
ep=sun(m,d,ep[0],lg)
zr=ep[0];
zr = zr + 11.25;
document.getElementById("azan_t6").innerHTML=hms(zr);
document.getElementById("azan_ht6").value=hhh(zr);
document.getElementById("azan_mt6").value=mmm(zr);
setTimeout("main()",60000);
if (fihgd==0){shownow();}
}
function sun(m,d,h,lg)
{
if(m<7)
d= 31*(m-1)+d+h/24;
else
d=6+30*(m-1)+d+h/24;
var M=74.2023+0.98560026*d;
var L=-2.75043+0.98564735*d;
var lst=8.3162159+0.065709824*Math.floor(d)+1.00273791*24*(d%1)+lg/15;
var e=0.0167065;
var omega=4.85131-0.052954*d;
var ep=23.4384717+0.00256*cosd(omega);
var ed=180.0/Math.PI*e;
var u=M;
for(var i=1;i<5;i++)
u=u-(u-ed*sind(u)-M)/(1-e*cosd(u));
var v=2*atand(tand(u/2)*Math.sqrt((1+e)/(1-e)));
var theta=L+v-M-0.00569-0.00479*sind(omega);
var delta=asind(sind(ep)*sind(theta));
var alpha=180.0/Math.PI*Math.atan2(cosd(ep)*sind(theta),cosd(theta));
if(alpha>=360)
alpha-=360;
var ha=lst-alpha/15;
var zr=Round(h-ha,24);
return ([zr,delta])
}
function init()
{
lgs= [0,49.70,48.30,45.07,51.64,48.68,46.42,57.33,56.29,50.84,59.21,46.28,51.41,48.34,49.59,60.86,48.50,53.06,53.39,47.00,50.86,52.52,50.00,50.88,57.06,47.09,54.44,59.58,48.52,51.59,54.35];
lats=[0,34.09,38.25,37.55,32.68,31.32,33.64,37.47,27.19,28.97,32.86,38.08,35.70,33.46,37.28,29.50,36.68,36.57,35.58,35.31,32.33,29.62,36.28,34.64,30.29,34.34,36.84,36.31,34.80,30.67,31.89];
}
function coord()
{
var c=document.getElementById("cities");
var i = c.selectedIndex;
if(i==0)
{
document.getElementById("longitude").value="";
document.getElementById("latitude").value="";
}
else
{
document.getElementById("longitude").value=lgs[i].toString()
document.getElementById("latitude").value=lats[i].toString()
}
}
function sind(x){return(Math.sin(Math.PI/180.0*x));}
function cosd(x){return(Math.cos(Math.PI/180.0*x));}
function tand(x){return(Math.tan(Math.PI/180.0*x));}
function atand(x){return(Math.atan(x)*180.0/Math.PI);}
function asind(x){return(Math.asin(x)*180.0/Math.PI);}
function acosd(x){return(Math.acos(x)*180.0/Math.PI);}
function sqrt(x){return(Math.sqrt(x));}
function frac(x){return(x%1);}
function floor(x){return(Math.floor(x));}
function ceil(x){return(Math.ceil(x));}
function loc2hor(z,d,p){
return(acosd((cosd(z)-sind(d)*sind(p))/cosd(d)/cosd(p))/15);
}
function Round(x,a){
var tmp=x%a;
if(tmp<0)
tmp+=a;
return(tmp)
}
function hms(x)
{
x=Math.floor(3600*x);
	h=Math.floor(x/3600);
	mp=x-3600*h;
	m=Math.floor(mp/60);
	s=Math.floor(mp-60*m);
	var Month=GetMonth ();
	if (Month >=1 && Month<=6)
		h++;
	return(((h>=24)? "00":((h<10)? "0" : "")+h.toString())+":"+((m<10)? "0" : "")+m.toString()+":"+((s<10)? "0" : "")+s.toString())
}

function hhh(x)
{
	x=Math.floor(3600*x);
	h=Math.floor(x/3600);
	mp=x-3600*h;
	m=Math.floor(mp/60);
	s=Math.floor(mp-60*m);
	var Month=GetMonth ();
	if (Month >=1 && Month<=6)
		h++;
	return(((h<10)? "0" : "")+h.toString())
}

function mmm(x)
{
	x=Math.floor(3600*x);
	h=Math.floor(x/3600);
	mp=x-3600*h;
	m=Math.floor(mp/60);
	s=Math.floor(mp-60*m);
	return(((m<10)? "0" : "")+m.toString())
}



function offshownow()
{
document.getElementById("azan_p1").src= Path + "/DeskTopModules/Prayer/Images/arrow.png"
document.getElementById("azan_p2").src=Path + "/DeskTopModules/Prayer/Images/arrow.png"
document.getElementById("azan_p3").src=Path + "/DeskTopModules/Prayer/Images/arrow.png"
document.getElementById("azan_p4").src=Path + "/DeskTopModules/Prayer/Images/arrow.png"
document.getElementById("azan_p5").src=Path + "/DeskTopModules/Prayer/Images/arrow.png"
document.getElementById("azan_p6").src=Path + "/DeskTopModules/Prayer/Images/arrow.png"
}

function SetPersian()
{
    var j, year, mon, mday, hour, min, sec,
        weekday, julcal, hebcal, islcal, hmindex, utime, isoweek,
        may_countcal, mayhaabcal, maytzolkincal, bahcal, frrcal,
        indcal, isoday, xgregcal;
    today = new Date( ); 
    year = new Number(Year);
    mon =  new Number(Month);
    mday = new Number(Day);
    //hour = min = sec = 0;
    //hour = new Number(today.getHours ());
    //min = new Number(today.getMinutes ());
    //sec = new Number(today.getSeconds ());

    //  Update Julian day

    j = gregorian_to_jd(year, mon, mday) ;//+ ((sec + 60 * (min + 60 * hour)) / 86400.0);
    //  Update day of week in Gregorian box

    weekday = jwday(j);
    perscal = jd_to_persian (j);
    //document.persian.wday.value = PERSIAN_WEEKDAYS[weekday];
    //document.persian.leap.value = NormLeap[leap_persian(perscal[0]) ? 1 : 0];
    return PERSIAN_WEEKDAYS[weekday] + " " + perscal[2] + " " + PERSIAN_MONTHS[perscal[1]-1] + " " + perscal[0];
}
function GetMonth()
{
	var today = new Date( ); 
    var year = new Number(today.getFullYear ());
    var mon =  new Number(today.getMonth ());
    var mday = new Number(today.getDate());
	var j = gregorian_to_jd(year, mon +1, mday) ;
	var perscal = jd_to_persian (j);
	return perscal[1];
}
function SetIslamic()
{
    var j, year, mon, mday, hour, min, sec,
        weekday, julcal, hebcal, islcal, hmindex, utime, isoweek,
        may_countcal, mayhaabcal, maytzolkincal, bahcal, frrcal,
        indcal, isoday, xgregcal;
    today = new Date( ); 
    year = new Number(today.getFullYear ());
    mon =  new Number(today.getMonth ());
    mday = new Number(today.getDate());
    hour = min = sec = 0;
    hour = new Number(today.getHours ());
    min = new Number(today.getMinutes ());
    sec = new Number(today.getSeconds ());

    //  Update Julian day

    j = gregorian_to_jd(year, mon +1, mday) ;//+ ((sec + 60 * (min + 60 * hour)) / 86400.0);
     
    //  Update day of week in Gregorian box

    weekday = jwday(j);
    perscal = jd_to_islamic (j);
    //document.persian.wday.value = PERSIAN_WEEKDAYS[weekday];
    //document.persian.leap.value = NormLeap[leap_persian(perscal[0]) ? 1 : 0];

    return ISLAMIC_WEEKDAYS[weekday] + " " + perscal[2] + " " + ISLAMIC_MONTHS[perscal[1]-1] + " " + perscal[0];
}
function shownow()
{
fihgd=1;
var zones = new Array ('Iran, Islamic Republic of - Tehran',12600000,16200000,Date.UTC(2005,2,21,20,30,0),Date.UTC(2005,8,21,19,30,0));
Sec = Math.floor (Sec ) +1 ;
var H = Hour;
if (Sec == 60)
    {
        Sec =0;
        Min = Math.floor (Min) + 1 ;
    }
if (Min == 60)
    {
        Min = 0;
        Hour = Math.floor (Hour) + 1 ;
    }
if (Hour >= 12)
    {
        H = Math.floor (Hour) - 12 ;
    }   
if (Hour == 24)
    {
        Hour = 0 ;
    }
var t = H + ":" + Min + ":" + Sec + " " + S ;
today = new Date();
azan_ttt = new Date();
azan_ttt.setFullYear (Year,Month-1,Day);
today.setFullYear (Year,Month-1,Day);
today.setHours (Hour ,Min ,Sec );
azan_ttt.setHours(document.getElementById("azan_ht1").value);
azan_ttt.setMinutes(document.getElementById("azan_mt1").value);
azan_ttt.setSeconds (Sec);
document.getElementById("date1").innerHTML="<font color=#000000>" + SetPersian() + "</font>";
document.getElementById("Time").innerHTML="<font color=#000000>"+  t +"</font>";
//document.getElementById("Time").innerHTML="<font color=#000000>"+ today.toLocaleTimeString (); +"</font>";
if (   azan_ttt.getTime( ) - today.getTime( )>20  ) 
    {
	    if (lastst!=1)
	        {
		        offshownow();
		        document.getElementById("azan_p1").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
		        lastst=1;
            }   
        diff = azan_ttt.getTime( ) - today.getTime( );
        diff = Math.floor(diff / (1000 * 60 ));
        hh= Math.floor(diff / ( 60 ));
        ss=diff-(hh * 60) ;
        document.getElementById("azanazan").innerHTML="<font color=#FF0000>" + hh + "</font><font color=#FF0000 id=donokh>:</font><font color=#FF0000>" + ss + "</font> &#1605;&#1575;&#1606;&#1583;&#1607; &#1578;&#1575; <font color=#FF0000>&#1575;&#1584;&#1575;&#1606; &#1589;&#1576;&#1581;</font>";
        donokh_show();
    }
else
    {
        if (    azan_ttt.getTime( ) - today.getTime( )<20 && azan_ttt.getTime( ) - today.getTime( )>-1   ) 
            {
                if (lastst!=1)
                    {
		                offshownow();
		                document.getElementById("azan_p1").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
		                lastst=1;
	                 }
	            document.getElementById("azanazan").innerHTML="<font color=#FF0000 id=donokh></font><font color=#FF0000>&#1575;&#1584;&#1575;&#1606; &#1589;&#1576;&#1581; &#1576;&#1607; &#1575;&#1601;&#1602; " + document.getElementById("cities").value + "</font>";
			    //document.getElementById("pazanbox").innerHTML="&#1575;&#1584;&#1575;&#1606; &#1589;&#1576;&#1581; &#1576;&#1607; &#1575;&#1601;&#1602; " + document.getElementById("cities").value ;
			    //if (document.getElementById('pzpzpz').style.display=="none"){	pz();}
            }
        else
            {
                today = new Date();
                today.setFullYear (Year,Month-1,Day);
                today.setHours (Hour ,Min ,Sec );
                azan_ttt = new Date( );
                azan_ttt.setFullYear (Year,Month-1,Day);  
                azan_ttt.setHours(document.getElementById("azan_ht2").value);     
                azan_ttt.setMinutes(document.getElementById("azan_mt2").value);
                azan_ttt.setSeconds (Sec); 
                if (   azan_ttt.getTime( ) - today.getTime( )>20  ) 
                    {
	                    if (lastst!=2)
	                        {
		                        offshownow();
		                        document.getElementById("azan_p2").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
		                        lastst=2;
	                        }  
	                    diff = azan_ttt.getTime( ) - today.getTime( );
	                    diff = Math.floor(diff / (1000 * 60 ));
	                    hh= Math.floor(diff / ( 60 ));
	                    ss=diff-(hh * 60) ;
	                    document.getElementById("azanazan").innerHTML="<font color=#FF0000>" + hh + "</font><font color=#FF0000 id=donokh>:</font><font color=#FF0000>" + ss + "</font> &#1605;&#1575;&#1606;&#1583;&#1607; &#1578;&#1575; <font color=#FF0000>&#1591;&#1604;&#1608;&#1593; &#1582;&#1608;&#1585;&#1588;&#1740;&#1583;</font>";
	                    donokh_show();
                    }
                else
                    {
                        if (    azan_ttt.getTime( ) - today.getTime( )<20 && azan_ttt.getTime( ) - today.getTime( )>-1   ) 
                            {
	                            if (lastst!=2)
	                                {
		                                offshownow();
		                                document.getElementById("azan_p2").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
		                                lastst=2;
	                                 }
	                            document.getElementById("azanazan").innerHTML="<font color=#FF0000 id=donokh></font><font color=#FF0000>&#1591;&#1604;&#1608;&#1593; &#1582;&#1608;&#1585;&#1588;&#1740;&#1583;</font>";
                            }
                        else
                            {
                                today = new Date();
                                today.setFullYear (Year,Month-1,Day);
                                today.setHours (Hour ,Min ,Sec );
					            azan_ttt = new Date( ); 
					            azan_ttt.setFullYear (Year,Month-1,Day); 
					            azan_ttt.setHours(document.getElementById("azan_ht3").value);     
					            azan_ttt.setMinutes(document.getElementById("azan_mt3").value);
					            azan_ttt.setSeconds (Sec); 
					            if (   azan_ttt.getTime( ) - today.getTime( )>20  ) 
					                {
						                if (lastst!=3)
						                    {
							                    offshownow();
							                    document.getElementById("azan_p3").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
							                    lastst=3;
						                    }
					                    diff = azan_ttt.getTime( ) - today.getTime( );	
					                    diff = Math.floor(diff / (1000 * 60 ));
					                    hh= Math.floor(diff / ( 60 ));
					                    ss=diff-(hh * 60) ;
						                document.getElementById("azanazan").innerHTML="<font color=#FF0000>" + hh + "</font><font color=#FF0000 id=donokh>:</font><font color=#FF0000>" + ss + "</font> &#1605;&#1575;&#1606;&#1583;&#1607; &#1578;&#1575; <font color=#FF0000>&#1575;&#1584;&#1575;&#1606; &#1592;&#1607;&#1585;</font>";
					                    donokh_show();
					                }	
					            else
						            {
						                if (    azan_ttt.getTime( ) - today.getTime( )<20 && azan_ttt.getTime( ) - today.getTime( )>-1   ) 
						                    {
							                    if (lastst!=3)
							                        {
								                        offshownow();
								                        document.getElementById("azan_p3").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
								                        lastst=3;
							                        }
							                    document.getElementById("azanazan").innerHTML="<font color=#FF0000 id=donokh></font><font color=#FF0000>&#1575;&#1584;&#1575;&#1606; &#1592;&#1607;&#1585; &#1576;&#1607; &#1575;&#1601;&#1602; " + document.getElementById("cities").value + "</font>";	
										        //document.getElementById("pazanbox").innerHTML="&#1575;&#1584;&#1575;&#1606; &#1592;&#1607;&#1585; &#1576;&#1607; &#1575;&#1601;&#1602; " + document.getElementById("cities").value ;
										        //if (document.getElementById('pzpzpz').style.display=="none"){	pz();}	
						                    }		
						                else
							                {   
							                    today = new Date();
							                    today.setFullYear (Year,Month-1,Day);
                                                today.setHours (Hour ,Min ,Sec );
							                    azan_ttt = new Date( ); 
							                    azan_ttt.setFullYear (Year,Month-1,Day); 
						                        azan_ttt.setHours(document.getElementById("azan_ht4").value);     
						                        azan_ttt.setMinutes(document.getElementById("azan_mt4").value); 
						                        azan_ttt.setSeconds (Sec);
						                        //alert(azan_ttt.getTime( ) - today.getTime( ));
						                        if (   azan_ttt.getTime( ) - today.getTime( )>20  ) 
							                        {
								                        if (lastst!=4)
								                            {
								                            	offshownow();
								                            	document.getElementById("azan_p4").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
								                            	lastst=4;
								                            }
						                            	diff = azan_ttt.getTime( ) - today.getTime( );
						                            	diff = Math.floor(diff / (1000 * 60 ));
						                            	hh= Math.floor(diff / ( 60 ));
						                            	ss=diff-(hh * 60) ;
								                        document.getElementById("azanazan").innerHTML="<font color=#FF0000>" + hh + "</font><font color=#FF0000 id=donokh>:</font><font color=#FF0000>" + ss + "</font> &#1605;&#1575;&#1606;&#1583;&#1607; &#1578;&#1575; <font color=#FF0000>&#1594;&#1585;&#1608;&#1576; &#1582;&#1608;&#1585;&#1588;&#1740;&#1583;</font>";
							                            donokh_show();
							                        }
							                    else
								                    {
								                        if (    azan_ttt.getTime( ) - today.getTime( )<20 && azan_ttt.getTime( ) - today.getTime( )>-1   ) 
								                            {
									                            if (lastst!=4)
									                                {
									                                	offshownow();
									                                	document.getElementById("azan_p4").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
									                                	lastst=4;
									                                }
									                            document.getElementById("azanazan").innerHTML="<font color=#FF0000 id=donokh></font><font color=#FF0000>&#1594;&#1585;&#1608;&#1576; &#1582;&#1608;&#1585;&#1588;&#1740;&#1583;</font>";
								                            }
								                        else
									                        {
									                            today = new Date();
									                            today.setFullYear (Year,Month-1,Day);
                                                                today.setHours (Hour ,Min ,Sec );
									                            azan_ttt = new Date( );
									                            azan_ttt.setFullYear (Year,Month-1,Day);  
								                            	azan_ttt.setHours(document.getElementById("azan_ht5").value);     
								                            	azan_ttt.setMinutes(document.getElementById("azan_mt5").value);
								                            	azan_ttt.setSeconds (Sec); 
									                            if (   azan_ttt.getTime( ) - today.getTime( )>20  ) 
									                                {
										                                if (lastst!=5)
										                                    {
										                                    	offshownow();
										                                    	document.getElementById("azan_p5").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
										                                    	lastst=5;
										                                    }
									                                    diff = azan_ttt.getTime( ) - today.getTime( );
								                                    	diff = Math.floor(diff / (1000 * 60 ));
								                                    	hh= Math.floor(diff / ( 60 ));
								                                    	ss=diff-(hh * 60); 
								                                    	document.getElementById("azanazan").innerHTML="<font color=#FF0000>" + hh + "</font><font color=#FF0000 id=donokh>:</font><font color=#FF0000>" + ss + "</font> &#1605;&#1575;&#1606;&#1583;&#1607; &#1578;&#1575; <font color=#FF0000>&#1575;&#1584;&#1575;&#1606; &#1605;&#1594;&#1585;&#1576;</font>";
								                                    	donokh_show();
									                                }
									                            else
										                            {
									                                	if (    azan_ttt.getTime( ) - today.getTime( )<20 && azan_ttt.getTime( ) - today.getTime( )>-1   ) 
									                                	    {
									                                		    if (lastst!=5)
									                                		        {
									                                		        	offshownow();
									                                		        	document.getElementById("azan_p5").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
									                                		        	lastst=5;
									                                		        }
									                                		document.getElementById("azanazan").innerHTML="<font color=#FF0000 id=donokh></font><font color=#FF0000>&#1575;&#1584;&#1575;&#1606; &#1605;&#1594;&#1585;&#1576; &#1576;&#1607; &#1575;&#1601;&#1602; " + document.getElementById("cities").value + "</font>";
									                                		
									                                		//document.getElementById("pazanbox").innerHTML="&#1575;&#1584;&#1575;&#1606; &#1605;&#1594;&#1585;&#1576; &#1576;&#1607; &#1575;&#1601;&#1602; " + document.getElementById("cities").value ;
									                                		//if (document.getElementById('pzpzpz').style.display=="none"){	pz();}	
									                                        }
									                                        
									                                     else
									                                        {
									                                            today = new Date();
									                                            today.setFullYear (Year,Month-1,Day);
                                                                                today.setHours (Hour ,Min ,Sec );
									                                            azan_ttt = new Date( );
									                                            azan_ttt.setFullYear (Year,Month-1,Day);  
								                            	                azan_ttt.setHours(document.getElementById("azan_ht6").value);     
								                            	                azan_ttt.setMinutes(document.getElementById("azan_mt6").value); 
								                            	                azan_ttt.setSeconds (Sec);
									                                            if (   azan_ttt.getTime( ) - today.getTime( )>20  ) 
									                                                {
										                                                if (lastst!=6)
										                                                    {
										                                    	                offshownow();
										                                    	                document.getElementById("azan_p6").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
										                                    	                lastst=6;
										                                                    }
									                                                    diff = azan_ttt.getTime( ) - today.getTime( );
								                                    	                diff = Math.floor(diff / (1000 * 60 ));
								                                    	                hh= Math.floor(diff / ( 60 ));
								                                    	                ss=diff-(hh * 60); 
								                                    	                document.getElementById("azanazan").innerHTML="<font color=#FF0000>" + hh + "</font><font color=#FF0000 id=donokh>:</font><font color=#FF0000>" + ss + "</font> &#1605;&#1575;&#1606;&#1583;&#1607; &#1578;&#1575; <font color=#FF0000>نیمه شب شرعی</font>";
								                                    	                donokh_show();
									                                                }
									                                            else
										                                            {
									                                	                if (    azan_ttt.getTime( ) - today.getTime( )<20 && azan_ttt.getTime( ) - today.getTime( )>-1   ) 
									                                	                    {
									                                		                    if (lastst!=6)
									                                		                        {
									                                		        	                offshownow();
									                                		        	                document.getElementById("azan_p6").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
									                                		        	                lastst=6;
									                                		                        }
									                                		                    document.getElementById("azanazan").innerHTML="<font color=#FF0000 id=donokh></font><font color=#FF0000>نیمه شب شرعی</font>";
									                                	                    	//document.getElementById("pazanbox").innerHTML="&#1575;&#1584;&#1575;&#1606; &#1605;&#1594;&#1585;&#1576; &#1576;&#1607; &#1575;&#1601;&#1602; " + document.getElementById("cities").value ;
									                                	                    	//if (document.getElementById('pzpzpz').style.display=="none"){	pz();}	
									                                                        }
										                                                else
											                                                {
											                                                    today = new Date();
											                                                    today.setFullYear (Year,Month-1,Day);
                                                                                                today.setHours (Hour ,Min ,Sec );
										                                                    	azan_ttt = new Date( ); 
										                                                    	azan_ttt.setFullYear (Year,Month-1,Day); 
										                                                    	azan_ttt.setSeconds (Sec);
										                                                    	azan_ttt.setHours(23);     
										                                                    	azan_ttt.setMinutes(59); 
										                                                    	diff = azan_ttt.getTime( ) - today.getTime( );
										                                                    	diff = Math.floor(diff / (1000 * 60 ));
										                                                    	hh= Math.floor(diff / ( 60 ));
										                                                    	ss=diff-(hh * 60) ;
												                                                if (lastst!=1)
												                                                    {
												                                                        offshownow();
												                                                        document.getElementById("azan_p1").src=Path + "/DeskTopModules/Prayer/Images/arrow.gif";
												                                                        lastst=1;
												                                                     }
										                                                    	hh+=Math.floor(document.getElementById("azan_ht1").value);
										                                                    	ss+=Math.floor(document.getElementById("azan_mt1").value);
												                                                document.getElementById("azanazan").innerHTML="<font color=#FF0000>" + hh + "</font><font color=#FF0000 id=donokh>:</font><font color=#FF0000>" + ss + "</font> &#1605;&#1575;&#1606;&#1583;&#1607; &#1578;&#1575; <font color=#FF0000>&#1575;&#1584;&#1575;&#1606; &#1589;&#1576;&#1581;</font>";
											                                                    donokh_show();
                                                                                            }              
                                                                                    }
                                                                             }
                                                                    }
                                                            }
                                                    }
                                            }
                                    }
                            }
                    }
            }
    }
    setTimeout("shownow()",1000);
}


function donokh_show()
{
//document.getElementById("donokh").color="#FF0000"
//setTimeout("donokh_hide()",500);
}
function donokh_hide()
{
//document.getElementById("donokh").color="#FFFFFF"
//setTimeout("donokh_show()",500);
}
document.write("<div style ='text-align:center'>");
document.write("<input type=hidden id=latitude  name=latitude><input id=azanday type=hidden name=azanday><input id=azanhighcmsmonth type=hidden name=azanhighcmsmonth><input  type=hidden id=longitude name=longitude ><input type=hidden id=azan_ht1 name=azan_ht1 ><input type=hidden id=azan_mt1 name=azan_mt1 ><input type=hidden id=azan_ht2 name=azan_ht2 ><input type=hidden id=azan_mt2 name=azan_mt2 ><input type=hidden id=azan_ht3 name=azan_ht3 ><input type=hidden id=azan_mt3 name=azan_mt3 ><input type=hidden id=azan_ht4 name=azan_ht4 ><input type=hidden id=azan_mt4 name=azan_mt4 ><input type=hidden id=azan_ht5 name=azan_ht5 ><input type=hidden id=azan_mt5 name=azan_mt5 ><input type=hidden id=azan_ht6 name=azan_ht6 ><input type=hidden id=azan_mt6 name=azan_mt6>")
document.write("<table border=0 width=151 style='font-family: Tahoma; font-size: 8pt' dir=rtl height=30><tr align =center valign =middle>	<td align=center><span id=Time></span></td></tr>	</table>")
document.write("<table border=0 width=151 style='font-family: Tahoma; font-size: 8pt' dir=rtl height=30><tr align =center valign =middle>	<td align=center><span id=date1></span></td></tr>	</table>")
document.write("<table border=0 width=151 style='font-family: Tahoma; font-size: 8pt' dir=rtl height=30><tr align =center valign =middle>	<td align=center><span id=azanazan></span>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>	</table>")
document.write("<table border=0 width=156 style='font-family: Tahoma; font-size: 8pt'><tr><td align=center id=azan_t1>&nbsp;</td><td dir=rtl width=58%>	<img border=0 src=images/arrs.gif width=10 height=7 id=azan_p1> <span>&#1575;&#1584;&#1575;&#1606; &#1589;&#1576;&#1581;</span></td></tr><tr><td align=center id=azan_t2>&nbsp;</td><td dir=rtl width=58%><img border=0 src=images/arrs.gif width=10 height=7 id=azan_p2> <span>&#1591;&#1604;&#1608;&#1593; &#1582;&#1608;&#1585;&#1588;&#1740;&#1583;</span></td>	</tr><tr><td align=center id=azan_t3>&nbsp;</td><td dir=rtl width=58%><img border=0 src=images/arrs.gif width=10 height=7 id=azan_p3> <span>&#1575;&#1584;&#1575;&#1606; &#1592;&#1607;&#1585;</span></td></tr><tr><td align=center id=azan_t4>&nbsp;</td><td dir=rtl width=58%><img border=0 src=images/arrs.gif width=10 height=7 id=azan_p4>	 <span>&#1594;&#1585;&#1608;&#1576; &#1582;&#1608;&#1585;&#1588;&#1740;&#1583;</span></td></tr><tr><td align=center id=azan_t5>&nbsp;</td><td dir=rtl width=58%><img border=0 src=images/arrs.gif width=10 height=7 id=azan_p5> 	<span>&#1575;&#1584;&#1575;&#1606; &#1605;&#1594;&#1585;&#1576;</span></td></tr>    <tr><td align=center id=azan_t6>&nbsp;</td><td dir=rtl width=65%><img border=0 src=images/arrs.gif width=10 height=7 id=azan_p6> 	<span>نیمه شب شرعی</span></td></tr></table>")
document.write("<table border=0 width=150 cellspacing=0 cellpadding=0 style='font-family: Tahoma; font-size: 8pt' dir='rtl' height=30><tr>	<td align=center><span>&#1575;&#1608;&#1602;&#1575;&#1578; &#1576;&#1607; &#1575;&#1601;&#1602; : <select id=cities size=1 name=c dir=rtl style='font-family: Tahoma; font-size: 8pt; width: 69; height: 19' onchange='coord();main();'><option value=''>&#1575;&#1606;&#1578;&#1582;&#1575;&#1576; &#1588;&#1607;&#1585;</option><option value='&#1575;&#1585;&#1575;&#1705;'>&#1575;&#1585;&#1575;&#1705;</option><option value='&#1575;&#1585;&#1583;&#1576;&#1740;&#1604;'>&#1575;&#1585;&#1583;&#1576;&#1740;&#1604;</option><option value='&#1575;&#1585;&#1608;&#1605;&#1740;&#1607;'>&#1575;&#1585;&#1608;&#1605;&#1740;&#1607;</option><option value='&#1575;&#1589;&#1601;&#1607;&#1575;&#1606;'>&#1575;&#1589;&#1601;&#1607;&#1575;&#1606;</option><option value='&#1575;&#1607;&#1608;&#1575;&#1586;'>&#1575;&#1607;&#1608;&#1575;&#1586;</option><option value='&#1575;&#1740;&#1604;&#1575;&#1605;'>&#1575;&#1740;&#1604;&#1575;&#1605;</option><option value='&#1576;&#1580;&#1606;&#1608;&#1585;&#1583;'>&#1576;&#1580;&#1606;&#1608;&#1585;&#1583;</option>	<option value='&#1576;&#1606;&#1583;&#1585;&#1593;&#1576;&#1575;&#1587;'>&#1576;&#1606;&#1583;&#1585;&#1593;&#1576;&#1575;&#1587;</option><option value='&#1576;&#1608;&#1588;&#1607;&#1585;'>&#1576;&#1608;&#1588;&#1607;&#1585;</option><option value='&#1576;&#1740;&#1585;&#1580;&#1606;&#1583;'>&#1576;&#1740;&#1585;&#1580;&#1606;&#1583;</option><option value='&#1578;&#1576;&#1585;&#1740;&#1586;'>&#1578;&#1576;&#1585;&#1740;&#1586;</option><option value='&#1578;&#1607;&#1585;&#1575;&#1606;'>&#1578;&#1607;&#1585;&#1575;&#1606;</option><option value='&#1582;&#1585;&#1605; &#1570;&#1576;&#1575;&#1583;'>&#1582;&#1585;&#1605; &#1570;&#1576;&#1575;&#1583;</option><option value='&#1585;&#1588;&#1578;'>&#1585;&#1588;&#1578;</option><option value='&#1586;&#1575;&#1607;&#1583;&#1575;&#1606;'>&#1586;&#1575;&#1607;&#1583;&#1575;&#1606;</option><option value='&#1586;&#1606;&#1580;&#1575;&#1606;'>&#1586;&#1606;&#1580;&#1575;&#1606;</option><option value='&#1587;&#1575;&#1585;&#1740;'>&#1587;&#1575;&#1585;&#1740;</option><option value='&#1587;&#1605;&#1606;&#1575;&#1606;'>&#1587;&#1605;&#1606;&#1575;&#1606;</option><option value='&#1587;&#1606;&#1606;&#1583;&#1580;'>&#1587;&#1606;&#1606;&#1583;&#1580;</option><option value='&#1588;&#1607;&#1585;&#1705;&#1585;&#1583;'>&#1588;&#1607;&#1585;&#1705;&#1585;&#1583;</option><option value='&#1588;&#1740;&#1585;&#1575;&#1586;'>&#1588;&#1740;&#1585;&#1575;&#1586;</option><option value='&#1602;&#1586;&#1608;&#1740;&#1606;'>&#1602;&#1586;&#1608;&#1740;&#1606;</option><option value='&#1602;&#1605;'>&#1602;&#1605;</option><option value='&#1705;&#1585;&#1605;&#1575;&#1606;'>&#1705;&#1585;&#1605;&#1575;&#1606;</option>	<option value='&#1705;&#1585;&#1605;&#1575;&#1606;&#1588;&#1575;&#1607;'>&#1705;&#1585;&#1605;&#1575;&#1606;&#1588;&#1575;&#1607;</option><option value='&#1711;&#1585;&#1711;&#1575;&#1606;'>&#1711;&#1585;&#1711;&#1575;&#1606;</option><option value='&#1605;&#1588;&#1607;&#1583;'>&#1605;&#1588;&#1607;&#1583;</option><option value='&#1607;&#1605;&#1583;&#1575;&#1606;'>&#1607;&#1605;&#1583;&#1575;&#1606;</option><option value='&#1740;&#1575;&#1587;&#1608;&#1580;'>&#1740;&#1575;&#1587;&#1608;&#1580;</option><option value='&#1740;&#1586;&#1583;'>&#1740;&#1586;&#1583;</option></select></span>&nbsp;&nbsp;&nbsp; </td></table>")
document.write("</div>");
