// JavaScript Document
//calculates the current time for a specific time zone - mountain standard time's offset is "-7"
function calcTime(offset) {
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000*offset));
return nd;
}
function updateClock ( )
{
var currentTime = calcTime(-6);
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
// Update the time display
document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}
function popitup(url,h,w,name) {
var left = (screen.width)
left=left/2;
left=left-(w/2);
var top=10;
newwindow=window.open(url, name,'height='+h+',width='+w+',top='+top+',left='+left+'');
if (window.focus) {newwindow.focus()}
if (name == "vote")
{
document.vote.target='vote';
document.vote.submit();
document.vote.reset();
}
return false;
}
function SetCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString();
}
function closeMe(value){
document.getElementById("newmessage").style.visibility='hidden';
document.getElementById("newsmessage2").style.visibility='hidden';	
SetCookie('PhotoSundayNew',value,99999);
}


