﻿// JScript 文件
var windows_width=window.screen.width;
var windows_height=window.screen.height;
var windows_top=0;
var windows_left=0;
var hasdate;
function Reset(objstr){
    if($){
        $(':text,select,textarea,:checkbox','#'+objstr).val("");
    }
}
function $M(id,sname){
    return $('#ctl00$'+sname+"$"+id);
}
function Setdate(){
    if($('.date').datepicker)
        $('.date').datepicker();
}

function showDialog(url,width,height)
{
    if(width==0)width=window.screen.width;
    if(height==0)height=window.screen.height;
    setCenter(width,height);
    window.showModelessDialog(url,"","resizable:yes;scroll:auto;status:no;left="+windows_left+"px;top="+windwos_top+"px;dialogWidth="+width+"px;dialogHeight="+height+"px;center=yes;help=no");
}
function showOpen(url,width,height)
{
    if(width==0)width=window.screen.width;
    if(height==0)height=window.screen.height;
    setCenter(width,height);
    window.open(url,"","left="+windows_left+",top="+windwos_top+",width="+width+",height="+height+",dependent=no,scrollbars=yes,resizable=no,toolbar=no,status=no,directories=no,menubar=no,resizable=yes");
}
function showOpenWin(url,width,height)
{
    window.open(url,"","");
}
function setCenter(width,height)
{
    if(windows_width>width)
        windows_left=(windows_width-width)/2;
    if(windows_height>height)
        windwos_top=(windows_height-height)/2;
}
//页面回调
function bindpage()
{
    window.location.reload(true);
}
/*
*string:原始字符串
*substr:子字符串
*isIgnoreCase:忽略大小写*/
function contains(string,substr,isIgnoreCase)
{
    if(isIgnoreCase)
    {
     string=string.toLowerCase();
     substr=substr.toLowerCase();
    }
    if(string.indexOf(substr)==-1)
        return false;
    return true;
}
function checkFloat(obj){
   if(obj!=null&&isNaN(obj.value)&&obj.value.length>0)
   {
    obj.value=obj.value.substring(0,obj.value.length-1);
    checkFloat(obj);
   }
}
 Date.prototype.format   =   function(format)   
{   
  var   o   =   {   
      "M+"   :   this.getMonth()+1,   //month   
      "d+"   :   this.getDate(),         //day   
      "h+"   :   this.getHours(),       //hour   
      "m+"   :   this.getMinutes(),   //minute   
      "s+"   :   this.getSeconds(),   //second   
      "q+"   :   Math.floor((this.getMonth()+3)/3),     //quarter   
      "S"   :   this.getMilliseconds()   //millisecond   
  }   
  if(/(y+)/.test(format))   format=format.replace(RegExp.$1,   
      (this.getFullYear()+"").substr(4   -   RegExp.$1.length));   
  for(var   k   in   o)if(new   RegExp("("+   k   +")").test(format))   
      format   =   format.replace(RegExp.$1,   
          RegExp.$1.length==1   ?   o[k]   :     
              ("00"+   o[k]).substr((""+   o[k]).length));   
  return   format;   
};  


