﻿
var dayarray=new Array("الاحد","الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعه","السبت ")
var montharray=new Array("يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","غسطس","سبتمبر","أكتوبر","نوفبر","ديسمبر")


function getthedate(Zone){
//var s =parseDate("May 25 2005 2:07PM")
var mydate=new Date()

var year=mydate.getUTCFullYear()
if (year < 1000)
year+=1900
var day   = mydate.getUTCDay()
var month = mydate.getUTCMonth()
var daym  = mydate.getUTCDate()
if((daym>4 && daym<=20) || ( daym>24 && daym<=30 ))
{
	daym=daym+"th"
}
else if(daym==1 || daym==21 || daym==31)
{
	daym=daym+"st"
}
else if(daym==2  || daym==22)
{
	daym=daym+"nd"
}
else if(daym==3  || daym==23)
{
	daym=daym+"rd"
}


//if (daym>4 && )
//daym="0"+daym
var hours

if(Zone == 2)
	hours=mydate.getUTCHours() + 04
	//hours=mydate.getUTCHours()
else
	hours=mydate.getUTCHours()

var minutes=mydate.getUTCMinutes()
var seconds=mydate.getUTCSeconds()
var dn="ص"
if (hours>=12)
dn="م"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate

if(Zone == 2)
{
	//month = month + 1
	//cdate="<small><font class='whitecopy'><b>UAE Time : "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn+"</b></font></small>"
	cdate="<small><font class='whitecopy'><b>UAE: "+daym+" "+ montharray[month] + " " +year+", "+hours+":"+minutes+":"+seconds+" "+dn+"</b></font></small>"
}
else
	cdate="<small><font class='whitecopy'><b>GMT: "+hours+":"+minutes+":"+seconds+" "+dn+"</b></font></small>"

if (document.all)
{
	if(Zone == 2)
		document.all.Dubai.innerHTML=cdate
	//else
	//	document.all.clock1.innerHTML=cdate
}
else if (document.getElementById)
{
	if(Zone == 2)
		document.getElementById("Dubai").innerHTML=cdate
	//else
	//	document.getElementById("clock1").innerHTML=cdate
}
else
	document.write(cdate)
}

/*if (!document.all&&!document.getElementById)
{
	alert();
	getthedate(2)
	//getthedate(1)
}*/

function goforit(){

if (document.all||document.getElementById)
{
setInterval("getthedate(2)",1000)
//setInterval("getthedate(1)",1000)
}
}
