function getCurrentTime()
{
    document.write("<span id='spanTime'></span>");
    startclock();
}
function getCurrentDate()
{
	var date = {};
	var day="";
	var month="";
	var ampm="";
	var ampmhour="";
	var myweekday="";
	var year="";
	mydate=new Date();
	myweekday=mydate.getDay();
	mymonth=mydate.getMonth()+1;
	myday= mydate.getDate();
	myyear= mydate.getYear();
    var myMinutes = mydate.getMinutes().toString().length<=1 ? "0" + mydate.getMinutes().toString() : mydate.getMinutes().toString();
	mytime= mydate.getHours() + ":" + myMinutes;
	year=(myyear > 200) ? myyear : 1900 + myyear;
	if(myweekday == 0)
	weekday="星期日";
	else if(myweekday == 1)
	weekday="星期一";
	else if(myweekday == 2)
	weekday="星期二";
	else if(myweekday == 3)
	weekday="星期三";
	else if(myweekday == 4)
	weekday="星期四";
	else if(myweekday == 5)
	weekday="星期五";
	else if(myweekday == 6)
	weekday="星期六";
    date.str = year + "年"+ mymonth+"月"+myday+"日"+weekday;
	date.year=year;
	date.month=mymonth;
	date.date=myday;
	date.day=weekday;
	return date;
}
var timerDate = getCurrentDate().str;
var timerID = null;
var timerRunning = false;
function stopclock ()
{
	if(timerRunning)
	clearTimeout(timerID);
	timerRunning = false;
}
function startclock ()
{
	stopclock();
	showtime();
}
function showtime ()
{
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds();
	var timeValue = "" +((hours >= 12) ? "下午 " : "上午" );
	timeValue += ((hours >12) ? hours -12 :hours);
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
	document.getElementById("spanTime").innerHTML = timerDate+ timeValue;
	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
}

function doJQueryAjax(fm,outputResponse,showFailure,asynFlag)
{
	ajaxFormRequest(fm.action,outputResponse,showFailure,fm,asynFlag);
}

function getLocationHref(){
	return location.href.lastIndexOf('#')==-1?location.href:location.href.substring(0,location.href.length-1)
}

function setHomePage(obj){
	obj.style.behavior='url(#default#homepage)';obj.setHomePage(getLocationHref());
}

function AddFavorite(title){
	window.external.AddFavorite(getLocationHref(),title);
}

function getSelectedByObj(obj)
{	
    var s="";
	if(obj+""=="undefined"){
		return "";
	}
	if(obj.length+""=="undefined")
	    {
	    if(obj.checked)
          return obj.value;
        else
          return "";
        }
    if(obj.length+""!="undefined")
    {
		for(i = 0; i < obj.length; i++)
		{
			if(obj[i].checked){
				if(s=="")
				  s=obj[i].value;
				else
				  s=s+","+obj[i].value;
			}
		}
		return s;
	}
}
