function OpenNewWin(strURL,winName){
 window.open(strURL,"newWin"+winName,"channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");

}

function OpenNewWinSmall(strURL,winName){
 window.open(strURL,"newWin"+winName,"channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,width=450,height=450");

}

function OpenNewWinVerySmall(strURL,winName){
window.open(strURL,"newWin"+winName,"channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=no,status=yes,toolbar=no,width=300,height=300");
}

function Openloginwin(strURL,winName){
window.open(strURL,"newWin"+winName,"channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=350,height=220");
}

function OpenNewWinQyrygl(strURL,winName){
 window.open(strURL,"newWin"+winName,"channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,height=300");

}
function parseCookie(){
  var j;
  cookieList=document.cookie.split(";");
       var cookieArray=new Array();
  for(var i=0;i<cookieList.length;i++){
    cookieList[i]=strTrim(cookieList[i]);
    j=cookieList[i].indexOf("=");
    
    cookieArray[cookieList[i].substring(0,j)]=cookieList[i].substring(j+1,cookieList[i].length);
  }
  return cookieArray;
}

function OpenNewWinWithMenu(strURL,winName){
 window.open(strURL,"newWin"+winName,"channelmode=no,directories=no,fullscreen=no,location=no,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=no");

}

function strTrim(instr){
  instr+="|";
  var j=instr.length-1;
  var result_str="";
  for(var i=0;i<j;i++)
    if(instr.charAt(i)!=" ") result_str+=instr.charAt(i);
  return result_str;
} //strTrim()

function openHelpWin(strURL,winName){
 screenWidth=screen.width;
 screenHeight=screen.height;
 winTop=0;
 winLeft=screenWidth-210;
 winHeight=screenHeight-200;
 window.open(strURL,"newWin"+winName,"channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,left="+winLeft+",top="+winTop+",width=200,height="+winHeight);

}


function ConfirmDel(str){
 if(! window.confirm(str)){window.event.returnValue=false;return} 
}

function openCalendarWin(url,calendarDate)
{
var rtn=window.showModalDialog(url,calendarDate,"dialogHeight: 300px; dialogWidth: 308px;help: No;edge: Raised;resizable: No; status: No;");
return rtn;
}

function valid_date(elem){
  var daysInMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  var index;
  var buffer="";
  var ch;
  var flag=0;

  var instr=strTrim(elem.value);
  if(instr.length==0) return;
  for(index=0;index<instr.length;index++)
  {
    ch=instr.charAt(index);
    if(('0'<=ch)&&(ch<='9')) buffer+=ch;
    else if(flag<2){buffer+="-"; flag++;}
    else{elem.value="1900-01-01"; alert("有效日期格式:yyyy-mm-dd。"); elem.focus();return;}
  }
  if(flag!=2){elem.value="1900-01-01"; alert("有效日期格式:yyyy-mm-dd。"); elem.focus();return;}
  var date_array=buffer.split('-');
  if((date_array[0].length!=2)&&(date_array[0].length!=4)){elem.value="1900-01-01"; alert("无效年份。"); elem.focus();return;}
  if(date_array[1].length==0){elem.value="1900-01-01"; alert("无效月份。"); elem.focus();return;}
  if(date_array[2].length==0){elem.value="1900-01-01"; alert("无效日期。"); elem.focus();return;}
  if(date_array[0].length==2)
  {
    if(date_array[0].charAt(0)!='0') date_array[0]="19"+date_array[0];
    else date_array[0]="20"+date_array[0];
  }
  if(date_array[1].length==1) date_array[1]="0"+date_array[1];
  if(date_array[2].length==1) date_array[2]="0"+date_array[2];
  var year=parseInt(date_array[0],10);   //year
  var month=parseInt(date_array[1],10);  //month
  if((month<1)||(month>12)){elem.value="1900-01-01"; alert("无效月份。"); elem.focus();return;}
  var day=parseInt(date_array[2],10);  //day
  if(month==2)  //February
  {
    index=((0==year%4)&&(0!=(year%100)))||(0==year%400)?29:28;
    if((day<1)||(day>index)){elem.value="1900-01-01"; alert("无效日期。"); elem.focus();return;}
  }
  else
  {
    index=daysInMonth[month-1];
    if((day<1)||(day>index)){elem.value="1900-01-01"; alert("无效日期。"); elem.focus();return;}
  }
  elem.value=date_array[0]+"-"+date_array[1]+"-"+date_array[2];
}  //valid_date()

function strTrim(instr){
  instr+="|";
  var j=instr.length-1;
  var result_str="";
  for(var i=0;i<j;i++)
    if(instr.charAt(i)!=" ") result_str+=instr.charAt(i);
  return result_str;
} //strTrim()