
var timerID = null
var timerRunning = false
function stopclock(){
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function startclock(offset){
    stopclock();
    showtime(offset);
	//alert(offset);
}

function stopclock (){
  if(timerRunning)
  clearTimeout(timerID);
  timerRunning = false
  }
function showtime (offset) {  
//GetObj("clocklocal_sh").innerHTML = calcTime(offset);
clocklocal_sh.innerHTML = calcTime(offset);
//alert(calcTime(offset));
  //timerID = setTimeout("showtime(offset)",200);//一秒钟自校对10次消除跳秒现象
    //timerRunning = true;

  }
function calcTime(offset) {

var Week=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
var Months=new Array("Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec");


var d = new Date();
var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
var now = new Date(utc + (3600000*offset));
  var year = now.getYear();
  var month = now.getMonth();
  var date = now.getDate();
  var day = now.getDay();
  var hours = now.getHours();
  var minutes = now.getMinutes();
  var seconds = now.getSeconds();
  var timeValue = "";
  
  
  timeValue += ((hours > 12) ? hours-12 : hours);
  timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
  //timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
  timeValue += (hours >=12)? "pm" : "am";
  timeValue += ", "+Week[day];
  timeValue += ", "+Months[month];
  timeValue += " "+date+" "+year;
  
  return timeValue;

}

function GetObj(objName) {
	if (document.getElementById) {
		return eval('document.getElementById("' + objName + '")');
	} else {
		return eval('document.all.' + objName);
	}
}

