<script language="JavaScript">
function worldClock(zone, region) {
var dst = 0
var time = new Date()
var gmtMS = time.getTime() + (time.getTimezoneOffset() * 60000)
var gmtTime = new Date(gmtMS)
var day = gmtTime.getDate()
var month = gmtTime.getMonth()
var year = gmtTime.getYear()
if (year < 1000) {
year += 1900
}
var monthArray = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec")
var monthDays = new Array("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
if (year % 4 == 0) {
monthDays = new Array("31", "29", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
}
if (year % 100 == 0 && year % 400 != 0) {
monthDays = new Array("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
}
var hr = gmtTime.getHours() + zone
var min = gmtTime.getMinutes()
var sec = gmtTime.getSeconds()
if (hr >= 24) {
hr = hr - 24
day -= -1
}
if (hr < 0) {
hr -= -24
day -= 1
}
if (hr < 10) {
hr = " " + hr
}
if (min < 10) {
min = "0" + min
}
if (sec < 10) {
sec = "0" + sec
}
if (day <= 0) {
if (month == 0) {
month = 11
year -= 1
}
else {
month = month - 1
}
day = monthDays[month]
}
if (day > monthDays[month]) {
day = 1
if (month == 11) {
month = 0
year -= -1
}
else {
month -= -1
}
}
if (region == "NAmerica") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(3)
startDST.setHours(2)
startDST.setDate(1)
var dayDST = startDST.getDay()
if (dayDST != 0) {
startDST.setDate(8 - dayDST)
}
else {
startDST.setDate(1)
}
endDST.setMonth(9)
endDST.setHours(1)
endDST.setDate(31)
dayDST = endDST.getDay()
endDST.setDate(31 - dayDST)
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST && currentTime < endDST) {
dst = 1
}
}
if (region == "Europe") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(2)
startDST.setHours(1)
startDST.setDate(31)
var dayDST = startDST.getDay()
startDST.setDate(31 - dayDST)
endDST.setMonth(9)
endDST.setHours(0)
endDST.setDate(31)
dayDST = endDST.getDay()
endDST.setDate(31 - dayDST)
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST && currentTime < endDST) {
dst = 1
}
}
if (region == "SAmerica") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(9)
startDST.setHours(0)
startDST.setDate(1)
var dayDST = startDST.getDay()
if (dayDST != 0) {
startDST.setDate(22 - dayDST)
}
else {
startDST.setDate(15)
}
endDST.setMonth(1)
endDST.setHours(11)
endDST.setDate(1)
dayDST = endDST.getDay()
if (dayDST != 0) {
endDST.setDate(21 - dayDST)
}
else {
endDST.setDate(14)
}
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST || currentTime < endDST) {
dst = 1
}
}
if (region == "Cairo") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(3)
startDST.setHours(0)
startDST.setDate(30)
var dayDST = startDST.getDay()
if (dayDST < 5) {
startDST.setDate(28 - dayDST)
}
else {
startDST.setDate(35 - dayDST)
}
endDST.setMonth(8)
endDST.setHours(11)
endDST.setDate(30)
dayDST = endDST.getDay()
if (dayDST < 4) {
endDST.setDate(27 - dayDST)
}
else {
endDST.setDate(34 - dayDST)
}
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST && currentTime < endDST) {
dst = 1
}
}
if (region == "Israel") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(3)
startDST.setHours(2)
startDST.setDate(1)
endDST.setMonth(8)
endDST.setHours(2)
endDST.setDate(25)
dayDST = endDST.getDay()
if (dayDST != 0) {
endDST.setDate(32 - dayDST)
}
else {
endDST.setDate(1)
endDST.setMonth(9)
}
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST && currentTime < endDST) {
dst = 1
}
}
if (region == "Beirut") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(2)
startDST.setHours(0)
startDST.setDate(31)
var dayDST = startDST.getDay()
startDST.setDate(31 - dayDST)
endDST.setMonth(9)
endDST.setHours(11)
endDST.setDate(31)
dayDST = endDST.getDay()
endDST.setDate(30 - dayDST)
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST && currentTime < endDST) {
dst = 1
}
}
if (region == "Baghdad") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(3)
startDST.setHours(3)
startDST.setDate(1)
endDST.setMonth(9)
endDST.setHours(3)
endDST.setDate(1)
dayDST = endDST.getDay()
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST && currentTime < endDST) {
dst = 1
}
}
if (region == "Australia") {
var startDST = new Date()
var endDST = new Date()
startDST.setMonth(9)
startDST.setHours(2)
startDST.setDate(31)
var dayDST = startDST.getDay()
startDST.setDate(31 - dayDST)
endDST.setMonth(2)
endDST.setHours(2)
endDST.setDate(31)
dayDST = endDST.getDay()
endDST.setDate(31 - dayDST)
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if (currentTime >= startDST || currentTime < endDST) {
dst = 1
}
}
if (dst == 1) {
hr -= -1
if (hr >= 24) {
hr = hr - 24
day -= -1
}
if (hr < 10) {
hr = " " + hr
}
if (day > monthDays[month]) {
day = 1
if (month == 11) {
month = 0
year -= -1
}
else {
month -= -1
}
}
return monthArray[month] + " " + day + ", " + year + "<br>" + hr + ":" + min + ":" + sec + " DST"
}
else {
var hr1 = hr - 4
var min1=min-30
return monthArray[month] + " " + day + ", " + year + "<br>" + hr1 + ":" + min1 + ":" + sec + "DST"
}
}
function worldClockZone() {
document.getElementById("India").innerHTML = worldClock(10, "Greenwich")
document.getElementById("Chicago").innerHTML = worldClock(-6, "NAmerica")
document.getElementById("Miami").innerHTML = worldClock(-5, "NAmerica")
document.getElementById("Syria").innerHTML = worldClock(2, "Europe")
document.getElementById("Tunisia").innerHTML = worldClock(2, "Europe")
document.getElementById("UK").innerHTML = worldClock(0, "Europe")
document.getElementById("Turkmenistan").innerHTML = worldClock(4, "Europe")
document.getElementById("Algeria").innerHTML = worldClock(0, "Europe")
document.getElementById("Oman").innerHTML = worldClock(4, "Dubai")
document.getElementById("UAE").innerHTML = worldClock(4, "Dubai")
setTimeout("worldClockZone()", 1000)
}
window.onload = worldClockZone;
</script>
<style type="text/css">
.hrow {
font-weight:bold;
color: #C1E97C;
font-family:Verdana;
text-align:center;
color:White;
background-color:#63657B;
font-size:12px;
font-weight:bold;
height:13px;
border: 1px solid #C0C0C0;
}
.hrow td{
padding-top: 0px;
width: 100px;
font-family:Verdana;
height:15px;
}
.hrowft {
width: 100px;
color:Black;
text-align:center;
font-size:12px;
color:Black;
background-color:Silver;
font-size:12px;
font-family:Verdana;
height:100%;
border: 1px solid Black;
}
</style>
<div style=" border-color:Silver">
<table cellspacing="2px" >
<tr class="hrow">
<td>Algeria</td><td >UK</td><td >Syria</td>
<td>Tunisia</td><td style="visibility:hidden;" >Chicago</td>
</tr>
<tr>
<td class="hrowft"><img height="133px" width="105px" id="Img0" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/Algeria.jpg" alt="Loading..."/></td>
<td class="hrowft"><img height="133px" width="105px" id="Img1" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/UK.jpg" alt="Loading..."/></td>
<td class="hrowft"><img height="133px" width="105px" id="Img2" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/Syria.jpg" alt="Loading..."/></td>
<td class="hrowft"><img height="133px" width="105px" id="Img3" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/Tunisia.jpg" alt="Loading..."/></td>
</tr>
<tr>
<td class="hrowft"><span id="Algeria"></span></td>
<td class="hrowft"><span id="UK"></span></td>
<td class="hrowft"><span id="Syria"></span></td>
<td class="hrowft"><span id="Tunisia"></span></td><td style="visibility:hidden;"><span id="Chicago"></span></td>
</tr>
<tr class="hrow">
<td >Oman</td><td >UAE</td><td >Turkmenistan</td>
<td>India</td><td style="visibility:hidden;">Miami</td>
</tr>
<tr>
<td class="hrowft"><img id="Img4" height="133px" width="105px" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/Oman.jpg" alt="Loading..."/></td>
<td class="hrowft" ><img id="Img8" height="133px" width="105px" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/UAE.jpg" alt="Loading..."/></td>
<td class="hrowft"><img id="Img5" height="133px" width="105px" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/Turkmenistan.jpg" alt="Loading..."/></td>
<td class="hrowft"><img id="Img6" height="133px" width="105px" src="http://vdev04aaashjuae:5000/PetrofacBranchImages/India.jpg"alt="Loading..." /></td>
</tr>
<tr>
<td class="hrowft" ><span id="Oman"></span></td>
<td class="hrowft"><span id="UAE"></span></td>
<td class="hrowft"><span id="Turkmenistan"></span></td>
<td class="hrowft"><span id="India"></span></td><td style="visibility:hidden;"><span id="Miami"></span></td>
</tr>
</table>
</div>
No comments:
Post a Comment