
function showLocalTime(container,dateCurrent,offsetMinutes){


if (!$("#"+container)){ return  }


$("#"+container).html($("#"+container).html());
$("#nonFormatClock").html($("#nonFormatClock").html());
var servertimestring=dateCurrent;

this.container=container;
this.localtime=this.serverdate=new Date(servertimestring)
//alert(this.serverdate);
this.localtime.setTime(this.serverdate.getTime()+offsetMinutes*60*1000) 
this.updateTime()
this.updateContainer()
}

showLocalTime.prototype.updateTime=function(){
var thisobj=this
this.localtime.setSeconds(this.localtime.getSeconds()+1)
setTimeout(function(){thisobj.updateTime()}, 1000) 
}

showLocalTime.prototype.updateContainer=function(){
var thisobj=this
var cmonth=this.localtime.getMonth();
var cday=formatField(this.localtime.getDate());
var cyear=this.localtime.getFullYear();
var chour=this.localtime.getHours();
var cmin=formatField(this.localtime.getMinutes());
var csec=formatField(this.localtime.getSeconds());

var finalDisplay=cday+" "+formatMonth(cmonth,language_id)+" "+cyear+" "+chour+":"+cmin+":"+csec;
var finalHiddenClock=formatField(cmonth+1)+"/"+cday+"/"+cyear+" "+chour+":"+cmin+":"+csec;

$("#nonFormatClock").html(finalHiddenClock);


$("#"+this.container).html(finalDisplay);

setTimeout(function(){thisobj.updateContainer()}, 1000) 
}

function formatField(num, isHour){
return (num<=9)? "0"+num : num
}
  

function formatMonth(numMonth,language_id){
	if(language_id==1){
	var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	}else{
	var montharray=new Array("Januar","Februar","Marts","April","Maj","Juni","Juli","August","September","October","November","December");
	}
	return montharray[numMonth];
}



function getCountDown(container, lang) {


now = new Date(""+$("#nonFormatClock").html()+"");
y2k = new Date(""+$("#absenteeBidDate").html()+"");

//alert(y2k);

//y2k = y2k.getTime();
//now = now.getTime();


days = (y2k - now) / 1000 / 60 / 60 / 24;

daysRound = Math.floor(days);
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
sec = (secondsRound == 1) ? "s:" : "s";
min = (minutesRound == 1) ? "m:" : "m:";
if(lang=='2'){
	hr = (hoursRound == 1) ? "t:" : "t:";
}
else{
	hr = (hoursRound == 1) ? "h:" : "h:";
}
dy = (daysRound == 1)  ? "d:" : "d:"
var tempDisplayTime="" + daysRound  + dy +""+ hoursRound + hr +""+minutesRound + min+"" + secondsRound + sec;

//alert(tempDisplayTime);
if(tempDisplayTime)
	$("."+container).html(tempDisplayTime);

setTimeout("getCountDown('"+container+"', '"+lang+"');", 1000);
}

