function popWaitDiv(strMessage){
	//document.location = "http://www.163.com";
	var msgw,msgh,bordercolor;
	msgw=200;//message width
	msgh=80;//message height
	bordercolor="#336699";
	titlecolor="#99CCFF";
	var sWidth,sHeight;
	// get page width, page height
	var arrayPageSize = getPageSize();
	sWidth = arrayPageSize[0];//document.body.offsetWidth;
	sHeight = arrayPageSize[1];//document.body.offsetHeight;
	// create wait div background
    bgObj = document.createElement("div");
    bgObj.setAttribute('id','bgDiv');
    bgObj.style.position = "absolute";
    bgObj.style.top = "0";
    bgObj.style.background = "#E6E8EC"; //"#777";
    bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
    bgObj.style.opacity = "0.6";
    bgObj.style.left = "0";
    bgObj.style.width = sWidth + "px";   
    bgObj.style.height = sHeight + "px";
    document.body.appendChild(bgObj);
	// create message div of wait div
    var msgObj = document.createElement("div")   
    msgObj.setAttribute("id","msgDiv");   
    msgObj.setAttribute("align","center");   
    msgObj.style.position = "absolute";   
    msgObj.style.background = "white";   
    msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";   
    msgObj.style.border = "1px solid " + bordercolor;   
    msgObj.style.width = msgw + "px";   
    msgObj.style.height = msgh + "px";   
	msgObj.style.top = (document.documentElement.scrollTop + (sHeight-msgh)/2) + "px";   
	msgObj.style.left = (sWidth - msgw)/2 + "px";
	document.body.appendChild(msgObj);
	// create
	var tBr = document.createElement("br");
	var txt = document.createElement("p");   
	txt.style.margin="1em 0"   
	txt.setAttribute("id", "msgTxt");   
	txt.innerHTML = strMessage;
	var tTmg = document.createElement("img");
	tTmg.setAttribute("id", "loadImg");
	tTmg.setAttribute("src", "images/ajax-loader.gif");
	document.getElementById("msgDiv").appendChild(tBr);
	document.getElementById("msgDiv").appendChild(tTmg);
	document.getElementById("msgDiv").appendChild(txt);
}

function removeDiv() {
	if (document.getElementById("msgDiv")) {
		document.body.removeChild(document.getElementById("msgDiv"));
	}
	if (document.getElementById("bgDiv")) {
		document.body.removeChild(document.getElementById("bgDiv"));
	}
}

function getPageScroll(){
  var yScroll;
  if (self.pageYOffset) {
    yScroll = self.pageYOffset;
  } else if (document.documentElement && document.documentElement.scrollTop){   // Explorer 6 Strict
    yScroll = document.documentElement.scrollTop;
  } else if (document.body) {// all other Explorers
    yScroll = document.body.scrollTop;
  }

  arrayPageScroll = new Array('',yScroll) 
  return arrayPageScroll;
}

function getPageSize(){  
  var xScroll, yScroll;  
  if (window.innerHeight && window.scrollMaxY) {  
    xScroll = document.body.scrollWidth;
    yScroll = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    xScroll = document.body.scrollWidth;
    yScroll = document.body.scrollHeight;
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
    xScroll = document.body.offsetWidth;
    yScroll = document.body.offsetHeight;
  }

  var windowWidth, windowHeight;
  if (self.innerHeight) {  // all except Explorer
    windowWidth = self.innerWidth;
    windowHeight = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if (document.body) { // other Explorers
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }  
  
  // for small pages with total height less then height of the viewport
  if(yScroll < windowHeight){
    pageHeight = windowHeight;
  } else { 
    pageHeight = yScroll;
  }

  if(xScroll < windowWidth){  
    pageWidth = windowWidth;
  } else {
    pageWidth = xScroll;
  }

  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
  return arrayPageSize;
}

// convert to number
function intval(v)
{
	v = parseInt(v);
	return isNaN(v) ? 0 : v;
}
// get element info
function getPos(e)
{
	var l = 0;
	var t  = 0;
	var w = intval(e.style.width);
	var h = intval(e.style.height);
	var wb = e.offsetWidth;
	var hb = e.offsetHeight;
	while (e.offsetParent){
		l += e.offsetLeft + (e.currentStyle?intval(e.currentStyle.borderLeftWidth):0);
		t += e.offsetTop  + (e.currentStyle?intval(e.currentStyle.borderTopWidth):0);
		e = e.offsetParent;
	}
	l += e.offsetLeft + (e.currentStyle?intval(e.currentStyle.borderLeftWidth):0);
	t  += e.offsetTop  + (e.currentStyle?intval(e.currentStyle.borderTopWidth):0);
	return {x:l, y:t, w:w, h:h, wb:wb, hb:hb};
}
// get scroll info
function getScroll()
{
	var t, l, w, h;
	if (document.documentElement && document.documentElement.scrollTop) {
		t = document.documentElement.scrollTop;
		l = document.documentElement.scrollLeft;
		w = document.documentElement.scrollWidth;
		h = document.documentElement.scrollHeight;
	} else if (document.body) {
		t = document.body.scrollTop;
		l = document.body.scrollLeft;
		w = document.body.scrollWidth;
		h = document.body.scrollHeight;
	}
	return { t: t, l: l, w: w, h: h };
}
// (Anchor) flatness jump
function scroller(el, duration)
{
	if(typeof el != 'object') { el = document.getElementById(el); }
	if(!el) return;
	var z = this;
	z.el = el;
	z.p = getPos(el);
	z.s = getScroll();
	z.clear = function(){window.clearInterval(z.timer);z.timer=null};
	z.t=(new Date).getTime();
	z.step = function(){
	var t = (new Date).getTime();
	var p = (t - z.t) / duration;
	if (t >= duration + z.t) {
		z.clear();
		window.setTimeout(function(){z.scroll(z.p.y, z.p.x)},13);
	} else {
		st = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.y-z.s.t) + z.s.t;
		sl = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.x-z.s.l) + z.s.l;
		z.scroll(st, sl);
	}
	};
	z.scroll = function (t, l){window.scrollTo(l, t)};
	z.timer = window.setInterval(function(){z.step();},13);
}

// ====================================== date selector begin ======================================= //
function DateSelector(selYear, selMonth, selDay)
{
    this.selYear = selYear;
    this.selMonth = selMonth;
    this.selDay = selDay;
    this.selYear.Group = this;
    this.selMonth.Group = this;
    // add onchange event to year,month
    if(window.document.all != null) // IE
    {
        this.selYear.attachEvent("onchange", DateSelector.OnYearChange);
        this.selMonth.attachEvent("onchange", DateSelector.Onchange);
    }
    else // Firefox
    {
        this.selYear.addEventListener("change", DateSelector.OnYearChange, false);
        this.selMonth.addEventListener("change", DateSelector.Onchange, false);
    }

    if(arguments.length == 4) //if have four args then the last args must be date type
        this.InitSelector(arguments[3].getFullYear(), arguments[3].getMonth() + 1, arguments[3].getDate());
    else if(arguments.length == 6) // if have six args , the last three args must be year,month,day
        this.InitSelector(arguments[3], arguments[4], arguments[5]);
    else // default use current date
    {
        var dt = new Date();
        this.InitSelector(dt.getFullYear(), dt.getMonth() + 1, dt.getDate());
    }
}

// add the attribute of min year 
DateSelector.prototype.MinYear = 1900;

// add the attribute of max year
DateSelector.prototype.MaxYear = (new Date()).getFullYear();

// init year
DateSelector.prototype.InitYearSelect = function()
{
    for(var i = this.MaxYear; i >= this.MinYear; i--)
    {
        // create OPTION object
        var op = window.document.createElement("OPTION");        
        // set OPTION's value
        op.value = i;        
        // set OPTION's content
        op.innerHTML = i;        
        // add year to select object
        this.selYear.appendChild(op);
    }
}

// init month
DateSelector.prototype.InitMonthSelect = function()
{
    for(var i = 1; i < 13; i++)
    {
        // create OPTION object
        var op = window.document.createElement("OPTION");        
        // set OPTION's value
        op.value = i;        
        // set OPTION's content
        op.innerHTML = i;        
        // add month to select object
        this.selMonth.appendChild(op);
    }
}

// get current month's day by year and month
DateSelector.DaysInMonth = function(year, month)
{
    var date = new Date(year, month, 0);
    return date.getDate();
}

// init day
DateSelector.prototype.InitDaySelect = function()
{
    var year = parseInt(this.selYear.value);
    var month = parseInt(this.selMonth.value);
    
    //get current month's day
    var daysInMonth = DateSelector.DaysInMonth(year, month);    

    this.selDay.options.length = 0;
    for(var i = 1; i <= daysInMonth ; i++)
    {
        /// create OPTION object
        var op = window.document.createElement("OPTION");        
        // set OPTION's value
        op.value = i;        
        // set OPTION's content
        op.innerHTML = i;        
        // add month to select object
        this.selDay.appendChild(op);
    }
}

DateSelector.Onchange = function(e)
{
    var selector = window.document.all != null ? e.srcElement : e.target;
    selector.Group.InitDaySelect();
}

DateSelector.OnYearChange = function()
{
    var year = parseInt(this.selYear.value);
    var month = parseInt(this.selMonth.value);
    
    var daysInMonth = DateSelector.DaysInMonth(year, month);
    if (daysInMonth != this.selDay.options.length) {
		this.selDay.options.length = 0;
		for(var i = 1; i <= daysInMonth ; i++)
		{
			var op = window.document.createElement("OPTION");
			op.value = i;
			op.innerHTML = i;
			this.selDay.appendChild(op);
		}
	}    
}

DateSelector.prototype.InitSelector = function(year, month, day)
{
    this.selYear.options.length = 0;
    this.selMonth.options.length = 0;
    
    // init year, month
    this.InitYearSelect();
    this.InitMonthSelect();

    this.selYear.selectedIndex = this.MaxYear - year;
    this.selMonth.selectedIndex = month - 1;
    
    // init day
    this.InitDaySelect();
    
    // set day
    this.selDay.selectedIndex = day - 1;
}

// set birthday
	function setBirthday(strSelect, number) {
		var objSelect = document.getElementById(strSelect);
		number = parseInt(number);
		for (i=0; i<objSelect.length; i++) {
			if (objSelect.options[i].value == number) {
				objSelect.selectedIndex = i;
			}
		}
	}
// ====================================== date selector end ======================================= //

