var nCalendarState = 0;//�Ƿ��ǲ����������=1˵���ǣ�������

/**
 * ����Ϊ��������Ķ��� onkeydown����
 */
function setCalendarState()
{
  nCalendarState = 1;
}

/**
 * ����keydown�¼�
 */
function keyDown(DnEvents)
{
  if(nCalendarState == 1)//
  {
	  nCalendarState = 0;
	  return true;
  }
}

document.onkeydown = keyDown; // work together to analyze keystrokes

/**
 * ҳ�涨�����ȴ���ʾ��
 * @param waitmsg �ȴ���ʾ��Ϣ
 * @author felix
 */
function showhtml(waitmsg)
{
	document.write("<div id='sending' style='position:absolute; top:320; left:20; z-index:10; visibility:hidden'><TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><td width=30%></td><TD bgcolor=#ff9900><TABLE WIDTH=100% height=70 BORDER=0 CELLSPACING=2 CELLPADDING=0><TR><td bgcolor=#eeeeee align=center>"+waitmsg+"</td></tr></table></td><td width=30%></td></tr></table></div>\n" );

	document.write("<div id='cover' style='position:absolute; top:0; left:0; z-index:9; visibility:hidden'><TABLE WIDTH=100% height=900 BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD align=center><br></td></tr></table></div>\n" );

}
/**
 * ҳ�����ȴ���ʾ��
 * @author felix
 */
function showSending()
{
	gnIsShowSending=1;
	sending.style.visibility="visible";
	cover.style.visibility="visible";
}


function formatDate(control)
{
  k =  window.event.keyCode;
  if(k!=8 && k!=13 && k!=37 && k!=46 && k!=39)
  {
	  var nLength = control.value.length;
	  switch(nLength)
	  {
	    case 4:
	    case 7:
	      control.value=control.value + "-";
	      break;
	  }
  }}


function formatDateTime(control)
{
  k =  window.event.keyCode;
  if(k!=8 && k!=13 && k!=37 && k!=46)
  {
	  var nLength = control.value.length;
	  switch(nLength)
	  {
	    case 4:
	    case 7:
	      control.value=control.value + "-";
	      break;
	    case 10:
	      control.value=control.value + " ";
	      break;
	    case 13:
	      control.value=control.value + ":";
	      break;
	    case 16:
	      control.value=control.value + ":00";
	      break;
	  }
  }
}


function focusIn(DnEvents)
{
  if(document.activeElement!=null)
  {
    if(document.activeElement.type == "text" || document.activeElement.type == "select-one" || document.activeElement.type == "checkbox" || document.activeElement.type == "radio" || document.activeElement.type == "file" || document.activeElement.type == "button" || document.activeElement.type == "reset")
    {
     document.activeElement.style.background='#99ccff';
    }
  }
}
function beforeDeactivate(DnEvents)
{
  if(window.event.srcElement!=null)
  {
 if(window.event.srcElement.type == "text" || window.event.srcElement.type == "select-one" || window.event.srcElement.type == "checkbox" || window.event.srcElement.type == "radio" )
 {
    window.event.srcElement.style.background="#ffffff";
 }
  }
}
 

document.onfocusin = focusIn;
document.onbeforedeactivate = beforeDeactivate;


function isEmail(strEmail) {
	if (strEmail.search(/^(\w|[\$])+((-\w+)|(\.\w+)|[\$])*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
   else
        return false;
}

function createXmlHttpRequest () {
	var http_request = false;
	if(window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType("text/xml");
		}
	} else if (window.ActiveXObject) { 
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		  try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				
			}
		}
	}
	return http_request;
}


