function showInNewWindow(url) {
	alert(url);
}

function isNum(strSrc){
	var strNum = "0123456789";
	var len = strSrc.length;
	for(var i=0;i<len;i++){
		if (strNum.indexOf(strSrc.charAt(i))<0){
			return false;
		}
	}
	return true;
}

function isFloat (s)
{
    var reFloat = /^((\d+(\.\d*)?)|((\d+\.)?\d+))$/
    if (isEmpty(s))
       if (isFloat.arguments.length == 1) return false;
       else return (isFloat.arguments[1] == true);

    return reFloat.test(s)
}

function isTelnum(strSrc){
	var strTelnum = "0123456789()-, ";
	var len = strSrc.length;
	for(var i=0;i<len;i++){
		if (strTelnum.indexOf(strSrc.charAt(i))<0){
			return false;
		}
	}
	return true;
}

function isFileName(strSrc){
	var strChar = '/\:*?"<>|';
	var len = strSrc.length;
	for(var i=0;i<len;i++){
		if (strChar.indexOf(strSrc.charAt(i))>=0){			
			return false;
		}
	}
	return true;
}

function isCharacter(strSrc){
	var strChar = "',;/\[]{}+<>%&#$^*()!~`";
	var len = strSrc.length;
	for(var i=0;i<len;i++){
		if (strChar.indexOf(strSrc.charAt(i))>=0){			
			return false;
		}
	}
	return true;
}

function isEmpty(s){
  return ((s == null) || (s.length == 0))
}

function isEmail(src){
  src = lrtrim(src);
  if(isEmpty(src)){
    return false;
  }

  if((src.indexOf("@")<=0) || (src.indexOf(".")<=0) || (src.indexOf(".")==src.length-1)){
    return false;
  }
  if((src.indexOf("@")>src.indexOf(".")) || (src.indexOf("@")+1==src.indexOf("."))){
    return false;
  }
  return true;
}

function lefttrim(strSrc){
	var len = strSrc.length;
	if(typeof(strSrc)!="string")
		return strSrc;
	for (var i=0; i<len; i++)
		if(strSrc.charAt(i)!=" ")
			break;
	strSrc=strSrc.substring(i,len);
	return strSrc;
}

function righttrim(strSrc){
	var len = strSrc.length;
	if(typeof(strSrc)!="string")
		return strSrc;
	for (var i=len-1; i>=0; i--)
		if(strSrc.charAt(i)!=" ")
			break;
	strSrc=strSrc.substring(0,i+1);
	return strSrc;
}

function lrtrim(strSrc){
	strSrc = lefttrim(strSrc);
	strSrc = righttrim(strSrc);
	return strSrc;
}

function isIpValue(strSrc){
	var strIpValue = "0123456789.";
	var len = strSrc.length;
	for(var i=0;i<len;i++){
		if (strIpValue.indexOf(strSrc.charAt(i))<0){
			return false;
		}
	}
	return true;
}

function chkdate(datestr) {
  var lthdatestr
  if (datestr != "")
    lthdatestr= datestr.length ;
  else
    lthdatestr=0;
  var tmpy="";
  var tmpm="";
  var tmpd="";
  //var datestr;
  var status;
  status=0;
  if ( lthdatestr== 0)
    return 0;
  for (i=0;i<lthdatestr;i++) {
    if (datestr.charAt(i)== '-') {
      status++;
    }
    if (status>2) {
      return 0;
    }
    if ((status==0) && (datestr.charAt(i)!='-')) {
      tmpy=tmpy+datestr.charAt(i)
    }
    if ((status==1) && (datestr.charAt(i)!='-')) {
      tmpm=tmpm+datestr.charAt(i)
    }
    if ((status==2) && (datestr.charAt(i)!='-')) {
      tmpd=tmpd+datestr.charAt(i)
    }
  }
  year=new String (tmpy);
  month=new String (tmpm);
  day=new String (tmpd);
  if ((tmpy.length!=4) || (tmpm.length>2) || (tmpd.length>2)) {
    return 0;
  }
  if (!((1<=month) && (12>=month) && (31>=day) && (1<=day)) ) {
    return 0;
  }
  if (!((year % 4)==0) && (month==2) && (day==29)) {
    return 0;
  }
  if ((month<=7) && ((month % 2)==0) && (day>=31)) {
    return 0;
  }
  if ((month>=8) && ((month % 2)==1) && (day>=31)) {
    return 0;
  }
  if ((month==2) && (day==30)) {
    return 0;
  }
  return 1;
}

function ShowMDialog(url,obj,hig,wid)
{
	var rtnTmp;
	if(hig == null)
		hig = 321;
	if(wid == null)
		wid = 453;
	rtnTmp = window.showModalDialog(url, obj, "dialogHeight:" + hig + "px; dialogWidth:" + wid + "px;dialogTop: px; dialogLeft: px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
	return rtnTmp;
}

function ShowWin(url)
{
    var win;
    var str = "";
    iwidth = 700;
    iheight = 500;

    if(screen.width == 1024)
    {
        iwidth = 900;
        iheight = 650;
    }

    if (window.screen)
    {
        var ah = screen.availHeight - 30;
        var aw = screen.availWidth - 10;
        var xc = (aw - iwidth) / 2;
        var yc = (ah - iheight) / 2;

        str += ",left=" + xc + ",screenX=" + xc;
        str += ",top=" + yc + ",screenY=" + yc;
    }

    win = window.open(url,"_blank","fullscreen=0,width=" + iwidth + ",height=" + iheight + ",'" + str + ",toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
    win.focus();
}

function getElementTop(e){  
	var t = e.offsetTop;
	while (e=e.offsetParent) {  
		t+=e.offsetTop;
	}
	return t;
}

function getElementLeft(e){
	var l = e.offsetLeft;
	while (e=e.offsetParent) {
		l+=e.offsetLeft;  
	}
	return l;
}

//document.oncontextmenu = fun_content;
//document.onselectstart = fun_select;
//document.ondragstart = fun_dragstart;
function fun_content()
{
        var el = window.event.srcElement;
        if(!(el.tagName == "INPUT" || el.tagName == "TEXTAREA"))
	    window.event.returnValue = false;
}
function fun_select()
{
        var el = window.event.srcElement;
        if(!(el.tagName == "INPUT" || el.tagName == "TEXTAREA"))
	    window.event.returnValue = false;
}
function fun_dragstart()
{
	window.event.returnValue = false;
}
function killErrors() { 
//return true; 
} 
window.onerror = killErrors;

function ShowMDialog(url,obj,hig,wid)
{
	var rtnTmp;
	if(hig == null)
		hig = 321;
	if(wid == null)
		wid = 453;
	rtnTmp = window.showModalDialog(url, obj, "dialogHeight:" + hig + "px; dialogWidth:" + wid + "px;dialogTop: px; dialogLeft: px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
	return rtnTmp;
}

function ShowUpLoadImages(obj)
{
	return ShowMDialog("Dialog/UpLoad/Dialog_UpLoadImages.asp", obj, 420, 700);
}

function TimeParse(strTime) {
	if ((strTime == "") || (strTime == null) || (strTime == "undefined"))
			return "";

	if(strTime.length > 4)
		strTime = strTime.substr(0,4);

		return strTime.substr(0,2) + ":" + strTime.substr(2,2);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Page(pageNum) {
	var f = document.forms.frmInfo;
	f.p.value = pageNum;
	f.submit();
}
