//======================================================//
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
//======================================================//
function Win(URL, name, width, height)
{
	var x = screen.width;
	var y = screen.height;
	x=(x/2)-(width/2);
	y=(y/2)-(height/2);
	var wini = window.open(URL, name, "top="+y+",left="+x+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width="+width+",height="+height+",resizable=yes");
	wini.window.focus();
}
//======================================================//
function ResetForm()
{
	document.aspnetForm.reset();
}
//======================================================//
function ClearDiv(divID)
{
	document.getElementById(divID).innerHTML = "";
}
//======================================================//
function DoTrim(strTmp)
{
	strTmp = strTmp.replace(/^\s*|\s*$/g,"");
	return strTmp;
}
//======================================================//
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
